@nymphjs/tilmeld-setup 1.0.0-beta.133 → 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 +8 -0
- package/dist/app/index.js +152 -53
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
|
|
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)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @nymphjs/tilmeld-setup
|
|
13
|
+
|
|
6
14
|
# [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
15
|
|
|
8
16
|
**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
|
-
|
|
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 (
|
|
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
|
-
|
|
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,16 +23757,53 @@
|
|
|
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;
|
|
23773
|
+
}
|
|
23774
|
+
}
|
|
23775
|
+
|
|
23776
|
+
class QueryWeakCache {
|
|
23777
|
+
queries = new Map();
|
|
23778
|
+
get(queryJSON) {
|
|
23779
|
+
const weakRef = this.queries.get(queryJSON);
|
|
23780
|
+
const deref = weakRef && weakRef.deref();
|
|
23781
|
+
if (deref != null) {
|
|
23782
|
+
return deref;
|
|
23783
|
+
}
|
|
23784
|
+
else {
|
|
23785
|
+
this.queries.delete(queryJSON);
|
|
23786
|
+
}
|
|
23787
|
+
return null;
|
|
23788
|
+
}
|
|
23789
|
+
set(queryJSON, promise) {
|
|
23790
|
+
this.clean();
|
|
23791
|
+
if (!(promise instanceof Promise)) {
|
|
23792
|
+
return;
|
|
23793
|
+
}
|
|
23794
|
+
const weakRef = new WeakRef(promise);
|
|
23795
|
+
this.queries.set(queryJSON, weakRef);
|
|
23796
|
+
}
|
|
23797
|
+
clean() {
|
|
23798
|
+
this.queries.forEach((value, key) => {
|
|
23799
|
+
const deref = value && value.deref();
|
|
23800
|
+
if (deref == null) {
|
|
23801
|
+
this.queries.delete(key);
|
|
23802
|
+
}
|
|
23803
|
+
});
|
|
23759
23804
|
}
|
|
23760
23805
|
}
|
|
23761
23806
|
|
|
23762
|
-
let requester;
|
|
23763
23807
|
class Nymph {
|
|
23764
23808
|
/**
|
|
23765
23809
|
* And optional PubSub client instance.
|
|
@@ -23773,6 +23817,10 @@
|
|
|
23773
23817
|
* The entity class for this instance of Nymph.
|
|
23774
23818
|
*/
|
|
23775
23819
|
Entity;
|
|
23820
|
+
/**
|
|
23821
|
+
* This instance's requester.
|
|
23822
|
+
*/
|
|
23823
|
+
requester;
|
|
23776
23824
|
requestCallbacks = [];
|
|
23777
23825
|
responseCallbacks = [];
|
|
23778
23826
|
restUrl = '';
|
|
@@ -23787,7 +23835,11 @@
|
|
|
23787
23835
|
/**
|
|
23788
23836
|
* The entity cache.
|
|
23789
23837
|
*/
|
|
23790
|
-
|
|
23838
|
+
entityCache = new EntityWeakCache();
|
|
23839
|
+
/**
|
|
23840
|
+
* The query cache.
|
|
23841
|
+
*/
|
|
23842
|
+
queryCache = new QueryWeakCache();
|
|
23791
23843
|
/**
|
|
23792
23844
|
* Return `null` or empty array instead of error when entity/ies not found.
|
|
23793
23845
|
*/
|
|
@@ -23802,21 +23854,28 @@
|
|
|
23802
23854
|
this.returnNullOnNotFound = NymphOptions.returnNullOnNotFound;
|
|
23803
23855
|
}
|
|
23804
23856
|
this.Entity = this.addEntityClass(Entity);
|
|
23805
|
-
requester = new HttpRequester('fetch' in NymphOptions ? NymphOptions.fetch : undefined);
|
|
23857
|
+
this.requester = new HttpRequester('fetch' in NymphOptions ? NymphOptions.fetch : undefined);
|
|
23806
23858
|
if ('renewTokens' in NymphOptions && !NymphOptions.renewTokens) {
|
|
23807
23859
|
this.headers['X-Tilmeld-Token-Renewal'] = 'off';
|
|
23808
23860
|
}
|
|
23809
|
-
requester.on('request', (_requester, url, options) => {
|
|
23861
|
+
this.requester.on('request', (_requester, url, options) => {
|
|
23810
23862
|
for (let i = 0; i < this.requestCallbacks.length; i++) {
|
|
23811
23863
|
this.requestCallbacks[i] && this.requestCallbacks[i](url, options);
|
|
23812
23864
|
}
|
|
23813
23865
|
});
|
|
23814
|
-
requester.on('response', (_requester, response, text) => {
|
|
23866
|
+
this.requester.on('response', (_requester, response, text) => {
|
|
23815
23867
|
for (let i = 0; i < this.responseCallbacks.length; i++) {
|
|
23816
23868
|
this.responseCallbacks[i] && this.responseCallbacks[i](response, text);
|
|
23817
23869
|
}
|
|
23818
23870
|
});
|
|
23819
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
|
+
}
|
|
23820
23879
|
/**
|
|
23821
23880
|
* Add your class to this instance.
|
|
23822
23881
|
*
|
|
@@ -23853,7 +23912,7 @@
|
|
|
23853
23912
|
throw new ClassNotAvailableError('Tried to use class: ' + key);
|
|
23854
23913
|
}
|
|
23855
23914
|
async newUID(name) {
|
|
23856
|
-
const data = await requester.POST({
|
|
23915
|
+
const data = await this.requester.POST({
|
|
23857
23916
|
url: this.restUrl,
|
|
23858
23917
|
headers: { ...this.headers },
|
|
23859
23918
|
dataType: 'text',
|
|
@@ -23862,7 +23921,7 @@
|
|
|
23862
23921
|
return Number(data);
|
|
23863
23922
|
}
|
|
23864
23923
|
async setUID(name, value) {
|
|
23865
|
-
return await requester.PUT({
|
|
23924
|
+
return await this.requester.PUT({
|
|
23866
23925
|
url: this.restUrl,
|
|
23867
23926
|
headers: { ...this.headers },
|
|
23868
23927
|
dataType: 'json',
|
|
@@ -23870,16 +23929,28 @@
|
|
|
23870
23929
|
});
|
|
23871
23930
|
}
|
|
23872
23931
|
async getUID(name) {
|
|
23873
|
-
const
|
|
23874
|
-
|
|
23875
|
-
|
|
23876
|
-
|
|
23877
|
-
|
|
23878
|
-
}
|
|
23932
|
+
const query = { action: 'uid', data: name };
|
|
23933
|
+
let promise = null;
|
|
23934
|
+
const queryJSON = JSON.stringify(query);
|
|
23935
|
+
if (this.weakCache) {
|
|
23936
|
+
promise = this.queryCache.get(queryJSON);
|
|
23937
|
+
}
|
|
23938
|
+
if (promise == null) {
|
|
23939
|
+
promise = this.requester.GET({
|
|
23940
|
+
url: this.restUrl,
|
|
23941
|
+
headers: { ...this.headers },
|
|
23942
|
+
dataType: 'text',
|
|
23943
|
+
data: query,
|
|
23944
|
+
});
|
|
23945
|
+
if (this.weakCache) {
|
|
23946
|
+
this.queryCache.set(queryJSON, promise);
|
|
23947
|
+
}
|
|
23948
|
+
}
|
|
23949
|
+
const data = await promise;
|
|
23879
23950
|
return Number(data);
|
|
23880
23951
|
}
|
|
23881
23952
|
async deleteUID(name) {
|
|
23882
|
-
return await requester.DELETE({
|
|
23953
|
+
return await this.requester.DELETE({
|
|
23883
23954
|
url: this.restUrl,
|
|
23884
23955
|
headers: { ...this.headers },
|
|
23885
23956
|
dataType: 'text',
|
|
@@ -23925,7 +23996,7 @@
|
|
|
23925
23996
|
return await this.requestWithMethod(entities, 'PATCH', patch, true);
|
|
23926
23997
|
}
|
|
23927
23998
|
async requestWithMethod(entity, method, data, plural) {
|
|
23928
|
-
const response = await requester[method]({
|
|
23999
|
+
const response = await this.requester[method]({
|
|
23929
24000
|
url: this.restUrl,
|
|
23930
24001
|
headers: { ...this.headers },
|
|
23931
24002
|
dataType: 'json',
|
|
@@ -23983,18 +24054,30 @@
|
|
|
23983
24054
|
if (typeof selectors[0] === 'string') {
|
|
23984
24055
|
selectors = [{ type: '&', guid: selectors[0] }];
|
|
23985
24056
|
}
|
|
23986
|
-
const
|
|
23987
|
-
|
|
23988
|
-
|
|
23989
|
-
|
|
23990
|
-
|
|
23991
|
-
|
|
23992
|
-
|
|
23993
|
-
|
|
23994
|
-
|
|
23995
|
-
|
|
23996
|
-
|
|
23997
|
-
}
|
|
24057
|
+
const query = {
|
|
24058
|
+
action: 'entity',
|
|
24059
|
+
data: [
|
|
24060
|
+
entityConstructorsToClassNames(options),
|
|
24061
|
+
...entityConstructorsToClassNames(entitiesToReferences(selectors)),
|
|
24062
|
+
],
|
|
24063
|
+
};
|
|
24064
|
+
let promise = null;
|
|
24065
|
+
const queryJSON = JSON.stringify(query);
|
|
24066
|
+
if (this.weakCache) {
|
|
24067
|
+
promise = this.queryCache.get(queryJSON);
|
|
24068
|
+
}
|
|
24069
|
+
if (promise == null) {
|
|
24070
|
+
promise = this.requester.GET({
|
|
24071
|
+
url: this.restUrl,
|
|
24072
|
+
headers: { ...this.headers },
|
|
24073
|
+
dataType: 'json',
|
|
24074
|
+
data: query,
|
|
24075
|
+
});
|
|
24076
|
+
if (this.weakCache) {
|
|
24077
|
+
this.queryCache.set(queryJSON, promise);
|
|
24078
|
+
}
|
|
24079
|
+
}
|
|
24080
|
+
const data = await promise;
|
|
23998
24081
|
if (options.return === 'count' || typeof data.guid !== 'undefined') {
|
|
23999
24082
|
return data;
|
|
24000
24083
|
}
|
|
@@ -24003,18 +24086,30 @@
|
|
|
24003
24086
|
async getEntities(options, ...selectors) {
|
|
24004
24087
|
let data = null;
|
|
24005
24088
|
try {
|
|
24006
|
-
|
|
24007
|
-
|
|
24008
|
-
|
|
24009
|
-
|
|
24010
|
-
|
|
24011
|
-
|
|
24012
|
-
|
|
24013
|
-
|
|
24014
|
-
|
|
24015
|
-
|
|
24016
|
-
|
|
24017
|
-
}
|
|
24089
|
+
const query = {
|
|
24090
|
+
action: 'entities',
|
|
24091
|
+
data: [
|
|
24092
|
+
entityConstructorsToClassNames(options),
|
|
24093
|
+
...entityConstructorsToClassNames(entitiesToReferences(selectors)),
|
|
24094
|
+
],
|
|
24095
|
+
};
|
|
24096
|
+
let promise = null;
|
|
24097
|
+
const queryJSON = JSON.stringify(query);
|
|
24098
|
+
if (this.weakCache) {
|
|
24099
|
+
promise = this.queryCache.get(queryJSON);
|
|
24100
|
+
}
|
|
24101
|
+
if (promise == null) {
|
|
24102
|
+
promise = this.requester.GET({
|
|
24103
|
+
url: this.restUrl,
|
|
24104
|
+
headers: { ...this.headers },
|
|
24105
|
+
dataType: 'json',
|
|
24106
|
+
data: query,
|
|
24107
|
+
});
|
|
24108
|
+
if (this.weakCache) {
|
|
24109
|
+
this.queryCache.set(queryJSON, promise);
|
|
24110
|
+
}
|
|
24111
|
+
}
|
|
24112
|
+
data = await promise;
|
|
24018
24113
|
}
|
|
24019
24114
|
catch (e) {
|
|
24020
24115
|
if (this.returnNullOnNotFound &&
|
|
@@ -24045,7 +24140,7 @@
|
|
|
24045
24140
|
let entity = EntityClass.factorySync();
|
|
24046
24141
|
if (this.weakCache) {
|
|
24047
24142
|
// Try to get it from cache.
|
|
24048
|
-
const entityFromCache = this.
|
|
24143
|
+
const entityFromCache = this.entityCache.get(EntityClass, entityJSON.guid || '');
|
|
24049
24144
|
if (entityFromCache != null) {
|
|
24050
24145
|
entity = entityFromCache;
|
|
24051
24146
|
}
|
|
@@ -24056,13 +24151,13 @@
|
|
|
24056
24151
|
if (!this.weakCache) {
|
|
24057
24152
|
return null;
|
|
24058
24153
|
}
|
|
24059
|
-
return this.
|
|
24154
|
+
return this.entityCache.get(EntityClass, guid);
|
|
24060
24155
|
}
|
|
24061
24156
|
setEntityToCache(EntityClass, entity) {
|
|
24062
24157
|
if (!this.weakCache) {
|
|
24063
24158
|
return;
|
|
24064
24159
|
}
|
|
24065
|
-
return this.
|
|
24160
|
+
return this.entityCache.set(EntityClass, entity);
|
|
24066
24161
|
}
|
|
24067
24162
|
initEntitiesFromData(item, isFromSave) {
|
|
24068
24163
|
if (Array.isArray(item)) {
|
|
@@ -24090,7 +24185,7 @@
|
|
|
24090
24185
|
return item;
|
|
24091
24186
|
}
|
|
24092
24187
|
async deleteEntity(entity, _plural = false) {
|
|
24093
|
-
return await requester.DELETE({
|
|
24188
|
+
return await this.requester.DELETE({
|
|
24094
24189
|
url: this.restUrl,
|
|
24095
24190
|
headers: { ...this.headers },
|
|
24096
24191
|
dataType: 'json',
|
|
@@ -24112,7 +24207,7 @@
|
|
|
24112
24207
|
return await this.deleteEntity(entities, true);
|
|
24113
24208
|
}
|
|
24114
24209
|
async serverCall(entity, method, params, stateless = false) {
|
|
24115
|
-
const data = await requester.POST({
|
|
24210
|
+
const data = await this.requester.POST({
|
|
24116
24211
|
url: this.restUrl,
|
|
24117
24212
|
headers: { ...this.headers },
|
|
24118
24213
|
dataType: 'json',
|
|
@@ -24132,7 +24227,7 @@
|
|
|
24132
24227
|
};
|
|
24133
24228
|
}
|
|
24134
24229
|
async serverCallStatic(className, method, params) {
|
|
24135
|
-
const data = await requester.POST({
|
|
24230
|
+
const data = await this.requester.POST({
|
|
24136
24231
|
url: this.restUrl,
|
|
24137
24232
|
headers: { ...this.headers },
|
|
24138
24233
|
dataType: 'json',
|
|
@@ -24149,7 +24244,7 @@
|
|
|
24149
24244
|
return this.initEntitiesFromData(data, false);
|
|
24150
24245
|
}
|
|
24151
24246
|
async serverCallStaticIterator(className, method, params) {
|
|
24152
|
-
const iterable = await requester.POST_ITERATOR({
|
|
24247
|
+
const iterable = await this.requester.POST_ITERATOR({
|
|
24153
24248
|
url: this.restUrl,
|
|
24154
24249
|
headers: { ...this.headers },
|
|
24155
24250
|
dataType: 'json',
|
|
@@ -24622,6 +24717,8 @@
|
|
|
24622
24717
|
if (this.nymph.pubsub) {
|
|
24623
24718
|
this.nymph.pubsub.authenticate(null);
|
|
24624
24719
|
}
|
|
24720
|
+
// Make sure entities requested under a previous user are not reused.
|
|
24721
|
+
this.nymph.clearCaches();
|
|
24625
24722
|
delete store.currentToken;
|
|
24626
24723
|
}
|
|
24627
24724
|
}
|
|
@@ -24643,6 +24740,8 @@
|
|
|
24643
24740
|
if (this.nymph.pubsub) {
|
|
24644
24741
|
this.nymph.pubsub.authenticate(token, switchToken);
|
|
24645
24742
|
}
|
|
24743
|
+
// Make sure entities requested under a previous user are not reused.
|
|
24744
|
+
this.nymph.clearCaches();
|
|
24646
24745
|
store.currentToken = token;
|
|
24647
24746
|
}
|
|
24648
24747
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nymphjs/tilmeld-setup",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
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.
|
|
45
|
-
"@nymphjs/tilmeld": "^1.0.0-beta.
|
|
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.
|
|
54
|
-
"@nymphjs/driver-sqlite3": "^1.0.0-beta.
|
|
55
|
-
"@nymphjs/query-parser": "^1.0.0-beta.
|
|
56
|
-
"@nymphjs/server": "^1.0.0-beta.
|
|
57
|
-
"@nymphjs/tilmeld-client": "^1.0.0-beta.
|
|
58
|
-
"@nymphjs/tilmeld-components": "^1.0.0-beta.
|
|
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": "
|
|
101
|
+
"gitHead": "ee05b44026f1408b76aaf56afb5b7172ee745632"
|
|
102
102
|
}
|