@fjell/cache 4.6.3 → 4.6.4

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.
@@ -3,8 +3,12 @@ model: gpt-4.1
3
3
  contextDirectories:
4
4
  - .kodrdriv/context
5
5
  commit:
6
+ add: true
6
7
  cached: true
7
8
  sendit: true
8
9
  release:
9
10
  from: main
10
11
  to: HEAD
12
+ publish:
13
+ mergeMethod: squash
14
+ dependencyUpdatePatterns: ["@fjell/*"]
package/commit.sh ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "Staging all changes..."
5
+ git add .
6
+
7
+ echo "Running kodrdriv commit..."
8
+ pnpm dlx @eldrforge/kodrdriv commit
package/dist/Cache.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AllItemTypeArrays, ComKey, Item, ItemQuery, LocKeyArray, PriKey, TypesProperties } from '@fjell/core';
1
+ import { AllItemTypeArrays, ComKey, Item, ItemQuery, LocKeyArray, PriKey } from '@fjell/core';
2
2
  import { CacheMap } from './CacheMap';
3
3
  import { ClientApi } from '@fjell/client-api';
4
4
  export interface Cache<V extends Item<S, L1, L2, L3, L4, L5>, S extends string, L1 extends string = never, L2 extends string = never, L3 extends string = never, L4 extends string = never, L5 extends string = never> {
@@ -7,11 +7,11 @@ export interface Cache<V extends Item<S, L1, L2, L3, L4, L5>, S extends string,
7
7
  action: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, action: string, body?: any) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
8
8
  allAction: (action: string, body?: any, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
9
9
  allFacet: (facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
10
- create: (item: TypesProperties<V, S, L1, L2, L3, L4, L5>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
10
+ create: (item: Partial<Item<S, L1, L2, L3, L4, L5>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
11
11
  get: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V | null]>;
12
12
  retrieve: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5> | null, V | null]>;
13
13
  remove: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>) => Promise<CacheMap<V, S, L1, L2, L3, L4, L5>>;
14
- update: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: TypesProperties<V, S, L1, L2, L3, L4, L5>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
14
+ update: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, item: Partial<Item<S, L1, L2, L3, L4, L5>>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
15
15
  facet: (key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, facet: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
16
16
  find: (finder: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V[]]>;
17
17
  findOne: (finder: string, params?: Record<string, string | number | boolean | Date | Array<string | number | boolean | Date>>, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fjell/cache",
3
3
  "description": "Cache for Fjell",
4
- "version": "4.6.3",
4
+ "version": "4.6.4",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs.js",
@@ -15,40 +15,40 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "@fjell/client-api": "^4.4.3",
19
- "@fjell/core": "^4.4.3",
20
- "@fjell/http-api": "^4.4.1",
21
- "@fjell/logging": "^4.4.3",
18
+ "@fjell/client-api": "^4.4.4",
19
+ "@fjell/core": "^4.4.5",
20
+ "@fjell/http-api": "^4.4.3",
21
+ "@fjell/logging": "^4.4.5",
22
22
  "d3": "^7.9.0",
23
23
  "dayjs": "^1.11.13",
24
24
  "react": "19.1.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@babel/preset-env": "^7.26.9",
28
- "@babel/preset-typescript": "^7.26.0",
27
+ "@babel/preset-env": "^7.27.2",
28
+ "@babel/preset-typescript": "^7.27.1",
29
29
  "@eslint/eslintrc": "^3.3.1",
30
- "@eslint/js": "^9.27.0",
31
- "@swc/core": "^1.11.24",
32
- "@tsconfig/recommended": "^1.0.8",
30
+ "@eslint/js": "^9.30.0",
31
+ "@swc/core": "^1.12.7",
32
+ "@tsconfig/recommended": "^1.0.10",
33
33
  "@types/babel__preset-env": "^7.10.0",
34
34
  "@types/d3": "^7.4.3",
35
- "@types/multer": "^1.4.12",
36
- "@types/node": "^24.0.3",
37
- "@typescript-eslint/eslint-plugin": "^8.24.1",
38
- "@typescript-eslint/parser": "^8.24.1",
39
- "@vitest/coverage-v8": "^3.1.4",
40
- "@vitest/ui": "^3.1.4",
41
- "concurrently": "^9.1.2",
42
- "eslint": "^9.21.0",
43
- "nodemon": "^3.1.9",
35
+ "@types/multer": "^1.4.13",
36
+ "@types/node": "^24.0.7",
37
+ "@typescript-eslint/eslint-plugin": "^8.35.0",
38
+ "@typescript-eslint/parser": "^8.35.0",
39
+ "@vitest/coverage-v8": "^3.2.4",
40
+ "@vitest/ui": "^3.2.4",
41
+ "concurrently": "^9.2.0",
42
+ "eslint": "^9.30.0",
43
+ "nodemon": "^3.1.10",
44
44
  "rimraf": "^6.0.1",
45
45
  "ts-node": "^10.9.2",
46
- "tsc-alias": "^1.8.10",
47
- "typescript": "^5.7.3",
48
- "vite": "^6.3.5",
46
+ "tsc-alias": "^1.8.16",
47
+ "typescript": "^5.8.3",
48
+ "vite": "^7.0.0",
49
49
  "vite-plugin-dts": "^4.5.4",
50
50
  "vite-plugin-node": "^5.0.1",
51
- "vitest": "^3.1.4"
51
+ "vitest": "^3.2.4"
52
52
  },
53
53
  "repository": {
54
54
  "type": "git",
@@ -57,6 +57,7 @@
57
57
  "scripts": {
58
58
  "dev": "concurrently \"tsc --noEmit --watch\" \"vite build --watch\"",
59
59
  "build": "pnpm run lint && tsc --noEmit && vite build",
60
+ "typecheck": "tsc --noEmit",
60
61
  "lint": "eslint . --ext .ts --fix",
61
62
  "clean": "rimraf dist",
62
63
  "test": "pnpm run lint && vitest run --coverage"
package/release.sh ADDED
@@ -0,0 +1,89 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+
5
+ echo "Preparing for release: switching from workspace to remote dependencies."
6
+ if [ -f "pnpm-workspace.yaml" ]; then
7
+ echo "Renaming pnpm-workspace.yaml to prevent workspace-protocol resolution"
8
+ mv pnpm-workspace.yaml pnpm-workspace.yaml.bak
9
+ else
10
+ echo "pnpm-workspace.yaml not found, skipping rename."
11
+ fi
12
+
13
+ echo "Updating dependencies to latest versions from registry"
14
+ pnpm update --latest
15
+
16
+ echo "Staging changes for release commit"
17
+ git add package.json pnpm-lock.yaml
18
+
19
+ echo "Running clean, lint, build, and test..."
20
+ pnpm run clean && pnpm run lint && pnpm run build && pnpm run test
21
+
22
+ if git diff --staged --quiet; then
23
+ echo "No changes to commit, skipping commit."
24
+ else
25
+ ./commit.sh
26
+ fi
27
+
28
+ echo "Bumping version..."
29
+ pnpm version patch
30
+
31
+ echo "Generating release notes..."
32
+ pnpm dlx @eldrforge/kodrdriv release > RELEASE_NOTES.md
33
+
34
+ echo "Pushing to origin..."
35
+ git push --follow-tags
36
+
37
+ echo "Creating GitHub pull request..."
38
+ PR_URL=$(gh pr create --fill)
39
+ PR_NUM=$(echo "$PR_URL" | grep -o '[0-9]*$')
40
+ echo "Pull request created: $PR_URL"
41
+
42
+ echo "Waiting for PR #$PR_NUM checks to complete..."
43
+ while true; do
44
+ STATUS=$(gh pr view "$PR_NUM" --json statusCheckRollup --jq '.statusCheckRollup.state' 2>/dev/null)
45
+ if [[ -z "$STATUS" ]]; then
46
+ STATUS="PENDING"
47
+ fi
48
+ echo "PR status: $STATUS"
49
+ if [[ "$STATUS" == "SUCCESS" ]]; then
50
+ echo "All checks passed!"
51
+ break
52
+ elif [[ "$STATUS" == "FAILURE" || "$STATUS" == "ERROR" ]]; then
53
+ echo "PR checks failed."
54
+ gh pr checks "$PR_NUM"
55
+ exit 1
56
+ elif [[ "$STATUS" == "PENDING" || "$STATUS" == "EXPECTED" ]]; then
57
+ echo "Checks are pending... waiting 10 seconds."
58
+ sleep 10
59
+ else
60
+ echo "Unknown PR status: $STATUS. Waiting 10 seconds."
61
+ sleep 10
62
+ fi
63
+ done
64
+
65
+ echo "Merging PR #$PR_NUM..."
66
+ gh pr merge "$PR_NUM" --squash --delete-branch
67
+
68
+ echo "Checking out main branch..."
69
+ git checkout main
70
+ git pull origin main
71
+
72
+ echo "Creating GitHub release..."
73
+ TAG_NAME="v$(jq -r .version package.json)"
74
+ gh release create "$TAG_NAME" --notes-file RELEASE_NOTES.md
75
+
76
+ echo "Creating next release branch..."
77
+ CURRENT_VERSION=$(jq -r .version package.json)
78
+ MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1)
79
+ MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2)
80
+ PATCH=$(echo "$CURRENT_VERSION" | cut -d. -f3)
81
+ NEXT_PATCH=$((PATCH + 1))
82
+ NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH"
83
+
84
+ echo "Next version is $NEXT_VERSION"
85
+ git checkout -b "release/v$NEXT_VERSION"
86
+ git commit -m "feat: Start release v$NEXT_VERSION"
87
+ git push -u origin "release/v$NEXT_VERSION"
88
+
89
+ echo "Release process completed."
package/src/Aggregator.ts CHANGED
@@ -4,8 +4,7 @@ import {
4
4
  Item,
5
5
  ItemQuery,
6
6
  LocKeyArray,
7
- PriKey,
8
- TypesProperties
7
+ PriKey
9
8
  } from "@fjell/core";
10
9
  import { Cache } from "./Cache";
11
10
  import { CacheMap } from "./CacheMap";
@@ -60,10 +59,10 @@ export const createAggregator = async <
60
59
  >(
61
60
  cache: Cache<V, S, L1, L2, L3, L4, L5>,
62
61
  { aggregates = {}, events = {} }:
63
- {
64
- aggregates?: AggregateConfig,
65
- events?: AggregateConfig
66
- }
62
+ {
63
+ aggregates?: AggregateConfig,
64
+ events?: AggregateConfig
65
+ }
67
66
  ): Promise<Aggregator<V, S, L1, L2, L3, L4, L5>> => {
68
67
 
69
68
  const populate = async (item: V): Promise<V> => {
@@ -93,9 +92,9 @@ export const createAggregator = async <
93
92
  } else if (item.refs[key] === undefined) {
94
93
  if (cacheConfig.optional === false) {
95
94
  logger.error('Item does not have mandatory ref with key, not optional ' +
96
- key + ' ' + JSON.stringify(item));
95
+ key + ' ' + JSON.stringify(item));
97
96
  throw new Error('Item does not have mandatory ref with key, not optional ' +
98
- key + ' ' + JSON.stringify(item));
97
+ key + ' ' + JSON.stringify(item));
99
98
  } else {
100
99
  if (item.events && Object.prototype.hasOwnProperty.call(item.events, key)) {
101
100
  delete item.events[key];
@@ -206,7 +205,7 @@ export const createAggregator = async <
206
205
  }
207
206
 
208
207
  const create = async (
209
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
208
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
210
209
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
211
210
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
212
211
  logger.default('create', { v, locations });
@@ -249,7 +248,7 @@ export const createAggregator = async <
249
248
 
250
249
  const update = async (
251
250
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
252
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
251
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
253
252
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
254
253
  logger.default('update', { key, v });
255
254
  const [cacheMap, item] = await cache.update(key, v);
package/src/Cache.ts CHANGED
@@ -7,7 +7,6 @@ import {
7
7
  ItemQuery,
8
8
  LocKeyArray,
9
9
  PriKey,
10
- TypesProperties,
11
10
  validatePK
12
11
  } from "@fjell/core";
13
12
  import { CacheMap } from "./CacheMap";
@@ -58,7 +57,7 @@ export interface Cache<
58
57
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, any]>;
59
58
 
60
59
  create: (
61
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
60
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
62
61
  locations?: LocKeyArray<L1, L2, L3, L4, L5> | []
63
62
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
64
63
 
@@ -76,7 +75,7 @@ export interface Cache<
76
75
 
77
76
  update: (
78
77
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
79
- item: TypesProperties<V, S, L1, L2, L3, L4, L5>,
78
+ item: Partial<Item<S, L1, L2, L3, L4, L5>>,
80
79
  ) => Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]>;
81
80
 
82
81
  facet: (
@@ -234,7 +233,7 @@ export const createCache = async <
234
233
  }
235
234
 
236
235
  const create = async (
237
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
236
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
238
237
  locations: LocKeyArray<L1, L2, L3, L4, L5> | [] = []
239
238
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
240
239
  logger.default('create', { v, locations });
@@ -321,7 +320,7 @@ export const createCache = async <
321
320
 
322
321
  const update = async (
323
322
  key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>,
324
- v: TypesProperties<V, S, L1, L2, L3, L4, L5>,
323
+ v: Partial<Item<S, L1, L2, L3, L4, L5>>,
325
324
  ): Promise<[CacheMap<V, S, L1, L2, L3, L4, L5>, V]> => {
326
325
  logger.default('update', { key, v });
327
326