@cleilsonalvino/qd-integration-helpers 1.0.3

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Cleilson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,24 @@
1
+ type IntegrationStatus = 'ONLINE' | 'OFFLINE';
2
+ interface IntegrationHealthPayload {
3
+ placeId: string;
4
+ storeName: string;
5
+ integrationType: string;
6
+ systemName: string;
7
+ status: IntegrationStatus;
8
+ lastError?: string;
9
+ logs?: string;
10
+ }
11
+
12
+ interface AppScriptClientOptions {
13
+ baseUrl: string;
14
+ timeout?: number;
15
+ headers?: Record<string, string>;
16
+ }
17
+ declare class AppScriptClient {
18
+ private http;
19
+ constructor(options: AppScriptClientOptions);
20
+ protected post<TResponse = any>(action: string, payload: unknown): Promise<TResponse>;
21
+ health(payload: IntegrationHealthPayload): Promise<any>;
22
+ }
23
+
24
+ export { AppScriptClient, type IntegrationHealthPayload, type IntegrationStatus };
@@ -0,0 +1,24 @@
1
+ type IntegrationStatus = 'ONLINE' | 'OFFLINE';
2
+ interface IntegrationHealthPayload {
3
+ placeId: string;
4
+ storeName: string;
5
+ integrationType: string;
6
+ systemName: string;
7
+ status: IntegrationStatus;
8
+ lastError?: string;
9
+ logs?: string;
10
+ }
11
+
12
+ interface AppScriptClientOptions {
13
+ baseUrl: string;
14
+ timeout?: number;
15
+ headers?: Record<string, string>;
16
+ }
17
+ declare class AppScriptClient {
18
+ private http;
19
+ constructor(options: AppScriptClientOptions);
20
+ protected post<TResponse = any>(action: string, payload: unknown): Promise<TResponse>;
21
+ health(payload: IntegrationHealthPayload): Promise<any>;
22
+ }
23
+
24
+ export { AppScriptClient, type IntegrationHealthPayload, type IntegrationStatus };
package/dist/index.js ADDED
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ AppScriptClient: () => AppScriptClient
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/client.ts
38
+ var import_axios = __toESM(require("axios"));
39
+ var AppScriptClient = class {
40
+ constructor(options) {
41
+ if (!options.baseUrl) {
42
+ throw new Error("baseUrl \xE9 obrigat\xF3rio");
43
+ }
44
+ this.http = import_axios.default.create({
45
+ baseURL: options.baseUrl,
46
+ timeout: options.timeout ?? 1e4,
47
+ headers: {
48
+ "Content-Type": "application/json",
49
+ ...options.headers
50
+ }
51
+ });
52
+ }
53
+ async post(action, payload) {
54
+ const { data } = await this.http.post("", {
55
+ action,
56
+ payload
57
+ });
58
+ return data;
59
+ }
60
+ async health(payload) {
61
+ try {
62
+ return await this.post("integration:health", payload);
63
+ } catch (err) {
64
+ throw new Error(
65
+ `Health check failed: ${err?.message || "unknown error"}`
66
+ );
67
+ }
68
+ }
69
+ };
70
+ // Annotate the CommonJS export names for ESM import in node:
71
+ 0 && (module.exports = {
72
+ AppScriptClient
73
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,36 @@
1
+ // src/client.ts
2
+ import axios from "axios";
3
+ var AppScriptClient = class {
4
+ constructor(options) {
5
+ if (!options.baseUrl) {
6
+ throw new Error("baseUrl \xE9 obrigat\xF3rio");
7
+ }
8
+ this.http = axios.create({
9
+ baseURL: options.baseUrl,
10
+ timeout: options.timeout ?? 1e4,
11
+ headers: {
12
+ "Content-Type": "application/json",
13
+ ...options.headers
14
+ }
15
+ });
16
+ }
17
+ async post(action, payload) {
18
+ const { data } = await this.http.post("", {
19
+ action,
20
+ payload
21
+ });
22
+ return data;
23
+ }
24
+ async health(payload) {
25
+ try {
26
+ return await this.post("integration:health", payload);
27
+ } catch (err) {
28
+ throw new Error(
29
+ `Health check failed: ${err?.message || "unknown error"}`
30
+ );
31
+ }
32
+ }
33
+ };
34
+ export {
35
+ AppScriptClient
36
+ };
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@cleilsonalvino/qd-integration-helpers",
3
+ "version": "1.0.3",
4
+ "license": "MIT",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsup src/index.ts --format cjs,esm --dts",
12
+ "prepublishOnly": "yarn build"
13
+ },
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
17
+ "dependencies": {
18
+ "axios": "^1.13.4"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^25.2.0",
22
+ "tsup": "^8.5.1",
23
+ "typescript": "^5.9.3"
24
+ }
25
+ }