@svadmin/core 0.36.0 → 0.36.1
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 +5 -5
- package/src/index.ts +2 -0
- package/src/provider-bundle.ts +25 -0
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@svadmin/core",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.1",
|
|
4
4
|
"author": "zuohuadong",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/vibeunion/svadmin.git",
|
|
8
8
|
"directory": "packages/core"
|
|
9
9
|
},
|
|
10
10
|
"main": "src/index.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
14
14
|
"@testing-library/dom": "^10.4.1",
|
|
15
15
|
"@testing-library/svelte": "^5.4.2",
|
|
16
|
-
"@testing-library/user-event": "^14.6.
|
|
16
|
+
"@testing-library/user-event": "^14.6.4",
|
|
17
17
|
"@types/bun": "^1.3.14",
|
|
18
18
|
"@types/jsdom": "^30.0.0",
|
|
19
19
|
"happy-dom": "^20.11.2",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"bugs": {
|
|
62
|
-
"url": "https://github.com/
|
|
62
|
+
"url": "https://github.com/vibeunion/svadmin/issues"
|
|
63
63
|
},
|
|
64
64
|
"description": "Core SDK — hooks, types, context, i18n, permissions, router",
|
|
65
65
|
"files": [
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"!src/**/vitest.config.*",
|
|
70
70
|
"!src/**/setupTest.*"
|
|
71
71
|
],
|
|
72
|
-
"homepage": "https://github.com/
|
|
72
|
+
"homepage": "https://github.com/vibeunion/svadmin#readme",
|
|
73
73
|
"license": "MIT",
|
|
74
74
|
"sideEffects": false,
|
|
75
75
|
"type": "module",
|
package/src/index.ts
CHANGED
package/src/provider-bundle.ts
CHANGED
|
@@ -116,6 +116,31 @@ export function isTenantCacheKey(value: unknown): value is TenantCacheKey {
|
|
|
116
116
|
);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated 0.36 — Query Key v2 replaces positional tenant cache-key appending.
|
|
121
|
+
* Use `keys({ tenant })` instead. Removed in 0.39.
|
|
122
|
+
*/
|
|
123
|
+
export function appendTenantCacheKey(
|
|
124
|
+
queryKey: readonly unknown[],
|
|
125
|
+
tenantCacheKey: TenantCacheKey | undefined,
|
|
126
|
+
): readonly unknown[] {
|
|
127
|
+
return tenantCacheKey ? [...queryKey, tenantCacheKey] : queryKey;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated 0.36 — Query Key v2 replaces positional tenant cache-key matching.
|
|
132
|
+
* Use `queryKeyMatches(queryKey, { tenant })` instead. Removed in 0.39.
|
|
133
|
+
*/
|
|
134
|
+
export function queryKeyMatchesTenant(
|
|
135
|
+
queryKey: readonly unknown[],
|
|
136
|
+
tenantCacheKey: TenantCacheKey | undefined,
|
|
137
|
+
): boolean {
|
|
138
|
+
const candidate = queryKey.at(-1);
|
|
139
|
+
const keyTenant = isTenantCacheKey(candidate) ? candidate : undefined;
|
|
140
|
+
if (!tenantCacheKey) return keyTenant === undefined;
|
|
141
|
+
return keyTenant?.__svadminTenant === tenantCacheKey.__svadminTenant;
|
|
142
|
+
}
|
|
143
|
+
|
|
119
144
|
export interface ProviderMetaInput {
|
|
120
145
|
readonly resource?: string;
|
|
121
146
|
readonly meta?: Record<string, unknown>;
|