@ssddo/ecf-react 0.1.0
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/README.md +252 -0
- package/dist/index.d.mts +6856 -0
- package/dist/index.d.ts +6856 -0
- package/dist/index.js +62 -0
- package/dist/index.mjs +25 -0
- package/package.json +49 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
createEcfReactClient: () => createEcfReactClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(index_exports);
|
|
36
|
+
|
|
37
|
+
// src/hooks.ts
|
|
38
|
+
var import_openapi_fetch = __toESM(require("openapi-fetch"));
|
|
39
|
+
var import_openapi_react_query = __toESM(require("openapi-react-query"));
|
|
40
|
+
var ENVIRONMENT_URLS = {
|
|
41
|
+
test: "https://api.test.ecfx.ssd.com.do",
|
|
42
|
+
cert: "https://api.cert.ecfx.ssd.com.do",
|
|
43
|
+
prod: "https://api.prod.ecfx.ssd.com.do"
|
|
44
|
+
};
|
|
45
|
+
function createEcfReactClient(config) {
|
|
46
|
+
const baseUrl = config.baseUrl ?? ENVIRONMENT_URLS[config.environment ?? "test"];
|
|
47
|
+
const fetchClient = (0, import_openapi_fetch.default)({
|
|
48
|
+
baseUrl
|
|
49
|
+
});
|
|
50
|
+
fetchClient.use({
|
|
51
|
+
async onRequest({ request }) {
|
|
52
|
+
request.headers.set("Authorization", `Bearer ${config.apiKey}`);
|
|
53
|
+
return request;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const $api = (0, import_openapi_react_query.default)(fetchClient);
|
|
57
|
+
return { $api, fetchClient };
|
|
58
|
+
}
|
|
59
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
60
|
+
0 && (module.exports = {
|
|
61
|
+
createEcfReactClient
|
|
62
|
+
});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/hooks.ts
|
|
2
|
+
import createFetchClient from "openapi-fetch";
|
|
3
|
+
import createClient from "openapi-react-query";
|
|
4
|
+
var ENVIRONMENT_URLS = {
|
|
5
|
+
test: "https://api.test.ecfx.ssd.com.do",
|
|
6
|
+
cert: "https://api.cert.ecfx.ssd.com.do",
|
|
7
|
+
prod: "https://api.prod.ecfx.ssd.com.do"
|
|
8
|
+
};
|
|
9
|
+
function createEcfReactClient(config) {
|
|
10
|
+
const baseUrl = config.baseUrl ?? ENVIRONMENT_URLS[config.environment ?? "test"];
|
|
11
|
+
const fetchClient = createFetchClient({
|
|
12
|
+
baseUrl
|
|
13
|
+
});
|
|
14
|
+
fetchClient.use({
|
|
15
|
+
async onRequest({ request }) {
|
|
16
|
+
request.headers.set("Authorization", `Bearer ${config.apiKey}`);
|
|
17
|
+
return request;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
const $api = createClient(fetchClient);
|
|
21
|
+
return { $api, fetchClient };
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
createEcfReactClient
|
|
25
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ssddo/ecf-react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Hooks de React Query para la API de ECF DGII (comprobantes fiscales electrónicos de República Dominicana)",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.mts",
|
|
12
|
+
"default": "./dist/index.mjs"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"engines": {
|
|
24
|
+
"node": ">=18"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"react": ">=18",
|
|
28
|
+
"react-dom": ">=18",
|
|
29
|
+
"@tanstack/react-query": ">=5"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"openapi-fetch": "^0.13.0",
|
|
33
|
+
"openapi-react-query": "^0.2.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@tanstack/react-query": "^5.62.0",
|
|
37
|
+
"@types/react": "^19.0.0",
|
|
38
|
+
"openapi-typescript": "^7.4.0",
|
|
39
|
+
"react": "^19.0.0",
|
|
40
|
+
"react-dom": "^19.0.0",
|
|
41
|
+
"tsup": "^8.3.0",
|
|
42
|
+
"typescript": "^5.7.0"
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"scripts": {
|
|
46
|
+
"generate": "openapi-typescript /Users/dawlin/Developer/puntoos/ecf_dgii/src/Apis/ECF_DGII.EcfApi/wwwroot/openapi/v1.json -o src/generated/v1.d.ts",
|
|
47
|
+
"build": "tsup"
|
|
48
|
+
}
|
|
49
|
+
}
|