@blob-solutions/vcr-am-sdk 0.4.0 → 0.5.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/lib/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var o=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})},m=(t,e,i,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of l(e))!y.call(t,s)&&s!==i&&o(t,s,{get:()=>e[s],enumerable:!(u=c(e,s))||u.enumerable});return t};var g=t=>m(o({},"__esModule",{value:!0}),t);var I={};d(I,{AVAILABLE_LANGUAGES:()=>b,VCRClient:()=>a,unitsKeys:()=>D});module.exports=g(I);var r=require("simple-typed-fetch"),n=require("zod"),f="https://vcr.am/api/v1",A=n.z.object({saleId:n.z.number(),crn:n.z.string(),srcReceiptId:n.z.number().int(),fiscal:n.z.string()}),a=class{constructor(e){this.apiKey=e}async registerSale(e){return await(0,r.simpleFetch)(async()=>await(0,r.fetchWithValidation)(`${f}/sales`,A,{method:"POST",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)},n.z.object({error:n.z.string()})))()}};var D=["pc","unit","set","box","pack","case","hr","sess","proj","sub","kg","l","m","g","ml","cm","bottle","can","jar","bag","m2","dozen","pair","mm","roll","tube","km","ton","m3","pallet","other"],b=["hy","ru","en"];
1
+ "use strict";var o=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var d=(n,e)=>{for(var i in e)o(n,i,{get:e[i],enumerable:!0})},m=(n,e,i,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of c(e))!y.call(n,s)&&s!==i&&o(n,s,{get:()=>e[s],enumerable:!(u=l(e,s))||u.enumerable});return n};var g=n=>m(o({},"__esModule",{value:!0}),n);var I={};d(I,{AVAILABLE_LANGUAGES:()=>b,VCRClient:()=>a,unitsKeys:()=>D});module.exports=g(I);var r=require("simple-typed-fetch"),t=require("zod"),f="https://vcr.am/api/v1",A=t.z.object({urlId:t.z.string(),saleId:t.z.number(),crn:t.z.string(),srcReceiptId:t.z.number().int(),fiscal:t.z.string()}),a=class{constructor(e){this.apiKey=e}async registerSale(e){return await(0,r.simpleFetch)(async()=>await(0,r.fetchWithValidation)(`${f}/sales`,A,{method:"POST",headers:{"x-api-key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)},t.z.object({error:t.z.string()})))()}};var D=["pc","unit","set","box","pack","case","hr","sess","proj","sub","kg","l","m","g","ml","cm","bottle","can","jar","bag","m2","dozen","pair","mm","roll","tube","km","ton","m3","pallet","other"],b=["hy","ru","en"];
2
2
  //# sourceMappingURL=index.cjs.map
package/lib/index.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/VCRClient.ts","../src/constants.ts"],"sourcesContent":["export { default as VCRClient } from \"./VCRClient\";\nexport * from \"./types\";\nexport * from \"./constants\";\n","import { fetchWithValidation, simpleFetch } from \"simple-typed-fetch\";\nimport { z } from \"zod\";\n\nimport type { SaleData } from \"./types\";\n\nconst API_URL = \"https://vcr.am/api/v1\";\n\nconst saleResponseSchema = z.object({\n saleId: z.number(),\n crn: z.string(),\n srcReceiptId: z.number().int(),\n fiscal: z.string(),\n});\n\nexport default class VCRClient {\n constructor(private readonly apiKey: string) {}\n\n async registerSale(data: SaleData) {\n const responseData = await simpleFetch(\n async () =>\n await fetchWithValidation(\n `${API_URL}/sales`,\n saleResponseSchema,\n {\n method: \"POST\",\n headers: {\n \"x-api-key\": this.apiKey,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n z.object({\n error: z.string(),\n })\n )\n )();\n\n return responseData;\n }\n}\n","export const unitsKeys = [\n \"pc\",\n \"unit\",\n \"set\",\n \"box\",\n \"pack\",\n \"case\",\n \"hr\",\n \"sess\",\n \"proj\",\n \"sub\",\n \"kg\",\n \"l\",\n \"m\",\n \"g\",\n \"ml\",\n \"cm\",\n \"bottle\",\n \"can\",\n \"jar\",\n \"bag\",\n \"m2\",\n \"dozen\",\n \"pair\",\n \"mm\",\n \"roll\",\n \"tube\",\n \"km\",\n \"ton\",\n \"m3\",\n \"pallet\",\n \"other\",\n] as const;\n\nexport const AVAILABLE_LANGUAGES = [\"hy\", \"ru\", \"en\"] as const;\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,cAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAL,GCAA,IAAAM,EAAiD,8BACjDC,EAAkB,eAIZC,EAAU,wBAEVC,EAAqB,IAAE,OAAO,CAClC,OAAQ,IAAE,OAAO,EACjB,IAAK,IAAE,OAAO,EACd,aAAc,IAAE,OAAO,EAAE,IAAI,EAC7B,OAAQ,IAAE,OAAO,CACnB,CAAC,EAEoBC,EAArB,KAA+B,CAC7B,YAA6BC,EAAgB,CAAhB,YAAAA,CAAiB,CAE9C,MAAM,aAAaC,EAAgB,CAoBjC,OAnBqB,QAAM,eACzB,SACE,QAAM,uBACJ,GAAGJ,CAAO,SACVC,EACA,CACE,OAAQ,OACR,QAAS,CACP,YAAa,KAAK,OAClB,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAUG,CAAI,CAC3B,EACA,IAAE,OAAO,CACP,MAAO,IAAE,OAAO,CAClB,CAAC,CACH,CACJ,EAAE,CAGJ,CACF,ECvCO,IAAMC,EAAY,CACvB,KACA,OACA,MACA,MACA,OACA,OACA,KACA,OACA,OACA,MACA,KACA,IACA,IACA,IACA,KACA,KACA,SACA,MACA,MACA,MACA,KACA,QACA,OACA,KACA,OACA,OACA,KACA,MACA,KACA,SACA,OACF,EAEaC,EAAsB,CAAC,KAAM,KAAM,IAAI","names":["src_exports","__export","AVAILABLE_LANGUAGES","VCRClient","unitsKeys","__toCommonJS","import_simple_typed_fetch","import_zod","API_URL","saleResponseSchema","VCRClient","apiKey","data","unitsKeys","AVAILABLE_LANGUAGES"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/VCRClient.ts","../src/constants.ts"],"sourcesContent":["export { default as VCRClient } from \"./VCRClient\";\nexport * from \"./types\";\nexport * from \"./constants\";\n","import { fetchWithValidation, simpleFetch } from \"simple-typed-fetch\";\nimport { z } from \"zod\";\n\nimport type { SaleData } from \"./types\";\n\nconst API_URL = \"https://vcr.am/api/v1\";\n\nconst saleResponseSchema = z.object({\n urlId: z.string(),\n saleId: z.number(),\n crn: z.string(),\n srcReceiptId: z.number().int(),\n fiscal: z.string(),\n});\n\nexport default class VCRClient {\n constructor(private readonly apiKey: string) {}\n\n async registerSale(data: SaleData) {\n const responseData = await simpleFetch(\n async () =>\n await fetchWithValidation(\n `${API_URL}/sales`,\n saleResponseSchema,\n {\n method: \"POST\",\n headers: {\n \"x-api-key\": this.apiKey,\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify(data),\n },\n z.object({\n error: z.string(),\n })\n )\n )();\n\n return responseData;\n }\n}\n","export const unitsKeys = [\n \"pc\",\n \"unit\",\n \"set\",\n \"box\",\n \"pack\",\n \"case\",\n \"hr\",\n \"sess\",\n \"proj\",\n \"sub\",\n \"kg\",\n \"l\",\n \"m\",\n \"g\",\n \"ml\",\n \"cm\",\n \"bottle\",\n \"can\",\n \"jar\",\n \"bag\",\n \"m2\",\n \"dozen\",\n \"pair\",\n \"mm\",\n \"roll\",\n \"tube\",\n \"km\",\n \"ton\",\n \"m3\",\n \"pallet\",\n \"other\",\n] as const;\n\nexport const AVAILABLE_LANGUAGES = [\"hy\", \"ru\", \"en\"] as const;\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,yBAAAE,EAAA,cAAAC,EAAA,cAAAC,IAAA,eAAAC,EAAAL,GCAA,IAAAM,EAAiD,8BACjDC,EAAkB,eAIZC,EAAU,wBAEVC,EAAqB,IAAE,OAAO,CAClC,MAAO,IAAE,OAAO,EAChB,OAAQ,IAAE,OAAO,EACjB,IAAK,IAAE,OAAO,EACd,aAAc,IAAE,OAAO,EAAE,IAAI,EAC7B,OAAQ,IAAE,OAAO,CACnB,CAAC,EAEoBC,EAArB,KAA+B,CAC7B,YAA6BC,EAAgB,CAAhB,YAAAA,CAAiB,CAE9C,MAAM,aAAaC,EAAgB,CAoBjC,OAnBqB,QAAM,eACzB,SACE,QAAM,uBACJ,GAAGJ,CAAO,SACVC,EACA,CACE,OAAQ,OACR,QAAS,CACP,YAAa,KAAK,OAClB,eAAgB,kBAClB,EACA,KAAM,KAAK,UAAUG,CAAI,CAC3B,EACA,IAAE,OAAO,CACP,MAAO,IAAE,OAAO,CAClB,CAAC,CACH,CACJ,EAAE,CAGJ,CACF,ECxCO,IAAMC,EAAY,CACvB,KACA,OACA,MACA,MACA,OACA,OACA,KACA,OACA,OACA,MACA,KACA,IACA,IACA,IACA,KACA,KACA,SACA,MACA,MACA,MACA,KACA,QACA,OACA,KACA,OACA,OACA,KACA,MACA,KACA,SACA,OACF,EAEaC,EAAsB,CAAC,KAAM,KAAM,IAAI","names":["src_exports","__export","AVAILABLE_LANGUAGES","VCRClient","unitsKeys","__toCommonJS","import_simple_typed_fetch","import_zod","API_URL","saleResponseSchema","VCRClient","apiKey","data","unitsKeys","AVAILABLE_LANGUAGES"]}
package/lib/index.d.cts CHANGED
@@ -103,6 +103,7 @@ declare class VCRClient {
103
103
  private readonly apiKey;
104
104
  constructor(apiKey: string);
105
105
  registerSale(data: SaleData): Promise<{
106
+ urlId: string;
106
107
  saleId: number;
107
108
  crn: string;
108
109
  srcReceiptId: number;
package/lib/index.d.ts CHANGED
@@ -103,6 +103,7 @@ declare class VCRClient {
103
103
  private readonly apiKey;
104
104
  constructor(apiKey: string);
105
105
  registerSale(data: SaleData): Promise<{
106
+ urlId: string;
106
107
  saleId: number;
107
108
  crn: string;
108
109
  srcReceiptId: number;