@symanticreative/vendure-admin-client
Version:
A TypeScript GraphQL client for Vendure Admin API to create custom dashboards
94 lines • 2.67 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_PRODUCT, GET_PRODUCTS, CREATE_PRODUCT, UPDATE_PRODUCT, DELETE_PRODUCT } from '../graphql/products/product.queries';
/**
* Repository for product operations
*/
let ProductRepository = class ProductRepository extends BasePaginatedRepository {
constructor(graphqlClient) {
super(graphqlClient);
}
/**
* Get the GraphQL query for finding by ID
*/
getFindByIdQuery() {
return GET_PRODUCT;
}
/**
* Get the GraphQL query for finding all
*/
getFindAllQuery() {
return GET_PRODUCTS;
}
/**
* Get the GraphQL mutation for creating
*/
getCreateMutation() {
return CREATE_PRODUCT;
}
/**
* Get the GraphQL mutation for updating
*/
getUpdateMutation() {
return UPDATE_PRODUCT;
}
/**
* Get the GraphQL mutation for deleting
*/
getDeleteMutation() {
return DELETE_PRODUCT;
}
/**
* Get the GraphQL query for pagination
*/
getFindWithPaginationQuery() {
return GET_PRODUCTS;
}
/**
* Get the result path for finding by ID
*/
getFindByIdResultPath() {
return 'product';
}
/**
* Get the result path for finding all
*/
getFindAllResultPath() {
return 'products.items';
}
/**
* Get the result path for creating
*/
getCreateResultPath() {
return 'createProduct';
}
/**
* Get the result path for updating
*/
getUpdateResultPath() {
return 'updateProduct';
}
/**
* Get the result path for deleting
*/
getDeleteResultPath() {
return 'deleteProduct.success';
}
/**
* Get the result path for pagination
*/
getFindWithPaginationResultPath() {
return 'products';
}
};
ProductRepository = __decorate([
Injectable()
], ProductRepository);
export { ProductRepository };
//# sourceMappingURL=product.repository.js.map