bt-core-app 1.1.4 → 1.1.6

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.
Files changed (42) hide show
  1. package/dist/bt-core-app.js +16462 -21769
  2. package/dist/index.d.ts +40 -13
  3. package/package.json +2 -1
  4. package/src/composables/api.ts +1 -1
  5. package/src/composables/document-meta.ts +5 -1
  6. package/src/composables/list.ts +5 -5
  7. package/src/composables/navigation.ts +1 -1
  8. package/src/composables/rules.ts +1 -1
  9. package/src/composables/stores.ts +1 -1
  10. package/src/index.ts +46 -13
  11. package/vite.config.ts +9 -1
  12. package/dist/components/BT-Span.vue.d.ts +0 -17
  13. package/dist/components/Dialog-Confirm.vue.d.ts +0 -38
  14. package/dist/components/Dialog-Select-Date.vue.d.ts +0 -36
  15. package/dist/components/Dialog-Select.vue.d.ts +0 -48
  16. package/dist/components/Dialog-Text.vue.d.ts +0 -33
  17. package/dist/composables/actions-tracker.d.ts +0 -19
  18. package/dist/composables/actions.d.ts +0 -79
  19. package/dist/composables/api.d.ts +0 -85
  20. package/dist/composables/auth.d.ts +0 -58
  21. package/dist/composables/cosmetics.d.ts +0 -34
  22. package/dist/composables/csv.d.ts +0 -20
  23. package/dist/composables/dates.d.ts +0 -14
  24. package/dist/composables/demo.d.ts +0 -8
  25. package/dist/composables/dialogs.d.ts +0 -75
  26. package/dist/composables/document-meta.d.ts +0 -10
  27. package/dist/composables/draggable.d.ts +0 -56
  28. package/dist/composables/filters.d.ts +0 -10
  29. package/dist/composables/forage.d.ts +0 -7
  30. package/dist/composables/helpers.d.ts +0 -102
  31. package/dist/composables/id.d.ts +0 -1
  32. package/dist/composables/navigation.d.ts +0 -89
  33. package/dist/composables/presets.d.ts +0 -7
  34. package/dist/composables/pwa.d.ts +0 -13
  35. package/dist/composables/resizable.d.ts +0 -35
  36. package/dist/composables/rules.d.ts +0 -8
  37. package/dist/composables/stores.d.ts +0 -100
  38. package/dist/composables/track.d.ts +0 -12
  39. package/dist/composables/urls.d.ts +0 -7
  40. package/dist/core.d.ts +0 -18
  41. package/dist/types.d.ts +0 -11
  42. package/dist/useApi.d.ts +0 -30
package/dist/index.d.ts CHANGED
@@ -1,16 +1,43 @@
1
- export * from './composables/actions-tracker';
2
- export * from './composables/actions';
3
- export * from './composables/demo';
4
- export * from './composables/document-meta';
1
+ export { useActionsTracker } from './composables/actions-tracker';
2
+ export type { BTActions, GetOptions, DeleteOptions, RestoreOptions, SaveOptions, ApiActionOptions, UseActionsOptions } from './composables/actions';
3
+ export { useActions } from './composables/actions';
4
+ export type { BTApi, UseApiOptions, PathOptions, QueryParams } from './composables/api';
5
+ export { createApi } from './composables/api';
6
+ export type { BTAuth, AuthItem, AuthSubscription, BaseAuthCredentials, CreateAuthOptions } from './composables/auth';
7
+ export { createAuth } from './composables/auth';
8
+ export type { BTCosmetics, BaseCosmeticTheme, UseCosmeticsOptions } from './composables/cosmetics';
9
+ export { createCosmetics } from './composables/cosmetics';
10
+ export * from './composables/csv';
11
+ export type { BTDates, CreateDatesOptions } from './composables/dates';
12
+ export { createDates } from './composables/dates';
13
+ export type { BTDemo } from './composables/demo';
14
+ export { createDemo } from './composables/demo';
15
+ export * from './composables/dialogs';
16
+ export type { BTDocumentMeta, UseDocumentMetaOptions } from './composables/document-meta';
17
+ export { useDocumentMeta } from './composables/document-meta';
5
18
  export * from './composables/draggable';
6
- export * from './composables/forage';
19
+ export type { BTFilters, UseFiltersOptions } from './composables/filters';
20
+ export { createFilters } from './composables/filters';
21
+ export { useLocalDb, useLocalCache } from './composables/forage';
7
22
  export * from './composables/helpers';
8
- export * from './composables/id';
9
- export * from './composables/list';
23
+ export { useId } from './composables/id';
24
+ export type { TableColumn, CustomFilterParam, ListEvents, ListProps, GroupedHeaderOption, UseListOptions } from './composables/list';
25
+ export { useList } from './composables/list';
26
+ export type { BTNavigation, ExternalParty, ExternalNavigation, NavigationItem, UseNavigationOptions } from './composables/navigation';
27
+ export { createNavigation } from './composables/navigation';
28
+ export type { BTPresets, CreatePresetsOptions } from './composables/presets';
29
+ export { createPresets } from './composables/presets';
30
+ export type { BTPWA, SWEvent } from './composables/pwa';
31
+ export { createPWA } from './composables/pwa';
10
32
  export * from './composables/resizable';
11
- export * from './composables/rules';
12
- export * from './composables/stores';
13
- export * from './composables/track';
14
- export * from './composables/urls';
15
- export * from './useApi';
16
- export * from './core';
33
+ export type { UseRulesOptions } from './composables/rules';
34
+ export { useRules } from './composables/rules';
35
+ export type { BTStore, StoreMode, StorageMode, LocalMeta, LocallyStoredItem, StoreGetAllReturn, StoreGetReturn, UseStoreOptions, CreateStoreBuilderOptions, CreateStoreOptions } from './composables/stores';
36
+ export { createStoreBuilder, createStore, createWholeLastUpdateStore, createSessionStore } from './composables/stores';
37
+ export type { UseTrackerOptions } from './composables/track';
38
+ export { useTracker } from './composables/track';
39
+ export { useUrl } from './composables/urls';
40
+ export { useApi, useAuth, useCosmetics, useDates, useDemo, useFilters, useNavigation, usePresets, usePWA, useStore } from './useApi';
41
+ export * from './types';
42
+ export type { CoreApp, CreateCoreOptions } from './core';
43
+ export { createCore } from './core';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "bt-core-app",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Core app tools for some basic features like navigation, authentication, server apis, and cosmetics",
5
5
  "homepage": "https://github.com/BlitzItTech/bt-core",
6
6
  "bugs": {
7
7
  "url": "https://github.com/BlitzItTech/bt-core/issues"
8
8
  },
9
9
  "type": "module",
10
+ "types": "./dist/index.d.ts",
10
11
  "scripts": {
11
12
  "dev": "vite",
12
13
  "build": "vue-tsc && vite build",
@@ -58,7 +58,7 @@ type FindPath = (navName?: string) => string | undefined
58
58
  // type BuildQuery = (params: any) => string
59
59
  // type BuildUrl = (path: PathOptions) => string
60
60
 
61
- interface UseApiOptions {
61
+ export interface UseApiOptions {
62
62
  auth?: BTAuth
63
63
  /**overrides the default */
64
64
  buildHeaders?: (path: PathOptions) => HeadersInit
@@ -6,8 +6,12 @@ export interface UseDocumentMetaOptions {
6
6
  demo?: BTDemo
7
7
  }
8
8
 
9
+ export interface BTDocumentMeta {
10
+ updateMeta: (to: RouteLocationNormalized) => void
11
+ }
12
+
9
13
  /**routes with meta object */
10
- export function useDocumentMeta(options?: UseDocumentMetaOptions) {
14
+ export function useDocumentMeta(options?: UseDocumentMetaOptions): BTDocumentMeta {
11
15
 
12
16
  function updateMeta(to: RouteLocationNormalized) {
13
17
  const nearestWithTitle = to.matched.slice().reverse().find(r => r.meta && r.meta.title);
@@ -9,6 +9,11 @@ import { useArrayDifference, useArrayUnique, watchArray, watchDebounced } from '
9
9
  import { useActions } from '@/composables/actions'
10
10
  import { StorageMode, StoreMode, useStore } from '../index'
11
11
 
12
+ export interface RefreshOptions {
13
+ deepRefresh?: boolean,
14
+ resetSearch?: boolean
15
+ }
16
+
12
17
  export interface TableColumn {
13
18
  align?: 'start' | 'end' | 'center'
14
19
  csv?: boolean,
@@ -412,11 +417,6 @@ export function useList(props: ListProps, emit?: ListEvents, options?: UseListOp
412
417
  }
413
418
  }
414
419
 
415
- interface RefreshOptions {
416
- deepRefresh?: boolean,
417
- resetSearch?: boolean
418
- }
419
-
420
420
  async function refresh(options?: RefreshOptions) {
421
421
  showError.value = false
422
422
 
@@ -94,7 +94,7 @@ export interface BTNavigation {
94
94
  updateNavigationProperties: (navName?: string | NavigationItem) => void
95
95
  }
96
96
 
97
- interface UseNavigationOptions {
97
+ export interface UseNavigationOptions {
98
98
  defaultCacheExpiryHours?: number
99
99
  navItems?: NavigationItem[]
100
100
  }
@@ -1,6 +1,6 @@
1
1
  import { validEmail } from '@/composables/helpers'
2
2
 
3
- interface UseRulesOptions {
3
+ export interface UseRulesOptions {
4
4
  forEmail?: boolean
5
5
  forPassword?: boolean
6
6
  otherRules?: any
@@ -50,7 +50,7 @@ export interface ApiError {
50
50
  message: string
51
51
  }
52
52
 
53
- interface UseStoreOptions {
53
+ export interface UseStoreOptions {
54
54
  /**ideally required. Otherwise will struggle to find url path */
55
55
  api?: BTApi
56
56
  /**ideally required. For setting unique local storage keys */
package/src/index.ts CHANGED
@@ -1,16 +1,49 @@
1
- export * from './composables/actions-tracker'
2
- export * from './composables/actions'
3
- export * from './composables/demo'
4
- export * from './composables/document-meta'
1
+ export { useActionsTracker } from './composables/actions-tracker'
2
+ export type { BTActions, GetOptions, DeleteOptions, RestoreOptions, SaveOptions, ApiActionOptions, UseActionsOptions } from './composables/actions'
3
+ export { useActions } from './composables/actions'
4
+ export type { BTApi, UseApiOptions, PathOptions, QueryParams } from './composables/api'
5
+ export { createApi } from './composables/api'
6
+ export type { BTAuth, AuthItem, AuthSubscription, BaseAuthCredentials, CreateAuthOptions } from './composables/auth'
7
+ export { createAuth } from './composables/auth'
8
+ export type { BTCosmetics, BaseCosmeticTheme, UseCosmeticsOptions } from './composables/cosmetics'
9
+ export { createCosmetics } from './composables/cosmetics'
10
+ export * from './composables/csv'
11
+ export type { BTDates, CreateDatesOptions } from './composables/dates'
12
+ export { createDates } from './composables/dates'
13
+ export type { BTDemo } from './composables/demo'
14
+ export { createDemo } from './composables/demo'
15
+ export * from './composables/dialogs'
16
+ export type { BTDocumentMeta, UseDocumentMetaOptions } from './composables/document-meta'
17
+ export { useDocumentMeta } from './composables/document-meta'
5
18
  export * from './composables/draggable'
6
- export * from './composables/forage'
19
+ export type { BTFilters, UseFiltersOptions } from './composables/filters'
20
+ export { createFilters } from './composables/filters'
21
+ export { useLocalDb, useLocalCache } from './composables/forage'
7
22
  export * from './composables/helpers'
8
- export * from './composables/id'
9
- export * from './composables/list'
23
+ export { useId } from './composables/id'
24
+ export type { TableColumn, CustomFilterParam, ListEvents, ListProps, GroupedHeaderOption, UseListOptions } from './composables/list'
25
+ export { useList } from './composables/list'
26
+ export type { BTNavigation, ExternalParty, ExternalNavigation, NavigationItem, UseNavigationOptions } from './composables/navigation'
27
+ export { createNavigation } from './composables/navigation'
28
+ export type { BTPresets, CreatePresetsOptions } from './composables/presets'
29
+ export { createPresets } from './composables/presets'
30
+ export type { BTPWA, SWEvent } from './composables/pwa'
31
+ export { createPWA } from './composables/pwa'
10
32
  export * from './composables/resizable'
11
- export * from './composables/rules'
12
- export * from './composables/stores'
13
- export * from './composables/track'
14
- export * from './composables/urls'
15
- export * from './useApi'
16
- export * from './core'
33
+ export type { UseRulesOptions } from './composables/rules'
34
+ export { useRules } from './composables/rules'
35
+ export type { BTStore, StoreMode, StorageMode, LocalMeta, LocallyStoredItem, StoreGetAllReturn, StoreGetReturn, UseStoreOptions, CreateStoreBuilderOptions, CreateStoreOptions } from './composables/stores'
36
+ export { createStoreBuilder, createStore, createWholeLastUpdateStore, createSessionStore } from './composables/stores'
37
+ export type { UseTrackerOptions } from './composables/track'
38
+ export { useTracker } from './composables/track'
39
+ export { useUrl } from './composables/urls'
40
+ export { useApi, useAuth, useCosmetics, useDates, useDemo, useFilters, useNavigation, usePresets, usePWA, useStore } from './useApi'
41
+ export * from './types'
42
+ export type { CoreApp, CreateCoreOptions } from './core'
43
+ export { createCore } from './core'
44
+
45
+
46
+ // import BTBtn from './components/BT-Btn.vue'
47
+ // import BTCol from './components/BT-Col.vue'
48
+
49
+ // export { BTBtn, BTCol }
package/vite.config.ts CHANGED
@@ -15,11 +15,19 @@ export default defineConfig({
15
15
  lib: {
16
16
  entry: path.resolve(__dirname, './src/index.ts'),
17
17
  formats: ['es']
18
+ },
19
+ rollupOptions: {
20
+ external: ['vue', 'vuetify'],
21
+ output: {
22
+ globals: {
23
+ vue: 'Vue'
24
+ }
25
+ }
18
26
  }
19
27
  },
20
28
  plugins: [
21
29
  vue(),
22
- dts({ include: ['src'] })
30
+ dts({ include: path.resolve(__dirname, './src/index.ts') })
23
31
  ],
24
32
  resolve: {
25
33
  alias: {
@@ -1,17 +0,0 @@
1
- interface Props {
2
- filter: string;
3
- prefix?: string;
4
- suffix?: string;
5
- value: any;
6
- }
7
- declare const _default: import('vue').DefineComponent<__VLS_TypePropsToRuntimeProps<Props>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<Props>>>, {}, {}>;
8
- export default _default;
9
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
10
- type __VLS_TypePropsToRuntimeProps<T> = {
11
- [K in keyof T]-?: {} extends Pick<T, K> ? {
12
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
13
- } : {
14
- type: import('vue').PropType<T[K]>;
15
- required: true;
16
- };
17
- };
@@ -1,38 +0,0 @@
1
- import { ConfirmDialogProps } from '../composables/dialogs';
2
-
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ConfirmDialogProps>, {
4
- cancelValue: boolean;
5
- confirmValue: boolean;
6
- startIncludeDetails: boolean;
7
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- cancel: (...args: any[]) => void;
9
- confirm: (...args: any[]) => void;
10
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ConfirmDialogProps>, {
11
- cancelValue: boolean;
12
- confirmValue: boolean;
13
- startIncludeDetails: boolean;
14
- }>>> & {
15
- onCancel?: ((...args: any[]) => any) | undefined;
16
- onConfirm?: ((...args: any[]) => any) | undefined;
17
- }, {
18
- cancelValue: any;
19
- confirmValue: any;
20
- }, {}>;
21
- export default _default;
22
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
23
- type __VLS_TypePropsToRuntimeProps<T> = {
24
- [K in keyof T]-?: {} extends Pick<T, K> ? {
25
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
26
- } : {
27
- type: import('vue').PropType<T[K]>;
28
- required: true;
29
- };
30
- };
31
- type __VLS_WithDefaults<P, D> = {
32
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
33
- default: D[K];
34
- }> : P[K];
35
- };
36
- type __VLS_Prettify<T> = {
37
- [K in keyof T]: T[K];
38
- } & {};
@@ -1,36 +0,0 @@
1
- import { SelectDateProps } from '../composables/dialogs';
2
-
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDateProps>, {
4
- cancelValue: boolean;
5
- height: string;
6
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
7
- cancel: (...args: any[]) => void;
8
- confirm: (...args: any[]) => void;
9
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDateProps>, {
10
- cancelValue: boolean;
11
- height: string;
12
- }>>> & {
13
- onCancel?: ((...args: any[]) => any) | undefined;
14
- onConfirm?: ((...args: any[]) => any) | undefined;
15
- }, {
16
- height: string;
17
- cancelValue: any;
18
- }, {}>;
19
- export default _default;
20
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
21
- type __VLS_TypePropsToRuntimeProps<T> = {
22
- [K in keyof T]-?: {} extends Pick<T, K> ? {
23
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
24
- } : {
25
- type: import('vue').PropType<T[K]>;
26
- required: true;
27
- };
28
- };
29
- type __VLS_WithDefaults<P, D> = {
30
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
31
- default: D[K];
32
- }> : P[K];
33
- };
34
- type __VLS_Prettify<T> = {
35
- [K in keyof T]: T[K];
36
- } & {};
@@ -1,48 +0,0 @@
1
- import { SelectDialogProps } from '../composables/dialogs';
2
-
3
- declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDialogProps>, {
4
- cancelValue: boolean;
5
- height: string;
6
- showSearch: boolean;
7
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- cancel: (...args: any[]) => void;
9
- confirm: (...args: any[]) => void;
10
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<SelectDialogProps>, {
11
- cancelValue: boolean;
12
- height: string;
13
- showSearch: boolean;
14
- }>>> & {
15
- onCancel?: ((...args: any[]) => any) | undefined;
16
- onConfirm?: ((...args: any[]) => any) | undefined;
17
- }, {
18
- height: string;
19
- cancelValue: any;
20
- showSearch: boolean;
21
- }, {}>, {
22
- default?(_: {
23
- item: any;
24
- }): any;
25
- }>;
26
- export default _default;
27
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
28
- type __VLS_TypePropsToRuntimeProps<T> = {
29
- [K in keyof T]-?: {} extends Pick<T, K> ? {
30
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
31
- } : {
32
- type: import('vue').PropType<T[K]>;
33
- required: true;
34
- };
35
- };
36
- type __VLS_WithDefaults<P, D> = {
37
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
38
- default: D[K];
39
- }> : P[K];
40
- };
41
- type __VLS_Prettify<T> = {
42
- [K in keyof T]: T[K];
43
- } & {};
44
- type __VLS_WithTemplateSlots<T, S> = T & {
45
- new (): {
46
- $slots: S;
47
- };
48
- };
@@ -1,33 +0,0 @@
1
- import { TextDialogProps } from '../composables/dialogs';
2
-
3
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TextDialogProps>, {
4
- height: string;
5
- }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
6
- cancel: (...args: any[]) => void;
7
- confirm: (...args: any[]) => void;
8
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<TextDialogProps>, {
9
- height: string;
10
- }>>> & {
11
- onCancel?: ((...args: any[]) => any) | undefined;
12
- onConfirm?: ((...args: any[]) => any) | undefined;
13
- }, {
14
- height: string;
15
- }, {}>;
16
- export default _default;
17
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
18
- type __VLS_TypePropsToRuntimeProps<T> = {
19
- [K in keyof T]-?: {} extends Pick<T, K> ? {
20
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
21
- } : {
22
- type: import('vue').PropType<T[K]>;
23
- required: true;
24
- };
25
- };
26
- type __VLS_WithDefaults<P, D> = {
27
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
28
- default: D[K];
29
- }> : P[K];
30
- };
31
- type __VLS_Prettify<T> = {
32
- [K in keyof T]: T[K];
33
- } & {};
@@ -1,19 +0,0 @@
1
- import { ShallowRef } from 'vue';
2
-
3
- export interface DoActionOptions {
4
- completionMsg?: string;
5
- confirmationMsg?: string;
6
- errorMsg?: string;
7
- loadingMsg?: string;
8
- requireConfirmation?: boolean;
9
- throwError?: boolean;
10
- }
11
- export declare function useActionsTracker(useOptions?: DoActionOptions): {
12
- actionErrorMsg: ShallowRef<string | undefined>;
13
- actionLoadingMsg: ShallowRef<string | undefined>;
14
- actionCompleteMsg: ShallowRef<string | undefined>;
15
- clearErrors: () => void;
16
- doAction: (action: any, options?: DoActionOptions) => Promise<any>;
17
- isLoading: import('vue').ComputedRef<boolean>;
18
- logError: (err?: string | Error) => void;
19
- };
@@ -1,79 +0,0 @@
1
- import { ShallowRef, ComputedRef } from 'vue';
2
- import { DoActionOptions } from './actions-tracker';
3
- import { BTApi, PathOptions } from './api';
4
- import { BTStore } from './stores';
5
- import { BladeMode } from '../types';
6
-
7
- export type OnCanDoAsync = (item: any) => Promise<string | undefined>;
8
- export type OnDoAsync = (item: any) => Promise<string | undefined>;
9
- export type OnDoSuccessAsync = (item: any) => Promise<any>;
10
- export type OnGetAsync = (opt?: GetOptions) => Promise<any>;
11
- export type OnGetSuccessAsync = (item: any, opt?: GetOptions) => Promise<any>;
12
- export interface GetOptions extends PathOptions, DoActionOptions {
13
- /**returns an error msg if failed */
14
- onGetAsync?: OnGetAsync;
15
- /**called after get occurs successfully */
16
- onGetSuccessAsync?: OnGetSuccessAsync;
17
- store?: BTStore;
18
- }
19
- export interface DeleteOptions extends PathOptions, DoActionOptions {
20
- /**Returns a string if cannot */
21
- onCanDeleteAsync?: OnCanDoAsync;
22
- /**Will override the default store delete action */
23
- onDeleteAsync?: OnDoAsync;
24
- /**Will open a dialog box requesting user confirmation for delete action */
25
- onDeleteSuccessAsync?: OnDoAsync;
26
- store?: BTStore;
27
- }
28
- export interface RestoreOptions extends PathOptions, DoActionOptions {
29
- /**Returns a string if cannot */
30
- onCanRestoreAsync?: OnCanDoAsync;
31
- /**Will override the default store delete action */
32
- onRestoreAsync?: OnDoSuccessAsync;
33
- /**Called after restore succeeds */
34
- onRestoreSuccessAsync?: OnDoSuccessAsync;
35
- store?: BTStore;
36
- }
37
- export interface SaveOptions extends PathOptions, DoActionOptions {
38
- /**will seek to post if 'new' otherwise will patch */
39
- mode?: BladeMode;
40
- /**called to check whether to proceed with save */
41
- onCanSaveAsync?: OnCanDoAsync;
42
- /**
43
- * retrieves item to save
44
- * called before seeing whether it can save
45
- */
46
- onGetSaveAsync?: OnDoSuccessAsync;
47
- /**Will override the default store post/patch action */
48
- onSaveAsync?: OnDoSuccessAsync;
49
- /**Called after save succeeds */
50
- onSaveSuccessAsync?: OnDoSuccessAsync;
51
- store?: BTStore;
52
- }
53
- export interface ApiActionOptions extends PathOptions, DoActionOptions {
54
- api: BTApi;
55
- }
56
- export interface UseActionsOptions extends DoActionOptions {
57
- nav?: string;
58
- proxyID?: string;
59
- refresh?: boolean;
60
- store?: BTStore;
61
- throwError?: boolean;
62
- url?: string;
63
- }
64
- export interface BTActions {
65
- apiGet: (doOptions: ApiActionOptions) => Promise<any>;
66
- apiPost: (doOptions: ApiActionOptions) => Promise<any>;
67
- actionLoadingMsg: ShallowRef<string | undefined>;
68
- actionErrorMsg: ShallowRef<string | undefined>;
69
- clearErrors: () => void;
70
- deleteItem: (doOptions: DeleteOptions) => Promise<any>;
71
- doAction: (action: any, options?: DoActionOptions) => Promise<any>;
72
- getAllItems: (doOptions: GetOptions) => Promise<any>;
73
- getItem: (doOptions: GetOptions) => Promise<any>;
74
- isLoading: ComputedRef<boolean>;
75
- logError: (err?: string | Error) => void;
76
- restoreItem: (doOptions: RestoreOptions) => Promise<any>;
77
- saveItem: (doOptions: SaveOptions) => Promise<any>;
78
- }
79
- export declare function useActions(options?: UseActionsOptions): BTActions;
@@ -1,85 +0,0 @@
1
- import { BTAuth } from './auth';
2
-
3
- export interface QueryParams {
4
- filterBy?: string;
5
- includeCount?: boolean;
6
- includeDetails?: boolean;
7
- includeInactive?: boolean;
8
- lastUpdate?: string;
9
- other?: any;
10
- properties?: string[] | string;
11
- query?: string;
12
- searchString?: string;
13
- sortOrder?: string;
14
- sortBy?: string;
15
- takeFrom?: number;
16
- takeAmount?: number;
17
- }
18
- export interface PathOptions {
19
- /**always added to end before query {url}/{additionalUrl}?{query} */
20
- additionalUrl?: string;
21
- /**application/json or other options */
22
- contentType?: string;
23
- /**that data to send in the body for POST, PATCH, and DELETE requests */
24
- data?: any;
25
- /** resulting url after building {nav | url}/{additionalUrl}?{params} */
26
- finalUrl?: string;
27
- /**override default headers */
28
- headers?: HeadersInit;
29
- /**id will be added as a url paramter (/{id}?) rather than as a query parameter */
30
- id?: string;
31
- /**where to find the url */
32
- nav?: string;
33
- /**headers will not be calculated. Only the given headers in these options will be used */
34
- overrideHeaders?: boolean;
35
- /**query parameters */
36
- params?: QueryParams;
37
- /**attaches a proxyID to the request */
38
- proxyID?: string;
39
- /**whether to refresh the store data and go straight to the server */
40
- refresh?: boolean;
41
- /**returns result as a json object. Defaults to true. */
42
- returnJson?: boolean;
43
- /**returns result as a string */
44
- returnText?: boolean;
45
- /**If false, returns response no matter the status code */
46
- throwError?: boolean;
47
- /**if exists then overrides default nav */
48
- url?: string;
49
- /**whether to preference using the local cache */
50
- useLocalCache?: boolean;
51
- }
52
- type FindPath = (navName?: string) => string | undefined;
53
- interface UseApiOptions {
54
- auth?: BTAuth;
55
- /**overrides the default */
56
- buildHeaders?: (path: PathOptions) => HeadersInit;
57
- /**build a query. Overrides the default */
58
- buildQuery?: (params: any) => string;
59
- /**overrides the default */
60
- buildUrl?: (path: PathOptions) => string;
61
- /**defaults to 'application/json' */
62
- defaultContentType?: string;
63
- /**returns result as a json object. Defaults to true. */
64
- defaultReturnJson?: boolean;
65
- /**returns result as a string */
66
- defaultReturnText?: boolean;
67
- /**defaults to true. Will throw an error on fail */
68
- defaultThrowError?: boolean;
69
- /**defaults to a function that returns '' */
70
- findPath?: FindPath;
71
- /**if true and logged in then will set an authorization header with 'bearer [token]' */
72
- useBearerToken?: boolean;
73
- }
74
- export interface BTApi {
75
- buildHeaders: (options: PathOptions) => HeadersInit;
76
- buildQuery: (params: any) => string;
77
- buildUrl: (path: PathOptions) => string;
78
- deleteItem: (pathOptions: PathOptions) => Promise<string | undefined>;
79
- get: <T>(pathOptions: PathOptions) => Promise<T>;
80
- getAll: <T>(pathOptions: PathOptions) => Promise<T>;
81
- post: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
82
- patch: <T>(pathOptions: PathOptions) => Promise<T | undefined>;
83
- }
84
- export declare function createApi(options?: UseApiOptions): BTApi;
85
- export {};
@@ -1,58 +0,0 @@
1
- import { BTDemo } from './demo';
2
- import { RemovableRef } from '@vueuse/core';
3
-
4
- export interface AuthItem {
5
- children?: AuthItem[];
6
- ignoreSuspension?: boolean;
7
- permissions?: string[];
8
- requiresAuth?: boolean;
9
- subscriptions?: string[];
10
- }
11
- export interface AuthSubscription {
12
- code: string;
13
- value: number;
14
- }
15
- export interface BaseAuthCredentials {
16
- expiresOn?: string;
17
- isGlobalAdmin?: boolean;
18
- isLoggedIn?: boolean;
19
- isSuspended?: boolean;
20
- permissions?: string;
21
- subscriptionCode?: string;
22
- timeZone?: string;
23
- token?: string;
24
- userID?: string;
25
- userPermissions?: string[];
26
- }
27
- export type GetAuthUrl = (redirectPath?: string, state?: string) => string;
28
- export interface CreateAuthOptions {
29
- defaultTimeZone?: string;
30
- demo?: BTDemo;
31
- /**expiry token date format. Defaults to 'd/MM/yyyy h:mm:ss a' */
32
- expiryTokenFormat?: string;
33
- /**retrieve the auth item */
34
- getAuthItem: (navName?: string | AuthItem) => AuthItem | null;
35
- /**retrieve the url to navigate to for the OAuth 2.0 process */
36
- getAuthUrl: GetAuthUrl;
37
- /**sets current credentials on top of default function*/
38
- setCredentials?: (state: RemovableRef<any>, payload: any) => void;
39
- /**suboptions */
40
- subscriptionOptions?: AuthSubscription[];
41
- }
42
- export interface BTAuth {
43
- authState: string;
44
- canEdit: (navName?: string) => boolean;
45
- canEditPermit: (permit: string) => boolean;
46
- canView: (navName?: string) => boolean;
47
- canViewPermit: (permit: string) => boolean;
48
- credentials: any;
49
- doShow: (subcodes?: string[], permissions?: string[], action?: 'view' | 'edit') => boolean;
50
- doShowByNav: (navName?: string | AuthItem, includeChildren?: boolean) => boolean;
51
- getAuthUrl: (redirectPath?: string) => string;
52
- getTimeZone: () => string;
53
- login: (redirectPath?: string) => void;
54
- logout: (navNameRedirect?: string) => void;
55
- setAuth: (jwtToken?: string) => void;
56
- tryLogin: () => boolean | undefined;
57
- }
58
- export declare function createAuth(options: CreateAuthOptions): BTAuth;