feeef 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/build/index.d.ts +1 -0
  2. package/build/index.js +1 -0
  3. package/build/src/core/core.d.ts +8 -0
  4. package/build/src/core/core.js +10 -0
  5. package/build/src/core/embadded/address.d.ts +13 -0
  6. package/build/src/core/embadded/address.js +1 -0
  7. package/build/src/core/embadded/category.d.ts +7 -0
  8. package/build/src/core/embadded/category.js +1 -0
  9. package/build/src/core/embadded/contact.d.ts +21 -0
  10. package/build/src/core/embadded/contact.js +17 -0
  11. package/build/src/core/entities/order.d.ts +49 -0
  12. package/build/src/core/entities/order.js +22 -0
  13. package/build/src/core/entities/product.d.ts +65 -0
  14. package/build/src/core/entities/product.js +19 -0
  15. package/build/src/core/entities/shipping_method.d.ts +29 -0
  16. package/build/src/core/entities/shipping_method.js +11 -0
  17. package/build/src/core/entities/store.d.ts +71 -0
  18. package/build/src/core/entities/store.js +15 -0
  19. package/build/src/core/entities/user.d.ts +23 -0
  20. package/build/src/core/entities/user.js +1 -0
  21. package/build/src/core/sdk/fif.d.ts +1 -0
  22. package/build/src/core/sdk/fif.js +4 -0
  23. package/build/src/feeef/feeef.d.ts +62 -0
  24. package/build/src/feeef/feeef.js +65 -0
  25. package/build/src/feeef/repositories/orders.d.ts +21 -0
  26. package/build/src/feeef/repositories/orders.js +27 -0
  27. package/build/src/feeef/repositories/products.d.ts +15 -0
  28. package/build/src/feeef/repositories/products.js +13 -0
  29. package/build/src/feeef/repositories/repository.d.ts +112 -0
  30. package/build/src/feeef/repositories/repository.js +96 -0
  31. package/build/src/feeef/repositories/stores.d.ts +22 -0
  32. package/build/src/feeef/repositories/stores.js +25 -0
  33. package/build/src/feeef/repositories/users.d.ts +51 -0
  34. package/build/src/feeef/repositories/users.js +65 -0
  35. package/build/src/feeef/validators/auth.js +46 -0
  36. package/build/src/feeef/validators/custom/datetime.d.ts +1 -0
  37. package/build/src/feeef/validators/custom/datetime.js +7 -0
  38. package/build/src/feeef/validators/helpers.js +65 -0
  39. package/build/src/feeef/validators/order.js +84 -0
  40. package/build/src/feeef/validators/product.js +92 -0
  41. package/build/src/feeef/validators/shipping_method.js +41 -0
  42. package/build/src/feeef/validators/stores.js +97 -0
  43. package/build/src/feeef/validators/user_stores.js +74 -0
  44. package/build/src/feeef/validators/users.js +67 -0
  45. package/build/vite.config.d.ts +2 -0
  46. package/build/vite.config.js +5 -0
  47. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ export * as core from "./src/core/core.js";
package/build/index.js ADDED
@@ -0,0 +1 @@
1
+ export * as core from "./src/core/core.js";
@@ -0,0 +1,8 @@
1
+ export * from './entities/order.js';
2
+ export * from './entities/store.js';
3
+ export * from './entities/product.js';
4
+ export * from './entities/user.js';
5
+ export * from './entities/shipping_method.js';
6
+ export * from './embadded/address.js';
7
+ export * from './embadded/category.js';
8
+ export * from './embadded/contact.js';
@@ -0,0 +1,10 @@
1
+ // entities
2
+ export * from './entities/order.js';
3
+ export * from './entities/store.js';
4
+ export * from './entities/product.js';
5
+ export * from './entities/user.js';
6
+ export * from './entities/shipping_method.js';
7
+ // embaddeds
8
+ export * from './embadded/address.js';
9
+ export * from './embadded/category.js';
10
+ export * from './embadded/contact.js';
@@ -0,0 +1,13 @@
1
+ export interface EmbaddedAddress {
2
+ city: string;
3
+ state: string;
4
+ country?: string;
5
+ street?: string;
6
+ zip?: string;
7
+ location?: {
8
+ geohash?: string;
9
+ lat: number;
10
+ long: number;
11
+ };
12
+ metadata?: Record<string, any>;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface EmbaddedCategory {
2
+ name: string;
3
+ description: string | null;
4
+ photoUrl: string | null;
5
+ ondarkPhotoUrl?: string | null;
6
+ metadata?: Record<string, any>;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ export declare enum EmbaddedContactType {
2
+ phone = "phone",
3
+ email = "email",
4
+ facebook = "facebook",
5
+ twitter = "twitter",
6
+ instagram = "instagram",
7
+ linkedin = "linkedin",
8
+ website = "website",
9
+ whatsapp = "whatsapp",
10
+ telegram = "telegram",
11
+ signal = "signal",
12
+ viber = "viber",
13
+ skype = "skype",
14
+ zoom = "zoom",
15
+ other = "other"
16
+ }
17
+ export interface EmbaddedContact {
18
+ type: EmbaddedContactType;
19
+ value: string;
20
+ metadata?: Record<string, any>;
21
+ }
@@ -0,0 +1,17 @@
1
+ export var EmbaddedContactType;
2
+ (function (EmbaddedContactType) {
3
+ EmbaddedContactType["phone"] = "phone";
4
+ EmbaddedContactType["email"] = "email";
5
+ EmbaddedContactType["facebook"] = "facebook";
6
+ EmbaddedContactType["twitter"] = "twitter";
7
+ EmbaddedContactType["instagram"] = "instagram";
8
+ EmbaddedContactType["linkedin"] = "linkedin";
9
+ EmbaddedContactType["website"] = "website";
10
+ EmbaddedContactType["whatsapp"] = "whatsapp";
11
+ EmbaddedContactType["telegram"] = "telegram";
12
+ EmbaddedContactType["signal"] = "signal";
13
+ EmbaddedContactType["viber"] = "viber";
14
+ EmbaddedContactType["skype"] = "skype";
15
+ EmbaddedContactType["zoom"] = "zoom";
16
+ EmbaddedContactType["other"] = "other";
17
+ })(EmbaddedContactType || (EmbaddedContactType = {}));
@@ -0,0 +1,49 @@
1
+ export declare enum OrderStatus {
2
+ draft = "draft",
3
+ pending = "pending",
4
+ processing = "processing",
5
+ completed = "completed",
6
+ cancelled = "cancelled"
7
+ }
8
+ export declare enum PaymentStatus {
9
+ unpaid = "unpaid",
10
+ paid = "paid",
11
+ received = "received"
12
+ }
13
+ export declare enum DeliveryStatus {
14
+ pending = "pending",
15
+ delivering = "delivering",
16
+ delivered = "delivered",
17
+ returned = "returned"
18
+ }
19
+ export interface OrderEntity {
20
+ id: string;
21
+ customerName: string | null;
22
+ customerPhone: string;
23
+ customerIp: string | null;
24
+ shippingAddress: string | null;
25
+ shippingCity: string | null;
26
+ shippingState: string | null;
27
+ shippingMethodId: string | null;
28
+ paymentMethodId: string | null;
29
+ items: OrderItem[];
30
+ subtotal: number;
31
+ shippingPrice: number;
32
+ total: number;
33
+ discount: number;
34
+ coupon: string | null;
35
+ storeId: string;
36
+ metadata: any;
37
+ status: OrderStatus;
38
+ paymentStatus: PaymentStatus;
39
+ deliveryStatus: DeliveryStatus;
40
+ createdAt: any;
41
+ updatedAt: any;
42
+ }
43
+ export interface OrderItem {
44
+ productId: string;
45
+ productName: string;
46
+ variantPath?: string;
47
+ quantity: number;
48
+ price: number;
49
+ }
@@ -0,0 +1,22 @@
1
+ export var OrderStatus;
2
+ (function (OrderStatus) {
3
+ OrderStatus["draft"] = "draft";
4
+ OrderStatus["pending"] = "pending";
5
+ OrderStatus["processing"] = "processing";
6
+ OrderStatus["completed"] = "completed";
7
+ OrderStatus["cancelled"] = "cancelled";
8
+ })(OrderStatus || (OrderStatus = {}));
9
+ // PaymentStatus
10
+ export var PaymentStatus;
11
+ (function (PaymentStatus) {
12
+ PaymentStatus["unpaid"] = "unpaid";
13
+ PaymentStatus["paid"] = "paid";
14
+ PaymentStatus["received"] = "received";
15
+ })(PaymentStatus || (PaymentStatus = {}));
16
+ export var DeliveryStatus;
17
+ (function (DeliveryStatus) {
18
+ DeliveryStatus["pending"] = "pending";
19
+ DeliveryStatus["delivering"] = "delivering";
20
+ DeliveryStatus["delivered"] = "delivered";
21
+ DeliveryStatus["returned"] = "returned";
22
+ })(DeliveryStatus || (DeliveryStatus = {}));
@@ -0,0 +1,65 @@
1
+ import { EmbaddedCategory } from "../embadded/category.js";
2
+ export interface ProductEntity {
3
+ id: string;
4
+ slug: string;
5
+ decoration: ProductDecoration | null;
6
+ name: string | null;
7
+ photoUrl: string | null;
8
+ media: string[];
9
+ storeId: string;
10
+ category: EmbaddedCategory;
11
+ title: string | null;
12
+ description: string | null;
13
+ body: string | null;
14
+ sku: string | null;
15
+ price: number;
16
+ discount: number | null;
17
+ stock: number;
18
+ sold: number;
19
+ views: number;
20
+ likes: number;
21
+ dislikes: number;
22
+ variant?: ProductVariant | null;
23
+ metadata: Record<string, any>;
24
+ status: ProductStatus;
25
+ type: ProductType;
26
+ verifiedAt: any | null;
27
+ blockedAt: any | null;
28
+ createdAt: any;
29
+ updatedAt: any;
30
+ }
31
+ export declare enum ProductStatus {
32
+ draft = "draft",
33
+ published = "published",
34
+ archived = "archived",
35
+ deleted = "deleted"
36
+ }
37
+ export interface ProductDecoration {
38
+ metadata: Record<string, any>;
39
+ }
40
+ export interface ProductVariant {
41
+ name: string;
42
+ options: ProductVariantOption[];
43
+ }
44
+ export interface ProductVariantOption {
45
+ name: string;
46
+ sku?: string | null;
47
+ price?: number | null;
48
+ discount?: number | null;
49
+ stock?: number | null;
50
+ sold?: number | null;
51
+ type?: VariantOptionType;
52
+ child?: ProductVariant | null;
53
+ mediaIndex?: number | null;
54
+ hint?: string | null;
55
+ }
56
+ export declare enum VariantOptionType {
57
+ color = "color",
58
+ image = "image",
59
+ text = "text"
60
+ }
61
+ export declare enum ProductType {
62
+ physical = "physical",
63
+ digital = "digital",
64
+ service = "service"
65
+ }
@@ -0,0 +1,19 @@
1
+ export var ProductStatus;
2
+ (function (ProductStatus) {
3
+ ProductStatus["draft"] = "draft";
4
+ ProductStatus["published"] = "published";
5
+ ProductStatus["archived"] = "archived";
6
+ ProductStatus["deleted"] = "deleted";
7
+ })(ProductStatus || (ProductStatus = {}));
8
+ export var VariantOptionType;
9
+ (function (VariantOptionType) {
10
+ VariantOptionType["color"] = "color";
11
+ VariantOptionType["image"] = "image";
12
+ VariantOptionType["text"] = "text";
13
+ })(VariantOptionType || (VariantOptionType = {}));
14
+ export var ProductType;
15
+ (function (ProductType) {
16
+ ProductType["physical"] = "physical";
17
+ ProductType["digital"] = "digital";
18
+ ProductType["service"] = "service";
19
+ })(ProductType || (ProductType = {}));
@@ -0,0 +1,29 @@
1
+ import { OrderEntity } from "./order.js";
2
+ export interface ShippingMethodEntity {
3
+ id: string;
4
+ name: string;
5
+ description: string | null;
6
+ logoUrl: string | null;
7
+ ondarkLogoUrl: string | null;
8
+ price: number;
9
+ forks: number;
10
+ sourceId: string;
11
+ storeId: string;
12
+ rates: (number | null)[];
13
+ status: ShippingMethodStatus;
14
+ policy: ShippingMethodPolicy;
15
+ verifiedAt: any;
16
+ createdAt: any;
17
+ updatedAt: any;
18
+ orders: OrderEntity[];
19
+ source: ShippingMethodEntity | null;
20
+ }
21
+ export declare enum ShippingMethodStatus {
22
+ draft = "draft",
23
+ published = "published",
24
+ archived = "archived"
25
+ }
26
+ export declare enum ShippingMethodPolicy {
27
+ private = "private",
28
+ public = "public"
29
+ }
@@ -0,0 +1,11 @@
1
+ export var ShippingMethodStatus;
2
+ (function (ShippingMethodStatus) {
3
+ ShippingMethodStatus["draft"] = "draft";
4
+ ShippingMethodStatus["published"] = "published";
5
+ ShippingMethodStatus["archived"] = "archived";
6
+ })(ShippingMethodStatus || (ShippingMethodStatus = {}));
7
+ export var ShippingMethodPolicy;
8
+ (function (ShippingMethodPolicy) {
9
+ ShippingMethodPolicy["private"] = "private";
10
+ ShippingMethodPolicy["public"] = "public";
11
+ })(ShippingMethodPolicy || (ShippingMethodPolicy = {}));
@@ -0,0 +1,71 @@
1
+ import { EmbaddedAddress } from '../embadded/address.js';
2
+ import { EmbaddedCategory } from '../embadded/category.js';
3
+ import { EmbaddedContact } from '../embadded/contact.js';
4
+ import { UserEntity } from './user.js';
5
+ export interface StoreEntity {
6
+ id: string;
7
+ slug: string;
8
+ banner: StoreBanner | null;
9
+ action: StoreAction | null;
10
+ domain: StoreDomain | null;
11
+ decoration: StoreDecoration | null;
12
+ name: string;
13
+ logoUrl: string | null;
14
+ ondarkLogoUrl: string | null;
15
+ userId: string;
16
+ categories: EmbaddedCategory[];
17
+ title: string | null;
18
+ description: string | null;
19
+ addresses: EmbaddedAddress[];
20
+ metadata: Record<string, any>;
21
+ contacts: EmbaddedContact[];
22
+ integrations: StoreIntegration[];
23
+ verifiedAt: any | null;
24
+ blockedAt: any | null;
25
+ createdAt: any;
26
+ updatedAt: any;
27
+ user: UserEntity;
28
+ defaultShippingRates: (number | null)[][] | null;
29
+ }
30
+ export interface StoreDomain {
31
+ name: string;
32
+ verifiedAt: any | null;
33
+ metadata: Record<string, any>;
34
+ }
35
+ export interface StoreBanner {
36
+ title: string;
37
+ url?: string | null;
38
+ enabled: boolean;
39
+ metadata: Record<string, any>;
40
+ }
41
+ export interface StoreDecoration {
42
+ primary: number;
43
+ onPrimary?: number;
44
+ showStoreLogoInHeader?: boolean;
45
+ logoFullHeight?: boolean;
46
+ showStoreNameInHeader?: boolean;
47
+ metadata?: Record<string, any>;
48
+ }
49
+ export interface StoreIntegration {
50
+ type: StoreIntegrations;
51
+ [key: string]: any;
52
+ metadata: Record<string, any>;
53
+ }
54
+ export declare enum StoreIntegrations {
55
+ telegram = "telegram",
56
+ facebookPixel = "facebook_pixel",
57
+ googleAnalytics = "google_analytics",
58
+ googleSheet = "google_sheet",
59
+ sms = "sms"
60
+ }
61
+ export interface StoreAction {
62
+ label: string;
63
+ url: string;
64
+ type: StoreActionType;
65
+ }
66
+ export declare enum StoreActionType {
67
+ link = "link",
68
+ whatsapp = "whatsapp",
69
+ telegram = "telegram",
70
+ phone = "phone"
71
+ }
@@ -0,0 +1,15 @@
1
+ export var StoreIntegrations;
2
+ (function (StoreIntegrations) {
3
+ StoreIntegrations["telegram"] = "telegram";
4
+ StoreIntegrations["facebookPixel"] = "facebook_pixel";
5
+ StoreIntegrations["googleAnalytics"] = "google_analytics";
6
+ StoreIntegrations["googleSheet"] = "google_sheet";
7
+ StoreIntegrations["sms"] = "sms";
8
+ })(StoreIntegrations || (StoreIntegrations = {}));
9
+ export var StoreActionType;
10
+ (function (StoreActionType) {
11
+ StoreActionType["link"] = "link";
12
+ StoreActionType["whatsapp"] = "whatsapp";
13
+ StoreActionType["telegram"] = "telegram";
14
+ StoreActionType["phone"] = "phone";
15
+ })(StoreActionType || (StoreActionType = {}));
@@ -0,0 +1,23 @@
1
+ export interface UserEntity {
2
+ id: string;
3
+ name: string | null;
4
+ email: string;
5
+ phone: string;
6
+ password: string;
7
+ photoUrl: string | null;
8
+ emailVerifiedAt: any | null;
9
+ phoneVerifiedAt: any | null;
10
+ verifiedAt: any | null;
11
+ blockedAt: any | null;
12
+ createdAt: any;
13
+ updatedAt: any | null;
14
+ metadata: Record<string, any>;
15
+ }
16
+ export interface AuthToken {
17
+ type: string;
18
+ name: string | null;
19
+ token: string;
20
+ abilities: string[];
21
+ lastUsedAt: any;
22
+ expiresAt: any;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ class FifStoreSdk {
2
+ constructor(parameters) { }
3
+ }
4
+ export {};
@@ -0,0 +1,62 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { OrderRepository } from "./repositories/orders";
3
+ import { ProductRepository } from "./repositories/products";
4
+ import { StoreRepository } from "./repositories/stores";
5
+ import { UserRepository } from "./repositories/users";
6
+ /**
7
+ * Configuration options for the FeeeF module.
8
+ */
9
+ export interface FeeeFConfig {
10
+ /**
11
+ * The API key to be used for authentication.
12
+ */
13
+ apiKey: string;
14
+ /**
15
+ * An optional Axios instance to be used for making HTTP requests.
16
+ */
17
+ client?: AxiosInstance;
18
+ /**
19
+ * Specifies whether caching should be enabled or disabled.
20
+ * If set to a number, it represents the maximum number of seconds to cache the responses.
21
+ * If set to `false`, caching will be disabled (5s).
22
+ * cannot be less than 5 seconds
23
+ */
24
+ cache?: false | number;
25
+ }
26
+ /**
27
+ * Represents the FeeeF class.
28
+ */
29
+ export declare class FeeeF {
30
+ /**
31
+ * The API key used for authentication.
32
+ */
33
+ apiKey: string;
34
+ /**
35
+ * The Axios instance used for making HTTP requests.
36
+ */
37
+ client: AxiosInstance;
38
+ /**
39
+ * The repository for managing stores.
40
+ */
41
+ stores: StoreRepository;
42
+ /**
43
+ * The repository for managing products.
44
+ */
45
+ products: ProductRepository;
46
+ /**
47
+ * The repository for managing users.
48
+ */
49
+ users: UserRepository;
50
+ /**
51
+ * The repository for managing orders.
52
+ */
53
+ orders: OrderRepository;
54
+ /**
55
+ * Constructs a new instance of the FeeeF class.
56
+ * @param {FeeeFConfig} config - The configuration object.
57
+ * @param {string} config.apiKey - The API key used for authentication.
58
+ * @param {AxiosInstance} config.client - The Axios instance used for making HTTP requests.
59
+ * @param {boolean | number} config.cache - The caching configuration. Set to `false` to disable caching, or provide a number to set the cache TTL in milliseconds.
60
+ */
61
+ constructor({ apiKey, client, cache }: FeeeFConfig);
62
+ }
@@ -0,0 +1,65 @@
1
+ import axios from "axios";
2
+ import { buildWebStorage, setupCache } from "axios-cache-interceptor";
3
+ import { OrderRepository } from "./repositories/orders";
4
+ import { ProductRepository } from "./repositories/products";
5
+ import { StoreRepository } from "./repositories/stores";
6
+ import { UserRepository } from "./repositories/users";
7
+ /**
8
+ * Represents the FeeeF class.
9
+ */
10
+ export class FeeeF {
11
+ /**
12
+ * The API key used for authentication.
13
+ */
14
+ apiKey;
15
+ /**
16
+ * The Axios instance used for making HTTP requests.
17
+ */
18
+ client;
19
+ /**
20
+ * The repository for managing stores.
21
+ */
22
+ stores;
23
+ /**
24
+ * The repository for managing products.
25
+ */
26
+ products;
27
+ /**
28
+ * The repository for managing users.
29
+ */
30
+ users;
31
+ /**
32
+ * The repository for managing orders.
33
+ */
34
+ orders;
35
+ /**
36
+ * Constructs a new instance of the FeeeF class.
37
+ * @param {FeeeFConfig} config - The configuration object.
38
+ * @param {string} config.apiKey - The API key used for authentication.
39
+ * @param {AxiosInstance} config.client - The Axios instance used for making HTTP requests.
40
+ * @param {boolean | number} config.cache - The caching configuration. Set to `false` to disable caching, or provide a number to set the cache TTL in milliseconds.
41
+ */
42
+ constructor({ apiKey, client, cache }) {
43
+ this.apiKey = apiKey;
44
+ // get th "cache" search param
45
+ const urlParams = new URLSearchParams(window.location.search);
46
+ const cacheParam = urlParams.get("cache");
47
+ // if is 0 or false, disable cache
48
+ if (cacheParam == '0') {
49
+ this.client = client || axios;
50
+ }
51
+ else {
52
+ this.client = setupCache(client || axios, {
53
+ ttl: cache === false ? 5 : Math.max(cache, 5) || 1 * 60 * 1000,
54
+ // for persistent cache use buildWebStorage
55
+ storage: buildWebStorage(localStorage, "ff:"),
56
+ });
57
+ }
58
+ // set base url
59
+ this.client.defaults.baseURL = "http://localhost:3333/api/v1";
60
+ this.stores = new StoreRepository(this.client);
61
+ this.products = new ProductRepository(this.client);
62
+ this.users = new UserRepository(this.client);
63
+ this.orders = new OrderRepository(this.client);
64
+ }
65
+ }
@@ -0,0 +1,21 @@
1
+ import { InferInput } from "@vinejs/vine/types";
2
+ import { AxiosInstance } from "axios";
3
+ import { OrderEntity } from "../../core/core";
4
+ import { CreateOrderSchema, SendOrderSchema } from "../validators/order";
5
+ import { ModelRepository } from "./repository";
6
+ /**
7
+ * Represents a repository for managing orders.
8
+ */
9
+ export declare class OrderRepository extends ModelRepository<OrderEntity, InferInput<typeof CreateOrderSchema>, InferInput<typeof CreateOrderSchema>> {
10
+ /**
11
+ * Constructs a new OrderRepository instance.
12
+ * @param client - The AxiosInstance used for making HTTP requests.
13
+ */
14
+ constructor(client: AxiosInstance);
15
+ /**
16
+ * Sends an order from an anonymous user.
17
+ * @param data - The data representing the order to be sent.
18
+ * @returns A Promise that resolves to the sent OrderEntity.
19
+ */
20
+ send(data: InferInput<typeof SendOrderSchema>): Promise<OrderEntity>;
21
+ }
@@ -0,0 +1,27 @@
1
+ import vine from "@vinejs/vine";
2
+ import { SendOrderSchema } from "../validators/order";
3
+ import { ModelRepository } from "./repository";
4
+ /**
5
+ * Represents a repository for managing orders.
6
+ */
7
+ export class OrderRepository extends ModelRepository {
8
+ /**
9
+ * Constructs a new OrderRepository instance.
10
+ * @param client - The AxiosInstance used for making HTTP requests.
11
+ */
12
+ constructor(client) {
13
+ super("orders", client);
14
+ }
15
+ /**
16
+ * Sends an order from an anonymous user.
17
+ * @param data - The data representing the order to be sent.
18
+ * @returns A Promise that resolves to the sent OrderEntity.
19
+ */
20
+ async send(data) {
21
+ const validator = vine.compile(SendOrderSchema);
22
+ const output = await validator.validate(data);
23
+ const res = await this.client.post(`/${this.resource}/send`, output);
24
+ // Return the sent OrderEntity
25
+ return res.data;
26
+ }
27
+ }
@@ -0,0 +1,15 @@
1
+ import { InferInput } from "@vinejs/vine/types";
2
+ import { AxiosInstance } from "axios";
3
+ import { ProductEntity } from "../../core/core";
4
+ import { CreateProductSchema, UpdateProductSchema } from "../validators/product";
5
+ import { ModelRepository } from "./repository";
6
+ /**
7
+ * Represents a repository for managing products.
8
+ */
9
+ export declare class ProductRepository extends ModelRepository<ProductEntity, InferInput<typeof CreateProductSchema>, InferInput<typeof UpdateProductSchema>> {
10
+ /**
11
+ * Creates a new instance of the ProductRepository class.
12
+ * @param client - The AxiosInstance used for making HTTP requests.
13
+ */
14
+ constructor(client: AxiosInstance);
15
+ }
@@ -0,0 +1,13 @@
1
+ import { ModelRepository } from "./repository";
2
+ /**
3
+ * Represents a repository for managing products.
4
+ */
5
+ export class ProductRepository extends ModelRepository {
6
+ /**
7
+ * Creates a new instance of the ProductRepository class.
8
+ * @param client - The AxiosInstance used for making HTTP requests.
9
+ */
10
+ constructor(client) {
11
+ super("products", client);
12
+ }
13
+ }