{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import axios, { RawAxiosRequestHeaders, AxiosRequestConfig } from \"axios\";\nimport crypto from \"node:crypto\";\nimport OAuth from \"oauth-1.0a\";\nimport Url from \"url-parse\";\nimport {\n    WooRestApiMethod,\n    // IWooRestApiQuery,\n    IWooRestApiOptions,\n    WooRestApiEndpoint,\n    OrdersMainParams,\n    ProductsMainParams,\n    SystemStatusParams,\n    CouponsParams,\n    CustomersParams,\n    DELETE,\n    Orders,\n    Products,\n    Customers,\n    Coupons,\n    SystemStatus,\n} from \"./typesANDinterfaces.js\"; // Typescript types for the library\n\nexport {\n    WooRestApiMethod,\n    IWooRestApiQuery,\n    IWooRestApiOptions,\n    WooRestApiEndpoint,\n    OrdersMainParams,\n    ProductsMainParams,\n    SystemStatusParams,\n    CouponsParams,\n    CustomersParams,\n    DELETE,\n    Orders,\n    Products,\n    Customers,\n    Coupons,\n    SystemStatus,\n} from \"./typesANDinterfaces.js\"; // Export all the types\n\n/**\n * Set the axiosConfig property to the axios config object.\n * Could reveive any axios |... config objects.\n * @param {AxiosRequestConfig} axiosConfig\n */\nexport type WooRestApiOptions = IWooRestApiOptions<AxiosRequestConfig>;\n\n/**\n * Set all the possible query params for the WooCommerce REST API.\n */\nexport type WooRestApiParams = CouponsParams &\n  CustomersParams &\n  OrdersMainParams &\n  ProductsMainParams &\n  SystemStatusParams &\n  DELETE;\n\n/**\n * Response wrapper for API calls\n */\nexport interface WooCommerceApiResponse<T> {\n  data: T;\n  status: number;\n  statusText: string;\n  headers: any;\n}\n\n/**\n * WooCommerce REST API wrapper\n *\n * @param {Object} opt\n */\nexport default class WooCommerceRestApi<T extends WooRestApiOptions> {\n    protected _opt: T;\n\n    /**\n   * Class constructor.\n   *\n   * @param {Object} opt\n   */\n    constructor(opt: T) {\n        this._opt = opt;\n\n        /**\n     * If the class is not instantiated, return a new instance.\n     * This is useful for the static methods.\n     */\n        if (!(this instanceof WooCommerceRestApi)) {\n            return new WooCommerceRestApi(opt);\n        }\n\n        /**\n     * Check if the url is defined.\n     */\n        if (!this._opt.url || this._opt.url === \"\") {\n            throw new OptionsException(\"url is required\");\n        }\n\n        /**\n     * Check if the consumerKey is defined.\n     */\n        if (!this._opt.consumerKey || this._opt.consumerKey === \"\") {\n            throw new OptionsException(\"consumerKey is required\");\n        }\n\n        /**\n     * Check if the consumerSecret is defined.\n     */\n        if (!this._opt.consumerSecret || this._opt.consumerSecret === \"\") {\n            throw new OptionsException(\"consumerSecret is required\");\n        }\n\n        /**\n     * Set default options\n     */\n        this._setDefaultsOptions(this._opt);\n    }\n\n    /**\n   * Set default options\n   *\n   * @param {Object} opt\n   */\n    _setDefaultsOptions(opt: T): void {\n        this._opt.wpAPIPrefix = opt.wpAPIPrefix || \"wp-json\";\n        this._opt.version = opt.version || \"wc/v3\";\n        this._opt.isHttps = /^https/i.test(this._opt.url);\n        this._opt.encoding = opt.encoding || \"utf-8\";\n        this._opt.queryStringAuth = opt.queryStringAuth || false;\n        this._opt.classVersion = \"0.0.2\";\n    }\n\n    /**\n   * Parse params to object.\n   *\n   * @param {Object} params\n   * @param {Object} query\n   * @return {Object} IWooRestApiQuery\n   */\n    // _parseParamsObject<T>(params: Record<string, T>, query: Record<string, any>): IWooRestApiQuery {\n    //     for (const key in params) {\n    //         if (typeof params[key] === \"object\") {\n    //             // If the value is an object, loop through it and add it to the query object\n    //             for (const subKey in params[key]) {\n    //                 query[key + \"[\" + subKey + \"]\"] = params[key][subKey];\n    //             }\n    //         } else {\n    //             query[key] = params[key]; // If the value is not an object, add it to the query object\n    //         }\n    //     }\n    //     return query; // Return the query object\n    // }\n\n    /**\n   * Normalize query string for oAuth 1.0a\n   * Depends on the _parseParamsObject method\n   *\n   * @param  {String} url\n   * @param  {Object} params\n   *\n   * @return {String}\n   */\n    _normalizeQueryString(\n        url: string,\n        params: Partial<Record<string, any>>,\n    ): string {\n    /**\n     * Exit if url and params are not defined\n     */\n        if (url.indexOf(\"?\") === -1 && Object.keys(params).length === 0) {\n            return url;\n        }\n        const query = new Url(url, true).query; // Parse the query string returned by the url\n\n        // console.log(\"params:\", params);\n        const values = [];\n\n        let queryString = \"\";\n\n        // Include params object into URL.searchParams.\n        // eslint-disable-next-line @typescript-eslint/no-unused-vars\n        // const a = this._parseParamsObject(params, query);\n        // console.log(\"A:\", a);\n\n        /**\n     * Loop through the params object and push the key and value into the values array\n     * Example: values = ['key1=value1', 'key2=value2']\n     */\n        for (const key in query) {\n            values.push(key);\n        }\n\n        values.sort(); // Sort the values array\n\n        for (const i in values) {\n            /*\n       * If the queryString is not empty, add an ampersand to the end of the string\n       */\n            if (queryString.length) queryString += \"&\";\n\n            /**\n       * Add the key and value to the queryString\n       */\n            queryString +=\n        encodeURIComponent(values[i]) +\n        \"=\" +\n        encodeURIComponent(<string | number | boolean>query[values[i]]);\n        }\n        /**\n     * Replace %5B with [ and %5D with ]\n     */\n        queryString = queryString.replace(/%5B/g, \"[\").replace(/%5D/g, \"]\");\n\n        /**\n     * Return the url with the queryString\n     */\n        const urlObject = url.split(\"?\")[0] + \"?\" + queryString;\n\n        return urlObject;\n    }\n\n    /**\n   * Get URL\n   *\n   * @param  {String} endpoint\n   * @param  {Object} params\n   *\n   * @return {String}\n   */\n    _getUrl(endpoint: string, params: Partial<Record<string, unknown>>): string {\n        const api = this._opt.wpAPIPrefix + \"/\"; // Add prefix to endpoint\n\n        let url =\n      this._opt.url.slice(-1) === \"/\" ? this._opt.url : this._opt.url + \"/\";\n\n        url = url + api + this._opt.version + \"/\" + endpoint;\n        // Add id param to url\n        if (params.id) {\n            url = url + \"/\" + params.id;\n            delete params.id;\n        }\n\n        // Add query params to url\n        if (Object.keys(params).length !== 0) {\n            const queryString = Object.entries(params)\n                .map(\n                    ([key, value]) =>\n                        `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`,\n                )\n                .join(\"&\");\n            url = `${url}?${queryString}`;\n        }\n\n        /**\n     * If port is defined, add it to the url\n     */\n        if (this._opt.port) {\n            const hostname = new Url(url).hostname;\n            url = url.replace(hostname, hostname + \":\" + this._opt.port);\n        }\n\n        /**\n     * If isHttps is true, normalize the query string\n     */\n        // if (this._opt.isHttps) {\n        //     url = this._normalizeQueryString(url, params);\n        //     return url;\n        // }\n        return url;\n    }\n\n    /**\n   * Create Hmac was deprecated fot this version at 16.11.2022\n   * Get OAuth 1.0a since it is mandatory for WooCommerce REST API\n   * You must use OAuth 1.0a \"one-legged\" authentication to ensure REST API credentials cannot be intercepted by an attacker.\n   * Reference: https://woocommerce.github.io/woocommerce-rest-api-docs/#authentication-over-http\n   * @return {Object}\n   */\n    _getOAuth(): OAuth {\n        const data = {\n            consumer: {\n                key: this._opt.consumerKey,\n                secret: this._opt.consumerSecret,\n            },\n            signature_method: \"HMAC-SHA256\",\n            hash_function: (base: any, key: any) => {\n                return crypto.createHmac(\"sha256\", key).update(base).digest(\"base64\");\n            },\n        };\n\n        return new OAuth(data);\n    }\n\n    /**\n   * Axios request\n   * Mount the options to send to axios and send the request.\n   *\n   * @param  {String} method\n   * @param  {String} endpoint\n   * @param  {Object} data\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    async _request(\n        method: WooRestApiMethod,\n        endpoint: string,\n        data?: Record<string, unknown>,\n        params: Record<string, unknown> = {},\n    ): Promise<any> {\n        const url = this._getUrl(endpoint, params);\n\n        const header: RawAxiosRequestHeaders = {\n            Accept: \"application/json\",\n        };\n        // only set \"User-Agent\" in node environment\n        // the checking method is identical to upstream axios\n        if (\n            typeof process !== \"undefined\" &&\n      Object.prototype.toString.call(process) === \"[object process]\"\n        ) {\n            header[\"User-Agent\"] =\n        \"WooCommerce REST API - TS Client/\" + this._opt.classVersion;\n        }\n\n        let options: AxiosRequestConfig = {\n            url,\n            method,\n            responseEncoding: this._opt.encoding,\n            timeout: this._opt.timeout,\n            responseType: \"json\",\n            headers: { ...header },\n            params: {},\n            data: data ? JSON.stringify(data) : null,\n        };\n\n        /**\n     * If isHttps is false, add the query string to the params object\n     */\n        if (this._opt.isHttps) {\n            if (this._opt.queryStringAuth) {\n                options.params = {\n                    consumer_key: this._opt.consumerKey,\n                    consumer_secret: this._opt.consumerSecret,\n                };\n            } else {\n                options.auth = {\n                    username: this._opt.consumerKey,\n                    password: this._opt.consumerSecret,\n                };\n            }\n\n            options.params = { ...options.params, ...params };\n        } else {\n            options.params = this._getOAuth().authorize({\n                url,\n                method,\n            });\n        }\n\n        if (options.data) {\n            options.headers = {\n                ...header,\n                \"Content-Type\": `application/json; charset=${this._opt.encoding}`,\n            };\n        }\n\n        // Allow set and override Axios options.\n        options = { ...options, ...this._opt.axiosConfig };\n\n        try {\n            return await axios(options);\n        } catch (error: any) {\n            // Enhanced error handling\n            if (error.response) {\n                const apiError = new WooCommerceApiError(\n                    error.response.data?.message || error.message || \"API request failed\",\n                    error.response.status,\n                    error.response.data,\n                    endpoint,\n                );\n                throw apiError;\n            } else if (error.request) {\n                throw new WooCommerceApiError(\n                    \"Network error: No response received from server\",\n                    0,\n                    null,\n                    endpoint,\n                );\n            } else {\n                throw new WooCommerceApiError(\n                    `Request setup error: ${error.message}`,\n                    0,\n                    null,\n                    endpoint,\n                );\n            }\n        }\n    }\n\n    /**\n   * GET requests\n   *\n   * @param  {String} endpoint\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    get<T = any>(\n        endpoint: WooRestApiEndpoint,\n        params?: Partial<WooRestApiParams>,\n    ): Promise<WooCommerceApiResponse<T>> {\n        return this._request(\"GET\", endpoint, undefined, params).then(\n            (response) => ({\n                data: response.data,\n                status: response.status,\n                statusText: response.statusText,\n                headers: response.headers,\n            }),\n        );\n    }\n\n    /**\n   * POST requests\n   *\n   * @param  {String} endpoint\n   * @param  {Object} data\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    post<T = any>(\n        endpoint: WooRestApiEndpoint,\n        data: Record<string, unknown>,\n        params?: Partial<WooRestApiParams>,\n    ): Promise<WooCommerceApiResponse<T>> {\n        return this._request(\"POST\", endpoint, data, params).then((response) => ({\n            data: response.data,\n            status: response.status,\n            statusText: response.statusText,\n            headers: response.headers,\n        }));\n    }\n\n    /**\n   * PUT requests\n   *\n   * @param  {String} endpoint\n   * @param  {Object} data\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    put<T = any>(\n        endpoint: WooRestApiEndpoint,\n        data: Record<string, unknown>,\n        params?: Partial<WooRestApiParams>,\n    ): Promise<WooCommerceApiResponse<T>> {\n        return this._request(\"PUT\", endpoint, data, params).then((response) => ({\n            data: response.data,\n            status: response.status,\n            statusText: response.statusText,\n            headers: response.headers,\n        }));\n    }\n\n    /**\n   * DELETE requests\n   *\n   * @param  {String} endpoint\n   * @param  {Object} params\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    delete<T = any>(\n        endpoint: WooRestApiEndpoint,\n        data: Pick<WooRestApiParams, \"force\">,\n        params: Pick<WooRestApiParams, \"id\">,\n    ): Promise<WooCommerceApiResponse<T>> {\n        return this._request(\"DELETE\", endpoint, data, params).then((response) => ({\n            data: response.data,\n            status: response.status,\n            statusText: response.statusText,\n            headers: response.headers,\n        }));\n    }\n\n    /**\n   * OPTIONS requests\n   *\n   * @param  {String} endpoint\n   * @param  {Object} params\n   *\n   * @return {Object}\n   */\n    options<T = any>(\n        endpoint: WooRestApiEndpoint,\n        params?: Partial<WooRestApiParams>,\n    ): Promise<WooCommerceApiResponse<T>> {\n        return this._request(\"OPTIONS\", endpoint, {}, params).then((response) => ({\n            data: response.data,\n            status: response.status,\n            statusText: response.statusText,\n            headers: response.headers,\n        }));\n    }\n\n    // Convenience methods with proper typing\n    /**\n   * Get all products with proper typing\n   */\n    async getProducts(\n        params?: Record<string, any>,\n    ): Promise<WooCommerceApiResponse<Products[]>> {\n        return this.get<Products[]>(\"products\", params);\n    }\n\n    /**\n   * Get a single product by ID\n   */\n    async getProduct(id: number): Promise<WooCommerceApiResponse<Products>> {\n        return this.get<Products>(\"products\", { id });\n    }\n\n    /**\n   * Create a new product\n   */\n    async createProduct(\n        productData: Partial<Products>,\n    ): Promise<WooCommerceApiResponse<Products>> {\n        return this.post<Products>(\"products\", productData);\n    }\n\n    /**\n   * Update an existing product\n   */\n    async updateProduct(\n        id: number,\n        productData: Partial<Products>,\n    ): Promise<WooCommerceApiResponse<Products>> {\n        return this.put<Products>(\"products\", productData, { id });\n    }\n\n    /**\n   * Get all orders with proper typing\n   */\n    async getOrders(\n        params?: Record<string, any>,\n    ): Promise<WooCommerceApiResponse<Orders[]>> {\n        return this.get<Orders[]>(\"orders\", params);\n    }\n\n    /**\n   * Get a single order by ID\n   */\n    async getOrder(id: number): Promise<WooCommerceApiResponse<Orders>> {\n        return this.get<Orders>(\"orders\", { id });\n    }\n\n    /**\n   * Create a new order\n   */\n    async createOrder(\n        orderData: Partial<Orders>,\n    ): Promise<WooCommerceApiResponse<Orders>> {\n        return this.post<Orders>(\"orders\", orderData);\n    }\n\n    /**\n   * Get all customers with proper typing\n   */\n    async getCustomers(\n        params?: Partial<CustomersParams>,\n    ): Promise<WooCommerceApiResponse<Customers[]>> {\n        return this.get<Customers[]>(\"customers\", params);\n    }\n\n    /**\n   * Get a single customer by ID\n   */\n    async getCustomer(id: number): Promise<WooCommerceApiResponse<Customers>> {\n        return this.get<Customers>(\"customers\", { id });\n    }\n\n    /**\n   * Get all coupons with proper typing\n   */\n    async getCoupons(\n        params?: Partial<CouponsParams>,\n    ): Promise<WooCommerceApiResponse<Coupons[]>> {\n        return this.get<Coupons[]>(\"coupons\", params);\n    }\n\n    /**\n   * Get system status\n   */\n    async getSystemStatus(): Promise<WooCommerceApiResponse<SystemStatus>> {\n        return this.get<SystemStatus>(\"system_status\");\n    }\n}\n\n/**\n * WooCommerce API Error.\n */\nexport class WooCommerceApiError extends Error {\n    constructor(\n        message: string,\n    public statusCode?: number,\n    public response?: any,\n    public endpoint?: string,\n    ) {\n        super(message);\n        this.name = \"WooCommerceApiError\";\n    }\n}\n\n/**\n * Authentication Error.\n */\nexport class AuthenticationError extends WooCommerceApiError {\n    constructor(message = \"Authentication failed\") {\n        super(message, 401);\n        this.name = \"AuthenticationError\";\n    }\n}\n\n/**\n * Options Exception.\n */\nexport class OptionsException {\n    public name: \"Options Error\";\n    public message: string;\n    /**\n   * Constructor.\n   *\n   * @param {String} message\n   */\n    constructor(message: string) {\n        this.name = \"Options Error\";\n        this.message = message;\n    }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAA2D;AAClE,OAAO,YAAY;AACnB,OAAO,WAAW;AAClB,OAAO,SAAS;AAqEhB,IAAqB,qBAArB,MAAqB,oBAAgD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjE,YAAY,KAAQ;AAChB,SAAK,OAAO;AAMZ,QAAI,EAAE,gBAAgB,sBAAqB;AACvC,aAAO,IAAI,oBAAmB,GAAG;AAAA,IACrC;AAKA,QAAI,CAAC,KAAK,KAAK,OAAO,KAAK,KAAK,QAAQ,IAAI;AACxC,YAAM,IAAI,iBAAiB,iBAAiB;AAAA,IAChD;AAKA,QAAI,CAAC,KAAK,KAAK,eAAe,KAAK,KAAK,gBAAgB,IAAI;AACxD,YAAM,IAAI,iBAAiB,yBAAyB;AAAA,IACxD;AAKA,QAAI,CAAC,KAAK,KAAK,kBAAkB,KAAK,KAAK,mBAAmB,IAAI;AAC9D,YAAM,IAAI,iBAAiB,4BAA4B;AAAA,IAC3D;AAKA,SAAK,oBAAoB,KAAK,IAAI;AAAA,EACtC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,oBAAoB,KAAc;AAC9B,SAAK,KAAK,cAAc,IAAI,eAAe;AAC3C,SAAK,KAAK,UAAU,IAAI,WAAW;AACnC,SAAK,KAAK,UAAU,UAAU,KAAK,KAAK,KAAK,GAAG;AAChD,SAAK,KAAK,WAAW,IAAI,YAAY;AACrC,SAAK,KAAK,kBAAkB,IAAI,mBAAmB;AACnD,SAAK,KAAK,eAAe;AAAA,EAC7B;AAAA;AAAA;AAAA;AAAA;AAAA;A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