@vtex/api
Version:
VTEX I/O API client
88 lines (87 loc) • 2.62 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IOClients = void 0;
const apps_1 = require("./apps");
const index_1 = require("./apps/catalogGraphQL/index");
const external_1 = require("./external");
const infra_1 = require("./infra");
const janus_1 = require("./janus");
class IOClients {
constructor(clientOptions, ctx) {
this.clientOptions = clientOptions;
this.ctx = ctx;
this.clients = {};
}
get apps() {
return this.getOrSet('apps', infra_1.Apps);
}
get assets() {
return this.getOrSet('assets', infra_1.Assets);
}
get billing() {
return this.getOrSet('billing', apps_1.Billing);
}
get billingMetrics() {
return this.getOrSet('billingMetrics', infra_1.BillingMetrics);
}
get builder() {
return this.getOrSet('builder', apps_1.Builder);
}
get events() {
return this.getOrSet('events', infra_1.Events);
}
get id() {
return this.getOrSet('id', external_1.ID);
}
get licenseManager() {
return this.getOrSet('licenseManager', janus_1.LicenseManager);
}
get masterdata() {
return this.getOrSet('masterdata', external_1.MasterData);
}
get messagesGraphQL() {
return this.getOrSet('messagesGraphQL', apps_1.MessagesGraphQL);
}
get registry() {
return this.getOrSet('registry', infra_1.Registry);
}
get router() {
return this.getOrSet('router', infra_1.Router);
}
get segment() {
return this.getOrSet('segment', janus_1.Segment);
}
get settings() {
return this.getOrSet('settings', apps_1.Settings);
}
get session() {
return this.getOrSet('session', janus_1.Session);
}
get tenant() {
return this.getOrSet('tenant', janus_1.TenantClient);
}
get vbase() {
return this.getOrSet('vbase', infra_1.VBase);
}
get workspaces() {
return this.getOrSet('workspaces', infra_1.Workspaces);
}
get catalogGraphQL() {
return this.getOrSet('catalogGraphQL', index_1.CatalogGraphQL);
}
get paymentProvider() {
return this.getOrSet('paymentProvider', external_1.PaymentProvider);
}
getOrSet(key, Implementation) {
const options = {
...this.clientOptions.default,
...this.clientOptions[key],
metrics,
};
if (!this.clients[key]) {
this.clients[key] = new Implementation(this.ctx, options);
}
return this.clients[key];
}
}
exports.IOClients = IOClients;