aspose-barcode-cloud-node 26.1.0 → 26.2.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.
- package/README.md +6 -2
- package/dist/index.d.mts +80 -79
- package/dist/index.d.ts +80 -79
- package/dist/index.js +1586 -3
- package/dist/index.mjs +1520 -3
- package/package.json +18 -5
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,1586 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
`),"binary"),this.headers={"Content-Type":`multipart/form-data; boundary=${this.boundary}`,"Content-Length":this.body.length.toString()}}};var q=class q{static getAttributeTypeMap(){return q.attributeTypeMap}};q.attributeTypeMap=[{name:"code",baseName:"code",type:"string"},{name:"message",baseName:"message",type:"string"},{name:"description",baseName:"description",type:"string"},{name:"dateTime",baseName:"dateTime",type:"Date"},{name:"innerError",baseName:"innerError",type:"ApiError"}];var R=q,L=class L{static getAttributeTypeMap(){return L.attributeTypeMap}};L.attributeTypeMap=[{name:"requestId",baseName:"requestId",type:"string"},{name:"error",baseName:"error",type:"ApiError"}];var A=L,D=(r=>(r.Png="Png",r.Jpeg="Jpeg",r.Svg="Svg",r.Tiff="Tiff",r.Gif="Gif",r))(D||{}),k=class k{static getAttributeTypeMap(){return k.attributeTypeMap}};k.attributeTypeMap=[{name:"imageFormat",baseName:"imageFormat",type:"BarcodeImageFormat"},{name:"textLocation",baseName:"textLocation",type:"CodeLocation"},{name:"foregroundColor",baseName:"foregroundColor",type:"string"},{name:"backgroundColor",baseName:"backgroundColor",type:"string"},{name:"units",baseName:"units",type:"GraphicsUnit"},{name:"resolution",baseName:"resolution",type:"number"},{name:"imageHeight",baseName:"imageHeight",type:"number"},{name:"imageWidth",baseName:"imageWidth",type:"number"},{name:"rotationAngle",baseName:"rotationAngle",type:"number"}];var M=k,U=class U{static getAttributeTypeMap(){return U.attributeTypeMap}};U.attributeTypeMap=[{name:"barcodeValue",baseName:"barcodeValue",type:"string"},{name:"type",baseName:"type",type:"string"},{name:"region",baseName:"region",type:"Array<RegionPoint>"},{name:"checksum",baseName:"checksum",type:"string"}];var S=U,G=class G{static getAttributeTypeMap(){return G.attributeTypeMap}};G.attributeTypeMap=[{name:"barcodes",baseName:"barcodes",type:"Array<BarcodeResponse>"}];var w=G,j=(i=>(i.Below="Below",i.Above="Above",i.None="None",i))(j||{}),Q=(a=>(a.MostCommonlyUsed="MostCommonlyUsed",a.Qr="QR",a.AustraliaPost="AustraliaPost",a.AustralianPosteParcel="AustralianPosteParcel",a.Aztec="Aztec",a.Codabar="Codabar",a.CodablockF="CodablockF",a.Code11="Code11",a.Code128="Code128",a.Code16K="Code16K",a.Code32="Code32",a.Code39="Code39",a.Code39FullAscii="Code39FullASCII",a.Code93="Code93",a.CompactPdf417="CompactPdf417",a.DataLogic2of5="DataLogic2of5",a.DataMatrix="DataMatrix",a.DatabarExpanded="DatabarExpanded",a.DatabarExpandedStacked="DatabarExpandedStacked",a.DatabarLimited="DatabarLimited",a.DatabarOmniDirectional="DatabarOmniDirectional",a.DatabarStacked="DatabarStacked",a.DatabarStackedOmniDirectional="DatabarStackedOmniDirectional",a.DatabarTruncated="DatabarTruncated",a.DeutschePostIdentcode="DeutschePostIdentcode",a.DeutschePostLeitcode="DeutschePostLeitcode",a.DotCode="DotCode",a.DutchKix="DutchKIX",a.Ean13="EAN13",a.Ean14="EAN14",a.Ean8="EAN8",a.Gs1Aztec="GS1Aztec",a.Gs1Code128="GS1Code128",a.Gs1CompositeBar="GS1CompositeBar",a.Gs1DataMatrix="GS1DataMatrix",a.Gs1DotCode="GS1DotCode",a.Gs1HanXin="GS1HanXin",a.Gs1MicroPdf417="GS1MicroPdf417",a.Gs1Qr="GS1QR",a.HanXin="HanXin",a.HibcAztecLic="HIBCAztecLIC",a.HibcAztecPas="HIBCAztecPAS",a.HibcCode128Lic="HIBCCode128LIC",a.HibcCode128Pas="HIBCCode128PAS",a.HibcCode39Lic="HIBCCode39LIC",a.HibcCode39Pas="HIBCCode39PAS",a.HibcDataMatrixLic="HIBCDataMatrixLIC",a.HibcDataMatrixPas="HIBCDataMatrixPAS",a.Hibcqrlic="HIBCQRLIC",a.Hibcqrpas="HIBCQRPAS",a.Iata2of5="IATA2of5",a.Isbn="ISBN",a.Ismn="ISMN",a.Issn="ISSN",a.Itf14="ITF14",a.Itf6="ITF6",a.Interleaved2of5="Interleaved2of5",a.ItalianPost25="ItalianPost25",a.MacroPdf417="MacroPdf417",a.Mailmark="Mailmark",a.Matrix2of5="Matrix2of5",a.MaxiCode="MaxiCode",a.MicrE13B="MicrE13B",a.MicroPdf417="MicroPdf417",a.MicroQr="MicroQR",a.Msi="MSI",a.OneCode="OneCode",a.Opc="OPC",a.PatchCode="PatchCode",a.Pdf417="Pdf417",a.Pharmacode="Pharmacode",a.Planet="Planet",a.Postnet="Postnet",a.Pzn="PZN",a.RectMicroQr="RectMicroQR",a.Rm4Scc="RM4SCC",a.Scc14="SCC14",a.Sscc18="SSCC18",a.Standard2of5="Standard2of5",a.Supplement="Supplement",a.SwissPostParcel="SwissPostParcel",a.Upca="UPCA",a.Upce="UPCE",a.Vin="VIN",a))(Q||{}),V=(n=>(n.Qr="QR",n.AustraliaPost="AustraliaPost",n.AustralianPosteParcel="AustralianPosteParcel",n.Aztec="Aztec",n.Codabar="Codabar",n.CodablockF="CodablockF",n.Code11="Code11",n.Code128="Code128",n.Code16K="Code16K",n.Code32="Code32",n.Code39="Code39",n.Code39FullAscii="Code39FullASCII",n.Code93="Code93",n.DataLogic2of5="DataLogic2of5",n.DataMatrix="DataMatrix",n.DatabarExpanded="DatabarExpanded",n.DatabarExpandedStacked="DatabarExpandedStacked",n.DatabarLimited="DatabarLimited",n.DatabarOmniDirectional="DatabarOmniDirectional",n.DatabarStacked="DatabarStacked",n.DatabarStackedOmniDirectional="DatabarStackedOmniDirectional",n.DatabarTruncated="DatabarTruncated",n.DeutschePostIdentcode="DeutschePostIdentcode",n.DeutschePostLeitcode="DeutschePostLeitcode",n.DotCode="DotCode",n.DutchKix="DutchKIX",n.Ean13="EAN13",n.Ean14="EAN14",n.Ean8="EAN8",n.Gs1Aztec="GS1Aztec",n.Gs1CodablockF="GS1CodablockF",n.Gs1Code128="GS1Code128",n.Gs1DataMatrix="GS1DataMatrix",n.Gs1DotCode="GS1DotCode",n.Gs1HanXin="GS1HanXin",n.Gs1MicroPdf417="GS1MicroPdf417",n.Gs1Qr="GS1QR",n.HanXin="HanXin",n.Iata2of5="IATA2of5",n.Isbn="ISBN",n.Ismn="ISMN",n.Issn="ISSN",n.Itf14="ITF14",n.Itf6="ITF6",n.Interleaved2of5="Interleaved2of5",n.ItalianPost25="ItalianPost25",n.Msi="MSI",n.MacroPdf417="MacroPdf417",n.Mailmark="Mailmark",n.Matrix2of5="Matrix2of5",n.MaxiCode="MaxiCode",n.MicroPdf417="MicroPdf417",n.MicroQr="MicroQR",n.Opc="OPC",n.OneCode="OneCode",n.Pzn="PZN",n.PatchCode="PatchCode",n.Pdf417="Pdf417",n.Pharmacode="Pharmacode",n.Planet="Planet",n.Postnet="Postnet",n.Rm4Scc="RM4SCC",n.RectMicroQr="RectMicroQR",n.Scc14="SCC14",n.Sscc18="SSCC18",n.SingaporePost="SingaporePost",n.Standard2of5="Standard2of5",n.SwissPostParcel="SwissPostParcel",n.Upca="UPCA",n.Upce="UPCE",n.UpcaGs1Code128Coupon="UpcaGs1Code128Coupon",n.UpcaGs1DatabarCoupon="UpcaGs1DatabarCoupon",n.Vin="VIN",n))(V||{}),F=class F{static getAttributeTypeMap(){return F.attributeTypeMap}};F.attributeTypeMap=[{name:"dataType",baseName:"dataType",type:"EncodeDataType"},{name:"data",baseName:"data",type:"string"}];var H=F,$=(i=>(i.StringData="StringData",i.Base64Bytes="Base64Bytes",i.HexBytes="HexBytes",i))($||{}),_=class _{static getAttributeTypeMap(){return _.attributeTypeMap}};_.attributeTypeMap=[{name:"barcodeType",baseName:"barcodeType",type:"EncodeBarcodeType"},{name:"encodeData",baseName:"encodeData",type:"EncodeData"},{name:"barcodeImageParams",baseName:"barcodeImageParams",type:"BarcodeImageParams"}];var I=_,X=(s=>(s.Pixel="Pixel",s.Point="Point",s.Inch="Inch",s.Millimeter="Millimeter",s))(X||{}),J=(i=>(i.Photo="Photo",i.ScannedDocument="ScannedDocument",i.ClearImage="ClearImage",i))(J||{}),E=(i=>(i.Fast="Fast",i.Normal="Normal",i.Excellent="Excellent",i))(E||{}),v=class v{static getAttributeTypeMap(){return v.attributeTypeMap}};v.attributeTypeMap=[{name:"barcodeTypes",baseName:"barcodeTypes",type:"Array<DecodeBarcodeType>"},{name:"fileBase64",baseName:"fileBase64",type:"string"},{name:"recognitionMode",baseName:"recognitionMode",type:"RecognitionMode"},{name:"recognitionImageKind",baseName:"recognitionImageKind",type:"RecognitionImageKind"}];var x=v,K=class K{static getAttributeTypeMap(){return K.attributeTypeMap}};K.attributeTypeMap=[{name:"x",baseName:"x",type:"number"},{name:"y",baseName:"y",type:"number"}];var z=K,W=class W{static getAttributeTypeMap(){return W.attributeTypeMap}};W.attributeTypeMap=[{name:"fileBase64",baseName:"fileBase64",type:"string"}];var N=W,at=class{constructor(t,e){this.foregroundColor="'Black'";this.backgroundColor="'White'";this.barcodeType=t,this.data=e}},rt=class{constructor(t){this.generateParams=t}},it=class{constructor(t,e){this.foregroundColor="'Black'";this.backgroundColor="'White'";this.barcodeType=t,this.data=e}},nt=class{constructor(t,e){this.barcodeType=t,this.fileUrl=e}},st=class{constructor(t){this.recognizeBase64Request=t}},ot=class{constructor(t,e){this.barcodeType=t,this.fileBytes=e}},lt=class{constructor(t){this.fileUrl=t}},ut=class{constructor(t){this.scanBase64Request=t}},ct=class{constructor(t){this.fileBytes=t}};var gt=["string","boolean","double","integer","long","float","number","any"],u=class l{static findCorrectType(t,e){if(t==null||gt.indexOf(e.toLowerCase())!==-1||e==="Date"||T[e]||!d[e])return e;let i=d[e].discriminator;return i==null?e:t[i]?t[i]:e}static serialize(t,e){if(t==null||gt.indexOf(e.toLowerCase())!==-1)return t;if(e.lastIndexOf("Array<",0)===0){let r=e.replace("Array<","");r=r.substring(0,r.length-1);let o=[];for(let p in t){let c=t[p];o.push(l.serialize(c,r))}return o}if(e==="Date")return t.toString();if(T[e]&&Object.values(T[e]).includes(t)||!d[e])return t;let i=d[e].getAttributeTypeMap(),s={};for(let r in i){let o=i[r];s[o.baseName]=l.serialize(t[o.name],o.type)}return s}static deserialize(t,e){if(e=l.findCorrectType(t,e),t==null||gt.indexOf(e.toLowerCase())!==-1)return t;if(e.lastIndexOf("Array<",0)===0){let r=e.replace("Array<","");r=r.substring(0,r.length-1);let o=[];for(let p in t){let c=t[p];o.push(l.deserialize(c,r))}return o}if(e==="Date")return new Date(t);if(T[e]||!d[e])return t;typeof t=="string"&&(t=JSON.parse(t));let i=new d[e],s=d[e].getAttributeTypeMap();for(let r of s){let o=r.baseName.replace(/^(.)/,p=>p.toLowerCase());i[r.name]=l.deserialize(t[o],r.type)}return i}},T={BarcodeImageFormat:D,CodeLocation:j,DecodeBarcodeType:Q,EncodeBarcodeType:V,EncodeDataType:$,GraphicsUnit:X,RecognitionImageKind:J,RecognitionMode:E},d={ApiError:R,ApiErrorResponse:A,BarcodeImageParams:M,BarcodeResponse:S,BarcodeResponseList:w,EncodeData:H,GenerateParams:I,RecognizeBase64Request:x,RegionPoint:z,ScanBase64Request:N},pt=class{constructor(t){this.defaultHeaders={"x-aspose-client":"nodejs sdk","x-aspose-client-version":"26.1.0"};this._configuration=t,this._client=new f}generate(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/generate/{barcodeType}".replace("{barcodeType}",String(t.barcodeType)),i={},s=Object.assign({},this.defaultHeaders);if(t.barcodeType==null)throw new Error("Required parameter request.barcodeType was null or undefined when calling generate.");if(t.data==null)throw new Error("Required parameter request.data was null or undefined when calling generate.");t.dataType!=null&&(i.dataType=u.serialize(t.dataType,"EncodeDataType")),t.data!=null&&(i.data=u.serialize(t.data,"string")),t.imageFormat!=null&&(i.imageFormat=u.serialize(t.imageFormat,"BarcodeImageFormat")),t.textLocation!=null&&(i.textLocation=u.serialize(t.textLocation,"CodeLocation")),t.foregroundColor!=null&&(i.foregroundColor=u.serialize(t.foregroundColor,"string")),t.backgroundColor!=null&&(i.backgroundColor=u.serialize(t.backgroundColor,"string")),t.units!=null&&(i.units=u.serialize(t.units,"GraphicsUnit")),t.resolution!=null&&(i.resolution=u.serialize(t.resolution,"number")),t.imageHeight!=null&&(i.imageHeight=u.serialize(t.imageHeight,"number")),t.imageWidth!=null&&(i.imageWidth=u.serialize(t.imageWidth,"number")),t.rotationAngle!=null&&(i.rotationAngle=u.serialize(t.rotationAngle,"number"));let r={method:"GET",qs:i,headers:s,uri:e,encoding:null};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"Buffer")}})}generateBody(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/generate-body",i={},s=Object.assign({},this.defaultHeaders);if(t.generateParams==null)throw new Error("Required parameter request.generateParams was null or undefined when calling generateBody.");let r={method:"POST",qs:i,headers:s,uri:e,body:u.serialize(t.generateParams,"GenerateParams"),json:!0,encoding:null};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"Buffer")}})}generateMultipart(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/generate-multipart",i={},s=Object.assign({},this.defaultHeaders),r=[];if(t.barcodeType==null)throw new Error("Required parameter request.barcodeType was null or undefined when calling generateMultipart.");if(t.data==null)throw new Error("Required parameter request.data was null or undefined when calling generateMultipart.");t.barcodeType!=null&&r.push(["barcodeType",u.serialize(t.barcodeType,"EncodeBarcodeType")]),t.dataType!=null&&r.push(["dataType",u.serialize(t.dataType,"EncodeDataType")]),t.data!=null&&r.push(["data",u.serialize(t.data,"string")]),t.imageFormat!=null&&r.push(["imageFormat",u.serialize(t.imageFormat,"BarcodeImageFormat")]),t.textLocation!=null&&r.push(["textLocation",u.serialize(t.textLocation,"CodeLocation")]),t.foregroundColor!=null&&r.push(["foregroundColor",u.serialize(t.foregroundColor,"string")]),t.backgroundColor!=null&&r.push(["backgroundColor",u.serialize(t.backgroundColor,"string")]),t.units!=null&&r.push(["units",u.serialize(t.units,"GraphicsUnit")]),t.resolution!=null&&r.push(["resolution",u.serialize(t.resolution,"number")]),t.imageHeight!=null&&r.push(["imageHeight",u.serialize(t.imageHeight,"number")]),t.imageWidth!=null&&r.push(["imageWidth",u.serialize(t.imageWidth,"number")]),t.rotationAngle!=null&&r.push(["rotationAngle",u.serialize(t.rotationAngle,"number")]);let o={method:"POST",qs:i,headers:s,uri:e,encoding:null},p=new Array,c=new y(r,p);o.body=c.body,o.headers=b(b({},o.headers),c.headers),yield this._configuration.authentication.applyToRequestAsync(o);let g=yield this._client.requestAsync(o);return{response:g.response,body:u.deserialize(g.body,"Buffer")}})}},mt=class{constructor(t){this.defaultHeaders={"x-aspose-client":"nodejs sdk","x-aspose-client-version":"26.1.0"};this._configuration=t,this._client=new f}recognize(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/recognize",i={},s=Object.assign({},this.defaultHeaders);if(t.barcodeType==null)throw new Error("Required parameter request.barcodeType was null or undefined when calling recognize.");if(t.fileUrl==null)throw new Error("Required parameter request.fileUrl was null or undefined when calling recognize.");t.barcodeType!=null&&(i.barcodeType=u.serialize(t.barcodeType,"DecodeBarcodeType")),t.fileUrl!=null&&(i.fileUrl=u.serialize(t.fileUrl,"string")),t.recognitionMode!=null&&(i.recognitionMode=u.serialize(t.recognitionMode,"RecognitionMode")),t.recognitionImageKind!=null&&(i.recognitionImageKind=u.serialize(t.recognitionImageKind,"RecognitionImageKind"));let r={method:"GET",qs:i,headers:s,uri:e};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"BarcodeResponseList")}})}recognizeBase64(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/recognize-body",i={},s=Object.assign({},this.defaultHeaders);if(t.recognizeBase64Request==null)throw new Error("Required parameter request.recognizeBase64Request was null or undefined when calling recognizeBase64.");let r={method:"POST",qs:i,headers:s,uri:e,body:u.serialize(t.recognizeBase64Request,"RecognizeBase64Request"),json:!0};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"BarcodeResponseList")}})}recognizeMultipart(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/recognize-multipart",i={},s=Object.assign({},this.defaultHeaders),r=[];if(t.barcodeType==null)throw new Error("Required parameter request.barcodeType was null or undefined when calling recognizeMultipart.");if(t.fileBytes==null)throw new Error("Required parameter request.fileBytes was null or undefined when calling recognizeMultipart.");t.barcodeType!=null&&r.push(["barcodeType",u.serialize(t.barcodeType,"DecodeBarcodeType")]),t.recognitionMode!=null&&r.push(["recognitionMode",u.serialize(t.recognitionMode,"RecognitionMode")]),t.recognitionImageKind!=null&&r.push(["recognitionImageKind",u.serialize(t.recognitionImageKind,"RecognitionImageKind")]);let o={method:"POST",qs:i,headers:s,uri:e},p=new Array;p=t.fileBytes==null?[]:[new P("file","",t.fileBytes)];let c=new y(r,p);o.body=c.body,o.headers=b(b({},o.headers),c.headers),yield this._configuration.authentication.applyToRequestAsync(o);let g=yield this._client.requestAsync(o);return{response:g.response,body:u.deserialize(g.body,"BarcodeResponseList")}})}},ft=class{constructor(t){this.defaultHeaders={"x-aspose-client":"nodejs sdk","x-aspose-client-version":"26.1.0"};this._configuration=t,this._client=new f}scan(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/scan",i={},s=Object.assign({},this.defaultHeaders);if(t.fileUrl==null)throw new Error("Required parameter request.fileUrl was null or undefined when calling scan.");t.fileUrl!=null&&(i.fileUrl=u.serialize(t.fileUrl,"string"));let r={method:"GET",qs:i,headers:s,uri:e};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"BarcodeResponseList")}})}scanBase64(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/scan-body",i={},s=Object.assign({},this.defaultHeaders);if(t.scanBase64Request==null)throw new Error("Required parameter request.scanBase64Request was null or undefined when calling scanBase64.");let r={method:"POST",qs:i,headers:s,uri:e,body:u.serialize(t.scanBase64Request,"ScanBase64Request"),json:!0};yield this._configuration.authentication.applyToRequestAsync(r);let o=yield this._client.requestAsync(r);return{response:o.response,body:u.deserialize(o.body,"BarcodeResponseList")}})}scanMultipart(t){return m(this,null,function*(){let e=this._configuration.getApiBaseUrl()+"/barcode/scan-multipart",i={},s=Object.assign({},this.defaultHeaders),r=[];if(t.fileBytes==null)throw new Error("Required parameter request.fileBytes was null or undefined when calling scanMultipart.");let o={method:"POST",qs:i,headers:s,uri:e},p=new Array;p=t.fileBytes==null?[]:[new P("file","",t.fileBytes)];let c=new y(r,p);o.body=c.body,o.headers=b(b({},o.headers),c.headers),yield this._configuration.authentication.applyToRequestAsync(o);let g=yield this._client.requestAsync(o);return{response:g.response,body:u.deserialize(g.body,"BarcodeResponseList")}})}};var Z=class{constructor(t){this._configuration=t,t.accessToken&&(this._accessToken=t.accessToken),this._client=new f}applyToRequestAsync(t){return m(this,null,function*(){return this._accessToken==null&&(this._accessToken=yield this.requestToken()),t&&t.headers&&(t.headers.Authorization="Bearer "+this._accessToken),Promise.resolve()})}requestToken(){return m(this,null,function*(){if(!this._configuration.clientId||!this._configuration.clientSecret)throw new Error("Required 'clientId' or 'clientSecret' not specified in configuration.");let t={method:"POST",uri:this._configuration.tokenUrl,form:{grant_type:"client_credentials",client_id:this._configuration.clientId,client_secret:this._configuration.clientSecret}},e=yield this._client.requestAsync(t);return JSON.parse(e.body).access_token})}};var Mt=(t=>(t.v4="v4.0",t))(Mt||{}),bt=class{constructor(t,e,i,s,r){this.version="v4.0";this.clientId=t,this.clientSecret=e,i?this.baseUrl=i:this.baseUrl="https://api.aspose.cloud",this.tokenUrl=r!=null?r:"https://id.aspose.cloud/connect/token",s?this.accessToken=s:this.accessToken="",this.authentication=new Z(this)}getApiBaseUrl(){return this.baseUrl+"/"+this.version}};0&&(module.exports={ApiError,ApiErrorResponse,ApiVersion,BarcodeImageFormat,BarcodeImageParams,BarcodeResponse,BarcodeResponseList,CodeLocation,Configuration,DecodeBarcodeType,EncodeBarcodeType,EncodeData,EncodeDataType,GenerateApi,GenerateBodyRequestWrapper,GenerateMultipartRequestWrapper,GenerateParams,GenerateRequestWrapper,GraphicsUnit,RecognitionImageKind,RecognitionMode,RecognizeApi,RecognizeBase64Request,RecognizeBase64RequestWrapper,RecognizeMultipartRequestWrapper,RecognizeRequestWrapper,RegionPoint,ScanApi,ScanBase64Request,ScanBase64RequestWrapper,ScanMultipartRequestWrapper,ScanRequestWrapper});
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
43
|
+
var __async = (__this, __arguments, generator) => {
|
|
44
|
+
return new Promise((resolve, reject) => {
|
|
45
|
+
var fulfilled = (value) => {
|
|
46
|
+
try {
|
|
47
|
+
step(generator.next(value));
|
|
48
|
+
} catch (e) {
|
|
49
|
+
reject(e);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var rejected = (value) => {
|
|
53
|
+
try {
|
|
54
|
+
step(generator.throw(value));
|
|
55
|
+
} catch (e) {
|
|
56
|
+
reject(e);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
60
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/index.ts
|
|
65
|
+
var index_exports = {};
|
|
66
|
+
__export(index_exports, {
|
|
67
|
+
ApiClient: () => ApiClient,
|
|
68
|
+
ApiError: () => ApiError,
|
|
69
|
+
ApiErrorResponse: () => ApiErrorResponse,
|
|
70
|
+
ApiVersion: () => ApiVersion,
|
|
71
|
+
BarcodeImageFormat: () => BarcodeImageFormat,
|
|
72
|
+
BarcodeImageParams: () => BarcodeImageParams,
|
|
73
|
+
BarcodeResponse: () => BarcodeResponse,
|
|
74
|
+
BarcodeResponseList: () => BarcodeResponseList,
|
|
75
|
+
CodeLocation: () => CodeLocation,
|
|
76
|
+
Configuration: () => Configuration,
|
|
77
|
+
DecodeBarcodeType: () => DecodeBarcodeType,
|
|
78
|
+
EncodeBarcodeType: () => EncodeBarcodeType,
|
|
79
|
+
EncodeData: () => EncodeData,
|
|
80
|
+
EncodeDataType: () => EncodeDataType,
|
|
81
|
+
GenerateApi: () => GenerateApi,
|
|
82
|
+
GenerateBodyRequestWrapper: () => GenerateBodyRequestWrapper,
|
|
83
|
+
GenerateMultipartRequestWrapper: () => GenerateMultipartRequestWrapper,
|
|
84
|
+
GenerateParams: () => GenerateParams,
|
|
85
|
+
GenerateRequestWrapper: () => GenerateRequestWrapper,
|
|
86
|
+
GraphicsUnit: () => GraphicsUnit,
|
|
87
|
+
RecognitionImageKind: () => RecognitionImageKind,
|
|
88
|
+
RecognitionMode: () => RecognitionMode,
|
|
89
|
+
RecognizeApi: () => RecognizeApi,
|
|
90
|
+
RecognizeBase64Request: () => RecognizeBase64Request,
|
|
91
|
+
RecognizeBase64RequestWrapper: () => RecognizeBase64RequestWrapper,
|
|
92
|
+
RecognizeMultipartRequestWrapper: () => RecognizeMultipartRequestWrapper,
|
|
93
|
+
RecognizeRequestWrapper: () => RecognizeRequestWrapper,
|
|
94
|
+
RegionPoint: () => RegionPoint,
|
|
95
|
+
ScanApi: () => ScanApi,
|
|
96
|
+
ScanBase64Request: () => ScanBase64Request,
|
|
97
|
+
ScanBase64RequestWrapper: () => ScanBase64RequestWrapper,
|
|
98
|
+
ScanMultipartRequestWrapper: () => ScanMultipartRequestWrapper,
|
|
99
|
+
ScanRequestWrapper: () => ScanRequestWrapper
|
|
100
|
+
});
|
|
101
|
+
module.exports = __toCommonJS(index_exports);
|
|
102
|
+
|
|
103
|
+
// src/multipart.ts
|
|
104
|
+
var import_crypto = __toESM(require("crypto"));
|
|
105
|
+
var RequestFile = class {
|
|
106
|
+
constructor(name, filename, data, contentType) {
|
|
107
|
+
this.name = name;
|
|
108
|
+
this.filename = filename;
|
|
109
|
+
this.data = data;
|
|
110
|
+
this.contentType = contentType;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
var Multipart = class {
|
|
114
|
+
constructor(textFields, files) {
|
|
115
|
+
const random = import_crypto.default.randomUUID();
|
|
116
|
+
this.boundary = "------------------------" + random.replace(/-/g, "");
|
|
117
|
+
const bodyLines = [];
|
|
118
|
+
for (const tuple of textFields) {
|
|
119
|
+
bodyLines.push(`--${this.boundary}`);
|
|
120
|
+
bodyLines.push(`Content-Disposition: form-data; name="${tuple[0]}"`);
|
|
121
|
+
bodyLines.push("");
|
|
122
|
+
bodyLines.push(tuple[1]);
|
|
123
|
+
}
|
|
124
|
+
for (const file of files || []) {
|
|
125
|
+
bodyLines.push(`--${this.boundary}`);
|
|
126
|
+
bodyLines.push(
|
|
127
|
+
`Content-Disposition: form-data; name="${file.name}"; filename="${file.filename || "filename"}"`
|
|
128
|
+
);
|
|
129
|
+
bodyLines.push(`Content-Type: ${file.contentType || "application/octet-stream"}`);
|
|
130
|
+
bodyLines.push("");
|
|
131
|
+
bodyLines.push(file.data.toString("binary"));
|
|
132
|
+
}
|
|
133
|
+
bodyLines.push(`--${this.boundary}--`);
|
|
134
|
+
this.body = Buffer.from(bodyLines.join("\r\n"), "binary");
|
|
135
|
+
this.headers = {
|
|
136
|
+
"Content-Type": `multipart/form-data; boundary=${this.boundary}`,
|
|
137
|
+
"Content-Length": this.body.length.toString()
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// src/models.ts
|
|
143
|
+
var _ApiError = class _ApiError {
|
|
144
|
+
static getAttributeTypeMap() {
|
|
145
|
+
return _ApiError.attributeTypeMap;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
_ApiError.attributeTypeMap = [
|
|
149
|
+
{
|
|
150
|
+
name: "code",
|
|
151
|
+
baseName: "code",
|
|
152
|
+
type: "string"
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "message",
|
|
156
|
+
baseName: "message",
|
|
157
|
+
type: "string"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "description",
|
|
161
|
+
baseName: "description",
|
|
162
|
+
type: "string"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
name: "dateTime",
|
|
166
|
+
baseName: "dateTime",
|
|
167
|
+
type: "Date"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "innerError",
|
|
171
|
+
baseName: "innerError",
|
|
172
|
+
type: "ApiError"
|
|
173
|
+
}
|
|
174
|
+
];
|
|
175
|
+
var ApiError = _ApiError;
|
|
176
|
+
var _ApiErrorResponse = class _ApiErrorResponse {
|
|
177
|
+
static getAttributeTypeMap() {
|
|
178
|
+
return _ApiErrorResponse.attributeTypeMap;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
_ApiErrorResponse.attributeTypeMap = [
|
|
182
|
+
{
|
|
183
|
+
name: "requestId",
|
|
184
|
+
baseName: "requestId",
|
|
185
|
+
type: "string"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "error",
|
|
189
|
+
baseName: "error",
|
|
190
|
+
type: "ApiError"
|
|
191
|
+
}
|
|
192
|
+
];
|
|
193
|
+
var ApiErrorResponse = _ApiErrorResponse;
|
|
194
|
+
var BarcodeImageFormat = /* @__PURE__ */ ((BarcodeImageFormat2) => {
|
|
195
|
+
BarcodeImageFormat2["Png"] = "Png";
|
|
196
|
+
BarcodeImageFormat2["Jpeg"] = "Jpeg";
|
|
197
|
+
BarcodeImageFormat2["Svg"] = "Svg";
|
|
198
|
+
BarcodeImageFormat2["Tiff"] = "Tiff";
|
|
199
|
+
BarcodeImageFormat2["Gif"] = "Gif";
|
|
200
|
+
return BarcodeImageFormat2;
|
|
201
|
+
})(BarcodeImageFormat || {});
|
|
202
|
+
var _BarcodeImageParams = class _BarcodeImageParams {
|
|
203
|
+
static getAttributeTypeMap() {
|
|
204
|
+
return _BarcodeImageParams.attributeTypeMap;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
_BarcodeImageParams.attributeTypeMap = [
|
|
208
|
+
{
|
|
209
|
+
name: "imageFormat",
|
|
210
|
+
baseName: "imageFormat",
|
|
211
|
+
type: "BarcodeImageFormat"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
name: "textLocation",
|
|
215
|
+
baseName: "textLocation",
|
|
216
|
+
type: "CodeLocation"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: "foregroundColor",
|
|
220
|
+
baseName: "foregroundColor",
|
|
221
|
+
type: "string"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "backgroundColor",
|
|
225
|
+
baseName: "backgroundColor",
|
|
226
|
+
type: "string"
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
name: "units",
|
|
230
|
+
baseName: "units",
|
|
231
|
+
type: "GraphicsUnit"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "resolution",
|
|
235
|
+
baseName: "resolution",
|
|
236
|
+
type: "number"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "imageHeight",
|
|
240
|
+
baseName: "imageHeight",
|
|
241
|
+
type: "number"
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "imageWidth",
|
|
245
|
+
baseName: "imageWidth",
|
|
246
|
+
type: "number"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
name: "rotationAngle",
|
|
250
|
+
baseName: "rotationAngle",
|
|
251
|
+
type: "number"
|
|
252
|
+
}
|
|
253
|
+
];
|
|
254
|
+
var BarcodeImageParams = _BarcodeImageParams;
|
|
255
|
+
var _BarcodeResponse = class _BarcodeResponse {
|
|
256
|
+
static getAttributeTypeMap() {
|
|
257
|
+
return _BarcodeResponse.attributeTypeMap;
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
_BarcodeResponse.attributeTypeMap = [
|
|
261
|
+
{
|
|
262
|
+
name: "barcodeValue",
|
|
263
|
+
baseName: "barcodeValue",
|
|
264
|
+
type: "string"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: "type",
|
|
268
|
+
baseName: "type",
|
|
269
|
+
type: "string"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
name: "region",
|
|
273
|
+
baseName: "region",
|
|
274
|
+
type: "Array<RegionPoint>"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "checksum",
|
|
278
|
+
baseName: "checksum",
|
|
279
|
+
type: "string"
|
|
280
|
+
}
|
|
281
|
+
];
|
|
282
|
+
var BarcodeResponse = _BarcodeResponse;
|
|
283
|
+
var _BarcodeResponseList = class _BarcodeResponseList {
|
|
284
|
+
static getAttributeTypeMap() {
|
|
285
|
+
return _BarcodeResponseList.attributeTypeMap;
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
_BarcodeResponseList.attributeTypeMap = [
|
|
289
|
+
{
|
|
290
|
+
name: "barcodes",
|
|
291
|
+
baseName: "barcodes",
|
|
292
|
+
type: "Array<BarcodeResponse>"
|
|
293
|
+
}
|
|
294
|
+
];
|
|
295
|
+
var BarcodeResponseList = _BarcodeResponseList;
|
|
296
|
+
var CodeLocation = /* @__PURE__ */ ((CodeLocation2) => {
|
|
297
|
+
CodeLocation2["Below"] = "Below";
|
|
298
|
+
CodeLocation2["Above"] = "Above";
|
|
299
|
+
CodeLocation2["None"] = "None";
|
|
300
|
+
return CodeLocation2;
|
|
301
|
+
})(CodeLocation || {});
|
|
302
|
+
var DecodeBarcodeType = /* @__PURE__ */ ((DecodeBarcodeType2) => {
|
|
303
|
+
DecodeBarcodeType2["MostCommonlyUsed"] = "MostCommonlyUsed";
|
|
304
|
+
DecodeBarcodeType2["Qr"] = "QR";
|
|
305
|
+
DecodeBarcodeType2["AustraliaPost"] = "AustraliaPost";
|
|
306
|
+
DecodeBarcodeType2["AustralianPosteParcel"] = "AustralianPosteParcel";
|
|
307
|
+
DecodeBarcodeType2["Aztec"] = "Aztec";
|
|
308
|
+
DecodeBarcodeType2["Codabar"] = "Codabar";
|
|
309
|
+
DecodeBarcodeType2["CodablockF"] = "CodablockF";
|
|
310
|
+
DecodeBarcodeType2["Code11"] = "Code11";
|
|
311
|
+
DecodeBarcodeType2["Code128"] = "Code128";
|
|
312
|
+
DecodeBarcodeType2["Code16K"] = "Code16K";
|
|
313
|
+
DecodeBarcodeType2["Code32"] = "Code32";
|
|
314
|
+
DecodeBarcodeType2["Code39"] = "Code39";
|
|
315
|
+
DecodeBarcodeType2["Code39FullAscii"] = "Code39FullASCII";
|
|
316
|
+
DecodeBarcodeType2["Code93"] = "Code93";
|
|
317
|
+
DecodeBarcodeType2["CompactPdf417"] = "CompactPdf417";
|
|
318
|
+
DecodeBarcodeType2["DataLogic2of5"] = "DataLogic2of5";
|
|
319
|
+
DecodeBarcodeType2["DataMatrix"] = "DataMatrix";
|
|
320
|
+
DecodeBarcodeType2["DatabarExpanded"] = "DatabarExpanded";
|
|
321
|
+
DecodeBarcodeType2["DatabarExpandedStacked"] = "DatabarExpandedStacked";
|
|
322
|
+
DecodeBarcodeType2["DatabarLimited"] = "DatabarLimited";
|
|
323
|
+
DecodeBarcodeType2["DatabarOmniDirectional"] = "DatabarOmniDirectional";
|
|
324
|
+
DecodeBarcodeType2["DatabarStacked"] = "DatabarStacked";
|
|
325
|
+
DecodeBarcodeType2["DatabarStackedOmniDirectional"] = "DatabarStackedOmniDirectional";
|
|
326
|
+
DecodeBarcodeType2["DatabarTruncated"] = "DatabarTruncated";
|
|
327
|
+
DecodeBarcodeType2["DeutschePostIdentcode"] = "DeutschePostIdentcode";
|
|
328
|
+
DecodeBarcodeType2["DeutschePostLeitcode"] = "DeutschePostLeitcode";
|
|
329
|
+
DecodeBarcodeType2["DotCode"] = "DotCode";
|
|
330
|
+
DecodeBarcodeType2["DutchKix"] = "DutchKIX";
|
|
331
|
+
DecodeBarcodeType2["Ean13"] = "EAN13";
|
|
332
|
+
DecodeBarcodeType2["Ean14"] = "EAN14";
|
|
333
|
+
DecodeBarcodeType2["Ean8"] = "EAN8";
|
|
334
|
+
DecodeBarcodeType2["Gs1Aztec"] = "GS1Aztec";
|
|
335
|
+
DecodeBarcodeType2["Gs1Code128"] = "GS1Code128";
|
|
336
|
+
DecodeBarcodeType2["Gs1CompositeBar"] = "GS1CompositeBar";
|
|
337
|
+
DecodeBarcodeType2["Gs1DataMatrix"] = "GS1DataMatrix";
|
|
338
|
+
DecodeBarcodeType2["Gs1DotCode"] = "GS1DotCode";
|
|
339
|
+
DecodeBarcodeType2["Gs1HanXin"] = "GS1HanXin";
|
|
340
|
+
DecodeBarcodeType2["Gs1MicroPdf417"] = "GS1MicroPdf417";
|
|
341
|
+
DecodeBarcodeType2["Gs1Qr"] = "GS1QR";
|
|
342
|
+
DecodeBarcodeType2["HanXin"] = "HanXin";
|
|
343
|
+
DecodeBarcodeType2["HibcAztecLic"] = "HIBCAztecLIC";
|
|
344
|
+
DecodeBarcodeType2["HibcAztecPas"] = "HIBCAztecPAS";
|
|
345
|
+
DecodeBarcodeType2["HibcCode128Lic"] = "HIBCCode128LIC";
|
|
346
|
+
DecodeBarcodeType2["HibcCode128Pas"] = "HIBCCode128PAS";
|
|
347
|
+
DecodeBarcodeType2["HibcCode39Lic"] = "HIBCCode39LIC";
|
|
348
|
+
DecodeBarcodeType2["HibcCode39Pas"] = "HIBCCode39PAS";
|
|
349
|
+
DecodeBarcodeType2["HibcDataMatrixLic"] = "HIBCDataMatrixLIC";
|
|
350
|
+
DecodeBarcodeType2["HibcDataMatrixPas"] = "HIBCDataMatrixPAS";
|
|
351
|
+
DecodeBarcodeType2["Hibcqrlic"] = "HIBCQRLIC";
|
|
352
|
+
DecodeBarcodeType2["Hibcqrpas"] = "HIBCQRPAS";
|
|
353
|
+
DecodeBarcodeType2["Iata2of5"] = "IATA2of5";
|
|
354
|
+
DecodeBarcodeType2["Isbn"] = "ISBN";
|
|
355
|
+
DecodeBarcodeType2["Ismn"] = "ISMN";
|
|
356
|
+
DecodeBarcodeType2["Issn"] = "ISSN";
|
|
357
|
+
DecodeBarcodeType2["Itf14"] = "ITF14";
|
|
358
|
+
DecodeBarcodeType2["Itf6"] = "ITF6";
|
|
359
|
+
DecodeBarcodeType2["Interleaved2of5"] = "Interleaved2of5";
|
|
360
|
+
DecodeBarcodeType2["ItalianPost25"] = "ItalianPost25";
|
|
361
|
+
DecodeBarcodeType2["MacroPdf417"] = "MacroPdf417";
|
|
362
|
+
DecodeBarcodeType2["Mailmark"] = "Mailmark";
|
|
363
|
+
DecodeBarcodeType2["Matrix2of5"] = "Matrix2of5";
|
|
364
|
+
DecodeBarcodeType2["MaxiCode"] = "MaxiCode";
|
|
365
|
+
DecodeBarcodeType2["MicrE13B"] = "MicrE13B";
|
|
366
|
+
DecodeBarcodeType2["MicroPdf417"] = "MicroPdf417";
|
|
367
|
+
DecodeBarcodeType2["MicroQr"] = "MicroQR";
|
|
368
|
+
DecodeBarcodeType2["Msi"] = "MSI";
|
|
369
|
+
DecodeBarcodeType2["OneCode"] = "OneCode";
|
|
370
|
+
DecodeBarcodeType2["Opc"] = "OPC";
|
|
371
|
+
DecodeBarcodeType2["PatchCode"] = "PatchCode";
|
|
372
|
+
DecodeBarcodeType2["Pdf417"] = "Pdf417";
|
|
373
|
+
DecodeBarcodeType2["Pharmacode"] = "Pharmacode";
|
|
374
|
+
DecodeBarcodeType2["Planet"] = "Planet";
|
|
375
|
+
DecodeBarcodeType2["Postnet"] = "Postnet";
|
|
376
|
+
DecodeBarcodeType2["Pzn"] = "PZN";
|
|
377
|
+
DecodeBarcodeType2["RectMicroQr"] = "RectMicroQR";
|
|
378
|
+
DecodeBarcodeType2["Rm4Scc"] = "RM4SCC";
|
|
379
|
+
DecodeBarcodeType2["Scc14"] = "SCC14";
|
|
380
|
+
DecodeBarcodeType2["Sscc18"] = "SSCC18";
|
|
381
|
+
DecodeBarcodeType2["Standard2of5"] = "Standard2of5";
|
|
382
|
+
DecodeBarcodeType2["Supplement"] = "Supplement";
|
|
383
|
+
DecodeBarcodeType2["SwissPostParcel"] = "SwissPostParcel";
|
|
384
|
+
DecodeBarcodeType2["Upca"] = "UPCA";
|
|
385
|
+
DecodeBarcodeType2["Upce"] = "UPCE";
|
|
386
|
+
DecodeBarcodeType2["Vin"] = "VIN";
|
|
387
|
+
return DecodeBarcodeType2;
|
|
388
|
+
})(DecodeBarcodeType || {});
|
|
389
|
+
var EncodeBarcodeType = /* @__PURE__ */ ((EncodeBarcodeType2) => {
|
|
390
|
+
EncodeBarcodeType2["Qr"] = "QR";
|
|
391
|
+
EncodeBarcodeType2["AustraliaPost"] = "AustraliaPost";
|
|
392
|
+
EncodeBarcodeType2["AustralianPosteParcel"] = "AustralianPosteParcel";
|
|
393
|
+
EncodeBarcodeType2["Aztec"] = "Aztec";
|
|
394
|
+
EncodeBarcodeType2["Codabar"] = "Codabar";
|
|
395
|
+
EncodeBarcodeType2["CodablockF"] = "CodablockF";
|
|
396
|
+
EncodeBarcodeType2["Code11"] = "Code11";
|
|
397
|
+
EncodeBarcodeType2["Code128"] = "Code128";
|
|
398
|
+
EncodeBarcodeType2["Code16K"] = "Code16K";
|
|
399
|
+
EncodeBarcodeType2["Code32"] = "Code32";
|
|
400
|
+
EncodeBarcodeType2["Code39"] = "Code39";
|
|
401
|
+
EncodeBarcodeType2["Code39FullAscii"] = "Code39FullASCII";
|
|
402
|
+
EncodeBarcodeType2["Code93"] = "Code93";
|
|
403
|
+
EncodeBarcodeType2["DataLogic2of5"] = "DataLogic2of5";
|
|
404
|
+
EncodeBarcodeType2["DataMatrix"] = "DataMatrix";
|
|
405
|
+
EncodeBarcodeType2["DatabarExpanded"] = "DatabarExpanded";
|
|
406
|
+
EncodeBarcodeType2["DatabarExpandedStacked"] = "DatabarExpandedStacked";
|
|
407
|
+
EncodeBarcodeType2["DatabarLimited"] = "DatabarLimited";
|
|
408
|
+
EncodeBarcodeType2["DatabarOmniDirectional"] = "DatabarOmniDirectional";
|
|
409
|
+
EncodeBarcodeType2["DatabarStacked"] = "DatabarStacked";
|
|
410
|
+
EncodeBarcodeType2["DatabarStackedOmniDirectional"] = "DatabarStackedOmniDirectional";
|
|
411
|
+
EncodeBarcodeType2["DatabarTruncated"] = "DatabarTruncated";
|
|
412
|
+
EncodeBarcodeType2["DeutschePostIdentcode"] = "DeutschePostIdentcode";
|
|
413
|
+
EncodeBarcodeType2["DeutschePostLeitcode"] = "DeutschePostLeitcode";
|
|
414
|
+
EncodeBarcodeType2["DotCode"] = "DotCode";
|
|
415
|
+
EncodeBarcodeType2["DutchKix"] = "DutchKIX";
|
|
416
|
+
EncodeBarcodeType2["Ean13"] = "EAN13";
|
|
417
|
+
EncodeBarcodeType2["Ean14"] = "EAN14";
|
|
418
|
+
EncodeBarcodeType2["Ean8"] = "EAN8";
|
|
419
|
+
EncodeBarcodeType2["Gs1Aztec"] = "GS1Aztec";
|
|
420
|
+
EncodeBarcodeType2["Gs1CodablockF"] = "GS1CodablockF";
|
|
421
|
+
EncodeBarcodeType2["Gs1Code128"] = "GS1Code128";
|
|
422
|
+
EncodeBarcodeType2["Gs1DataMatrix"] = "GS1DataMatrix";
|
|
423
|
+
EncodeBarcodeType2["Gs1DotCode"] = "GS1DotCode";
|
|
424
|
+
EncodeBarcodeType2["Gs1HanXin"] = "GS1HanXin";
|
|
425
|
+
EncodeBarcodeType2["Gs1MicroPdf417"] = "GS1MicroPdf417";
|
|
426
|
+
EncodeBarcodeType2["Gs1Qr"] = "GS1QR";
|
|
427
|
+
EncodeBarcodeType2["HanXin"] = "HanXin";
|
|
428
|
+
EncodeBarcodeType2["Iata2of5"] = "IATA2of5";
|
|
429
|
+
EncodeBarcodeType2["Isbn"] = "ISBN";
|
|
430
|
+
EncodeBarcodeType2["Ismn"] = "ISMN";
|
|
431
|
+
EncodeBarcodeType2["Issn"] = "ISSN";
|
|
432
|
+
EncodeBarcodeType2["Itf14"] = "ITF14";
|
|
433
|
+
EncodeBarcodeType2["Itf6"] = "ITF6";
|
|
434
|
+
EncodeBarcodeType2["Interleaved2of5"] = "Interleaved2of5";
|
|
435
|
+
EncodeBarcodeType2["ItalianPost25"] = "ItalianPost25";
|
|
436
|
+
EncodeBarcodeType2["Msi"] = "MSI";
|
|
437
|
+
EncodeBarcodeType2["MacroPdf417"] = "MacroPdf417";
|
|
438
|
+
EncodeBarcodeType2["Mailmark"] = "Mailmark";
|
|
439
|
+
EncodeBarcodeType2["Matrix2of5"] = "Matrix2of5";
|
|
440
|
+
EncodeBarcodeType2["MaxiCode"] = "MaxiCode";
|
|
441
|
+
EncodeBarcodeType2["MicroPdf417"] = "MicroPdf417";
|
|
442
|
+
EncodeBarcodeType2["MicroQr"] = "MicroQR";
|
|
443
|
+
EncodeBarcodeType2["Opc"] = "OPC";
|
|
444
|
+
EncodeBarcodeType2["OneCode"] = "OneCode";
|
|
445
|
+
EncodeBarcodeType2["Pzn"] = "PZN";
|
|
446
|
+
EncodeBarcodeType2["PatchCode"] = "PatchCode";
|
|
447
|
+
EncodeBarcodeType2["Pdf417"] = "Pdf417";
|
|
448
|
+
EncodeBarcodeType2["Pharmacode"] = "Pharmacode";
|
|
449
|
+
EncodeBarcodeType2["Planet"] = "Planet";
|
|
450
|
+
EncodeBarcodeType2["Postnet"] = "Postnet";
|
|
451
|
+
EncodeBarcodeType2["Rm4Scc"] = "RM4SCC";
|
|
452
|
+
EncodeBarcodeType2["RectMicroQr"] = "RectMicroQR";
|
|
453
|
+
EncodeBarcodeType2["Scc14"] = "SCC14";
|
|
454
|
+
EncodeBarcodeType2["Sscc18"] = "SSCC18";
|
|
455
|
+
EncodeBarcodeType2["SingaporePost"] = "SingaporePost";
|
|
456
|
+
EncodeBarcodeType2["Standard2of5"] = "Standard2of5";
|
|
457
|
+
EncodeBarcodeType2["SwissPostParcel"] = "SwissPostParcel";
|
|
458
|
+
EncodeBarcodeType2["Upca"] = "UPCA";
|
|
459
|
+
EncodeBarcodeType2["Upce"] = "UPCE";
|
|
460
|
+
EncodeBarcodeType2["UpcaGs1Code128Coupon"] = "UpcaGs1Code128Coupon";
|
|
461
|
+
EncodeBarcodeType2["UpcaGs1DatabarCoupon"] = "UpcaGs1DatabarCoupon";
|
|
462
|
+
EncodeBarcodeType2["Vin"] = "VIN";
|
|
463
|
+
return EncodeBarcodeType2;
|
|
464
|
+
})(EncodeBarcodeType || {});
|
|
465
|
+
var _EncodeData = class _EncodeData {
|
|
466
|
+
static getAttributeTypeMap() {
|
|
467
|
+
return _EncodeData.attributeTypeMap;
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
_EncodeData.attributeTypeMap = [
|
|
471
|
+
{
|
|
472
|
+
name: "dataType",
|
|
473
|
+
baseName: "dataType",
|
|
474
|
+
type: "EncodeDataType"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: "data",
|
|
478
|
+
baseName: "data",
|
|
479
|
+
type: "string"
|
|
480
|
+
}
|
|
481
|
+
];
|
|
482
|
+
var EncodeData = _EncodeData;
|
|
483
|
+
var EncodeDataType = /* @__PURE__ */ ((EncodeDataType2) => {
|
|
484
|
+
EncodeDataType2["StringData"] = "StringData";
|
|
485
|
+
EncodeDataType2["Base64Bytes"] = "Base64Bytes";
|
|
486
|
+
EncodeDataType2["HexBytes"] = "HexBytes";
|
|
487
|
+
return EncodeDataType2;
|
|
488
|
+
})(EncodeDataType || {});
|
|
489
|
+
var _GenerateParams = class _GenerateParams {
|
|
490
|
+
static getAttributeTypeMap() {
|
|
491
|
+
return _GenerateParams.attributeTypeMap;
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
_GenerateParams.attributeTypeMap = [
|
|
495
|
+
{
|
|
496
|
+
name: "barcodeType",
|
|
497
|
+
baseName: "barcodeType",
|
|
498
|
+
type: "EncodeBarcodeType"
|
|
499
|
+
},
|
|
500
|
+
{
|
|
501
|
+
name: "encodeData",
|
|
502
|
+
baseName: "encodeData",
|
|
503
|
+
type: "EncodeData"
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: "barcodeImageParams",
|
|
507
|
+
baseName: "barcodeImageParams",
|
|
508
|
+
type: "BarcodeImageParams"
|
|
509
|
+
}
|
|
510
|
+
];
|
|
511
|
+
var GenerateParams = _GenerateParams;
|
|
512
|
+
var GraphicsUnit = /* @__PURE__ */ ((GraphicsUnit2) => {
|
|
513
|
+
GraphicsUnit2["Pixel"] = "Pixel";
|
|
514
|
+
GraphicsUnit2["Point"] = "Point";
|
|
515
|
+
GraphicsUnit2["Inch"] = "Inch";
|
|
516
|
+
GraphicsUnit2["Millimeter"] = "Millimeter";
|
|
517
|
+
return GraphicsUnit2;
|
|
518
|
+
})(GraphicsUnit || {});
|
|
519
|
+
var RecognitionImageKind = /* @__PURE__ */ ((RecognitionImageKind2) => {
|
|
520
|
+
RecognitionImageKind2["Photo"] = "Photo";
|
|
521
|
+
RecognitionImageKind2["ScannedDocument"] = "ScannedDocument";
|
|
522
|
+
RecognitionImageKind2["ClearImage"] = "ClearImage";
|
|
523
|
+
return RecognitionImageKind2;
|
|
524
|
+
})(RecognitionImageKind || {});
|
|
525
|
+
var RecognitionMode = /* @__PURE__ */ ((RecognitionMode2) => {
|
|
526
|
+
RecognitionMode2["Fast"] = "Fast";
|
|
527
|
+
RecognitionMode2["Normal"] = "Normal";
|
|
528
|
+
RecognitionMode2["Excellent"] = "Excellent";
|
|
529
|
+
return RecognitionMode2;
|
|
530
|
+
})(RecognitionMode || {});
|
|
531
|
+
var _RecognizeBase64Request = class _RecognizeBase64Request {
|
|
532
|
+
static getAttributeTypeMap() {
|
|
533
|
+
return _RecognizeBase64Request.attributeTypeMap;
|
|
534
|
+
}
|
|
535
|
+
};
|
|
536
|
+
_RecognizeBase64Request.attributeTypeMap = [
|
|
537
|
+
{
|
|
538
|
+
name: "barcodeTypes",
|
|
539
|
+
baseName: "barcodeTypes",
|
|
540
|
+
type: "Array<DecodeBarcodeType>"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: "fileBase64",
|
|
544
|
+
baseName: "fileBase64",
|
|
545
|
+
type: "string"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "recognitionMode",
|
|
549
|
+
baseName: "recognitionMode",
|
|
550
|
+
type: "RecognitionMode"
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
name: "recognitionImageKind",
|
|
554
|
+
baseName: "recognitionImageKind",
|
|
555
|
+
type: "RecognitionImageKind"
|
|
556
|
+
}
|
|
557
|
+
];
|
|
558
|
+
var RecognizeBase64Request = _RecognizeBase64Request;
|
|
559
|
+
var _RegionPoint = class _RegionPoint {
|
|
560
|
+
static getAttributeTypeMap() {
|
|
561
|
+
return _RegionPoint.attributeTypeMap;
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
_RegionPoint.attributeTypeMap = [
|
|
565
|
+
{
|
|
566
|
+
name: "x",
|
|
567
|
+
baseName: "x",
|
|
568
|
+
type: "number"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
name: "y",
|
|
572
|
+
baseName: "y",
|
|
573
|
+
type: "number"
|
|
574
|
+
}
|
|
575
|
+
];
|
|
576
|
+
var RegionPoint = _RegionPoint;
|
|
577
|
+
var _ScanBase64Request = class _ScanBase64Request {
|
|
578
|
+
static getAttributeTypeMap() {
|
|
579
|
+
return _ScanBase64Request.attributeTypeMap;
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
_ScanBase64Request.attributeTypeMap = [
|
|
583
|
+
{
|
|
584
|
+
name: "fileBase64",
|
|
585
|
+
baseName: "fileBase64",
|
|
586
|
+
type: "string"
|
|
587
|
+
}
|
|
588
|
+
];
|
|
589
|
+
var ScanBase64Request = _ScanBase64Request;
|
|
590
|
+
var GenerateRequestWrapper = class {
|
|
591
|
+
/**
|
|
592
|
+
* @param barcodeType Type of barcode to generate.
|
|
593
|
+
* @param data String represents data to encode
|
|
594
|
+
*/
|
|
595
|
+
constructor(barcodeType, data) {
|
|
596
|
+
/**
|
|
597
|
+
* Specify the displaying bars and content Color.
|
|
598
|
+
Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value started with #.
|
|
599
|
+
For example: AliceBlue or #FF000000
|
|
600
|
+
Default value: Black.
|
|
601
|
+
*/
|
|
602
|
+
this["foregroundColor"] = "'Black'";
|
|
603
|
+
/**
|
|
604
|
+
* Background color of the barcode image.
|
|
605
|
+
Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value started with #.
|
|
606
|
+
For example: AliceBlue or #FF000000
|
|
607
|
+
Default value: White.
|
|
608
|
+
*/
|
|
609
|
+
this["backgroundColor"] = "'White'";
|
|
610
|
+
this.barcodeType = barcodeType;
|
|
611
|
+
this.data = data;
|
|
612
|
+
}
|
|
613
|
+
};
|
|
614
|
+
var GenerateBodyRequestWrapper = class {
|
|
615
|
+
/**
|
|
616
|
+
* @param generateParams
|
|
617
|
+
*/
|
|
618
|
+
constructor(generateParams) {
|
|
619
|
+
this.generateParams = generateParams;
|
|
620
|
+
}
|
|
621
|
+
};
|
|
622
|
+
var GenerateMultipartRequestWrapper = class {
|
|
623
|
+
/**
|
|
624
|
+
* @param barcodeType
|
|
625
|
+
* @param data String represents data to encode
|
|
626
|
+
*/
|
|
627
|
+
constructor(barcodeType, data) {
|
|
628
|
+
/**
|
|
629
|
+
* Specify the displaying bars and content Color. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value started with #. For example: AliceBlue or #FF000000 Default value: Black.
|
|
630
|
+
*/
|
|
631
|
+
this["foregroundColor"] = "'Black'";
|
|
632
|
+
/**
|
|
633
|
+
* Background color of the barcode image. Value: Color name from https://reference.aspose.com/drawing/net/system.drawing/color/ or ARGB value started with #. For example: AliceBlue or #FF000000 Default value: White.
|
|
634
|
+
*/
|
|
635
|
+
this["backgroundColor"] = "'White'";
|
|
636
|
+
this.barcodeType = barcodeType;
|
|
637
|
+
this.data = data;
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
var RecognizeRequestWrapper = class {
|
|
641
|
+
/**
|
|
642
|
+
* @param barcodeType Type of barcode to recognize
|
|
643
|
+
* @param fileUrl Url to barcode image
|
|
644
|
+
*/
|
|
645
|
+
constructor(barcodeType, fileUrl) {
|
|
646
|
+
this.barcodeType = barcodeType;
|
|
647
|
+
this.fileUrl = fileUrl;
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
var RecognizeBase64RequestWrapper = class {
|
|
651
|
+
/**
|
|
652
|
+
* @param recognizeBase64Request
|
|
653
|
+
*/
|
|
654
|
+
constructor(recognizeBase64Request) {
|
|
655
|
+
this.recognizeBase64Request = recognizeBase64Request;
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
var RecognizeMultipartRequestWrapper = class {
|
|
659
|
+
/**
|
|
660
|
+
* @param barcodeType
|
|
661
|
+
* @param fileBytes Barcode image file
|
|
662
|
+
*/
|
|
663
|
+
constructor(barcodeType, fileBytes) {
|
|
664
|
+
this.barcodeType = barcodeType;
|
|
665
|
+
this.fileBytes = fileBytes;
|
|
666
|
+
}
|
|
667
|
+
};
|
|
668
|
+
var ScanRequestWrapper = class {
|
|
669
|
+
/**
|
|
670
|
+
* @param fileUrl Url to barcode image
|
|
671
|
+
*/
|
|
672
|
+
constructor(fileUrl) {
|
|
673
|
+
this.fileUrl = fileUrl;
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
var ScanBase64RequestWrapper = class {
|
|
677
|
+
/**
|
|
678
|
+
* @param scanBase64Request
|
|
679
|
+
*/
|
|
680
|
+
constructor(scanBase64Request) {
|
|
681
|
+
this.scanBase64Request = scanBase64Request;
|
|
682
|
+
}
|
|
683
|
+
};
|
|
684
|
+
var ScanMultipartRequestWrapper = class {
|
|
685
|
+
/**
|
|
686
|
+
* @param fileBytes Barcode image file
|
|
687
|
+
*/
|
|
688
|
+
constructor(fileBytes) {
|
|
689
|
+
this.fileBytes = fileBytes;
|
|
690
|
+
}
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
// src/api.ts
|
|
694
|
+
var ApiClient = class {
|
|
695
|
+
constructor() {
|
|
696
|
+
const resolvedFetch = globalThis.fetch;
|
|
697
|
+
if (!resolvedFetch) {
|
|
698
|
+
throw new Error("Global fetch API is not available. Please use Node.js 18+.");
|
|
699
|
+
}
|
|
700
|
+
this._fetcher = resolvedFetch;
|
|
701
|
+
}
|
|
702
|
+
requestAsync(options) {
|
|
703
|
+
const url = options.qs ? new URL(`?${new URLSearchParams(options.qs).toString()}`, options.uri) : new URL(options.uri);
|
|
704
|
+
const requestBody = this.buildRequestBody(options);
|
|
705
|
+
const responseEncoding = options.encoding === null ? null : options.encoding || "utf-8";
|
|
706
|
+
const requestOptions = {
|
|
707
|
+
method: options.method || "GET",
|
|
708
|
+
headers: options.headers
|
|
709
|
+
};
|
|
710
|
+
if (requestBody) {
|
|
711
|
+
requestOptions.body = requestBody;
|
|
712
|
+
}
|
|
713
|
+
return this.doFetchRequest(url, requestOptions, responseEncoding);
|
|
714
|
+
}
|
|
715
|
+
buildRequestBody(options) {
|
|
716
|
+
let requestBody = options.body;
|
|
717
|
+
if (options.form) {
|
|
718
|
+
requestBody = new URLSearchParams(options.form).toString();
|
|
719
|
+
options.headers = Object.assign(
|
|
720
|
+
{
|
|
721
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
722
|
+
},
|
|
723
|
+
options.headers
|
|
724
|
+
);
|
|
725
|
+
}
|
|
726
|
+
if (options.json) {
|
|
727
|
+
requestBody = JSON.stringify(options.body);
|
|
728
|
+
options.headers = Object.assign(
|
|
729
|
+
{
|
|
730
|
+
"Content-Type": "application/json"
|
|
731
|
+
},
|
|
732
|
+
options.headers
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
return requestBody;
|
|
736
|
+
}
|
|
737
|
+
doFetchRequest(url, requestOptions, responseEncoding) {
|
|
738
|
+
return __async(this, null, function* () {
|
|
739
|
+
let response;
|
|
740
|
+
try {
|
|
741
|
+
response = yield this._fetcher(url.toString(), requestOptions);
|
|
742
|
+
} catch (error) {
|
|
743
|
+
return Promise.reject({
|
|
744
|
+
response: null,
|
|
745
|
+
error: this.normalizeFetchError(error),
|
|
746
|
+
errorResponse: null
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
const respBody = yield this.readResponseBody(response, responseEncoding);
|
|
750
|
+
const responseHeaders = this.toHeaderDict(response.headers);
|
|
751
|
+
const httpResponse = {
|
|
752
|
+
statusCode: response.status,
|
|
753
|
+
statusMessage: response.statusText,
|
|
754
|
+
headers: responseHeaders,
|
|
755
|
+
body: respBody
|
|
756
|
+
};
|
|
757
|
+
if (response.ok) {
|
|
758
|
+
return {
|
|
759
|
+
response: httpResponse,
|
|
760
|
+
body: respBody
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
const rejectObject = {
|
|
764
|
+
response: httpResponse,
|
|
765
|
+
error: new Error(`Error on '${url}': ${response.status} ${response.statusText}`),
|
|
766
|
+
errorResponse: null
|
|
767
|
+
};
|
|
768
|
+
let errorResponse = null;
|
|
769
|
+
try {
|
|
770
|
+
errorResponse = JSON.parse(respBody.toString());
|
|
771
|
+
} catch (parseError) {
|
|
772
|
+
}
|
|
773
|
+
if (errorResponse) {
|
|
774
|
+
rejectObject.errorResponse = errorResponse;
|
|
775
|
+
} else {
|
|
776
|
+
rejectObject.error.message += `. ${respBody}`;
|
|
777
|
+
}
|
|
778
|
+
return Promise.reject(rejectObject);
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
readResponseBody(response, responseEncoding) {
|
|
782
|
+
return __async(this, null, function* () {
|
|
783
|
+
const arrayBuffer = yield response.arrayBuffer();
|
|
784
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
785
|
+
if (responseEncoding === null) {
|
|
786
|
+
return buffer;
|
|
787
|
+
}
|
|
788
|
+
return buffer.toString(responseEncoding);
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
toHeaderDict(headers) {
|
|
792
|
+
const normalizedHeaders = {};
|
|
793
|
+
headers.forEach((value, key) => {
|
|
794
|
+
const existing = normalizedHeaders[key];
|
|
795
|
+
if (existing === void 0) {
|
|
796
|
+
normalizedHeaders[key] = value;
|
|
797
|
+
return;
|
|
798
|
+
}
|
|
799
|
+
if (Array.isArray(existing)) {
|
|
800
|
+
existing.push(value);
|
|
801
|
+
normalizedHeaders[key] = existing;
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
normalizedHeaders[key] = [existing, value];
|
|
805
|
+
});
|
|
806
|
+
return normalizedHeaders;
|
|
807
|
+
}
|
|
808
|
+
normalizeFetchError(error) {
|
|
809
|
+
if (error instanceof Error) {
|
|
810
|
+
const mutableError = error;
|
|
811
|
+
let normalizedCode = mutableError.code;
|
|
812
|
+
if (!normalizedCode) {
|
|
813
|
+
const cause = mutableError.cause;
|
|
814
|
+
if (cause && typeof cause === "object" && "code" in cause) {
|
|
815
|
+
const code = cause.code;
|
|
816
|
+
if (code) {
|
|
817
|
+
normalizedCode = String(code);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
if (!normalizedCode) {
|
|
822
|
+
normalizedCode = mutableError.name || "FETCH_ERROR";
|
|
823
|
+
}
|
|
824
|
+
try {
|
|
825
|
+
if (!mutableError.code) {
|
|
826
|
+
mutableError.code = normalizedCode;
|
|
827
|
+
}
|
|
828
|
+
} catch (assignError) {
|
|
829
|
+
}
|
|
830
|
+
if (mutableError.code) {
|
|
831
|
+
return mutableError;
|
|
832
|
+
}
|
|
833
|
+
const wrapped2 = new Error(mutableError.message);
|
|
834
|
+
wrapped2.name = mutableError.name;
|
|
835
|
+
wrapped2.code = normalizedCode;
|
|
836
|
+
return wrapped2;
|
|
837
|
+
}
|
|
838
|
+
const wrapped = new Error(String(error));
|
|
839
|
+
wrapped.code = "FETCH_ERROR";
|
|
840
|
+
return wrapped;
|
|
841
|
+
}
|
|
842
|
+
};
|
|
843
|
+
var primitives = ["string", "boolean", "double", "integer", "long", "float", "number", "any"];
|
|
844
|
+
var ObjectSerializer = class _ObjectSerializer {
|
|
845
|
+
static findCorrectType(data, expectedType) {
|
|
846
|
+
if (data == null) {
|
|
847
|
+
return expectedType;
|
|
848
|
+
}
|
|
849
|
+
if (primitives.indexOf(expectedType.toLowerCase()) !== -1) {
|
|
850
|
+
return expectedType;
|
|
851
|
+
}
|
|
852
|
+
if (expectedType === "Date") {
|
|
853
|
+
return expectedType;
|
|
854
|
+
}
|
|
855
|
+
if (enumsMap[expectedType]) {
|
|
856
|
+
return expectedType;
|
|
857
|
+
}
|
|
858
|
+
if (!typeMap[expectedType]) {
|
|
859
|
+
return expectedType;
|
|
860
|
+
}
|
|
861
|
+
let discriminatorProperty = typeMap[expectedType].discriminator;
|
|
862
|
+
if (discriminatorProperty == null) {
|
|
863
|
+
return expectedType;
|
|
864
|
+
}
|
|
865
|
+
if (data[discriminatorProperty]) {
|
|
866
|
+
return data[discriminatorProperty];
|
|
867
|
+
}
|
|
868
|
+
return expectedType;
|
|
869
|
+
}
|
|
870
|
+
static serialize(data, type) {
|
|
871
|
+
if (data == null) {
|
|
872
|
+
return data;
|
|
873
|
+
}
|
|
874
|
+
if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
875
|
+
return data;
|
|
876
|
+
}
|
|
877
|
+
if (type.lastIndexOf("Array<", 0) === 0) {
|
|
878
|
+
let subType = type.replace("Array<", "");
|
|
879
|
+
subType = subType.substring(0, subType.length - 1);
|
|
880
|
+
let transformedData = [];
|
|
881
|
+
for (let index in data) {
|
|
882
|
+
let date = data[index];
|
|
883
|
+
transformedData.push(_ObjectSerializer.serialize(date, subType));
|
|
884
|
+
}
|
|
885
|
+
return transformedData;
|
|
886
|
+
}
|
|
887
|
+
if (type === "Date") {
|
|
888
|
+
return data.toString();
|
|
889
|
+
}
|
|
890
|
+
if (enumsMap[type] && Object.values(enumsMap[type]).includes(data)) {
|
|
891
|
+
return data;
|
|
892
|
+
}
|
|
893
|
+
if (!typeMap[type]) {
|
|
894
|
+
return data;
|
|
895
|
+
}
|
|
896
|
+
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
897
|
+
let instance = {};
|
|
898
|
+
for (let index in attributeTypes) {
|
|
899
|
+
let attributeType = attributeTypes[index];
|
|
900
|
+
instance[attributeType.baseName] = _ObjectSerializer.serialize(data[attributeType.name], attributeType.type);
|
|
901
|
+
}
|
|
902
|
+
return instance;
|
|
903
|
+
}
|
|
904
|
+
static deserialize(data, type) {
|
|
905
|
+
type = _ObjectSerializer.findCorrectType(data, type);
|
|
906
|
+
if (data == null) {
|
|
907
|
+
return data;
|
|
908
|
+
}
|
|
909
|
+
if (primitives.indexOf(type.toLowerCase()) !== -1) {
|
|
910
|
+
return data;
|
|
911
|
+
}
|
|
912
|
+
if (type.lastIndexOf("Array<", 0) === 0) {
|
|
913
|
+
let subType = type.replace("Array<", "");
|
|
914
|
+
subType = subType.substring(0, subType.length - 1);
|
|
915
|
+
let transformedData = [];
|
|
916
|
+
for (let index in data) {
|
|
917
|
+
let date = data[index];
|
|
918
|
+
transformedData.push(_ObjectSerializer.deserialize(date, subType));
|
|
919
|
+
}
|
|
920
|
+
return transformedData;
|
|
921
|
+
}
|
|
922
|
+
if (type === "Date") {
|
|
923
|
+
return new Date(data);
|
|
924
|
+
}
|
|
925
|
+
if (enumsMap[type]) {
|
|
926
|
+
return data;
|
|
927
|
+
}
|
|
928
|
+
if (!typeMap[type]) {
|
|
929
|
+
return data;
|
|
930
|
+
}
|
|
931
|
+
if (typeof data === "string") {
|
|
932
|
+
data = JSON.parse(data);
|
|
933
|
+
}
|
|
934
|
+
let instance = new typeMap[type]();
|
|
935
|
+
let attributeTypes = typeMap[type].getAttributeTypeMap();
|
|
936
|
+
for (const attributeType of attributeTypes) {
|
|
937
|
+
const key = attributeType.baseName.replace(/^(.)/, ($1) => {
|
|
938
|
+
return $1.toLowerCase();
|
|
939
|
+
});
|
|
940
|
+
instance[attributeType.name] = _ObjectSerializer.deserialize(data[key], attributeType.type);
|
|
941
|
+
}
|
|
942
|
+
return instance;
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
var enumsMap = {
|
|
946
|
+
BarcodeImageFormat,
|
|
947
|
+
CodeLocation,
|
|
948
|
+
DecodeBarcodeType,
|
|
949
|
+
EncodeBarcodeType,
|
|
950
|
+
EncodeDataType,
|
|
951
|
+
GraphicsUnit,
|
|
952
|
+
RecognitionImageKind,
|
|
953
|
+
RecognitionMode
|
|
954
|
+
};
|
|
955
|
+
var typeMap = {
|
|
956
|
+
ApiError,
|
|
957
|
+
ApiErrorResponse,
|
|
958
|
+
BarcodeImageParams,
|
|
959
|
+
BarcodeResponse,
|
|
960
|
+
BarcodeResponseList,
|
|
961
|
+
EncodeData,
|
|
962
|
+
GenerateParams,
|
|
963
|
+
RecognizeBase64Request,
|
|
964
|
+
RegionPoint,
|
|
965
|
+
ScanBase64Request
|
|
966
|
+
};
|
|
967
|
+
var GenerateApi = class {
|
|
968
|
+
constructor(configuration) {
|
|
969
|
+
this.defaultHeaders = {
|
|
970
|
+
"x-aspose-client": "nodejs sdk",
|
|
971
|
+
"x-aspose-client-version": "26.2.0"
|
|
972
|
+
};
|
|
973
|
+
this._configuration = configuration;
|
|
974
|
+
this._client = new ApiClient();
|
|
975
|
+
}
|
|
976
|
+
/**
|
|
977
|
+
* Generate barcode using GET request with parameters in route and query string.
|
|
978
|
+
* @param request GenerateRequestWrapper
|
|
979
|
+
*/
|
|
980
|
+
generate(request) {
|
|
981
|
+
return __async(this, null, function* () {
|
|
982
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/generate/{barcodeType}".replace("{barcodeType}", String(request.barcodeType));
|
|
983
|
+
let queryParameters = {};
|
|
984
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
985
|
+
if (request.barcodeType == null) {
|
|
986
|
+
throw new Error("Required parameter request.barcodeType was null or undefined when calling generate.");
|
|
987
|
+
}
|
|
988
|
+
if (request.data == null) {
|
|
989
|
+
throw new Error("Required parameter request.data was null or undefined when calling generate.");
|
|
990
|
+
}
|
|
991
|
+
if (request.dataType != null) {
|
|
992
|
+
queryParameters["dataType"] = ObjectSerializer.serialize(request.dataType, "EncodeDataType");
|
|
993
|
+
}
|
|
994
|
+
if (request.data != null) {
|
|
995
|
+
queryParameters["data"] = ObjectSerializer.serialize(request.data, "string");
|
|
996
|
+
}
|
|
997
|
+
if (request.imageFormat != null) {
|
|
998
|
+
queryParameters["imageFormat"] = ObjectSerializer.serialize(request.imageFormat, "BarcodeImageFormat");
|
|
999
|
+
}
|
|
1000
|
+
if (request.textLocation != null) {
|
|
1001
|
+
queryParameters["textLocation"] = ObjectSerializer.serialize(request.textLocation, "CodeLocation");
|
|
1002
|
+
}
|
|
1003
|
+
if (request.foregroundColor != null) {
|
|
1004
|
+
queryParameters["foregroundColor"] = ObjectSerializer.serialize(request.foregroundColor, "string");
|
|
1005
|
+
}
|
|
1006
|
+
if (request.backgroundColor != null) {
|
|
1007
|
+
queryParameters["backgroundColor"] = ObjectSerializer.serialize(request.backgroundColor, "string");
|
|
1008
|
+
}
|
|
1009
|
+
if (request.units != null) {
|
|
1010
|
+
queryParameters["units"] = ObjectSerializer.serialize(request.units, "GraphicsUnit");
|
|
1011
|
+
}
|
|
1012
|
+
if (request.resolution != null) {
|
|
1013
|
+
queryParameters["resolution"] = ObjectSerializer.serialize(request.resolution, "number");
|
|
1014
|
+
}
|
|
1015
|
+
if (request.imageHeight != null) {
|
|
1016
|
+
queryParameters["imageHeight"] = ObjectSerializer.serialize(request.imageHeight, "number");
|
|
1017
|
+
}
|
|
1018
|
+
if (request.imageWidth != null) {
|
|
1019
|
+
queryParameters["imageWidth"] = ObjectSerializer.serialize(request.imageWidth, "number");
|
|
1020
|
+
}
|
|
1021
|
+
if (request.rotationAngle != null) {
|
|
1022
|
+
queryParameters["rotationAngle"] = ObjectSerializer.serialize(request.rotationAngle, "number");
|
|
1023
|
+
}
|
|
1024
|
+
const requestOptions = {
|
|
1025
|
+
method: "GET",
|
|
1026
|
+
qs: queryParameters,
|
|
1027
|
+
headers: headerParams,
|
|
1028
|
+
uri: requestPath,
|
|
1029
|
+
encoding: null
|
|
1030
|
+
};
|
|
1031
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1032
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1033
|
+
return {
|
|
1034
|
+
response: result.response,
|
|
1035
|
+
body: ObjectSerializer.deserialize(result.body, "Buffer")
|
|
1036
|
+
};
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Generate barcode using POST request with parameters in body in json or xml format.
|
|
1041
|
+
* @param request GenerateBodyRequestWrapper
|
|
1042
|
+
*/
|
|
1043
|
+
generateBody(request) {
|
|
1044
|
+
return __async(this, null, function* () {
|
|
1045
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/generate-body";
|
|
1046
|
+
let queryParameters = {};
|
|
1047
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1048
|
+
if (request.generateParams == null) {
|
|
1049
|
+
throw new Error(
|
|
1050
|
+
"Required parameter request.generateParams was null or undefined when calling generateBody."
|
|
1051
|
+
);
|
|
1052
|
+
}
|
|
1053
|
+
const requestOptions = {
|
|
1054
|
+
method: "POST",
|
|
1055
|
+
qs: queryParameters,
|
|
1056
|
+
headers: headerParams,
|
|
1057
|
+
uri: requestPath,
|
|
1058
|
+
body: ObjectSerializer.serialize(request.generateParams, "GenerateParams"),
|
|
1059
|
+
json: true,
|
|
1060
|
+
encoding: null
|
|
1061
|
+
};
|
|
1062
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1063
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1064
|
+
return {
|
|
1065
|
+
response: result.response,
|
|
1066
|
+
body: ObjectSerializer.deserialize(result.body, "Buffer")
|
|
1067
|
+
};
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
/**
|
|
1071
|
+
* Generate barcode using POST request with parameters in multipart form.
|
|
1072
|
+
* @param request GenerateMultipartRequestWrapper
|
|
1073
|
+
*/
|
|
1074
|
+
generateMultipart(request) {
|
|
1075
|
+
return __async(this, null, function* () {
|
|
1076
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/generate-multipart";
|
|
1077
|
+
let queryParameters = {};
|
|
1078
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1079
|
+
const formParams = [];
|
|
1080
|
+
if (request.barcodeType == null) {
|
|
1081
|
+
throw new Error(
|
|
1082
|
+
"Required parameter request.barcodeType was null or undefined when calling generateMultipart."
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1085
|
+
if (request.data == null) {
|
|
1086
|
+
throw new Error("Required parameter request.data was null or undefined when calling generateMultipart.");
|
|
1087
|
+
}
|
|
1088
|
+
if (request.barcodeType != null) {
|
|
1089
|
+
formParams.push(["barcodeType", ObjectSerializer.serialize(request.barcodeType, "EncodeBarcodeType")]);
|
|
1090
|
+
}
|
|
1091
|
+
if (request.dataType != null) {
|
|
1092
|
+
formParams.push(["dataType", ObjectSerializer.serialize(request.dataType, "EncodeDataType")]);
|
|
1093
|
+
}
|
|
1094
|
+
if (request.data != null) {
|
|
1095
|
+
formParams.push(["data", ObjectSerializer.serialize(request.data, "string")]);
|
|
1096
|
+
}
|
|
1097
|
+
if (request.imageFormat != null) {
|
|
1098
|
+
formParams.push(["imageFormat", ObjectSerializer.serialize(request.imageFormat, "BarcodeImageFormat")]);
|
|
1099
|
+
}
|
|
1100
|
+
if (request.textLocation != null) {
|
|
1101
|
+
formParams.push(["textLocation", ObjectSerializer.serialize(request.textLocation, "CodeLocation")]);
|
|
1102
|
+
}
|
|
1103
|
+
if (request.foregroundColor != null) {
|
|
1104
|
+
formParams.push(["foregroundColor", ObjectSerializer.serialize(request.foregroundColor, "string")]);
|
|
1105
|
+
}
|
|
1106
|
+
if (request.backgroundColor != null) {
|
|
1107
|
+
formParams.push(["backgroundColor", ObjectSerializer.serialize(request.backgroundColor, "string")]);
|
|
1108
|
+
}
|
|
1109
|
+
if (request.units != null) {
|
|
1110
|
+
formParams.push(["units", ObjectSerializer.serialize(request.units, "GraphicsUnit")]);
|
|
1111
|
+
}
|
|
1112
|
+
if (request.resolution != null) {
|
|
1113
|
+
formParams.push(["resolution", ObjectSerializer.serialize(request.resolution, "number")]);
|
|
1114
|
+
}
|
|
1115
|
+
if (request.imageHeight != null) {
|
|
1116
|
+
formParams.push(["imageHeight", ObjectSerializer.serialize(request.imageHeight, "number")]);
|
|
1117
|
+
}
|
|
1118
|
+
if (request.imageWidth != null) {
|
|
1119
|
+
formParams.push(["imageWidth", ObjectSerializer.serialize(request.imageWidth, "number")]);
|
|
1120
|
+
}
|
|
1121
|
+
if (request.rotationAngle != null) {
|
|
1122
|
+
formParams.push(["rotationAngle", ObjectSerializer.serialize(request.rotationAngle, "number")]);
|
|
1123
|
+
}
|
|
1124
|
+
const requestOptions = {
|
|
1125
|
+
method: "POST",
|
|
1126
|
+
qs: queryParameters,
|
|
1127
|
+
headers: headerParams,
|
|
1128
|
+
uri: requestPath,
|
|
1129
|
+
encoding: null
|
|
1130
|
+
};
|
|
1131
|
+
let fileArray = new Array();
|
|
1132
|
+
const multipartForm = new Multipart(formParams, fileArray);
|
|
1133
|
+
requestOptions.body = multipartForm.body;
|
|
1134
|
+
requestOptions.headers = __spreadValues(__spreadValues({}, requestOptions.headers), multipartForm.headers);
|
|
1135
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1136
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1137
|
+
return {
|
|
1138
|
+
response: result.response,
|
|
1139
|
+
body: ObjectSerializer.deserialize(result.body, "Buffer")
|
|
1140
|
+
};
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
};
|
|
1144
|
+
var RecognizeApi = class {
|
|
1145
|
+
constructor(configuration) {
|
|
1146
|
+
this.defaultHeaders = {
|
|
1147
|
+
"x-aspose-client": "nodejs sdk",
|
|
1148
|
+
"x-aspose-client-version": "26.2.0"
|
|
1149
|
+
};
|
|
1150
|
+
this._configuration = configuration;
|
|
1151
|
+
this._client = new ApiClient();
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Recognize barcode from file on server in the Internet using GET requests with parameter in query string. For recognizing files from your hard drive use `recognize-body` or `recognize-multipart` endpoints instead.
|
|
1155
|
+
* @param request RecognizeRequestWrapper
|
|
1156
|
+
*/
|
|
1157
|
+
recognize(request) {
|
|
1158
|
+
return __async(this, null, function* () {
|
|
1159
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/recognize";
|
|
1160
|
+
let queryParameters = {};
|
|
1161
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1162
|
+
if (request.barcodeType == null) {
|
|
1163
|
+
throw new Error("Required parameter request.barcodeType was null or undefined when calling recognize.");
|
|
1164
|
+
}
|
|
1165
|
+
if (request.fileUrl == null) {
|
|
1166
|
+
throw new Error("Required parameter request.fileUrl was null or undefined when calling recognize.");
|
|
1167
|
+
}
|
|
1168
|
+
if (request.barcodeType != null) {
|
|
1169
|
+
queryParameters["barcodeType"] = ObjectSerializer.serialize(request.barcodeType, "DecodeBarcodeType");
|
|
1170
|
+
}
|
|
1171
|
+
if (request.fileUrl != null) {
|
|
1172
|
+
queryParameters["fileUrl"] = ObjectSerializer.serialize(request.fileUrl, "string");
|
|
1173
|
+
}
|
|
1174
|
+
if (request.recognitionMode != null) {
|
|
1175
|
+
queryParameters["recognitionMode"] = ObjectSerializer.serialize(request.recognitionMode, "RecognitionMode");
|
|
1176
|
+
}
|
|
1177
|
+
if (request.recognitionImageKind != null) {
|
|
1178
|
+
queryParameters["recognitionImageKind"] = ObjectSerializer.serialize(
|
|
1179
|
+
request.recognitionImageKind,
|
|
1180
|
+
"RecognitionImageKind"
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
const requestOptions = {
|
|
1184
|
+
method: "GET",
|
|
1185
|
+
qs: queryParameters,
|
|
1186
|
+
headers: headerParams,
|
|
1187
|
+
uri: requestPath
|
|
1188
|
+
};
|
|
1189
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1190
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1191
|
+
return {
|
|
1192
|
+
response: result.response,
|
|
1193
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1194
|
+
};
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Recognize barcode from file in request body using POST requests with parameters in body in json or xml format.
|
|
1199
|
+
* @param request RecognizeBase64RequestWrapper
|
|
1200
|
+
*/
|
|
1201
|
+
recognizeBase64(request) {
|
|
1202
|
+
return __async(this, null, function* () {
|
|
1203
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/recognize-body";
|
|
1204
|
+
let queryParameters = {};
|
|
1205
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1206
|
+
if (request.recognizeBase64Request == null) {
|
|
1207
|
+
throw new Error(
|
|
1208
|
+
"Required parameter request.recognizeBase64Request was null or undefined when calling recognizeBase64."
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
const requestOptions = {
|
|
1212
|
+
method: "POST",
|
|
1213
|
+
qs: queryParameters,
|
|
1214
|
+
headers: headerParams,
|
|
1215
|
+
uri: requestPath,
|
|
1216
|
+
body: ObjectSerializer.serialize(request.recognizeBase64Request, "RecognizeBase64Request"),
|
|
1217
|
+
json: true
|
|
1218
|
+
};
|
|
1219
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1220
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1221
|
+
return {
|
|
1222
|
+
response: result.response,
|
|
1223
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1224
|
+
};
|
|
1225
|
+
});
|
|
1226
|
+
}
|
|
1227
|
+
/**
|
|
1228
|
+
* Recognize barcode from file in request body using POST requests with parameters in multipart form.
|
|
1229
|
+
* @param request RecognizeMultipartRequestWrapper
|
|
1230
|
+
*/
|
|
1231
|
+
recognizeMultipart(request) {
|
|
1232
|
+
return __async(this, null, function* () {
|
|
1233
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/recognize-multipart";
|
|
1234
|
+
let queryParameters = {};
|
|
1235
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1236
|
+
const formParams = [];
|
|
1237
|
+
if (request.barcodeType == null) {
|
|
1238
|
+
throw new Error(
|
|
1239
|
+
"Required parameter request.barcodeType was null or undefined when calling recognizeMultipart."
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
if (request.fileBytes == null) {
|
|
1243
|
+
throw new Error(
|
|
1244
|
+
"Required parameter request.fileBytes was null or undefined when calling recognizeMultipart."
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
if (request.barcodeType != null) {
|
|
1248
|
+
formParams.push(["barcodeType", ObjectSerializer.serialize(request.barcodeType, "DecodeBarcodeType")]);
|
|
1249
|
+
}
|
|
1250
|
+
if (request.recognitionMode != null) {
|
|
1251
|
+
formParams.push([
|
|
1252
|
+
"recognitionMode",
|
|
1253
|
+
ObjectSerializer.serialize(request.recognitionMode, "RecognitionMode")
|
|
1254
|
+
]);
|
|
1255
|
+
}
|
|
1256
|
+
if (request.recognitionImageKind != null) {
|
|
1257
|
+
formParams.push([
|
|
1258
|
+
"recognitionImageKind",
|
|
1259
|
+
ObjectSerializer.serialize(request.recognitionImageKind, "RecognitionImageKind")
|
|
1260
|
+
]);
|
|
1261
|
+
}
|
|
1262
|
+
const requestOptions = {
|
|
1263
|
+
method: "POST",
|
|
1264
|
+
qs: queryParameters,
|
|
1265
|
+
headers: headerParams,
|
|
1266
|
+
uri: requestPath
|
|
1267
|
+
};
|
|
1268
|
+
let fileArray = new Array();
|
|
1269
|
+
fileArray = request.fileBytes == null ? [] : [new RequestFile("file", "", request.fileBytes)];
|
|
1270
|
+
const multipartForm = new Multipart(formParams, fileArray);
|
|
1271
|
+
requestOptions.body = multipartForm.body;
|
|
1272
|
+
requestOptions.headers = __spreadValues(__spreadValues({}, requestOptions.headers), multipartForm.headers);
|
|
1273
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1274
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1275
|
+
return {
|
|
1276
|
+
response: result.response,
|
|
1277
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1278
|
+
};
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
var ScanApi = class {
|
|
1283
|
+
constructor(configuration) {
|
|
1284
|
+
this.defaultHeaders = {
|
|
1285
|
+
"x-aspose-client": "nodejs sdk",
|
|
1286
|
+
"x-aspose-client-version": "26.2.0"
|
|
1287
|
+
};
|
|
1288
|
+
this._configuration = configuration;
|
|
1289
|
+
this._client = new ApiClient();
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Scan barcode from file on server in the Internet using GET requests with parameter in query string. For scaning files from your hard drive use `scan-body` or `scan-multipart` endpoints instead.
|
|
1293
|
+
* @param request ScanRequestWrapper
|
|
1294
|
+
*/
|
|
1295
|
+
scan(request) {
|
|
1296
|
+
return __async(this, null, function* () {
|
|
1297
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/scan";
|
|
1298
|
+
let queryParameters = {};
|
|
1299
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1300
|
+
if (request.fileUrl == null) {
|
|
1301
|
+
throw new Error("Required parameter request.fileUrl was null or undefined when calling scan.");
|
|
1302
|
+
}
|
|
1303
|
+
if (request.fileUrl != null) {
|
|
1304
|
+
queryParameters["fileUrl"] = ObjectSerializer.serialize(request.fileUrl, "string");
|
|
1305
|
+
}
|
|
1306
|
+
const requestOptions = {
|
|
1307
|
+
method: "GET",
|
|
1308
|
+
qs: queryParameters,
|
|
1309
|
+
headers: headerParams,
|
|
1310
|
+
uri: requestPath
|
|
1311
|
+
};
|
|
1312
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1313
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1314
|
+
return {
|
|
1315
|
+
response: result.response,
|
|
1316
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1317
|
+
};
|
|
1318
|
+
});
|
|
1319
|
+
}
|
|
1320
|
+
/**
|
|
1321
|
+
* Scan barcode from file in request body using POST requests with parameter in body in json or xml format.
|
|
1322
|
+
* @param request ScanBase64RequestWrapper
|
|
1323
|
+
*/
|
|
1324
|
+
scanBase64(request) {
|
|
1325
|
+
return __async(this, null, function* () {
|
|
1326
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/scan-body";
|
|
1327
|
+
let queryParameters = {};
|
|
1328
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1329
|
+
if (request.scanBase64Request == null) {
|
|
1330
|
+
throw new Error(
|
|
1331
|
+
"Required parameter request.scanBase64Request was null or undefined when calling scanBase64."
|
|
1332
|
+
);
|
|
1333
|
+
}
|
|
1334
|
+
const requestOptions = {
|
|
1335
|
+
method: "POST",
|
|
1336
|
+
qs: queryParameters,
|
|
1337
|
+
headers: headerParams,
|
|
1338
|
+
uri: requestPath,
|
|
1339
|
+
body: ObjectSerializer.serialize(request.scanBase64Request, "ScanBase64Request"),
|
|
1340
|
+
json: true
|
|
1341
|
+
};
|
|
1342
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1343
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1344
|
+
return {
|
|
1345
|
+
response: result.response,
|
|
1346
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1347
|
+
};
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Scan barcode from file in request body using POST requests with parameter in multipart form.
|
|
1352
|
+
* @param request ScanMultipartRequestWrapper
|
|
1353
|
+
*/
|
|
1354
|
+
scanMultipart(request) {
|
|
1355
|
+
return __async(this, null, function* () {
|
|
1356
|
+
const requestPath = this._configuration.getApiBaseUrl() + "/barcode/scan-multipart";
|
|
1357
|
+
let queryParameters = {};
|
|
1358
|
+
let headerParams = Object.assign({}, this.defaultHeaders);
|
|
1359
|
+
const formParams = [];
|
|
1360
|
+
if (request.fileBytes == null) {
|
|
1361
|
+
throw new Error("Required parameter request.fileBytes was null or undefined when calling scanMultipart.");
|
|
1362
|
+
}
|
|
1363
|
+
const requestOptions = {
|
|
1364
|
+
method: "POST",
|
|
1365
|
+
qs: queryParameters,
|
|
1366
|
+
headers: headerParams,
|
|
1367
|
+
uri: requestPath
|
|
1368
|
+
};
|
|
1369
|
+
let fileArray = new Array();
|
|
1370
|
+
fileArray = request.fileBytes == null ? [] : [new RequestFile("file", "", request.fileBytes)];
|
|
1371
|
+
const multipartForm = new Multipart(formParams, fileArray);
|
|
1372
|
+
requestOptions.body = multipartForm.body;
|
|
1373
|
+
requestOptions.headers = __spreadValues(__spreadValues({}, requestOptions.headers), multipartForm.headers);
|
|
1374
|
+
yield this._configuration.authentication.applyToRequestAsync(requestOptions);
|
|
1375
|
+
const result = yield this._client.requestAsync(requestOptions);
|
|
1376
|
+
return {
|
|
1377
|
+
response: result.response,
|
|
1378
|
+
body: ObjectSerializer.deserialize(result.body, "BarcodeResponseList")
|
|
1379
|
+
};
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
};
|
|
1383
|
+
|
|
1384
|
+
// src/JWTAuth.ts
|
|
1385
|
+
var JWTAuth = class {
|
|
1386
|
+
constructor(configuration) {
|
|
1387
|
+
this._configuration = configuration;
|
|
1388
|
+
const resolvedFetch = globalThis.fetch;
|
|
1389
|
+
if (!resolvedFetch) {
|
|
1390
|
+
throw new Error("Global fetch API is not available. Please use Node.js 18+.");
|
|
1391
|
+
}
|
|
1392
|
+
this._fetcher = resolvedFetch;
|
|
1393
|
+
if (configuration.accessToken) {
|
|
1394
|
+
this._accessToken = configuration.accessToken;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* Apply authentication settings to header and query params.
|
|
1399
|
+
*/
|
|
1400
|
+
applyToRequestAsync(requestOptions) {
|
|
1401
|
+
return __async(this, null, function* () {
|
|
1402
|
+
if (this._accessToken == null) {
|
|
1403
|
+
this._accessToken = yield this.requestToken();
|
|
1404
|
+
}
|
|
1405
|
+
if (requestOptions && requestOptions.headers) {
|
|
1406
|
+
requestOptions.headers.Authorization = "Bearer " + this._accessToken;
|
|
1407
|
+
}
|
|
1408
|
+
return Promise.resolve();
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
requestToken() {
|
|
1412
|
+
return __async(this, null, function* () {
|
|
1413
|
+
if (!this._configuration.clientId || !this._configuration.clientSecret) {
|
|
1414
|
+
throw new Error("Required 'clientId' or 'clientSecret' not specified in configuration.");
|
|
1415
|
+
}
|
|
1416
|
+
const requestBody = new URLSearchParams({
|
|
1417
|
+
grant_type: "client_credentials",
|
|
1418
|
+
client_id: this._configuration.clientId,
|
|
1419
|
+
client_secret: this._configuration.clientSecret
|
|
1420
|
+
}).toString();
|
|
1421
|
+
let response;
|
|
1422
|
+
try {
|
|
1423
|
+
response = yield this._fetcher(this._configuration.tokenUrl, {
|
|
1424
|
+
method: "POST",
|
|
1425
|
+
headers: {
|
|
1426
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1427
|
+
},
|
|
1428
|
+
body: requestBody
|
|
1429
|
+
});
|
|
1430
|
+
} catch (error) {
|
|
1431
|
+
throw {
|
|
1432
|
+
response: null,
|
|
1433
|
+
error: this.normalizeFetchError(error),
|
|
1434
|
+
errorResponse: null
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1437
|
+
const responseBody = yield response.text();
|
|
1438
|
+
const responseInfo = {
|
|
1439
|
+
statusCode: response.status,
|
|
1440
|
+
statusMessage: response.statusText,
|
|
1441
|
+
headers: this.toHeaderDict(response.headers),
|
|
1442
|
+
body: responseBody
|
|
1443
|
+
};
|
|
1444
|
+
if (!response.ok) {
|
|
1445
|
+
const rejectObject = {
|
|
1446
|
+
response: responseInfo,
|
|
1447
|
+
error: new Error(
|
|
1448
|
+
`Error on '${this._configuration.tokenUrl}': ${response.status} ${response.statusText}`
|
|
1449
|
+
),
|
|
1450
|
+
errorResponse: null
|
|
1451
|
+
};
|
|
1452
|
+
let errorResponse = null;
|
|
1453
|
+
try {
|
|
1454
|
+
errorResponse = JSON.parse(responseBody);
|
|
1455
|
+
} catch (parseError) {
|
|
1456
|
+
}
|
|
1457
|
+
if (errorResponse) {
|
|
1458
|
+
rejectObject.errorResponse = errorResponse;
|
|
1459
|
+
} else {
|
|
1460
|
+
rejectObject.error.message += `. ${responseBody}`;
|
|
1461
|
+
}
|
|
1462
|
+
throw rejectObject;
|
|
1463
|
+
}
|
|
1464
|
+
const parsed = JSON.parse(responseBody);
|
|
1465
|
+
return parsed.access_token;
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
toHeaderDict(headers) {
|
|
1469
|
+
const normalizedHeaders = {};
|
|
1470
|
+
headers.forEach((value, key) => {
|
|
1471
|
+
const existing = normalizedHeaders[key];
|
|
1472
|
+
if (existing === void 0) {
|
|
1473
|
+
normalizedHeaders[key] = value;
|
|
1474
|
+
return;
|
|
1475
|
+
}
|
|
1476
|
+
if (Array.isArray(existing)) {
|
|
1477
|
+
existing.push(value);
|
|
1478
|
+
normalizedHeaders[key] = existing;
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1481
|
+
normalizedHeaders[key] = [existing, value];
|
|
1482
|
+
});
|
|
1483
|
+
return normalizedHeaders;
|
|
1484
|
+
}
|
|
1485
|
+
normalizeFetchError(error) {
|
|
1486
|
+
if (error instanceof Error) {
|
|
1487
|
+
const mutableError = error;
|
|
1488
|
+
let normalizedCode = mutableError.code;
|
|
1489
|
+
if (!normalizedCode) {
|
|
1490
|
+
const cause = mutableError.cause;
|
|
1491
|
+
if (cause && typeof cause === "object" && "code" in cause) {
|
|
1492
|
+
const code = cause.code;
|
|
1493
|
+
if (code) {
|
|
1494
|
+
normalizedCode = String(code);
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
if (!normalizedCode) {
|
|
1499
|
+
normalizedCode = mutableError.name || "FETCH_ERROR";
|
|
1500
|
+
}
|
|
1501
|
+
try {
|
|
1502
|
+
if (!mutableError.code) {
|
|
1503
|
+
mutableError.code = normalizedCode;
|
|
1504
|
+
}
|
|
1505
|
+
} catch (assignError) {
|
|
1506
|
+
}
|
|
1507
|
+
if (mutableError.code) {
|
|
1508
|
+
return mutableError;
|
|
1509
|
+
}
|
|
1510
|
+
const wrapped2 = new Error(mutableError.message);
|
|
1511
|
+
wrapped2.name = mutableError.name;
|
|
1512
|
+
wrapped2.code = normalizedCode;
|
|
1513
|
+
return wrapped2;
|
|
1514
|
+
}
|
|
1515
|
+
const wrapped = new Error(String(error));
|
|
1516
|
+
wrapped.code = "FETCH_ERROR";
|
|
1517
|
+
return wrapped;
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
|
|
1521
|
+
// src/Configuration.ts
|
|
1522
|
+
var ApiVersion = /* @__PURE__ */ ((ApiVersion2) => {
|
|
1523
|
+
ApiVersion2["v4"] = "v4.0";
|
|
1524
|
+
return ApiVersion2;
|
|
1525
|
+
})(ApiVersion || {});
|
|
1526
|
+
var Configuration = class {
|
|
1527
|
+
constructor(clientId, clientSecret, baseUrl, accessToken, tokenUrl) {
|
|
1528
|
+
this.version = "v4.0" /* v4 */;
|
|
1529
|
+
this.clientId = clientId;
|
|
1530
|
+
this.clientSecret = clientSecret;
|
|
1531
|
+
if (baseUrl) {
|
|
1532
|
+
this.baseUrl = baseUrl;
|
|
1533
|
+
} else {
|
|
1534
|
+
this.baseUrl = "https://api.aspose.cloud";
|
|
1535
|
+
}
|
|
1536
|
+
this.tokenUrl = tokenUrl != null ? tokenUrl : "https://id.aspose.cloud/connect/token";
|
|
1537
|
+
if (accessToken) {
|
|
1538
|
+
this.accessToken = accessToken;
|
|
1539
|
+
} else {
|
|
1540
|
+
this.accessToken = "";
|
|
1541
|
+
}
|
|
1542
|
+
this.authentication = new JWTAuth(this);
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Returns api base url
|
|
1546
|
+
*/
|
|
1547
|
+
getApiBaseUrl() {
|
|
1548
|
+
return this.baseUrl + "/" + this.version;
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1552
|
+
0 && (module.exports = {
|
|
1553
|
+
ApiClient,
|
|
1554
|
+
ApiError,
|
|
1555
|
+
ApiErrorResponse,
|
|
1556
|
+
ApiVersion,
|
|
1557
|
+
BarcodeImageFormat,
|
|
1558
|
+
BarcodeImageParams,
|
|
1559
|
+
BarcodeResponse,
|
|
1560
|
+
BarcodeResponseList,
|
|
1561
|
+
CodeLocation,
|
|
1562
|
+
Configuration,
|
|
1563
|
+
DecodeBarcodeType,
|
|
1564
|
+
EncodeBarcodeType,
|
|
1565
|
+
EncodeData,
|
|
1566
|
+
EncodeDataType,
|
|
1567
|
+
GenerateApi,
|
|
1568
|
+
GenerateBodyRequestWrapper,
|
|
1569
|
+
GenerateMultipartRequestWrapper,
|
|
1570
|
+
GenerateParams,
|
|
1571
|
+
GenerateRequestWrapper,
|
|
1572
|
+
GraphicsUnit,
|
|
1573
|
+
RecognitionImageKind,
|
|
1574
|
+
RecognitionMode,
|
|
1575
|
+
RecognizeApi,
|
|
1576
|
+
RecognizeBase64Request,
|
|
1577
|
+
RecognizeBase64RequestWrapper,
|
|
1578
|
+
RecognizeMultipartRequestWrapper,
|
|
1579
|
+
RecognizeRequestWrapper,
|
|
1580
|
+
RegionPoint,
|
|
1581
|
+
ScanApi,
|
|
1582
|
+
ScanBase64Request,
|
|
1583
|
+
ScanBase64RequestWrapper,
|
|
1584
|
+
ScanMultipartRequestWrapper,
|
|
1585
|
+
ScanRequestWrapper
|
|
1586
|
+
});
|