@gesagro/jaspion-sdk 1.0.0 → 1.0.1
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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ var OriginList = class extends Report {
|
|
|
72
72
|
async pdf(input) {
|
|
73
73
|
return await this.request({
|
|
74
74
|
contentType: "application/pdf",
|
|
75
|
-
resources: [{ key: "
|
|
75
|
+
resources: [{ key: "FARM_ID", value: input.farmId }],
|
|
76
76
|
parameters: [
|
|
77
77
|
{ key: "DATA_ONLY", value: false },
|
|
78
78
|
{ key: "LOCATE", value: input.language.replace("-", "_") }
|
|
@@ -82,7 +82,7 @@ var OriginList = class extends Report {
|
|
|
82
82
|
async csv(input) {
|
|
83
83
|
return await this.request({
|
|
84
84
|
contentType: "text/csv",
|
|
85
|
-
resources: [{ key: "
|
|
85
|
+
resources: [{ key: "FARM_ID", value: input.farmId }],
|
|
86
86
|
parameters: [
|
|
87
87
|
{ key: "DATA_ONLY", value: false },
|
|
88
88
|
{ key: "LOCATE", value: input.language.replace("-", "_") }
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/core/report.ts","../src/namespaces/pig-master/reports/origin-list.ts","../src/namespaces/pig-master/index.ts"],"sourcesContent":["export { jaspion } from './client'\n","import axios, { type AxiosInstance } from 'axios'\nimport { PigMasterNamespace } from './namespaces/pig-master'\n\nexport class JaspionClient {\n public readonly pigMaster: PigMasterNamespace\n\n constructor(private readonly http: AxiosInstance) {\n this.pigMaster = new PigMasterNamespace(http)\n }\n\n setAccessToken(token: string) {\n this.http.defaults.headers.common.Authorization = `Bearer ${token}`\n }\n}\n\nexport function jaspion(baseURL: string) {\n const http = axios.create({ baseURL })\n\n return new JaspionClient(http)\n}\n","import type { AxiosInstance } from 'axios'\n\ntype ContentType = 'application/pdf' | 'text/csv'\n\nexport interface Parameter {\n key: string\n value: string | number | boolean | null\n}\n\nexport interface Resource {\n key: string\n value: string\n}\n\ninterface ReportConfig {\n template: string\n fileName: string\n}\n\ninterface RequestReportInput {\n contentType: ContentType\n parameters: Parameter[]\n resources: Resource[]\n}\n\nexport abstract class Report {\n constructor(\n protected readonly http: AxiosInstance,\n protected readonly config: ReportConfig,\n ) {}\n\n protected async request({\n contentType,\n parameters,\n resources,\n }: RequestReportInput) {\n const extension = contentType === 'application/pdf' ? '.pdf' : '.csv'\n const fileName = `${this.config.fileName}${extension}`\n\n await this.http.post('/reports', {\n template: this.config.template,\n fileName: fileName,\n parameters,\n resources,\n contentType,\n type: 'jasper-reports',\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Report } from '../../../core/report'\nimport { LanguageCode } from '../../../core/types'\n\ninterface OriginListInput {\n farmId: string\n language: LanguageCode\n}\n\nexport class OriginList extends Report {\n constructor(http: AxiosInstance) {\n super(http, {\n template: '@pig-master/origin-list',\n fileName: 'Listagem de origens',\n })\n }\n\n async pdf(input: OriginListInput) {\n return await this.request({\n contentType: 'application/pdf',\n resources: [{ key: '
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/client.ts","../src/core/report.ts","../src/namespaces/pig-master/reports/origin-list.ts","../src/namespaces/pig-master/index.ts"],"sourcesContent":["export { jaspion } from './client'\n","import axios, { type AxiosInstance } from 'axios'\nimport { PigMasterNamespace } from './namespaces/pig-master'\n\nexport class JaspionClient {\n public readonly pigMaster: PigMasterNamespace\n\n constructor(private readonly http: AxiosInstance) {\n this.pigMaster = new PigMasterNamespace(http)\n }\n\n setAccessToken(token: string) {\n this.http.defaults.headers.common.Authorization = `Bearer ${token}`\n }\n}\n\nexport function jaspion(baseURL: string) {\n const http = axios.create({ baseURL })\n\n return new JaspionClient(http)\n}\n","import type { AxiosInstance } from 'axios'\n\ntype ContentType = 'application/pdf' | 'text/csv'\n\nexport interface Parameter {\n key: string\n value: string | number | boolean | null\n}\n\nexport interface Resource {\n key: string\n value: string\n}\n\ninterface ReportConfig {\n template: string\n fileName: string\n}\n\ninterface RequestReportInput {\n contentType: ContentType\n parameters: Parameter[]\n resources: Resource[]\n}\n\nexport abstract class Report {\n constructor(\n protected readonly http: AxiosInstance,\n protected readonly config: ReportConfig,\n ) {}\n\n protected async request({\n contentType,\n parameters,\n resources,\n }: RequestReportInput) {\n const extension = contentType === 'application/pdf' ? '.pdf' : '.csv'\n const fileName = `${this.config.fileName}${extension}`\n\n await this.http.post('/reports', {\n template: this.config.template,\n fileName: fileName,\n parameters,\n resources,\n contentType,\n type: 'jasper-reports',\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Report } from '../../../core/report'\nimport { LanguageCode } from '../../../core/types'\n\ninterface OriginListInput {\n farmId: string\n language: LanguageCode\n}\n\nexport class OriginList extends Report {\n constructor(http: AxiosInstance) {\n super(http, {\n template: '@pig-master/origin-list',\n fileName: 'Listagem de origens',\n })\n }\n\n async pdf(input: OriginListInput) {\n return await this.request({\n contentType: 'application/pdf',\n resources: [{ key: 'FARM_ID', value: input.farmId }],\n parameters: [\n { key: 'DATA_ONLY', value: false },\n { key: 'LOCATE', value: input.language.replace('-', '_') },\n ],\n })\n }\n\n async csv(input: OriginListInput) {\n return await this.request({\n contentType: 'text/csv',\n resources: [{ key: 'FARM_ID', value: input.farmId }],\n parameters: [\n { key: 'DATA_ONLY', value: false },\n { key: 'LOCATE', value: input.language.replace('-', '_') },\n ],\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { OriginList } from './reports/origin-list'\n\nexport class PigMasterNamespace {\n public readonly originList: OriginList\n\n constructor(http: AxiosInstance) {\n this.originList = new OriginList(http)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAA0C;;;ACyBnC,IAAe,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,YAAY,MAAqB;AAC/B,SAAK,aAAa,IAAI,WAAW,IAAI;AAAA,EACvC;AACF;;;AHNO,IAAM,gBAAN,MAAoB;AAAA,EAGzB,YAA6B,MAAqB;AAArB;AAC3B,SAAK,YAAY,IAAI,mBAAmB,IAAI;AAAA,EAC9C;AAAA,EAEA,eAAe,OAAe;AAC5B,SAAK,KAAK,SAAS,QAAQ,OAAO,gBAAgB,UAAU,KAAK;AAAA,EACnE;AACF;AAEO,SAAS,QAAQ,SAAiB;AACvC,QAAM,OAAO,aAAAA,QAAM,OAAO,EAAE,QAAQ,CAAC;AAErC,SAAO,IAAI,cAAc,IAAI;AAC/B;","names":["axios"]}
|
package/dist/index.mjs
CHANGED
|
@@ -36,7 +36,7 @@ var OriginList = class extends Report {
|
|
|
36
36
|
async pdf(input) {
|
|
37
37
|
return await this.request({
|
|
38
38
|
contentType: "application/pdf",
|
|
39
|
-
resources: [{ key: "
|
|
39
|
+
resources: [{ key: "FARM_ID", value: input.farmId }],
|
|
40
40
|
parameters: [
|
|
41
41
|
{ key: "DATA_ONLY", value: false },
|
|
42
42
|
{ key: "LOCATE", value: input.language.replace("-", "_") }
|
|
@@ -46,7 +46,7 @@ var OriginList = class extends Report {
|
|
|
46
46
|
async csv(input) {
|
|
47
47
|
return await this.request({
|
|
48
48
|
contentType: "text/csv",
|
|
49
|
-
resources: [{ key: "
|
|
49
|
+
resources: [{ key: "FARM_ID", value: input.farmId }],
|
|
50
50
|
parameters: [
|
|
51
51
|
{ key: "DATA_ONLY", value: false },
|
|
52
52
|
{ key: "LOCATE", value: input.language.replace("-", "_") }
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client.ts","../src/core/report.ts","../src/namespaces/pig-master/reports/origin-list.ts","../src/namespaces/pig-master/index.ts"],"sourcesContent":["import axios, { type AxiosInstance } from 'axios'\nimport { PigMasterNamespace } from './namespaces/pig-master'\n\nexport class JaspionClient {\n public readonly pigMaster: PigMasterNamespace\n\n constructor(private readonly http: AxiosInstance) {\n this.pigMaster = new PigMasterNamespace(http)\n }\n\n setAccessToken(token: string) {\n this.http.defaults.headers.common.Authorization = `Bearer ${token}`\n }\n}\n\nexport function jaspion(baseURL: string) {\n const http = axios.create({ baseURL })\n\n return new JaspionClient(http)\n}\n","import type { AxiosInstance } from 'axios'\n\ntype ContentType = 'application/pdf' | 'text/csv'\n\nexport interface Parameter {\n key: string\n value: string | number | boolean | null\n}\n\nexport interface Resource {\n key: string\n value: string\n}\n\ninterface ReportConfig {\n template: string\n fileName: string\n}\n\ninterface RequestReportInput {\n contentType: ContentType\n parameters: Parameter[]\n resources: Resource[]\n}\n\nexport abstract class Report {\n constructor(\n protected readonly http: AxiosInstance,\n protected readonly config: ReportConfig,\n ) {}\n\n protected async request({\n contentType,\n parameters,\n resources,\n }: RequestReportInput) {\n const extension = contentType === 'application/pdf' ? '.pdf' : '.csv'\n const fileName = `${this.config.fileName}${extension}`\n\n await this.http.post('/reports', {\n template: this.config.template,\n fileName: fileName,\n parameters,\n resources,\n contentType,\n type: 'jasper-reports',\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Report } from '../../../core/report'\nimport { LanguageCode } from '../../../core/types'\n\ninterface OriginListInput {\n farmId: string\n language: LanguageCode\n}\n\nexport class OriginList extends Report {\n constructor(http: AxiosInstance) {\n super(http, {\n template: '@pig-master/origin-list',\n fileName: 'Listagem de origens',\n })\n }\n\n async pdf(input: OriginListInput) {\n return await this.request({\n contentType: 'application/pdf',\n resources: [{ key: '
|
|
1
|
+
{"version":3,"sources":["../src/client.ts","../src/core/report.ts","../src/namespaces/pig-master/reports/origin-list.ts","../src/namespaces/pig-master/index.ts"],"sourcesContent":["import axios, { type AxiosInstance } from 'axios'\nimport { PigMasterNamespace } from './namespaces/pig-master'\n\nexport class JaspionClient {\n public readonly pigMaster: PigMasterNamespace\n\n constructor(private readonly http: AxiosInstance) {\n this.pigMaster = new PigMasterNamespace(http)\n }\n\n setAccessToken(token: string) {\n this.http.defaults.headers.common.Authorization = `Bearer ${token}`\n }\n}\n\nexport function jaspion(baseURL: string) {\n const http = axios.create({ baseURL })\n\n return new JaspionClient(http)\n}\n","import type { AxiosInstance } from 'axios'\n\ntype ContentType = 'application/pdf' | 'text/csv'\n\nexport interface Parameter {\n key: string\n value: string | number | boolean | null\n}\n\nexport interface Resource {\n key: string\n value: string\n}\n\ninterface ReportConfig {\n template: string\n fileName: string\n}\n\ninterface RequestReportInput {\n contentType: ContentType\n parameters: Parameter[]\n resources: Resource[]\n}\n\nexport abstract class Report {\n constructor(\n protected readonly http: AxiosInstance,\n protected readonly config: ReportConfig,\n ) {}\n\n protected async request({\n contentType,\n parameters,\n resources,\n }: RequestReportInput) {\n const extension = contentType === 'application/pdf' ? '.pdf' : '.csv'\n const fileName = `${this.config.fileName}${extension}`\n\n await this.http.post('/reports', {\n template: this.config.template,\n fileName: fileName,\n parameters,\n resources,\n contentType,\n type: 'jasper-reports',\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { Report } from '../../../core/report'\nimport { LanguageCode } from '../../../core/types'\n\ninterface OriginListInput {\n farmId: string\n language: LanguageCode\n}\n\nexport class OriginList extends Report {\n constructor(http: AxiosInstance) {\n super(http, {\n template: '@pig-master/origin-list',\n fileName: 'Listagem de origens',\n })\n }\n\n async pdf(input: OriginListInput) {\n return await this.request({\n contentType: 'application/pdf',\n resources: [{ key: 'FARM_ID', value: input.farmId }],\n parameters: [\n { key: 'DATA_ONLY', value: false },\n { key: 'LOCATE', value: input.language.replace('-', '_') },\n ],\n })\n }\n\n async csv(input: OriginListInput) {\n return await this.request({\n contentType: 'text/csv',\n resources: [{ key: 'FARM_ID', value: input.farmId }],\n parameters: [\n { key: 'DATA_ONLY', value: false },\n { key: 'LOCATE', value: input.language.replace('-', '_') },\n ],\n })\n }\n}\n","import type { AxiosInstance } from 'axios'\nimport { OriginList } from './reports/origin-list'\n\nexport class PigMasterNamespace {\n public readonly originList: OriginList\n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