@symanticreative/vendure-admin-client
Version:
A TypeScript GraphQL client for Vendure Admin API to create custom dashboards
102 lines • 3.09 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Injectable } from '../core/di/injectable.decorator';
import { BasePaginatedRepository } from './base.repository';
import { GET_CUSTOMER, GET_CUSTOMERS, CREATE_CUSTOMER, UPDATE_CUSTOMER } from '../graphql/customers/customer.queries';
/**
* Repository for customer operations
*/
let CustomerRepository = class CustomerRepository extends BasePaginatedRepository {
constructor(graphqlClient) {
super(graphqlClient);
}
/**
* Get the GraphQL query for finding by ID
*/
getFindByIdQuery() {
return GET_CUSTOMER;
}
/**
* Get the GraphQL query for finding all
*/
getFindAllQuery() {
return GET_CUSTOMERS;
}
/**
* Get the GraphQL mutation for creating
*/
getCreateMutation() {
return CREATE_CUSTOMER;
}
/**
* Get the GraphQL mutation for updating
*/
getUpdateMutation() {
return UPDATE_CUSTOMER;
}
/**
* Get the GraphQL mutation for deleting
* Note: Deleting customers is typically not supported or is done differently
*/
getDeleteMutation() {
throw new Error('Deleting customers is not supported directly');
}
/**
* Get the GraphQL query for pagination
*/
getFindWithPaginationQuery() {
return GET_CUSTOMERS;
}
/**
* Get the result path for finding by ID
*/
getFindByIdResultPath() {
return 'customer';
}
/**
* Get the result path for finding all
*/
getFindAllResultPath() {
return 'customers.items';
}
/**
* Get the result path for creating
*/
getCreateResultPath() {
return 'createCustomer.customer';
}
/**
* Get the result path for updating
*/
getUpdateResultPath() {
return 'updateCustomer.customer';
}
/**
* Get the result path for deleting
*/
getDeleteResultPath() {
throw new Error('Deleting customers is not supported directly');
}
/**
* Get the result path for pagination
*/
getFindWithPaginationResultPath() {
return 'customers';
}
/**
* Delete is intentionally overridden to throw an error
* since this operation might not be supported in the API
*/
async delete(_id) {
throw new Error('Deleting customers is not supported directly');
}
};
CustomerRepository = __decorate([
Injectable()
], CustomerRepository);
export { CustomerRepository };
//# sourceMappingURL=customer.repository.js.map