@lasterp/shared 1.0.0-beta.13 → 1.0.0-beta.15
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/dist/index.cjs +11 -3
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +11 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -235,7 +235,13 @@ var useFrappeGetCall = (method, params, options, type = "GET") => {
|
|
|
235
235
|
const queryKey = ["frappeCall", type, method, url];
|
|
236
236
|
const { data, error, isLoading, isFetching, refetch } = import_react_query2.useQuery({
|
|
237
237
|
queryKey,
|
|
238
|
-
queryFn: type === "GET" ?
|
|
238
|
+
queryFn: type === "GET" ? async () => {
|
|
239
|
+
const response = await call.get(method, params);
|
|
240
|
+
return response.message;
|
|
241
|
+
} : async () => {
|
|
242
|
+
const response = await call.post(method, params);
|
|
243
|
+
return response.message;
|
|
244
|
+
},
|
|
239
245
|
enabled: (options?.enabled ?? true) && !!method,
|
|
240
246
|
staleTime: options?.staleTime,
|
|
241
247
|
retry: options?.retry ?? false
|
|
@@ -542,10 +548,12 @@ var import_react14 = require("react");
|
|
|
542
548
|
var import_react_query11 = require("@tanstack/react-query");
|
|
543
549
|
var useFrappeGetMeta = (doctype, options) => {
|
|
544
550
|
const { url, call } = import_react14.useContext(FrappeContext);
|
|
545
|
-
const queryKey = ["meta", url, doctype];
|
|
546
551
|
const { data, error, isLoading, isFetching, refetch } = import_react_query11.useQuery({
|
|
547
552
|
queryKey: ["meta", url, doctype],
|
|
548
|
-
queryFn: () =>
|
|
553
|
+
queryFn: async () => {
|
|
554
|
+
const response = await call.get("lasterp.api.get_meta", { doctype });
|
|
555
|
+
return response.message;
|
|
556
|
+
},
|
|
549
557
|
enabled: !!doctype,
|
|
550
558
|
staleTime: options?.staleTime ?? Infinity,
|
|
551
559
|
retry: options?.retry ?? false
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface Item {
|
|
2
2
|
name: string;
|
|
3
|
+
image: string;
|
|
3
4
|
item_code: string;
|
|
4
5
|
item_name: string;
|
|
5
6
|
item_group: string;
|
|
@@ -153,6 +154,9 @@ interface TokenParams {
|
|
|
153
154
|
/** Type of token to be used for authentication */
|
|
154
155
|
type: "Bearer" | "token";
|
|
155
156
|
}
|
|
157
|
+
interface FrappeResult<T> {
|
|
158
|
+
message: T;
|
|
159
|
+
}
|
|
156
160
|
interface FrappeMeta {
|
|
157
161
|
fields: FrappeMetaField[];
|
|
158
162
|
permissions: {
|
|
@@ -166,6 +170,7 @@ interface FrappeMeta {
|
|
|
166
170
|
interface FrappeMetaField {
|
|
167
171
|
label: string;
|
|
168
172
|
fieldname: string;
|
|
173
|
+
in_list_view: boolean;
|
|
169
174
|
read_only: boolean;
|
|
170
175
|
set_only_once: boolean;
|
|
171
176
|
}
|
|
@@ -705,4 +710,4 @@ interface ProductContext {
|
|
|
705
710
|
}
|
|
706
711
|
import { camelize, decamelize, camelizeKeys, decamelizeKeys } from "humps";
|
|
707
712
|
declare function equalsIgnoreCase(str1: string, str2: string): boolean;
|
|
708
|
-
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, equalsIgnoreCase, decamelizeKeys, decamelize, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, Model, LocaleProvider, Item, Image, Hero, Header, Globals, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, Colour, Category, Brand, Block };
|
|
713
|
+
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, equalsIgnoreCase, decamelizeKeys, decamelize, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, Model, LocaleProvider, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, Colour, Category, Brand, Block };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
interface Item {
|
|
2
2
|
name: string;
|
|
3
|
+
image: string;
|
|
3
4
|
item_code: string;
|
|
4
5
|
item_name: string;
|
|
5
6
|
item_group: string;
|
|
@@ -153,6 +154,9 @@ interface TokenParams {
|
|
|
153
154
|
/** Type of token to be used for authentication */
|
|
154
155
|
type: "Bearer" | "token";
|
|
155
156
|
}
|
|
157
|
+
interface FrappeResult<T> {
|
|
158
|
+
message: T;
|
|
159
|
+
}
|
|
156
160
|
interface FrappeMeta {
|
|
157
161
|
fields: FrappeMetaField[];
|
|
158
162
|
permissions: {
|
|
@@ -166,6 +170,7 @@ interface FrappeMeta {
|
|
|
166
170
|
interface FrappeMetaField {
|
|
167
171
|
label: string;
|
|
168
172
|
fieldname: string;
|
|
173
|
+
in_list_view: boolean;
|
|
169
174
|
read_only: boolean;
|
|
170
175
|
set_only_once: boolean;
|
|
171
176
|
}
|
|
@@ -705,4 +710,4 @@ interface ProductContext {
|
|
|
705
710
|
}
|
|
706
711
|
import { camelize, decamelize, camelizeKeys, decamelizeKeys } from "humps";
|
|
707
712
|
declare function equalsIgnoreCase(str1: string, str2: string): boolean;
|
|
708
|
-
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, equalsIgnoreCase, decamelizeKeys, decamelize, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, Model, LocaleProvider, Item, Image, Hero, Header, Globals, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, Colour, Category, Brand, Block };
|
|
713
|
+
export { useVariantSelector, useSearch, useLocale, useFrappeUpdateDoc, useFrappePutCall, useFrappePrefetchDoc, useFrappePostCall, useFrappeGetMeta, useFrappeGetDocList, useFrappeGetDocCount, useFrappeGetDoc, useFrappeGetCall, useFrappeFileUpload, useFrappeEventListener, useFrappeDocumentEventListener, useFrappeDocTypeEventListener, useFrappeDeleteDoc, useFrappeDeleteCall, useFrappeCreateDoc, useFrappeAuth, equalsIgnoreCase, decamelizeKeys, decamelize, camelizeKeys, camelize, WorkspaceSidebarItem, WorkspaceSidebar, ViewerEventData, VariantSelectorResult, VariantSelectorProps, VariantSelectorOption, UseFrappeFileUploadReturnType, TopbarItem, Topbar, TokenParams, ShopContext, SearchResult, ScreenSpec, ProductVariant, ProductContext, Product, Page, NavbarSubItemGroup, NavbarSubItem, NavbarItem, Model, LocaleProvider, Item, Image, Hero, Header, Globals, FrappeResult, FrappeProviderProps, FrappeProvider, FrappeMutationResult, FrappeMetaField, FrappeMeta, FrappeFileUploadResponse, FrappeError, FrappeContext, FrappeConfig, FooterItemGroup, FooterItem, Footer, DocumentUpdateEventData, DocTypeListUpdateEventData, Colour, Category, Brand, Block };
|
package/dist/index.js
CHANGED
|
@@ -161,7 +161,13 @@ var useFrappeGetCall = (method, params, options, type = "GET") => {
|
|
|
161
161
|
const queryKey = ["frappeCall", type, method, url];
|
|
162
162
|
const { data, error, isLoading, isFetching, refetch } = useQuery2({
|
|
163
163
|
queryKey,
|
|
164
|
-
queryFn: type === "GET" ?
|
|
164
|
+
queryFn: type === "GET" ? async () => {
|
|
165
|
+
const response = await call.get(method, params);
|
|
166
|
+
return response.message;
|
|
167
|
+
} : async () => {
|
|
168
|
+
const response = await call.post(method, params);
|
|
169
|
+
return response.message;
|
|
170
|
+
},
|
|
165
171
|
enabled: (options?.enabled ?? true) && !!method,
|
|
166
172
|
staleTime: options?.staleTime,
|
|
167
173
|
retry: options?.retry ?? false
|
|
@@ -470,10 +476,12 @@ import { useContext as useContext12 } from "react";
|
|
|
470
476
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
471
477
|
var useFrappeGetMeta = (doctype, options) => {
|
|
472
478
|
const { url, call } = useContext12(FrappeContext);
|
|
473
|
-
const queryKey = ["meta", url, doctype];
|
|
474
479
|
const { data, error, isLoading, isFetching, refetch } = useQuery6({
|
|
475
480
|
queryKey: ["meta", url, doctype],
|
|
476
|
-
queryFn: () =>
|
|
481
|
+
queryFn: async () => {
|
|
482
|
+
const response = await call.get("lasterp.api.get_meta", { doctype });
|
|
483
|
+
return response.message;
|
|
484
|
+
},
|
|
477
485
|
enabled: !!doctype,
|
|
478
486
|
staleTime: options?.staleTime ?? Infinity,
|
|
479
487
|
retry: options?.retry ?? false
|