Skip to content

Commit

Permalink
updated ea-utils v37
Browse files Browse the repository at this point in the history
  • Loading branch information
shourya-itential committed Jul 31, 2023
1 parent 662945d commit e263529
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 31 deletions.
61 changes: 33 additions & 28 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10809,28 +10809,17 @@ class Utils {
}


// getMarketingMessage(){
// return <body>
// <div id="root"></div>
// <h1>Customer Support</h1>
// <span> You would need an Itential account to get the credentials to configure the ServiceNow application.</span>
// <br/>
// <span>In order to utilize this application, you would need to have an active
// Itential Automation Platform (IAP). If you are an existing
// customer, please contact your Itential account team for
// additional details. &#xA0;</span>
// <br/>
// <span> For new customers interested in an Itential trial please click&#xA0; </span>
// <a href="https://www.itential.com/get-started/" target="_blank" rel="noopener noreferrer">here</a>
// <span>&#xA0; to request one.</span>
// <br/>
// <span> Additional details can be found in our &#xA0;</span> <a href="https://docs.itential.com/opensource/docs/servicenow-application" target="_blank" rel="noopener noreferrer"> user guide</a>
// <br/>
// <span> Reach out to Itential for additional ServiceNow application support. &#xA0;</span> <a href="mailto:snow@itential.com">snow@itential.com</a>
// <br/>
// <a href="https://www.itential.com/" target="_blank" rel="noopener noreferrer">Itential</a>
// </body>
// }
getMarketingMessage(){
const marketing = {
iap: "In order to utilize this application, you would need to have an active Itential Automation Platform (IAP). If you are an existing customer, please contact your Itential account team for additional details.",
account: "You would need an Itential account to get the credentials to configure the ServiceNow application.",
doc: 'Additional details can be found in our <a href="https://docs.itential.com/opensource/docs/servicenow-application" target="_blank" rel="noopener noreferrer"> user guide</a>',
new: 'For new customers interested in an Itential trial please click <a href="https://www.itential.com/get-started/" target="_blank" rel="noopener noreferrer">here</a> to request one',
serviceDesk: 'Reach out to Itential for additional ServiceNow application support at <a href="mailto:snow@itential.com">snow@itential.com</a>',
itentialHome: '<a href="https://www.itential.com/" target="_blank" rel="noopener noreferrer">Itential</a>'
}
return marketing;
}

}
;// CONCATENATED MODULE: ./node_modules/ea-utils/lib/authApi.js
Expand Down Expand Up @@ -11173,7 +11162,16 @@ class GenericAPI {
*/
async genericRequest(method, hyperSchema, href, callback, data = {}) {
try {
method = method.trim();
hyperSchema = hyperSchema.trim();
href = href.trim();
let token_object = {};
let query = ''
if(href.includes("?")){
query = '&';
} else {
query = '?';
}
await this.auth.getToken(`${this.baseURL}_${this.user}`, (token_obj, error) => {
if (error) {
error.IAPerror.origin = 'generic-genericRequest';
Expand Down Expand Up @@ -11204,13 +11202,18 @@ class GenericAPI {
formatted_req.url,
headers
};

} else if (method === 'GET') {
axiosRequest = {
method,
url:
formatted_req.url,
headers
};

}else {
const error = this.utils.formatErrorObject("generic-genericReqiest", "Invalid HTTP Method", null, null, null, null);
return callback(null, error);
}

}else { // for basic or static token
Expand All @@ -11220,23 +11223,25 @@ class GenericAPI {
method,
data,
url:
`${this.baseURL}${hyperSchema}${href}?token=${token_object.token}`
`${this.baseURL}${hyperSchema}${href}${query}token=${token_object.token_object}`
};

} else if (method === 'GET') {
axiosRequest = {
method,
url:
`${this.baseURL}${hyperSchema}${href}?token=${token_object.token}`
`${this.baseURL}${hyperSchema}${href}${query}token=${token_object.token}`
};

}else {
const error = this.utils.formatErrorObject("generic-genericReqiest", "Invalid HTTP Method", null, null, null, null);
return callback(null, error);
}

}

const res = await lib_axios(axiosRequest);
return callback(res, null);

const error = this.utils.formatErrorObject("generic-genericReqiest", "Invalid HTTP Method", null, null, null, null);
return callback(null, error);

} catch (err) {
const error = this.utils.formatErrorObject("generic-genericReqiest", "Axios Error", null, null, null, err);
return callback(null, error);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@
"@actions/github": "^5.1.1",
"@vercel/ncc": "^0.36.0",
"axios": "^1.2.1",
"ea-utils": "gitlab:itential/northbound-integrations/ea-utils#v0.0.36"
"ea-utils": "gitlab:itential/northbound-integrations/ea-utils#v0.0.37"
}
}

0 comments on commit e263529

Please sign in to comment.