@nymphjs/tilmeld-setup 1.0.0-beta.133 → 1.0.0-beta.134

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/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-beta.134](https://forge.sciactive.com/sciactive/nymphjs/compare/v1.0.0-beta.133...v1.0.0-beta.134) (2026-10-29)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
9
+
6
10
  # [1.0.0-beta.133](https://forge.sciactive.com/sciactive/nymphjs/compare/v1.0.0-beta.132...v1.0.0-beta.133) (2026-10-28)
7
11
 
8
12
  **Note:** Version bump only for package @nymphjs/tilmeld-setup
package/dist/app/index.js CHANGED
@@ -23759,6 +23759,37 @@
23759
23759
  }
23760
23760
  }
23761
23761
 
23762
+ class QueryWeakCache {
23763
+ queries = new Map();
23764
+ get(queryJSON) {
23765
+ const weakRef = this.queries.get(queryJSON);
23766
+ const deref = weakRef && weakRef.deref();
23767
+ if (deref != null) {
23768
+ return deref;
23769
+ }
23770
+ else {
23771
+ this.queries.delete(queryJSON);
23772
+ }
23773
+ return null;
23774
+ }
23775
+ set(queryJSON, promise) {
23776
+ this.clean();
23777
+ if (!(promise instanceof Promise)) {
23778
+ return;
23779
+ }
23780
+ const weakRef = new WeakRef(promise);
23781
+ this.queries.set(queryJSON, weakRef);
23782
+ }
23783
+ clean() {
23784
+ this.queries.forEach((value, key) => {
23785
+ const deref = value && value.deref();
23786
+ if (deref == null) {
23787
+ this.queries.delete(key);
23788
+ }
23789
+ });
23790
+ }
23791
+ }
23792
+
23762
23793
  let requester;
23763
23794
  class Nymph {
23764
23795
  /**
@@ -23787,7 +23818,11 @@
23787
23818
  /**
23788
23819
  * The entity cache.
23789
23820
  */
23790
- cache = new EntityWeakCache();
23821
+ entityCache = new EntityWeakCache();
23822
+ /**
23823
+ * The query cache.
23824
+ */
23825
+ queryCache = new QueryWeakCache();
23791
23826
  /**
23792
23827
  * Return `null` or empty array instead of error when entity/ies not found.
23793
23828
  */
@@ -23870,12 +23905,24 @@
23870
23905
  });
23871
23906
  }
23872
23907
  async getUID(name) {
23873
- const data = await requester.GET({
23874
- url: this.restUrl,
23875
- headers: { ...this.headers },
23876
- dataType: 'text',
23877
- data: { action: 'uid', data: name },
23878
- });
23908
+ const query = { action: 'uid', data: name };
23909
+ let promise = null;
23910
+ const queryJSON = JSON.stringify(query);
23911
+ if (this.weakCache) {
23912
+ promise = this.queryCache.get(queryJSON);
23913
+ }
23914
+ if (promise == null) {
23915
+ promise = requester.GET({
23916
+ url: this.restUrl,
23917
+ headers: { ...this.headers },
23918
+ dataType: 'text',
23919
+ data: query,
23920
+ });
23921
+ if (this.weakCache) {
23922
+ this.queryCache.set(queryJSON, promise);
23923
+ }
23924
+ }
23925
+ const data = await promise;
23879
23926
  return Number(data);
23880
23927
  }
23881
23928
  async deleteUID(name) {
@@ -23983,18 +24030,30 @@
23983
24030
  if (typeof selectors[0] === 'string') {
23984
24031
  selectors = [{ type: '&', guid: selectors[0] }];
23985
24032
  }
23986
- const data = await requester.GET({
23987
- url: this.restUrl,
23988
- headers: { ...this.headers },
23989
- dataType: 'json',
23990
- data: {
23991
- action: 'entity',
23992
- data: [
23993
- entityConstructorsToClassNames(options),
23994
- ...entityConstructorsToClassNames(entitiesToReferences(selectors)),
23995
- ],
23996
- },
23997
- });
24033
+ const query = {
24034
+ action: 'entity',
24035
+ data: [
24036
+ entityConstructorsToClassNames(options),
24037
+ ...entityConstructorsToClassNames(entitiesToReferences(selectors)),
24038
+ ],
24039
+ };
24040
+ let promise = null;
24041
+ const queryJSON = JSON.stringify(query);
24042
+ if (this.weakCache) {
24043
+ promise = this.queryCache.get(queryJSON);
24044
+ }
24045
+ if (promise == null) {
24046
+ promise = requester.GET({
24047
+ url: this.restUrl,
24048
+ headers: { ...this.headers },
24049
+ dataType: 'json',
24050
+ data: query,
24051
+ });
24052
+ if (this.weakCache) {
24053
+ this.queryCache.set(queryJSON, promise);
24054
+ }
24055
+ }
24056
+ const data = await promise;
23998
24057
  if (options.return === 'count' || typeof data.guid !== 'undefined') {
23999
24058
  return data;
24000
24059
  }
@@ -24003,18 +24062,30 @@
24003
24062
  async getEntities(options, ...selectors) {
24004
24063
  let data = null;
24005
24064
  try {
24006
- data = await requester.GET({
24007
- url: this.restUrl,
24008
- headers: { ...this.headers },
24009
- dataType: 'json',
24010
- data: {
24011
- action: 'entities',
24012
- data: [
24013
- entityConstructorsToClassNames(options),
24014
- ...entityConstructorsToClassNames(entitiesToReferences(selectors)),
24015
- ],
24016
- },
24017
- });
24065
+ const query = {
24066
+ action: 'entities',
24067
+ data: [
24068
+ entityConstructorsToClassNames(options),
24069
+ ...entityConstructorsToClassNames(entitiesToReferences(selectors)),
24070
+ ],
24071
+ };
24072
+ let promise = null;
24073
+ const queryJSON = JSON.stringify(query);
24074
+ if (this.weakCache) {
24075
+ promise = this.queryCache.get(queryJSON);
24076
+ }
24077
+ if (promise == null) {
24078
+ promise = requester.GET({
24079
+ url: this.restUrl,
24080
+ headers: { ...this.headers },
24081
+ dataType: 'json',
24082
+ data: query,
24083
+ });
24084
+ if (this.weakCache) {
24085
+ this.queryCache.set(queryJSON, promise);
24086
+ }
24087
+ }
24088
+ data = await promise;
24018
24089
  }
24019
24090
  catch (e) {
24020
24091
  if (this.returnNullOnNotFound &&
@@ -24045,7 +24116,7 @@
24045
24116
  let entity = EntityClass.factorySync();
24046
24117
  if (this.weakCache) {
24047
24118
  // Try to get it from cache.
24048
- const entityFromCache = this.cache.get(EntityClass, entityJSON.guid || '');
24119
+ const entityFromCache = this.entityCache.get(EntityClass, entityJSON.guid || '');
24049
24120
  if (entityFromCache != null) {
24050
24121
  entity = entityFromCache;
24051
24122
  }
@@ -24056,13 +24127,13 @@
24056
24127
  if (!this.weakCache) {
24057
24128
  return null;
24058
24129
  }
24059
- return this.cache.get(EntityClass, guid);
24130
+ return this.entityCache.get(EntityClass, guid);
24060
24131
  }
24061
24132
  setEntityToCache(EntityClass, entity) {
24062
24133
  if (!this.weakCache) {
24063
24134
  return;
24064
24135
  }
24065
- return this.cache.set(EntityClass, entity);
24136
+ return this.entityCache.set(EntityClass, entity);
24066
24137
  }
24067
24138
  initEntitiesFromData(item, isFromSave) {
24068
24139
  if (Array.isArray(item)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nymphjs/tilmeld-setup",
3
- "version": "1.0.0-beta.133",
3
+ "version": "1.0.0-beta.134",
4
4
  "description": "Nymph.js - Tilmeld Setup App",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -41,8 +41,8 @@
41
41
  },
42
42
  "license": "Apache-2.0",
43
43
  "dependencies": {
44
- "@nymphjs/nymph": "^1.0.0-beta.133",
45
- "@nymphjs/tilmeld": "^1.0.0-beta.133",
44
+ "@nymphjs/nymph": "^1.0.0-beta.134",
45
+ "@nymphjs/tilmeld": "^1.0.0-beta.134",
46
46
  "express": "^5.2.1",
47
47
  "locutus": "^3.0.36"
48
48
  },
@@ -50,12 +50,12 @@
50
50
  "@material/elevation": "^14.0.0",
51
51
  "@material/typography": "^14.0.0",
52
52
  "@mdi/js": "^7.4.47",
53
- "@nymphjs/client": "^1.0.0-beta.133",
54
- "@nymphjs/driver-sqlite3": "^1.0.0-beta.133",
55
- "@nymphjs/query-parser": "^1.0.0-beta.133",
56
- "@nymphjs/server": "^1.0.0-beta.133",
57
- "@nymphjs/tilmeld-client": "^1.0.0-beta.133",
58
- "@nymphjs/tilmeld-components": "^1.0.0-beta.133",
53
+ "@nymphjs/client": "^1.0.0-beta.134",
54
+ "@nymphjs/driver-sqlite3": "^1.0.0-beta.134",
55
+ "@nymphjs/query-parser": "^1.0.0-beta.134",
56
+ "@nymphjs/server": "^1.0.0-beta.134",
57
+ "@nymphjs/tilmeld-client": "^1.0.0-beta.134",
58
+ "@nymphjs/tilmeld-components": "^1.0.0-beta.134",
59
59
  "@rollup/plugin-commonjs": "^29.0.3",
60
60
  "@rollup/plugin-node-resolve": "^16.0.3",
61
61
  "@rollup/plugin-sucrase": "^5.1.0",
@@ -98,5 +98,5 @@
98
98
  "tslib": "^2.8.1",
99
99
  "typescript": "^7.0.2"
100
100
  },
101
- "gitHead": "4edb32e721ba78f0be8d43d675578168f166b8b5"
101
+ "gitHead": "31b045084100c2267c2eac7ad457d52983b0b895"
102
102
  }