@svadmin/core 0.5.1 → 0.5.5
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/package.json +3 -3
- package/src/{data-transfer.ts → data-transfer.svelte.ts} +1 -1
- package/src/form-hooks.svelte.ts +1 -1
- package/src/hook-utils.svelte.ts +1 -1
- package/src/hooks.svelte.ts +2 -2
- package/src/index.ts +5 -5
- package/src/live-sse.ts +1 -1
- package/src/live-websocket.ts +1 -1
- package/src/live.test.ts +1 -1
- package/src/mutation-hooks.svelte.ts +1 -1
- package/src/query-hooks.svelte.ts +2 -2
- package/src/routing-hooks.svelte.ts +1 -1
- package/src/table-hooks.svelte.ts +1 -1
- package/src/table-state.svelte.ts +1 -1
- package/src/utility-hooks.svelte.ts +1 -1
- /package/src/{live.ts → live.svelte.ts} +0 -0
- /package/src/{useParsed.ts → useParsed.svelte.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/core",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Core SDK — hooks, types, context, i18n, permissions, router",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"default": "./src/audit.ts"
|
|
36
36
|
},
|
|
37
37
|
"./live": {
|
|
38
|
-
"types": "./src/live.ts",
|
|
39
|
-
"default": "./src/live.ts"
|
|
38
|
+
"types": "./src/live.svelte.ts",
|
|
39
|
+
"default": "./src/live.svelte.ts"
|
|
40
40
|
},
|
|
41
41
|
"./theme": {
|
|
42
42
|
"types": "./src/theme.svelte.ts",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDataProviderForResource } from './context.svelte';
|
|
2
|
-
import { useParsed } from './useParsed';
|
|
2
|
+
import { useParsed } from './useParsed.svelte';
|
|
3
3
|
import type { GetListResult, Sort, Filter, BaseRecord } from './types';
|
|
4
4
|
|
|
5
5
|
export interface UseExportOptions<TData extends BaseRecord = BaseRecord> {
|
package/src/form-hooks.svelte.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQueryClient } from '@tanstack/svelte-query';
|
|
2
|
-
import { useParsed } from './useParsed';
|
|
2
|
+
import { useParsed } from './useParsed.svelte';
|
|
3
3
|
import { getAdminOptions } from './options';
|
|
4
4
|
import { getDataProviderForResource } from './context.svelte';
|
|
5
5
|
import { createQuery, createMutation } from '@tanstack/svelte-query';
|
package/src/hook-utils.svelte.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Uses Svelte 5 runes ($state, $effect) for automatic lifecycle management
|
|
3
3
|
|
|
4
4
|
import { useQueryClient } from '@tanstack/svelte-query';
|
|
5
|
-
import type { LiveProvider, LiveEvent, LiveMode } from './live';
|
|
5
|
+
import type { LiveProvider, LiveEvent, LiveMode } from './live.svelte';
|
|
6
6
|
import { toast } from './toast.svelte';
|
|
7
7
|
|
|
8
8
|
// ─── Overtime Tracker ───────────────────────────────────────────
|
package/src/hooks.svelte.ts
CHANGED
|
@@ -24,11 +24,11 @@ export type { OvertimeResult, OvertimeOptions, NotificationConfig } from './hook
|
|
|
24
24
|
import { createQuery, createInfiniteQuery, createMutation, useQueryClient } from '@tanstack/svelte-query';
|
|
25
25
|
import { getAdminOptions } from './options';
|
|
26
26
|
import { getDataProviderForResource, getDataProvider } from './context.svelte';
|
|
27
|
-
import { useParsed } from './useParsed';
|
|
27
|
+
import { useParsed } from './useParsed.svelte';
|
|
28
28
|
import { createOvertimeTracker, fireSuccessNotification, fireErrorNotification } from './hook-utils.svelte';
|
|
29
29
|
import type { NotificationConfig, OvertimeOptions } from './hook-utils.svelte';
|
|
30
30
|
import type { BaseRecord, HttpError, Pagination, Sort, Filter, DataProvider, KnownResources } from './types';
|
|
31
|
-
import type { LiveMode, LiveEvent } from './live';
|
|
31
|
+
import type { LiveMode, LiveEvent } from './live.svelte';
|
|
32
32
|
import { useList } from './query-hooks.svelte';
|
|
33
33
|
import type { UseListOptions } from './query-hooks.svelte';
|
|
34
34
|
import { audit } from './audit';
|
package/src/index.ts
CHANGED
|
@@ -29,7 +29,7 @@ export {
|
|
|
29
29
|
export { matchRoute, navigate, currentPath, setActiveRouterProvider } from './router';
|
|
30
30
|
export { readURLState, writeURLState } from './url-sync';
|
|
31
31
|
export { setAccessControl, setAccessControlProvider, getAccessControlProvider, getAccessControlOptions, canAccess, canAccessAsync } from './permissions';
|
|
32
|
-
export { useLive, useSubscription, usePublish } from './live';
|
|
32
|
+
export { useLive, useSubscription, usePublish } from './live.svelte';
|
|
33
33
|
export { toast } from './toast.svelte';
|
|
34
34
|
export { notify, closeNotification, setNotificationProvider, getNotificationProvider } from './notification.svelte';
|
|
35
35
|
export { t, setLocale, getLocale, getAvailableLocales, addTranslations, useTranslation } from './i18n.svelte';
|
|
@@ -63,7 +63,7 @@ export type {
|
|
|
63
63
|
BaseRecord,
|
|
64
64
|
} from './types';
|
|
65
65
|
export type { InvalidateScope } from './options';
|
|
66
|
-
export type { LiveProvider, LiveEvent, LiveMode } from './live';
|
|
66
|
+
export type { LiveProvider, LiveEvent, LiveMode } from './live.svelte';
|
|
67
67
|
export type { Action, CanParams, CanResult, AccessControlProvider, AccessControlResult, AccessControlFn } from './permissions';
|
|
68
68
|
export type { AuditEntry, AuditHandler } from './audit';
|
|
69
69
|
export { useCan } from './useCan';
|
|
@@ -71,15 +71,15 @@ export type { UseCanOptions, UseCanResult } from './useCan';
|
|
|
71
71
|
export { createCaslAccessControl } from './adapters/casl';
|
|
72
72
|
export { createCasbinAccessControl } from './adapters/casbin';
|
|
73
73
|
export type { CasbinAdapterOptions } from './adapters/casbin';
|
|
74
|
-
export { useExport, useImport } from './data-transfer';
|
|
75
|
-
export type { UseExportOptions, UseImportOptions } from './data-transfer';
|
|
74
|
+
export { useExport, useImport } from './data-transfer.svelte';
|
|
75
|
+
export type { UseExportOptions, UseImportOptions } from './data-transfer.svelte';
|
|
76
76
|
export {
|
|
77
77
|
useLogin, useLogout,
|
|
78
78
|
useRegister, useForgotPassword, useUpdatePassword,
|
|
79
79
|
useGetIdentity, useIsAuthenticated,
|
|
80
80
|
useOnError, usePermissions,
|
|
81
81
|
} from './auth-hooks.svelte';
|
|
82
|
-
export { useParsed } from './useParsed';
|
|
82
|
+
export { useParsed } from './useParsed.svelte';
|
|
83
83
|
export * from './useStepsForm.svelte';
|
|
84
84
|
export { createHashRouterProvider, createHistoryRouterProvider } from './router-provider';
|
|
85
85
|
export type { RouterProvider } from './router-provider';
|
package/src/live-sse.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* event: posts
|
|
10
10
|
* data: { "type": "INSERT", "payload": {...} }
|
|
11
11
|
*/
|
|
12
|
-
import type { LiveProvider, LiveEvent } from './live';
|
|
12
|
+
import type { LiveProvider, LiveEvent } from './live.svelte';
|
|
13
13
|
|
|
14
14
|
export interface SSELiveProviderOptions {
|
|
15
15
|
/** SSE endpoint URL, e.g. "https://api.example.com/events" */
|
package/src/live-websocket.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* The server is expected to send JSON messages matching the LiveEvent shape:
|
|
6
6
|
* { type: 'INSERT' | 'UPDATE' | 'DELETE', resource: string, payload: {...} }
|
|
7
7
|
*/
|
|
8
|
-
import type { LiveProvider, LiveEvent } from './live';
|
|
8
|
+
import type { LiveProvider, LiveEvent } from './live.svelte';
|
|
9
9
|
|
|
10
10
|
export interface WebSocketLiveProviderOptions {
|
|
11
11
|
/** WebSocket server URL, e.g. "wss://api.example.com/ws" */
|
package/src/live.test.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Tests the subscription management logic without requiring actual WebSocket/SSE connections.
|
|
4
4
|
*/
|
|
5
5
|
import { describe, test, expect, mock } from 'bun:test';
|
|
6
|
-
import type { LiveProvider, LiveEvent } from './live';
|
|
6
|
+
import type { LiveProvider, LiveEvent } from './live.svelte';
|
|
7
7
|
|
|
8
8
|
// Helper: create a minimal in-memory LiveProvider for testing subscription logic
|
|
9
9
|
function createMockLiveProvider(): LiveProvider & { emit: (event: LiveEvent) => void } {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMutation, useQueryClient } from '@tanstack/svelte-query';
|
|
2
2
|
import { getAdminOptions } from './options';
|
|
3
3
|
import { getDataProviderForResource } from './context.svelte';
|
|
4
|
-
import { useParsed } from './useParsed';
|
|
4
|
+
import { useParsed } from './useParsed.svelte';
|
|
5
5
|
import { audit } from './audit';
|
|
6
6
|
import { UndoError } from './types';
|
|
7
7
|
import type { BaseRecord, HttpError, CreateParams, UpdateParams, DeleteParams, KnownResources } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createQuery, createInfiniteQuery } from '@tanstack/svelte-query';
|
|
2
2
|
import { getAdminOptions } from './options';
|
|
3
3
|
import { getDataProviderForResource, getDataProvider, getLiveProvider } from './context.svelte';
|
|
4
|
-
import { useParsed } from './useParsed';
|
|
4
|
+
import { useParsed } from './useParsed.svelte';
|
|
5
5
|
import {
|
|
6
6
|
createOvertimeTracker,
|
|
7
7
|
createLiveSubscription,
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
GetOneParams, GetOneResult, GetManyParams, GetManyResult, CustomParams, CustomResult,
|
|
15
15
|
KnownResources,
|
|
16
16
|
} from './types';
|
|
17
|
-
import type { LiveMode, LiveEvent } from './live';
|
|
17
|
+
import type { LiveMode, LiveEvent } from './live.svelte';
|
|
18
18
|
|
|
19
19
|
// ─── useList ───────────────────────────────────────────────────
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { currentPath, navigate } from './router';
|
|
2
2
|
import { getResource, getResources, getRouterProvider } from './context.svelte';
|
|
3
|
-
import { useParsed } from './useParsed';
|
|
3
|
+
import { useParsed } from './useParsed.svelte';
|
|
4
4
|
|
|
5
5
|
// ─── routing-hooks.svelte.ts ───────────────────────────────────
|
|
6
6
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useParsed } from './useParsed';
|
|
1
|
+
import { useParsed } from './useParsed.svelte';
|
|
2
2
|
import { useList } from './query-hooks.svelte';
|
|
3
3
|
import { readURLState, writeURLState } from './url-sync';
|
|
4
4
|
import type { Pagination, Sort, Filter, BaseRecord, HttpError, KnownResources, GetListResult } from './types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// TableState — Svelte 5 Class State Pattern for table data management
|
|
2
2
|
// Reactive class that encapsulates all table state with fine-grained $state/$derived
|
|
3
3
|
|
|
4
|
-
import { useParsed } from './useParsed';
|
|
4
|
+
import { useParsed } from './useParsed.svelte';
|
|
5
5
|
import { useList } from './query-hooks.svelte';
|
|
6
6
|
import { readURLState, writeURLState } from './url-sync';
|
|
7
7
|
import type { Pagination, Sort, Filter, BaseRecord, HttpError, KnownResources, GetListResult } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useForm, type UseFormOptions } from './form-hooks.svelte';
|
|
2
2
|
import { useQueryClient } from '@tanstack/svelte-query';
|
|
3
|
-
import { useParsed } from './useParsed';
|
|
3
|
+
import { useParsed } from './useParsed.svelte';
|
|
4
4
|
import { getResource, getResources } from './context.svelte';
|
|
5
5
|
import { getAdminOptions } from './options';
|
|
6
6
|
import { navigate } from './router';
|
|
File without changes
|
|
File without changes
|