@fusebit-int/xero-connector
Version:
Xero Connector
41 lines • 2.09 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceConnector = void 0;
const oauth_connector_1 = require("@fusebit-int/oauth-connector");
const Service_1 = require("./Service");
const TOKEN_URL = 'https://identity.xero.com/connect/token';
const AUTHORIZATION_URL = 'https://login.xero.com/identity/connect/authorize';
const REVOCATION_URL = 'https://identity.xero.com/connect/revocation';
const SERVICE_NAME = 'Xero';
// Configuration section name used to add extra configuration elements via this.addConfigurationElement
const CONFIGURATION_SECTION = 'Fusebit Connector Configuration';
class ServiceConnector extends oauth_connector_1.OAuthConnector {
constructor() {
super();
this.router.get('/api/configure', async (ctx) => {
// Adjust the configuration elements here
ctx.body.uischema.elements.find((element) => element.label == 'OAuth2 Configuration').label =
'Xero Configuration';
this.addConfigurationElement(ctx, CONFIGURATION_SECTION, 'signingSecret', 'password');
// Adjust the data schema
ctx.body.schema.properties.scope.description = `Space separated scopes to request from your ${SERVICE_NAME} App`;
ctx.body.schema.properties.clientId.description = `The Client ID from your ${SERVICE_NAME} App`;
ctx.body.schema.properties.clientSecret.description = `The Client Secret from your ${SERVICE_NAME} App`;
ctx.body.schema.properties.signingSecret = {
title: `Webhooks key from your ${SERVICE_NAME} App`,
type: 'string',
};
});
}
createService() {
return new ServiceConnector.Service();
}
addUrlConfigurationAdjustment() {
return this.adjustUrlConfiguration(TOKEN_URL, AUTHORIZATION_URL, SERVICE_NAME.toLowerCase());
}
}
exports.ServiceConnector = ServiceConnector;
ServiceConnector.Service = Service_1.Service;
const connector = new ServiceConnector();
exports.default = connector;
//# sourceMappingURL=index.js.map