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

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.135](https://forge.sciactive.com/sciactive/nymphjs/compare/v1.0.0-beta.134...v1.0.0-beta.135) (2026-10-31)
7
+
8
+ **Note:** Version bump only for package @nymphjs/tilmeld-setup
9
+
6
10
  # [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
11
 
8
12
  **Note:** Version bump only for package @nymphjs/tilmeld-setup
package/dist/app/index.js CHANGED
@@ -22788,12 +22788,13 @@
22788
22788
  }
22789
22789
  this.$isASleepingReference = false;
22790
22790
  this.$sleepingReference = null;
22791
+ const instanceIsNew = !this.$originalTags.length;
22791
22792
  this.guid = entityJson.guid;
22792
22793
  this.cdate = entityJson.cdate;
22793
22794
  this.mdate = entityJson.mdate;
22794
22795
  if (
22795
22796
  // The instance is new.
22796
- !this.$originalTags.length ||
22797
+ instanceIsNew ||
22797
22798
  // The data is coming from a save.
22798
22799
  isFromSave ||
22799
22800
  // The tags haven't been modified.
@@ -22802,11 +22803,17 @@
22802
22803
  this.tags = entityJson.tags;
22803
22804
  }
22804
22805
  this.$originalTags = entityJson.tags.slice(0);
22805
- if (!this.$nymph.weakCache || !this.$nymph.weakCacheKeepDirtyData) {
22806
+ if (
22807
+ // The instance is new.
22808
+ instanceIsNew ||
22809
+ // Weak cache is not enabled.
22810
+ !this.$nymph.weakCache ||
22811
+ // Weak cache doesn't keep dirty data.
22812
+ !this.$nymph.weakCacheKeepDirtyData ||
22813
+ // This data is coming from a save.
22814
+ isFromSave) {
22806
22815
  // Clear dirty data tracker.
22807
- for (let name in this.$dirty) {
22808
- delete this.$dirty[name];
22809
- }
22816
+ this.$dirty = {};
22810
22817
  }
22811
22818
  for (let name in this.$dataStore) {
22812
22819
  if (!this.$dirty[name]) {
@@ -22821,7 +22828,7 @@
22821
22828
  }
22822
22829
  }
22823
22830
  for (let name in entityJson.data) {
22824
- if (!(name in this.$dataStore)) {
22831
+ if (!(name in this.$dataStore) && !this.$dirty[name]) {
22825
22832
  this.$dataStore[name] = classNamesToEntityConstructors(this.$nymph, referencesToEntities(entityJson.data[name], this.$nymph));
22826
22833
  this.$dirty[name] = false;
22827
22834
  }
@@ -23750,12 +23757,19 @@
23750
23757
  }
23751
23758
  set(EntityClass, entity) {
23752
23759
  if (!entity.guid) {
23753
- return;
23760
+ return entity;
23754
23761
  }
23755
23762
  const weakRef = new WeakRef(entity);
23756
23763
  const classMap = this.references.get(EntityClass) || {};
23764
+ if (entity.guid in classMap) {
23765
+ const deref = classMap[entity.guid] && classMap[entity.guid].deref();
23766
+ if (deref != null) {
23767
+ return deref;
23768
+ }
23769
+ }
23757
23770
  this.references.set(EntityClass, classMap);
23758
23771
  classMap[entity.guid] = weakRef;
23772
+ return entity;
23759
23773
  }
23760
23774
  }
23761
23775
 
@@ -23790,7 +23804,6 @@
23790
23804
  }
23791
23805
  }
23792
23806
 
23793
- let requester;
23794
23807
  class Nymph {
23795
23808
  /**
23796
23809
  * And optional PubSub client instance.
@@ -23804,6 +23817,10 @@
23804
23817
  * The entity class for this instance of Nymph.
23805
23818
  */
23806
23819
  Entity;
23820
+ /**
23821
+ * This instance's requester.
23822
+ */
23823
+ requester;
23807
23824
  requestCallbacks = [];
23808
23825
  responseCallbacks = [];
23809
23826
  restUrl = '';
@@ -23837,21 +23854,28 @@
23837
23854
  this.returnNullOnNotFound = NymphOptions.returnNullOnNotFound;
23838
23855
  }
23839
23856
  this.Entity = this.addEntityClass(Entity);
23840
- requester = new HttpRequester('fetch' in NymphOptions ? NymphOptions.fetch : undefined);
23857
+ this.requester = new HttpRequester('fetch' in NymphOptions ? NymphOptions.fetch : undefined);
23841
23858
  if ('renewTokens' in NymphOptions && !NymphOptions.renewTokens) {
23842
23859
  this.headers['X-Tilmeld-Token-Renewal'] = 'off';
23843
23860
  }
23844
- requester.on('request', (_requester, url, options) => {
23861
+ this.requester.on('request', (_requester, url, options) => {
23845
23862
  for (let i = 0; i < this.requestCallbacks.length; i++) {
23846
23863
  this.requestCallbacks[i] && this.requestCallbacks[i](url, options);
23847
23864
  }
23848
23865
  });
23849
- requester.on('response', (_requester, response, text) => {
23866
+ this.requester.on('response', (_requester, response, text) => {
23850
23867
  for (let i = 0; i < this.responseCallbacks.length; i++) {
23851
23868
  this.responseCallbacks[i] && this.responseCallbacks[i](response, text);
23852
23869
  }
23853
23870
  });
23854
23871
  }
23872
+ /**
23873
+ * Clear both the entity and the query caches.
23874
+ */
23875
+ clearCaches() {
23876
+ this.entityCache = new EntityWeakCache();
23877
+ this.queryCache = new QueryWeakCache();
23878
+ }
23855
23879
  /**
23856
23880
  * Add your class to this instance.
23857
23881
  *
@@ -23888,7 +23912,7 @@
23888
23912
  throw new ClassNotAvailableError('Tried to use class: ' + key);
23889
23913
  }
23890
23914
  async newUID(name) {
23891
- const data = await requester.POST({
23915
+ const data = await this.requester.POST({
23892
23916
  url: this.restUrl,
23893
23917
  headers: { ...this.headers },
23894
23918
  dataType: 'text',
@@ -23897,7 +23921,7 @@
23897
23921
  return Number(data);
23898
23922
  }
23899
23923
  async setUID(name, value) {
23900
- return await requester.PUT({
23924
+ return await this.requester.PUT({
23901
23925
  url: this.restUrl,
23902
23926
  headers: { ...this.headers },
23903
23927
  dataType: 'json',
@@ -23912,7 +23936,7 @@
23912
23936
  promise = this.queryCache.get(queryJSON);
23913
23937
  }
23914
23938
  if (promise == null) {
23915
- promise = requester.GET({
23939
+ promise = this.requester.GET({
23916
23940
  url: this.restUrl,
23917
23941
  headers: { ...this.headers },
23918
23942
  dataType: 'text',
@@ -23926,7 +23950,7 @@
23926
23950
  return Number(data);
23927
23951
  }
23928
23952
  async deleteUID(name) {
23929
- return await requester.DELETE({
23953
+ return await this.requester.DELETE({
23930
23954
  url: this.restUrl,
23931
23955
  headers: { ...this.headers },
23932
23956
  dataType: 'text',
@@ -23972,7 +23996,7 @@
23972
23996
  return await this.requestWithMethod(entities, 'PATCH', patch, true);
23973
23997
  }
23974
23998
  async requestWithMethod(entity, method, data, plural) {
23975
- const response = await requester[method]({
23999
+ const response = await this.requester[method]({
23976
24000
  url: this.restUrl,
23977
24001
  headers: { ...this.headers },
23978
24002
  dataType: 'json',
@@ -24043,7 +24067,7 @@
24043
24067
  promise = this.queryCache.get(queryJSON);
24044
24068
  }
24045
24069
  if (promise == null) {
24046
- promise = requester.GET({
24070
+ promise = this.requester.GET({
24047
24071
  url: this.restUrl,
24048
24072
  headers: { ...this.headers },
24049
24073
  dataType: 'json',
@@ -24075,7 +24099,7 @@
24075
24099
  promise = this.queryCache.get(queryJSON);
24076
24100
  }
24077
24101
  if (promise == null) {
24078
- promise = requester.GET({
24102
+ promise = this.requester.GET({
24079
24103
  url: this.restUrl,
24080
24104
  headers: { ...this.headers },
24081
24105
  dataType: 'json',
@@ -24161,7 +24185,7 @@
24161
24185
  return item;
24162
24186
  }
24163
24187
  async deleteEntity(entity, _plural = false) {
24164
- return await requester.DELETE({
24188
+ return await this.requester.DELETE({
24165
24189
  url: this.restUrl,
24166
24190
  headers: { ...this.headers },
24167
24191
  dataType: 'json',
@@ -24183,7 +24207,7 @@
24183
24207
  return await this.deleteEntity(entities, true);
24184
24208
  }
24185
24209
  async serverCall(entity, method, params, stateless = false) {
24186
- const data = await requester.POST({
24210
+ const data = await this.requester.POST({
24187
24211
  url: this.restUrl,
24188
24212
  headers: { ...this.headers },
24189
24213
  dataType: 'json',
@@ -24203,7 +24227,7 @@
24203
24227
  };
24204
24228
  }
24205
24229
  async serverCallStatic(className, method, params) {
24206
- const data = await requester.POST({
24230
+ const data = await this.requester.POST({
24207
24231
  url: this.restUrl,
24208
24232
  headers: { ...this.headers },
24209
24233
  dataType: 'json',
@@ -24220,7 +24244,7 @@
24220
24244
  return this.initEntitiesFromData(data, false);
24221
24245
  }
24222
24246
  async serverCallStaticIterator(className, method, params) {
24223
- const iterable = await requester.POST_ITERATOR({
24247
+ const iterable = await this.requester.POST_ITERATOR({
24224
24248
  url: this.restUrl,
24225
24249
  headers: { ...this.headers },
24226
24250
  dataType: 'json',
@@ -24693,6 +24717,8 @@
24693
24717
  if (this.nymph.pubsub) {
24694
24718
  this.nymph.pubsub.authenticate(null);
24695
24719
  }
24720
+ // Make sure entities requested under a previous user are not reused.
24721
+ this.nymph.clearCaches();
24696
24722
  delete store.currentToken;
24697
24723
  }
24698
24724
  }
@@ -24714,6 +24740,8 @@
24714
24740
  if (this.nymph.pubsub) {
24715
24741
  this.nymph.pubsub.authenticate(token, switchToken);
24716
24742
  }
24743
+ // Make sure entities requested under a previous user are not reused.
24744
+ this.nymph.clearCaches();
24717
24745
  store.currentToken = token;
24718
24746
  }
24719
24747
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nymphjs/tilmeld-setup",
3
- "version": "1.0.0-beta.134",
3
+ "version": "1.0.0-beta.135",
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.134",
45
- "@nymphjs/tilmeld": "^1.0.0-beta.134",
44
+ "@nymphjs/nymph": "^1.0.0-beta.135",
45
+ "@nymphjs/tilmeld": "^1.0.0-beta.135",
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.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",
53
+ "@nymphjs/client": "^1.0.0-beta.135",
54
+ "@nymphjs/driver-sqlite3": "^1.0.0-beta.135",
55
+ "@nymphjs/query-parser": "^1.0.0-beta.135",
56
+ "@nymphjs/server": "^1.0.0-beta.135",
57
+ "@nymphjs/tilmeld-client": "^1.0.0-beta.135",
58
+ "@nymphjs/tilmeld-components": "^1.0.0-beta.135",
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": "31b045084100c2267c2eac7ad457d52983b0b895"
101
+ "gitHead": "ee05b44026f1408b76aaf56afb5b7172ee745632"
102
102
  }