@easyquery/enterprise 7.5.0 → 7.5.1
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.
|
@@ -659,11 +659,81 @@ function strIsEmpty(str) {
|
|
|
659
659
|
}
|
|
660
660
|
const baseLicApiUrl = 'https://account.korzh.com/api/license';
|
|
661
661
|
const eqVersion = lcv.versionNum;
|
|
662
|
+
const installIdStorageKey = 'eq.iid';
|
|
663
|
+
/**
|
|
664
|
+
* A random id for this sample in this browser, kept in localStorage.
|
|
665
|
+
* Returns null when storage is blocked - the version check works without it.
|
|
666
|
+
*/
|
|
667
|
+
function installId() {
|
|
668
|
+
try {
|
|
669
|
+
let id = localStorage.getItem(installIdStorageKey);
|
|
670
|
+
if (!id) {
|
|
671
|
+
const bytes = new Uint8Array(16);
|
|
672
|
+
crypto.getRandomValues(bytes);
|
|
673
|
+
id = 's_' + Array.from(bytes, b => ('0' + b.toString(16)).slice(-2)).join('');
|
|
674
|
+
localStorage.setItem(installIdStorageKey, id);
|
|
675
|
+
}
|
|
676
|
+
return id;
|
|
677
|
+
}
|
|
678
|
+
catch (_a) {
|
|
679
|
+
return null;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
662
682
|
class LCDialog {
|
|
663
683
|
constructor(context) {
|
|
664
684
|
this.http = new core$1.HttpClient();
|
|
665
685
|
this.context = context;
|
|
666
686
|
}
|
|
687
|
+
isVersionCheckEnabled() {
|
|
688
|
+
return !window.EQ_NO_VERSION_CHECK && !this.context.options.noVersionCheck;
|
|
689
|
+
}
|
|
690
|
+
/** The install id to send, or undefined when the developer opted out of the version check. */
|
|
691
|
+
getInstallId() {
|
|
692
|
+
return this.isVersionCheckEnabled() ? installId() || undefined : undefined;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Asks korzh.com whether this is the latest EasyQuery.JS release and, if it is not,
|
|
696
|
+
* adds a line to the dialog. Never delays the dialog; any failure changes nothing.
|
|
697
|
+
*/
|
|
698
|
+
checkVersion() {
|
|
699
|
+
if (!this.isVersionCheckEnabled())
|
|
700
|
+
return;
|
|
701
|
+
try {
|
|
702
|
+
const backend = this.context.backendInfo || {};
|
|
703
|
+
this.http.post(core.equtils.combinePath(baseLicApiUrl, 'version-check'), {
|
|
704
|
+
version: core.eqjsVersion,
|
|
705
|
+
iid: this.getInstallId(),
|
|
706
|
+
ptag: backend.type,
|
|
707
|
+
apptype: backend.subType,
|
|
708
|
+
appName: this.context.getAppName() || undefined
|
|
709
|
+
}, { dataType: 'json' })
|
|
710
|
+
.then(result => {
|
|
711
|
+
if (result && result.status === 'outdated' && result.latest) {
|
|
712
|
+
this.showVersionNotice(result);
|
|
713
|
+
}
|
|
714
|
+
})
|
|
715
|
+
.catch(() => { });
|
|
716
|
+
}
|
|
717
|
+
catch (_a) {
|
|
718
|
+
// the check is optional - the dialog works the same without it
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
showVersionNotice(result) {
|
|
722
|
+
const el = this.versionNoticeElement;
|
|
723
|
+
if (!el)
|
|
724
|
+
return;
|
|
725
|
+
el.textContent = `You are using EasyQuery.JS ${core.eqjsVersion}. The latest release is ${result.latest}.`;
|
|
726
|
+
if (result.releaseNotes && /^https:\/\//i.test(result.releaseNotes)) {
|
|
727
|
+
el.appendChild(document.createTextNode(' '));
|
|
728
|
+
const link = document.createElement('a');
|
|
729
|
+
link.href = result.releaseNotes;
|
|
730
|
+
link.target = '_blank';
|
|
731
|
+
link.rel = 'noopener';
|
|
732
|
+
link.textContent = "What's new";
|
|
733
|
+
el.appendChild(link);
|
|
734
|
+
}
|
|
735
|
+
el.style.display = '';
|
|
736
|
+
}
|
|
667
737
|
show() {
|
|
668
738
|
const dialogService = new ui.DefaultDialogService();
|
|
669
739
|
this.dialogSet = dialogService.createSet([
|
|
@@ -703,6 +773,7 @@ class LCDialog {
|
|
|
703
773
|
},
|
|
704
774
|
]);
|
|
705
775
|
const dialog1 = this.dialogSet.open(0);
|
|
776
|
+
this.checkVersion();
|
|
706
777
|
setTimeout(() => {
|
|
707
778
|
this.validateForm(dialog1);
|
|
708
779
|
const emailInput = document.getElementById('eqAuthEmail');
|
|
@@ -756,6 +827,14 @@ class LCDialog {
|
|
|
756
827
|
formBuilder.addChild('div', b => b
|
|
757
828
|
.html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div>' +
|
|
758
829
|
'<div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>'));
|
|
830
|
+
// filled in by checkVersion() when a newer release exists
|
|
831
|
+
formBuilder.addChild('div', b => {
|
|
832
|
+
b.setStyle('display', 'none');
|
|
833
|
+
b.setStyle('margin-top', '14px');
|
|
834
|
+
b.setStyle('font-size', '0.9em');
|
|
835
|
+
b.setStyle('opacity', '0.8');
|
|
836
|
+
this.versionNoticeElement = b.toDOM();
|
|
837
|
+
});
|
|
759
838
|
formBuilder
|
|
760
839
|
.addClass('kfrm-form')
|
|
761
840
|
.addChild('div', b => {
|
|
@@ -836,6 +915,7 @@ class LCDialog {
|
|
|
836
915
|
data: {
|
|
837
916
|
ptag: this.context.backendInfo.type,
|
|
838
917
|
apptype: this.context.backendInfo.subType,
|
|
918
|
+
iid: this.getInstallId()
|
|
839
919
|
}
|
|
840
920
|
}, { dataType: 'json' })
|
|
841
921
|
.then(result => {
|
|
@@ -866,7 +946,8 @@ class LCDialog {
|
|
|
866
946
|
email: this.authEmail,
|
|
867
947
|
ptag: this.context.backendInfo.type,
|
|
868
948
|
apptype: this.context.backendInfo.subType,
|
|
869
|
-
version: eqVersion
|
|
949
|
+
version: eqVersion,
|
|
950
|
+
iid: this.getInstallId()
|
|
870
951
|
}, { dataType: 'json' })
|
|
871
952
|
.then(result => {
|
|
872
953
|
switch (result.status) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Condition, CondTag, QueryColumn, Query, LinkType, Tree, DataModel, EqAggregatesContainer, equtils, registerEqContextResolver, EqContext, ExprTag, Expression } from '@easyquery/core';
|
|
1
|
+
import { Condition, CondTag, QueryColumn, Query, LinkType, Tree, DataModel, EqAggregatesContainer, equtils, eqjsVersion, registerEqContextResolver, EqContext, ExprTag, Expression } from '@easyquery/core';
|
|
2
2
|
import { HttpClient, EasyDataTable } from '@easydata/core';
|
|
3
3
|
import { DefaultDialogService, domel } from '@easydata/ui';
|
|
4
4
|
|
|
@@ -657,11 +657,81 @@ function strIsEmpty(str) {
|
|
|
657
657
|
}
|
|
658
658
|
const baseLicApiUrl = 'https://account.korzh.com/api/license';
|
|
659
659
|
const eqVersion = lcv.versionNum;
|
|
660
|
+
const installIdStorageKey = 'eq.iid';
|
|
661
|
+
/**
|
|
662
|
+
* A random id for this sample in this browser, kept in localStorage.
|
|
663
|
+
* Returns null when storage is blocked - the version check works without it.
|
|
664
|
+
*/
|
|
665
|
+
function installId() {
|
|
666
|
+
try {
|
|
667
|
+
let id = localStorage.getItem(installIdStorageKey);
|
|
668
|
+
if (!id) {
|
|
669
|
+
const bytes = new Uint8Array(16);
|
|
670
|
+
crypto.getRandomValues(bytes);
|
|
671
|
+
id = 's_' + Array.from(bytes, b => ('0' + b.toString(16)).slice(-2)).join('');
|
|
672
|
+
localStorage.setItem(installIdStorageKey, id);
|
|
673
|
+
}
|
|
674
|
+
return id;
|
|
675
|
+
}
|
|
676
|
+
catch (_a) {
|
|
677
|
+
return null;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
660
680
|
class LCDialog {
|
|
661
681
|
constructor(context) {
|
|
662
682
|
this.http = new HttpClient();
|
|
663
683
|
this.context = context;
|
|
664
684
|
}
|
|
685
|
+
isVersionCheckEnabled() {
|
|
686
|
+
return !window.EQ_NO_VERSION_CHECK && !this.context.options.noVersionCheck;
|
|
687
|
+
}
|
|
688
|
+
/** The install id to send, or undefined when the developer opted out of the version check. */
|
|
689
|
+
getInstallId() {
|
|
690
|
+
return this.isVersionCheckEnabled() ? installId() || undefined : undefined;
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Asks korzh.com whether this is the latest EasyQuery.JS release and, if it is not,
|
|
694
|
+
* adds a line to the dialog. Never delays the dialog; any failure changes nothing.
|
|
695
|
+
*/
|
|
696
|
+
checkVersion() {
|
|
697
|
+
if (!this.isVersionCheckEnabled())
|
|
698
|
+
return;
|
|
699
|
+
try {
|
|
700
|
+
const backend = this.context.backendInfo || {};
|
|
701
|
+
this.http.post(equtils.combinePath(baseLicApiUrl, 'version-check'), {
|
|
702
|
+
version: eqjsVersion,
|
|
703
|
+
iid: this.getInstallId(),
|
|
704
|
+
ptag: backend.type,
|
|
705
|
+
apptype: backend.subType,
|
|
706
|
+
appName: this.context.getAppName() || undefined
|
|
707
|
+
}, { dataType: 'json' })
|
|
708
|
+
.then(result => {
|
|
709
|
+
if (result && result.status === 'outdated' && result.latest) {
|
|
710
|
+
this.showVersionNotice(result);
|
|
711
|
+
}
|
|
712
|
+
})
|
|
713
|
+
.catch(() => { });
|
|
714
|
+
}
|
|
715
|
+
catch (_a) {
|
|
716
|
+
// the check is optional - the dialog works the same without it
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
showVersionNotice(result) {
|
|
720
|
+
const el = this.versionNoticeElement;
|
|
721
|
+
if (!el)
|
|
722
|
+
return;
|
|
723
|
+
el.textContent = `You are using EasyQuery.JS ${eqjsVersion}. The latest release is ${result.latest}.`;
|
|
724
|
+
if (result.releaseNotes && /^https:\/\//i.test(result.releaseNotes)) {
|
|
725
|
+
el.appendChild(document.createTextNode(' '));
|
|
726
|
+
const link = document.createElement('a');
|
|
727
|
+
link.href = result.releaseNotes;
|
|
728
|
+
link.target = '_blank';
|
|
729
|
+
link.rel = 'noopener';
|
|
730
|
+
link.textContent = "What's new";
|
|
731
|
+
el.appendChild(link);
|
|
732
|
+
}
|
|
733
|
+
el.style.display = '';
|
|
734
|
+
}
|
|
665
735
|
show() {
|
|
666
736
|
const dialogService = new DefaultDialogService();
|
|
667
737
|
this.dialogSet = dialogService.createSet([
|
|
@@ -701,6 +771,7 @@ class LCDialog {
|
|
|
701
771
|
},
|
|
702
772
|
]);
|
|
703
773
|
const dialog1 = this.dialogSet.open(0);
|
|
774
|
+
this.checkVersion();
|
|
704
775
|
setTimeout(() => {
|
|
705
776
|
this.validateForm(dialog1);
|
|
706
777
|
const emailInput = document.getElementById('eqAuthEmail');
|
|
@@ -754,6 +825,14 @@ class LCDialog {
|
|
|
754
825
|
formBuilder.addChild('div', b => b
|
|
755
826
|
.html('<div style="font-size:1.2em">The EasyQuery license key is either absent, invalid or was issued for a different version of the library.</div>' +
|
|
756
827
|
'<div style="font-size:1.2em">Please fill out the form to obtain a valid trial license key.</div>'));
|
|
828
|
+
// filled in by checkVersion() when a newer release exists
|
|
829
|
+
formBuilder.addChild('div', b => {
|
|
830
|
+
b.setStyle('display', 'none');
|
|
831
|
+
b.setStyle('margin-top', '14px');
|
|
832
|
+
b.setStyle('font-size', '0.9em');
|
|
833
|
+
b.setStyle('opacity', '0.8');
|
|
834
|
+
this.versionNoticeElement = b.toDOM();
|
|
835
|
+
});
|
|
757
836
|
formBuilder
|
|
758
837
|
.addClass('kfrm-form')
|
|
759
838
|
.addChild('div', b => {
|
|
@@ -834,6 +913,7 @@ class LCDialog {
|
|
|
834
913
|
data: {
|
|
835
914
|
ptag: this.context.backendInfo.type,
|
|
836
915
|
apptype: this.context.backendInfo.subType,
|
|
916
|
+
iid: this.getInstallId()
|
|
837
917
|
}
|
|
838
918
|
}, { dataType: 'json' })
|
|
839
919
|
.then(result => {
|
|
@@ -864,7 +944,8 @@ class LCDialog {
|
|
|
864
944
|
email: this.authEmail,
|
|
865
945
|
ptag: this.context.backendInfo.type,
|
|
866
946
|
apptype: this.context.backendInfo.subType,
|
|
867
|
-
version: eqVersion
|
|
947
|
+
version: eqVersion,
|
|
948
|
+
iid: this.getInstallId()
|
|
868
949
|
}, { dataType: 'json' })
|
|
869
950
|
.then(result => {
|
|
870
951
|
switch (result.status) {
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { DomElementBuilder, Dialog } from '@easydata/ui';
|
|
2
2
|
import { EqContext } from '@easyquery/core';
|
|
3
|
+
interface VersionCheckResponse {
|
|
4
|
+
status: 'latest' | 'outdated' | 'unknown';
|
|
5
|
+
latest?: string;
|
|
6
|
+
beta?: string;
|
|
7
|
+
releaseNotes?: string;
|
|
8
|
+
}
|
|
3
9
|
export declare class LCDialog {
|
|
4
10
|
private dialogSet;
|
|
5
11
|
private http;
|
|
6
12
|
private context;
|
|
7
13
|
private authName;
|
|
8
14
|
private authEmail;
|
|
15
|
+
private versionNoticeElement;
|
|
9
16
|
constructor(context: EqContext);
|
|
17
|
+
protected isVersionCheckEnabled(): boolean;
|
|
18
|
+
/** The install id to send, or undefined when the developer opted out of the version check. */
|
|
19
|
+
protected getInstallId(): string | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Asks korzh.com whether this is the latest EasyQuery.JS release and, if it is not,
|
|
22
|
+
* adds a line to the dialog. Never delays the dialog; any failure changes nothing.
|
|
23
|
+
*/
|
|
24
|
+
protected checkVersion(): void;
|
|
25
|
+
protected showVersionNotice(result: VersionCheckResponse): void;
|
|
10
26
|
show(): void;
|
|
11
27
|
protected isValidForm(form: HTMLElement): boolean | RegExpMatchArray;
|
|
12
28
|
protected validateForm(dialog: Dialog): void;
|
|
@@ -19,3 +35,4 @@ export declare class LCDialog {
|
|
|
19
35
|
protected codePageOnSubmit(dlg: Dialog): boolean;
|
|
20
36
|
}
|
|
21
37
|
export declare function showNoLicenseAlert(context: EqContext): void;
|
|
38
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easyquery/enterprise",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.1",
|
|
4
4
|
"description": "EasyQuery.JS Enterprise",
|
|
5
5
|
"types": "./dist/types/public_api.d.ts",
|
|
6
6
|
"main": "./dist/easyquery.enterprise.cjs.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"bugs": "https://korzh.com/support",
|
|
29
29
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@easyquery/core": "^7.5.
|
|
32
|
-
"@easyquery/ui": "^7.5.
|
|
31
|
+
"@easyquery/core": "^7.5.1",
|
|
32
|
+
"@easyquery/ui": "^7.5.1"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist"
|