@wbsuite/react-hooks 1.0.13 → 1.0.14

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.
@@ -0,0 +1,14 @@
1
+ export declare const deserialize: (content: string) => any;
2
+ export declare const useArticles: () => {
3
+ deserialize: (content: string) => any;
4
+ requestor: import("../../models/Requestor").Requestor;
5
+ list: (filters?: Partial<any> | undefined) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any[]>>;
6
+ get: (id: string) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
7
+ create: (param: Partial<any>) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
8
+ } | {
9
+ deserialize: (content: string) => any;
10
+ requestor: import("../../models/Requestor").Requestor;
11
+ list: (filters?: Partial<any> | undefined) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any[]>>;
12
+ get: (id: string) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
13
+ create: (param: Partial<any>) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
14
+ };
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ Object.defineProperty(exports, "__esModule", { value: true });
25
+ exports.useArticles = exports.deserialize = void 0;
26
+ var html_1 = require("@slate-serializers/html");
27
+ var useBackend_1 = require("hooks/useBackend");
28
+ var deserialize = function (content) {
29
+ try {
30
+ var deserializedContent = JSON.parse(content);
31
+ if (Array.isArray(deserializedContent))
32
+ return (0, html_1.slateToHtml)(deserializedContent);
33
+ return deserializedContent;
34
+ }
35
+ catch (e) {
36
+ return content;
37
+ }
38
+ };
39
+ exports.deserialize = deserialize;
40
+ var useArticles = function () {
41
+ var endpoints = __rest((0, useBackend_1.useBackend)('articles'), []);
42
+ return __assign(__assign({}, endpoints), { deserialize: exports.deserialize });
43
+ };
44
+ exports.useArticles = useArticles;
45
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXJ0aWNsZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGdEQUFzRDtBQUN0RCwrQ0FBOEM7QUFFdkMsSUFBTSxXQUFXLEdBQUcsVUFBQyxPQUFlO0lBQ3pDLElBQUksQ0FBQztRQUNILElBQU0sbUJBQW1CLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUNoRCxJQUFHLEtBQUssQ0FBQyxPQUFPLENBQUMsbUJBQW1CLENBQUM7WUFBRSxPQUFPLElBQUEsa0JBQVcsRUFBQyxtQkFBbUIsQ0FBQyxDQUFDO1FBQy9FLE9BQU8sbUJBQW1CLENBQUM7SUFDN0IsQ0FBQztJQUFDLE9BQU8sQ0FBQyxFQUFFLENBQUM7UUFDWCxPQUFPLE9BQU8sQ0FBQztJQUNqQixDQUFDO0FBQ0gsQ0FBQyxDQUFBO0FBUlksUUFBQSxXQUFXLGVBUXZCO0FBRU0sSUFBTSxXQUFXLEdBQUc7SUFDekIsSUFBVyxTQUFTLFVBQUssSUFBQSx1QkFBVSxFQUFDLFVBQVUsQ0FBQyxFQUF6QyxFQUFnQixDQUF5QixDQUFDO0lBQ2hELDZCQUFZLFNBQVMsS0FBRSxXQUFXLHFCQUFBLElBQUc7QUFDdkMsQ0FBQyxDQUFDO0FBSFcsUUFBQSxXQUFXLGVBR3RCIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgc2xhdGVUb0h0bWwgfSBmcm9tICdAc2xhdGUtc2VyaWFsaXplcnMvaHRtbCc7XG5pbXBvcnQgeyB1c2VCYWNrZW5kIH0gZnJvbSAnaG9va3MvdXNlQmFja2VuZCc7XG5cbmV4cG9ydCBjb25zdCBkZXNlcmlhbGl6ZSA9IChjb250ZW50OiBzdHJpbmcpID0+IHtcbiAgdHJ5IHtcbiAgICBjb25zdCBkZXNlcmlhbGl6ZWRDb250ZW50ID0gSlNPTi5wYXJzZShjb250ZW50KTtcbiAgICBpZihBcnJheS5pc0FycmF5KGRlc2VyaWFsaXplZENvbnRlbnQpKSByZXR1cm4gc2xhdGVUb0h0bWwoZGVzZXJpYWxpemVkQ29udGVudCk7XG4gICAgcmV0dXJuIGRlc2VyaWFsaXplZENvbnRlbnQ7XG4gIH0gY2F0Y2ggKGUpIHtcbiAgICByZXR1cm4gY29udGVudDtcbiAgfVxufVxuXG5leHBvcnQgY29uc3QgdXNlQXJ0aWNsZXMgPSAoKSA9PiB7XG4gIGNvbnN0IHsgLi4uZW5kcG9pbnRzIH0gPSB1c2VCYWNrZW5kKCdhcnRpY2xlcycpO1xuICByZXR1cm4geyAuLi5lbmRwb2ludHMsIGRlc2VyaWFsaXplIH07XG59O1xuIl19
@@ -0,0 +1,14 @@
1
+ export declare const deserialize: (content: string) => any;
2
+ export declare const useArticles: () => {
3
+ deserialize: (content: string) => any;
4
+ requestor: import("../../models/Requestor").Requestor;
5
+ list: (filters?: Partial<any> | undefined) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any[]>>;
6
+ get: (id: string) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
7
+ create: (param: Partial<any>) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
8
+ } | {
9
+ deserialize: (content: string) => any;
10
+ requestor: import("../../models/Requestor").Requestor;
11
+ list: (filters?: Partial<any> | undefined) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any[]>>;
12
+ get: (id: string) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
13
+ create: (param: Partial<any>) => Promise<import("@wb/types/custom-response/custom-response.model").CustomResponse<any>>;
14
+ };
@@ -0,0 +1,40 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { slateToHtml } from '@slate-serializers/html';
24
+ import { useBackend } from 'hooks/useBackend';
25
+ export var deserialize = function (content) {
26
+ try {
27
+ var deserializedContent = JSON.parse(content);
28
+ if (Array.isArray(deserializedContent))
29
+ return slateToHtml(deserializedContent);
30
+ return deserializedContent;
31
+ }
32
+ catch (e) {
33
+ return content;
34
+ }
35
+ };
36
+ export var useArticles = function () {
37
+ var endpoints = __rest(useBackend('articles'), []);
38
+ return __assign(__assign({}, endpoints), { deserialize: deserialize });
39
+ };
40
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9zcmMvaG9va3MvdXNlQXJ0aWNsZXMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLE9BQU8sRUFBRSxXQUFXLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUN0RCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sa0JBQWtCLENBQUM7QUFFOUMsTUFBTSxDQUFDLElBQU0sV0FBVyxHQUFHLFVBQUMsT0FBZTtJQUN6QyxJQUFJLENBQUM7UUFDSCxJQUFNLG1CQUFtQixHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsT0FBTyxDQUFDLENBQUM7UUFDaEQsSUFBRyxLQUFLLENBQUMsT0FBTyxDQUFDLG1CQUFtQixDQUFDO1lBQUUsT0FBTyxXQUFXLENBQUMsbUJBQW1CLENBQUMsQ0FBQztRQUMvRSxPQUFPLG1CQUFtQixDQUFDO0lBQzdCLENBQUM7SUFBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1FBQ1gsT0FBTyxPQUFPLENBQUM7SUFDakIsQ0FBQztBQUNILENBQUMsQ0FBQTtBQUVELE1BQU0sQ0FBQyxJQUFNLFdBQVcsR0FBRztJQUN6QixJQUFXLFNBQVMsVUFBSyxVQUFVLENBQUMsVUFBVSxDQUFDLEVBQXpDLEVBQWdCLENBQXlCLENBQUM7SUFDaEQsNkJBQVksU0FBUyxLQUFFLFdBQVcsYUFBQSxJQUFHO0FBQ3ZDLENBQUMsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IHNsYXRlVG9IdG1sIH0gZnJvbSAnQHNsYXRlLXNlcmlhbGl6ZXJzL2h0bWwnO1xuaW1wb3J0IHsgdXNlQmFja2VuZCB9IGZyb20gJ2hvb2tzL3VzZUJhY2tlbmQnO1xuXG5leHBvcnQgY29uc3QgZGVzZXJpYWxpemUgPSAoY29udGVudDogc3RyaW5nKSA9PiB7XG4gIHRyeSB7XG4gICAgY29uc3QgZGVzZXJpYWxpemVkQ29udGVudCA9IEpTT04ucGFyc2UoY29udGVudCk7XG4gICAgaWYoQXJyYXkuaXNBcnJheShkZXNlcmlhbGl6ZWRDb250ZW50KSkgcmV0dXJuIHNsYXRlVG9IdG1sKGRlc2VyaWFsaXplZENvbnRlbnQpO1xuICAgIHJldHVybiBkZXNlcmlhbGl6ZWRDb250ZW50O1xuICB9IGNhdGNoIChlKSB7XG4gICAgcmV0dXJuIGNvbnRlbnQ7XG4gIH1cbn1cblxuZXhwb3J0IGNvbnN0IHVzZUFydGljbGVzID0gKCkgPT4ge1xuICBjb25zdCB7IC4uLmVuZHBvaW50cyB9ID0gdXNlQmFja2VuZCgnYXJ0aWNsZXMnKTtcbiAgcmV0dXJuIHsgLi4uZW5kcG9pbnRzLCBkZXNlcmlhbGl6ZSB9O1xufTtcbiJdfQ==
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@wbsuite/react-hooks","version":"1.0.13","description":"","main":"cjs/index.js","module":"esm/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","lint":"npx eslint src/**","build":"npm run build:esm && npm run build:cjs","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir dist/react-hooks/cjs","pre-publish":"npm run lint && rm -rf dist && npm run build && cp package*.json dist/react-hooks","publish-to-npm":"cd dist/react-hooks && npm publish --access public --registry=https://registry.npmjs.org/"},"author":"faluma@webbuilders.com.ar","license":"ISC","devDependencies":{"@wb/types":"^2.0.0","eslint":"^8.57.0","typescript":"^5.3.3","typescript-eslint":"^7.0.2","@eslint/js":"^8.57.0"},"dependencies":{"axios":"^1.6.7"}}
1
+ {"name":"@wbsuite/react-hooks","version":"1.0.14","description":"","main":"cjs/index.js","module":"esm/index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1","lint":"npx eslint src/**","build":"npm run build:esm && npm run build:cjs","build:esm":"tsc","build:cjs":"tsc --module commonjs --outDir dist/react-hooks/cjs","pre-publish":"npm run lint && rm -rf dist && npm run build && cp package*.json dist/react-hooks","publish-to-npm":"cd dist/react-hooks && npm publish --access public --registry=https://registry.npmjs.org/"},"author":"faluma@webbuilders.com.ar","license":"ISC","devDependencies":{"@eslint/js":"^8.57.0","@wb/types":"^2.0.0","eslint":"^8.57.0","typescript":"^5.3.3","typescript-eslint":"^7.0.2"},"dependencies":{"@slate-serializers/html":"^2.2.3","axios":"^1.6.7"}}