@visualbravo/zenstack-cache 1.0.2 → 1.0.3

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/plugin.cjs CHANGED
@@ -32,9 +32,16 @@ function defineCachePlugin(pluginOptions) {
32
32
  return revalidation;
33
33
  }
34
34
  } },
35
- onQuery: async ({ args, model, operation, proceed }) => {
35
+ onQuery: async ({ args, model, operation, proceed, client }) => {
36
36
  if (args && "cache" in args) {
37
- const json = (0, stable_hash.stableHash)({
37
+ let json;
38
+ if (client.$auth) json = (0, stable_hash.stableHash)({
39
+ args,
40
+ model,
41
+ operation,
42
+ userId: Object.keys(client.$auth).filter((key$1) => client.$schema.models[client.$schema.authType].idFields.includes(key$1)).join("_")
43
+ });
44
+ else json = (0, stable_hash.stableHash)({
38
45
  args,
39
46
  model,
40
47
  operation
package/dist/plugin.mjs CHANGED
@@ -30,9 +30,16 @@ function defineCachePlugin(pluginOptions) {
30
30
  return revalidation;
31
31
  }
32
32
  } },
33
- onQuery: async ({ args, model, operation, proceed }) => {
33
+ onQuery: async ({ args, model, operation, proceed, client }) => {
34
34
  if (args && "cache" in args) {
35
- const json = stableHash({
35
+ let json;
36
+ if (client.$auth) json = stableHash({
37
+ args,
38
+ model,
39
+ operation,
40
+ userId: Object.keys(client.$auth).filter((key$1) => client.$schema.models[client.$schema.authType].idFields.includes(key$1)).join("_")
41
+ });
42
+ else json = stableHash({
36
43
  args,
37
44
  model,
38
45
  operation
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@visualbravo/zenstack-cache",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
+ "keywords": [
5
+ "accelerate",
6
+ "cache",
7
+ "caching",
8
+ "orm",
9
+ "prisma",
10
+ "redis",
11
+ "self-hosted",
12
+ "typescript",
13
+ "zenstack"
14
+ ],
4
15
  "license": "MIT",
5
16
  "repository": "github:visualbravo/zenstack-cache",
6
17
  "type": "module",
7
18
  "main": "./dist/index.cjs",
8
19
  "module": "./dist/index.mjs",
9
20
  "types": "./dist/index.d.cts",
10
- "keywords": [
11
- "zenstack",
12
- "cache",
13
- "caching",
14
- "prisma",
15
- "accelerate",
16
- "orm"
17
- ],
18
21
  "exports": {
19
22
  ".": {
20
23
  "@zenstack-cache/source": "./src/index.ts",