@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 CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@svadmin/core",
3
- "version": "0.36.0",
3
+ "version": "0.36.1",
4
4
  "author": "zuohuadong",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "https://github.com/zuohuadong/svadmin.git",
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.3",
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/zuohuadong/svadmin/issues"
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/zuohuadong/svadmin#readme",
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
@@ -16,7 +16,9 @@ export {
16
16
  createProviderBundle,
17
17
  createTenantCacheKey,
18
18
  defaultTenantAdapter,
19
+ appendTenantCacheKey,
19
20
  isTenantCacheKey,
21
+ queryKeyMatchesTenant,
20
22
  resolveTenantProviderMeta,
21
23
  withProviderMeta,
22
24
  withTenantDataProvider,
@@ -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>;