@omnia/velcron 8.0.95-vnext → 8.0.96-dev
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/actions/Alert.js +1 -1
- package/actions/Array.js +9 -2
- package/actions/Clone.d.ts +2 -0
- package/actions/Clone.js +11 -0
- package/actions/Date.d.ts +3 -0
- package/actions/Date.js +29 -0
- package/actions/Http.js +23 -6
- package/actions/IActionHandler.d.ts +1 -0
- package/actions/Timer.d.ts +4 -0
- package/actions/Timer.js +80 -0
- package/actions/index.d.ts +3 -0
- package/actions/index.js +3 -0
- package/internal-do-not-import-from-here/shared/models/Broadcasting.js +1 -1
- package/internal-do-not-import-from-here/shared/models/DynamicState.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/Equals.js +33 -3
- package/internal-do-not-import-from-here/shared/models/Future.d.ts +17 -1
- package/internal-do-not-import-from-here/shared/models/Future.js +26 -5
- package/internal-do-not-import-from-here/shared/models/Guid.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/Guid.js +13 -6
- package/internal-do-not-import-from-here/shared/models/HttpCommon.d.ts +27 -0
- package/internal-do-not-import-from-here/shared/models/OmniaSharedBootstrapData.d.ts +7 -1
- package/internal-do-not-import-from-here/shared/models/Realtime.d.ts +1 -13
- package/internal-do-not-import-from-here/shared/models/Realtime.js +1 -22
- package/internal-do-not-import-from-here/shared/models/StronglyTypedId.d.ts +3 -0
- package/internal-do-not-import-from-here/shared/models/StronglyTypedId.js +2 -0
- package/internal-do-not-import-from-here/shared/models/Tokens.d.ts +1 -0
- package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.d.ts +7 -1
- package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.js +5 -1
- package/internal-do-not-import-from-here/shared/models/Workers.js +1 -1
- package/internal-do-not-import-from-here/shared/models/hub/ExternalIdentityId.d.ts +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/ExternalIdentityId.js +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.d.ts +13 -0
- package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.js +20 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.d.ts +67 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.js +7 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.d.ts +7 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.d.ts +14 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.js +15 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.d.ts +30 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.js +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.d.ts +15 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.d.ts +8 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.js +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.d.ts +15 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.d.ts +40 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.js +39 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/index.d.ts +8 -0
- package/internal-do-not-import-from-here/shared/models/hub/activities/index.js +11 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.d.ts +3 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.d.ts +4 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.d.ts +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.js +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/index.d.ts +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/index.js +8 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.d.ts +10 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.js +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.d.ts +5 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.js +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/index.d.ts +2 -0
- package/internal-do-not-import-from-here/shared/models/hub/social/index.js +5 -0
- package/internal-do-not-import-from-here/shared/models/index.d.ts +5 -1
- package/internal-do-not-import-from-here/shared/models/index.js +5 -1
- package/internal-do-not-import-from-here/shared/models/theming/BlueprintDefinition.d.ts +44 -46
- package/internal-do-not-import-from-here/shared/models/theming/BlueprintDefinition.js +7 -13
- package/internal-do-not-import-from-here/shared/models/theming/ChromeDefinition.d.ts +25 -0
- package/internal-do-not-import-from-here/shared/models/theming/ChromeDefinition.js +2 -0
- package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.d.ts +2 -2
- package/internal-do-not-import-from-here/shared/models/theming/SharedBlueprintMethods.js +8 -7
- package/internal-do-not-import-from-here/shared/models/theming/SpacingSetting.d.ts +5 -4
- package/internal-do-not-import-from-here/shared/models/theming/SpacingSetting.js +1 -1
- package/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.d.ts +22 -13
- package/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.js +8 -10
- package/internal-do-not-import-from-here/shared/models/theming/TypographyDefinition.d.ts +5 -0
- package/internal-do-not-import-from-here/shared/models/theming/TypographyDefinition.js +2 -2
- package/internal-do-not-import-from-here/shared/models/theming/UseThemeMethods.d.ts +3 -5
- package/internal-do-not-import-from-here/shared/models/theming/UseThemeMethods.js +4 -30
- package/internal-do-not-import-from-here/shared/models/theming/index.d.ts +1 -1
- package/internal-do-not-import-from-here/shared/models/theming/index.js +2 -1
- package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.d.ts +87 -0
- package/internal-do-not-import-from-here/shared/models/velcron/VelcronDefinition.js +2 -0
- package/internal-do-not-import-from-here/shared/models/velcron/VelcronEvents.js +2 -0
- package/internal-do-not-import-from-here/shared/models/velcron/index.d.ts +2 -0
- package/internal-do-not-import-from-here/shared/models/velcron/index.js +5 -0
- package/models/ActionHooks.d.ts +12 -0
- package/models/ActionHooks.js +2 -0
- package/models/Enums.js +7 -7
- package/models/VelcronDefinitions.d.ts +79 -88
- package/models/VelcronDefinitions.js +1 -1
- package/models/VelcronPropertyEditorDefinitions.d.ts +259 -19
- package/models/VelcronPropertyEditorDefinitions.js +114 -2
- package/models/VelcronTypes.d.ts +1 -1
- package/models/ViewModelAndContext.d.ts +1 -1
- package/models/index.d.ts +1 -1
- package/models/index.js +1 -1
- package/package.json +1 -1
- package/parser/VelcronActions.d.ts +8 -2
- package/parser/VelcronActions.js +23 -3
- package/parser/VelcronConstants.d.ts +6 -1
- package/parser/VelcronConstants.js +7 -2
- package/parser/VelcronData.d.ts +3 -2
- package/parser/VelcronData.js +16 -12
- package/parser/VelcronPropertyEditors.js +1 -1
- package/parser/VelcronRenderers.d.ts +2 -1
- package/parser/VelcronRenderers.js +20 -19
- package/parser/VelcronStyles.d.ts +2 -1
- package/parser/VelcronStyles.js +168 -65
- package/stores/ReactivitySystem.d.ts +2 -2
- package/stores/ReactivitySystem.js +1 -1
- package/stores/VelcronColorSchema.d.ts +9 -8
- package/stores/VelcronTheming.d.ts +4 -3
- package/stores/VelcronTheming.js +15 -3
- package/stores/index.d.ts +0 -1
- package/stores/index.js +1 -1
- package/templatebuilder/editor/VelcronContentEditor.d.ts +26 -2
- package/templatebuilder/editor/VelcronContentEditor.js +164 -4
- package/templatebuilder/editor/VelcronEditorBuilder2.d.ts +15 -0
- package/templatebuilder/editor/VelcronEditorBuilder2.js +106 -0
- package/templatebuilder/editor/VelcronEditorBuilderBase.d.ts +1 -1
- package/templatebuilder/editor/VelcronPropertyMappingEditorBuilder.js +1 -1
- package/templatebuilder/index.d.ts +1 -0
- package/templatebuilder/index.js +1 -0
- package/templatebuilder/state/VelcronBlockHeaderStateBuilder.d.ts +0 -0
- package/templatebuilder/state/VelcronBlockHeaderStateBuilder.js +38 -0
- package/templatebuilder/state/VelcronColorSchemaBuilder.d.ts +10 -5
- package/templatebuilder/state/VelcronColorSchemaBuilder.js +18 -6
- package/templatebuilder/state/VelcronContentStateBuilder.d.ts +7 -13
- package/templatebuilder/state/VelcronContentStateBuilder.js +26 -18
- package/templatebuilder/state/VelcronImageStateBuilder.d.ts +2 -4
- package/templatebuilder/state/VelcronImageStateBuilder.js +10 -4
- package/templatebuilder/state/VelcronPropertyMappingStateBuilder.d.ts +3 -2
- package/templatebuilder/state/VelcronPropertyMappingStateBuilder.js +12 -5
- package/templatebuilder/state/VelcronStateBuilder.d.ts +2 -1
- package/templatebuilder/state/VelcronStateBuilderBase.d.ts +7 -3
- package/templatebuilder/state/VelcronStateBuilderBase.js +8 -4
- package/templatebuilder/state/VelcronTextContentBuilder.d.ts +32 -0
- package/templatebuilder/state/VelcronTextContentBuilder.js +110 -0
- package/templatebuilder/useVelcronEditorBuilder.d.ts +2 -0
- package/templatebuilder/useVelcronEditorBuilder.js +9 -0
- package/internal-do-not-import-from-here/shared/models/Bring.d.ts +0 -23
- package/internal-do-not-import-from-here/shared/models/theming/OmniaThemes.d.ts +0 -5
- package/internal-do-not-import-from-here/shared/models/theming/OmniaThemes.js +0 -18
- package/stores/VelcronBlueprint.d.ts +0 -39
- package/stores/VelcronBlueprint.js +0 -55
- /package/internal-do-not-import-from-here/shared/models/{Bring.js → DynamicState.js} +0 -0
- /package/{models/VelcronEvents.js → internal-do-not-import-from-here/shared/models/HttpCommon.js} +0 -0
- /package/{models → internal-do-not-import-from-here/shared/models/velcron}/VelcronEvents.d.ts +0 -0
package/actions/Alert.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.alerter = void 0;
|
|
4
4
|
exports.alerter = {
|
|
5
5
|
name: "@alert",
|
|
6
|
-
action: (action, value
|
|
6
|
+
action: (action, value) => {
|
|
7
7
|
//value = VelcronData.dataBind(action, value)
|
|
8
8
|
//alert(value + nisse ? nisse : 'nullsiu');
|
|
9
9
|
alert(`${value}`);
|
package/actions/Array.js
CHANGED
|
@@ -6,8 +6,15 @@ const ActionResults_1 = require("./ActionResults");
|
|
|
6
6
|
exports.arrayAppend = {
|
|
7
7
|
name: "@array.append",
|
|
8
8
|
action: (action, arrayToAppend) => {
|
|
9
|
-
const
|
|
10
|
-
existingArray.
|
|
9
|
+
const path = action.path.replace("=", "").trim();
|
|
10
|
+
const existingArray = VelcronData_1.VelcronData.getOrSet(action, path);
|
|
11
|
+
if (!Array.isArray(existingArray)) {
|
|
12
|
+
const arr = existingArray;
|
|
13
|
+
arr.push(...arr);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
existingArray.push(arrayToAppend);
|
|
17
|
+
}
|
|
11
18
|
return Promise.resolve(new ActionResults_1.SkipSetValue());
|
|
12
19
|
}
|
|
13
20
|
};
|
package/actions/Clone.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.objClone = void 0;
|
|
4
|
+
const stores_1 = require("../stores");
|
|
5
|
+
exports.objClone = {
|
|
6
|
+
name: "@clone",
|
|
7
|
+
action: (action, objToClone) => {
|
|
8
|
+
const path = action.path.replace("=", "").trim();
|
|
9
|
+
return Promise.resolve(stores_1.ReactivitySystem.makeReactive(JSON.parse(JSON.stringify(objToClone))));
|
|
10
|
+
}
|
|
11
|
+
};
|
package/actions/Date.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.diff = exports.dateFormat = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
6
|
+
exports.dateFormat = {
|
|
7
|
+
name: "@date.format",
|
|
8
|
+
action: (action, value) => {
|
|
9
|
+
return Promise.resolve((0, dayjs_1.default)().format(value));
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
exports.diff = {
|
|
13
|
+
name: "@date.diff",
|
|
14
|
+
action: (action, date, past = false) => {
|
|
15
|
+
const now = (0, dayjs_1.default)();
|
|
16
|
+
const futureDateTime = (0, dayjs_1.default)(date);
|
|
17
|
+
const duration = past ? dayjs_1.default.duration(now.diff(futureDateTime)) : dayjs_1.default.duration(futureDateTime.diff(now));
|
|
18
|
+
const expired = past ? false : duration.asMilliseconds() <= 0;
|
|
19
|
+
return Promise.resolve({
|
|
20
|
+
years: duration.years(),
|
|
21
|
+
months: duration.months(),
|
|
22
|
+
days: duration.days(),
|
|
23
|
+
hours: duration.hours(),
|
|
24
|
+
minutes: duration.minutes(),
|
|
25
|
+
seconds: duration.seconds(),
|
|
26
|
+
expired,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
};
|
package/actions/Http.js
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.httpGet = void 0;
|
|
4
|
-
const
|
|
4
|
+
const parser_1 = require("../parser");
|
|
5
5
|
exports.httpGet = {
|
|
6
6
|
name: "@http.get",
|
|
7
|
-
action: (action,
|
|
7
|
+
action: (action, incomingUrl) => {
|
|
8
8
|
return new Promise(function (resolve) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
incomingUrl = parser_1.VelcronData.dataBind(action, incomingUrl);
|
|
10
|
+
let requestInitLocal = { "method": "GET" };
|
|
11
|
+
const hookResult = parser_1.VelcronActions.tryTriggerBeforeActionHook("http.get", { url: incomingUrl, requestInit: requestInitLocal });
|
|
12
|
+
incomingUrl = hookResult?.url ?? incomingUrl;
|
|
13
|
+
requestInitLocal = hookResult?.requestInit ?? requestInitLocal;
|
|
14
|
+
fetch(incomingUrl, requestInitLocal)
|
|
15
|
+
.then(async (response) => {
|
|
16
|
+
const res = parser_1.VelcronActions.tryTriggerAfterActionHook("http.get", {
|
|
17
|
+
json: await response.json(),
|
|
18
|
+
response: response
|
|
19
|
+
});
|
|
20
|
+
return res.json;
|
|
21
|
+
})
|
|
22
|
+
.then((json) => {
|
|
23
|
+
resolve(json);
|
|
24
|
+
})
|
|
25
|
+
.catch((error) => {
|
|
26
|
+
//How do we handle errors?
|
|
27
|
+
console.error("Velcron @http.get error occurred:", error);
|
|
28
|
+
throw error;
|
|
29
|
+
});
|
|
13
30
|
});
|
|
14
31
|
}
|
|
15
32
|
};
|
package/actions/Timer.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.timerStop = exports.timerStart = exports.timerCreate = void 0;
|
|
4
|
+
const parser_1 = require("../parser");
|
|
5
|
+
const timerCreateName = "@timer.create";
|
|
6
|
+
exports.timerCreate = {
|
|
7
|
+
name: "@timer.create",
|
|
8
|
+
action: (action, interval, autostart = true, immediate = false) => {
|
|
9
|
+
if (!action.path) {
|
|
10
|
+
parser_1.VelcronLogger.logActionError(`${timerCreateName} requires assignment to a state variable. Example: $state.timer1 = ${timerCreateName}(1000)`);
|
|
11
|
+
}
|
|
12
|
+
if (interval < 1000) {
|
|
13
|
+
parser_1.VelcronLogger.logActionError(`${timerCreateName} The timer interval must be at least 1000 milliseconds`);
|
|
14
|
+
}
|
|
15
|
+
const path = getPath(action.path);
|
|
16
|
+
if (action.rootContext[path] === typeof TimerInstance) {
|
|
17
|
+
//TODO: What do we do if the instance is already created?
|
|
18
|
+
console.dir("Timer already created");
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
//TODO: action.rootContext[path] validate it to be Array<string>
|
|
22
|
+
action.rootContext[path] = new TimerInstance(action.rootContext[path], action, interval, autostart, immediate);
|
|
23
|
+
}
|
|
24
|
+
return Promise.resolve(null);
|
|
25
|
+
},
|
|
26
|
+
dispose: (action) => {
|
|
27
|
+
return () => {
|
|
28
|
+
const path = getPath(action.path);
|
|
29
|
+
action.rootContext[path].stop();
|
|
30
|
+
action.rootContext[path] = undefined;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const timerStartName = "@timer.start";
|
|
35
|
+
exports.timerStart = {
|
|
36
|
+
name: timerStartName,
|
|
37
|
+
action: (action, timer) => {
|
|
38
|
+
if ((timer instanceof TimerInstance) === false) {
|
|
39
|
+
parser_1.VelcronLogger.logActionError(`Error in ${timerStartName} the timer does not exists. Did you use ${timerCreateName} to create the timer?`);
|
|
40
|
+
}
|
|
41
|
+
timer.start();
|
|
42
|
+
return Promise.resolve(null);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const timerStopName = "@timer.stop";
|
|
46
|
+
exports.timerStop = {
|
|
47
|
+
name: timerStopName,
|
|
48
|
+
action: (action, timer) => {
|
|
49
|
+
if ((timer instanceof TimerInstance) === false) {
|
|
50
|
+
parser_1.VelcronLogger.logActionError(`Error in ${timerStopName} the timer does not exists. Did you use ${timerCreateName} to create the timer?`);
|
|
51
|
+
}
|
|
52
|
+
timer.stop();
|
|
53
|
+
return Promise.resolve(null);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
function getPath(path) {
|
|
57
|
+
return path.substring(0, path.indexOf("=")).trim();
|
|
58
|
+
}
|
|
59
|
+
class TimerInstance {
|
|
60
|
+
constructor(actions, renderCtx, interval, autostart, immediate) {
|
|
61
|
+
this.actions = actions;
|
|
62
|
+
this.renderCtx = renderCtx;
|
|
63
|
+
this.interval = interval;
|
|
64
|
+
this.autostart = autostart;
|
|
65
|
+
this.immediate = immediate;
|
|
66
|
+
if (autostart) {
|
|
67
|
+
this.start();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
stop() {
|
|
71
|
+
clearInterval(this.intervalId);
|
|
72
|
+
}
|
|
73
|
+
start() {
|
|
74
|
+
//Run the action immediately
|
|
75
|
+
this.immediate && parser_1.VelcronActions.parseAndExecuteActions(this.actions, this.renderCtx);
|
|
76
|
+
this.intervalId = setInterval(() => {
|
|
77
|
+
parser_1.VelcronActions.parseAndExecuteActions(this.actions, this.renderCtx);
|
|
78
|
+
}, this.interval);
|
|
79
|
+
}
|
|
80
|
+
}
|
package/actions/index.d.ts
CHANGED
package/actions/index.js
CHANGED
|
@@ -12,3 +12,6 @@ tslib_1.__exportStar(require("./Log"), exports);
|
|
|
12
12
|
tslib_1.__exportStar(require("./MsGraph"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./MsSharePoint"), exports);
|
|
14
14
|
tslib_1.__exportStar(require("./Emit"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./Timer"), exports);
|
|
16
|
+
tslib_1.__exportStar(require("./Date"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./Clone"), exports);
|
|
@@ -9,4 +9,4 @@ var BroadcastTopicScopes;
|
|
|
9
9
|
BroadcastTopicScopes["globalUi"] = "globalUi";
|
|
10
10
|
BroadcastTopicScopes["globalWorker"] = "globalWorker";
|
|
11
11
|
BroadcastTopicScopes["globalAll"] = "globalAll";
|
|
12
|
-
})(BroadcastTopicScopes
|
|
12
|
+
})(BroadcastTopicScopes || (exports.BroadcastTopicScopes = BroadcastTopicScopes = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DynamicState = object;
|
|
@@ -1,14 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//have issue with guidvalue can't auto cast to string if have more extension method here.
|
|
4
|
+
// declare global {
|
|
5
|
+
// interface String {
|
|
6
|
+
// equals?: {
|
|
7
|
+
// component<TElement = typeof omfx>(cb: (elements: TElement) => any): boolean;
|
|
8
|
+
// }
|
|
9
|
+
// }
|
|
10
|
+
// }
|
|
3
11
|
const _equalsObject = {};
|
|
12
|
+
const _equalsString = {};
|
|
4
13
|
// only add extension methods when running in browser, not in node.js
|
|
5
14
|
if (globalThis.omnia) {
|
|
6
15
|
Object.defineProperty(String.prototype, "equals", {
|
|
7
|
-
|
|
8
|
-
|
|
16
|
+
get() {
|
|
17
|
+
_equalsString["_this_value"] = this;
|
|
18
|
+
return _equalsString;
|
|
9
19
|
},
|
|
10
|
-
writable: false,
|
|
11
20
|
configurable: false,
|
|
12
21
|
enumerable: false
|
|
13
22
|
});
|
|
23
|
+
Object.defineProperty(Object.prototype, "equals", {
|
|
24
|
+
value: _equalsObject,
|
|
25
|
+
writable: true,
|
|
26
|
+
configurable: false,
|
|
27
|
+
enumerable: false
|
|
28
|
+
});
|
|
29
|
+
// Object.defineProperty(String.prototype["equals"], "element", {
|
|
30
|
+
// value: function () {
|
|
31
|
+
// return function (cb: (elements) => any) {
|
|
32
|
+
// const elementName = cb(new Proxy({}, {
|
|
33
|
+
// get(target, key: string) {
|
|
34
|
+
// return key;
|
|
35
|
+
// }
|
|
36
|
+
// }) as any);
|
|
37
|
+
// return this.toString().replace(/-/g, "").toLowerCase().indexof(elementName.toLowerCase()) > -1;
|
|
38
|
+
// };
|
|
39
|
+
// },
|
|
40
|
+
// writable: false,
|
|
41
|
+
// configurable: false,
|
|
42
|
+
// enumerable: false
|
|
43
|
+
// });
|
|
14
44
|
}
|
|
@@ -14,7 +14,10 @@ export declare class Future<T> extends Promise<T> {
|
|
|
14
14
|
* @return {*} {Future<{ success?: T, error?: Error; }>}
|
|
15
15
|
* @memberof Future
|
|
16
16
|
*/
|
|
17
|
-
tryCatch(): Future<
|
|
17
|
+
tryCatch(): Future<{
|
|
18
|
+
success: T;
|
|
19
|
+
error: Error;
|
|
20
|
+
}>;
|
|
18
21
|
/**
|
|
19
22
|
* Aborts the request
|
|
20
23
|
*
|
|
@@ -22,6 +25,13 @@ export declare class Future<T> extends Promise<T> {
|
|
|
22
25
|
* @memberof Future
|
|
23
26
|
*/
|
|
24
27
|
abort(reason?: any): void;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a Future that resolves after a specified delay.
|
|
30
|
+
*
|
|
31
|
+
* @param {number} ms - The time to delay in milliseconds.
|
|
32
|
+
* @returns {Future<void>} A Future that resolves after the specified delay.
|
|
33
|
+
*/
|
|
34
|
+
static delay(ms: number): Future<void>;
|
|
25
35
|
/**
|
|
26
36
|
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
|
27
37
|
* resolve, or rejected when any Promise is rejected.
|
|
@@ -35,6 +45,12 @@ export declare class Future<T> extends Promise<T> {
|
|
|
35
45
|
get rejected(): boolean;
|
|
36
46
|
static get [Symbol.species](): PromiseConstructor;
|
|
37
47
|
get [Symbol.toStringTag](): string;
|
|
48
|
+
/**
|
|
49
|
+
* Creates a new instance of the Future class with a specific return value type.
|
|
50
|
+
*
|
|
51
|
+
* @template TReturnValue - The type of the return value for the Future instance.
|
|
52
|
+
* @returns {Future<TReturnValue>} - A new instance of the Future class.
|
|
53
|
+
*/
|
|
38
54
|
static new<TReturnValue>(): Future<TReturnValue>;
|
|
39
55
|
}
|
|
40
56
|
export declare class ResponsePromise<T> extends Promise<T> {
|
|
@@ -5,16 +5,18 @@ class Future extends Promise {
|
|
|
5
5
|
constructor(executor) {
|
|
6
6
|
let resolveLocal;
|
|
7
7
|
let rejectLocal;
|
|
8
|
+
// Cant have function here since this is undefined in setTimeout
|
|
9
|
+
// eslint-disable-next-line func-style
|
|
8
10
|
const onAborted = (cb) => {
|
|
9
11
|
setTimeout(() => {
|
|
10
12
|
this.onAborted = cb;
|
|
11
13
|
});
|
|
12
14
|
};
|
|
13
|
-
|
|
15
|
+
function exec(resolve, reject) {
|
|
14
16
|
// assign to local to prevent error assignbefore call super;
|
|
15
17
|
resolveLocal = resolve;
|
|
16
18
|
rejectLocal = reject;
|
|
17
|
-
}
|
|
19
|
+
}
|
|
18
20
|
super(exec);
|
|
19
21
|
this.resolving = false;
|
|
20
22
|
this._resolved = false;
|
|
@@ -46,10 +48,10 @@ class Future extends Promise {
|
|
|
46
48
|
return new Future(async (resolve) => {
|
|
47
49
|
try {
|
|
48
50
|
const data = await this;
|
|
49
|
-
resolve(
|
|
51
|
+
resolve({ success: data, error: undefined });
|
|
50
52
|
}
|
|
51
|
-
catch (
|
|
52
|
-
resolve(
|
|
53
|
+
catch (error) {
|
|
54
|
+
resolve({ success: undefined, error });
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
}
|
|
@@ -67,6 +69,19 @@ class Future extends Promise {
|
|
|
67
69
|
throw "Failed calling abort() => The future has no onAborted callback or you tried to call abort immediately after the future was created.";
|
|
68
70
|
}
|
|
69
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Creates a Future that resolves after a specified delay.
|
|
74
|
+
*
|
|
75
|
+
* @param {number} ms - The time to delay in milliseconds.
|
|
76
|
+
* @returns {Future<void>} A Future that resolves after the specified delay.
|
|
77
|
+
*/
|
|
78
|
+
static delay(ms) {
|
|
79
|
+
return new Future((resolve) => {
|
|
80
|
+
setTimeout(() => {
|
|
81
|
+
resolve();
|
|
82
|
+
}, ms);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
70
85
|
/**
|
|
71
86
|
* Creates a Promise that is resolved with an array of results when all of the provided Promises
|
|
72
87
|
* resolve, or rejected when any Promise is rejected.
|
|
@@ -94,6 +109,12 @@ class Future extends Promise {
|
|
|
94
109
|
//<<vue3>> back to normal because vue 3 use native proxy.
|
|
95
110
|
return "Future";
|
|
96
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Creates a new instance of the Future class with a specific return value type.
|
|
114
|
+
*
|
|
115
|
+
* @template TReturnValue - The type of the return value for the Future instance.
|
|
116
|
+
* @returns {Future<TReturnValue>} - A new instance of the Future class.
|
|
117
|
+
*/
|
|
97
118
|
static new() {
|
|
98
119
|
return new Future(() => { });
|
|
99
120
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Guid = void 0;
|
|
3
|
+
exports.guid = exports.Guid = void 0;
|
|
4
4
|
//export interface GuidValue {
|
|
5
5
|
// :string;
|
|
6
6
|
//}
|
|
@@ -56,18 +56,25 @@ class Guid {
|
|
|
56
56
|
return this.value.toLowerCase();
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
Guid._empty = new Guid("00000000-0000-0000-0000-000000000000");
|
|
60
59
|
exports.Guid = Guid;
|
|
60
|
+
Guid._empty = new Guid("00000000-0000-0000-0000-000000000000");
|
|
61
61
|
// only add extension methods when running in browser, not in node.js
|
|
62
62
|
if (globalThis.omnia) {
|
|
63
63
|
Object.defineProperty(String.prototype["equals"], "guid", {
|
|
64
|
-
value: function () {
|
|
65
|
-
return
|
|
66
|
-
return this.toString() === value.toString();
|
|
67
|
-
};
|
|
64
|
+
value: function (value) {
|
|
65
|
+
return this["_this_value"].toString() === value.toString();
|
|
68
66
|
},
|
|
69
67
|
writable: false,
|
|
70
68
|
configurable: false,
|
|
71
69
|
enumerable: false
|
|
72
70
|
});
|
|
73
71
|
}
|
|
72
|
+
// will make Guid class to static class to prevent new Guid instance later on
|
|
73
|
+
// now expose new function to create guid
|
|
74
|
+
function guid(value) {
|
|
75
|
+
if (!Guid.isValid(value)) {
|
|
76
|
+
throw `The string '${value}' is not a valid Guid`;
|
|
77
|
+
}
|
|
78
|
+
return value;
|
|
79
|
+
}
|
|
80
|
+
exports.guid = guid;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type HttpMethods = "GET" | "POST" | "PUT" | "DELETE" | "PATCH" | "HEAD" | "OPTIONS";
|
|
2
|
+
export type HttpCacheOptions = "no-cache" | "reload" | "force-cache" | "only-if-cached";
|
|
3
|
+
export type HttpCredentials = "include" | "omit" | "same-origin";
|
|
4
|
+
export interface HttpInterceptOptions {
|
|
5
|
+
beforeRequest?: (request: HttpConfig) => HttpConfig;
|
|
6
|
+
afterRequest?: <T>(response: HttpResponse<T>, request: HttpConfig) => HttpResponse<T>;
|
|
7
|
+
}
|
|
8
|
+
export interface HttpConfig {
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
headers?: {
|
|
11
|
+
[key: string]: string;
|
|
12
|
+
};
|
|
13
|
+
query?: {
|
|
14
|
+
[key: string]: string;
|
|
15
|
+
};
|
|
16
|
+
cache?: HttpCacheOptions;
|
|
17
|
+
interceptors?: HttpInterceptOptions;
|
|
18
|
+
abortable?: boolean;
|
|
19
|
+
credentials?: HttpCredentials;
|
|
20
|
+
executeOnWorker?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface HttpResponse<TData> {
|
|
23
|
+
data?: TData;
|
|
24
|
+
status: Number;
|
|
25
|
+
statusText: String;
|
|
26
|
+
ok: Boolean;
|
|
27
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OmniaToken } from "
|
|
1
|
+
import { OmniaToken } from "./Tokens";
|
|
2
2
|
import { Guid, GuidValue } from "./Guid";
|
|
3
3
|
import { TenantIdentifier } from "./Tenant";
|
|
4
4
|
export interface OmniaSharedBootstrapData {
|
|
@@ -14,6 +14,7 @@ export interface OmniaSharedBootstrapData {
|
|
|
14
14
|
tokenKey?: OmniaToken;
|
|
15
15
|
tokenRef: GuidValue;
|
|
16
16
|
identity: string;
|
|
17
|
+
hubIdentity?: number;
|
|
17
18
|
licenses: Array<Guid>;
|
|
18
19
|
hubDev?: boolean;
|
|
19
20
|
realtimeDevPort?: string;
|
|
@@ -21,6 +22,11 @@ export interface OmniaSharedBootstrapData {
|
|
|
21
22
|
servingMode?: boolean;
|
|
22
23
|
serviceDnsMapping: OmniaServiceToDnsMapping;
|
|
23
24
|
authDisabled?: boolean;
|
|
25
|
+
analytics: OmniaAnalytics;
|
|
26
|
+
}
|
|
27
|
+
export interface OmniaAnalytics {
|
|
28
|
+
paq: any[];
|
|
29
|
+
enabled: boolean;
|
|
24
30
|
}
|
|
25
31
|
export interface OmniaServiceToDnsMapping {
|
|
26
32
|
[serviceId: string]: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GuidValue } from "./Guid";
|
|
2
2
|
export declare abstract class RealtimeChannel {
|
|
3
3
|
/**
|
|
4
4
|
* Construct a unique channel id that can be targeted to users who are set to be in that channel on the client
|
|
@@ -6,11 +6,6 @@ export declare abstract class RealtimeChannel {
|
|
|
6
6
|
*/
|
|
7
7
|
abstract getId(): string;
|
|
8
8
|
}
|
|
9
|
-
export declare class BusinuessProfileChannel extends RealtimeChannel {
|
|
10
|
-
private _profileId;
|
|
11
|
-
constructor(profileId: Guid);
|
|
12
|
-
getId(): string;
|
|
13
|
-
}
|
|
14
9
|
export declare abstract class RealtimeData<TRealtimeChannel extends RealtimeChannel, TRealtimeData> {
|
|
15
10
|
private _channel;
|
|
16
11
|
private _value;
|
|
@@ -19,13 +14,6 @@ export declare abstract class RealtimeData<TRealtimeChannel extends RealtimeChan
|
|
|
19
14
|
abstract getId(): GuidValue;
|
|
20
15
|
constructor(channel: TRealtimeChannel, value?: TRealtimeData);
|
|
21
16
|
}
|
|
22
|
-
export declare class PageChatRealtimeData extends RealtimeData<BusinuessProfileChannel, {
|
|
23
|
-
x: number;
|
|
24
|
-
y: number;
|
|
25
|
-
}> {
|
|
26
|
-
constructor(channel: BusinuessProfileChannel);
|
|
27
|
-
getId(): GuidValue;
|
|
28
|
-
}
|
|
29
17
|
export type RealtimeChannelUpdateTypes = "activate" | "deactivate";
|
|
30
18
|
export interface RealtimeChannelUpdateMessage extends RealtimChannelMessage {
|
|
31
19
|
threadId: GuidValue;
|
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const Guid_1 = require("./Guid");
|
|
3
|
+
exports.RealtimeData = exports.RealtimeChannel = void 0;
|
|
5
4
|
class RealtimeChannel {
|
|
6
5
|
}
|
|
7
6
|
exports.RealtimeChannel = RealtimeChannel;
|
|
8
|
-
class BusinuessProfileChannel extends RealtimeChannel {
|
|
9
|
-
constructor(profileId) {
|
|
10
|
-
super();
|
|
11
|
-
this._profileId = profileId;
|
|
12
|
-
}
|
|
13
|
-
getId() {
|
|
14
|
-
return this._profileId.toString();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.BusinuessProfileChannel = BusinuessProfileChannel;
|
|
18
7
|
class RealtimeData {
|
|
19
8
|
get channel() {
|
|
20
9
|
return this._channel;
|
|
@@ -28,13 +17,3 @@ class RealtimeData {
|
|
|
28
17
|
}
|
|
29
18
|
}
|
|
30
19
|
exports.RealtimeData = RealtimeData;
|
|
31
|
-
//FIXME: This is a test implementation remove when tested
|
|
32
|
-
class PageChatRealtimeData extends RealtimeData {
|
|
33
|
-
constructor(channel) {
|
|
34
|
-
super(channel);
|
|
35
|
-
}
|
|
36
|
-
getId() {
|
|
37
|
-
return new Guid_1.Guid("0366c62b-da25-4ed1-b5dc-de7e9934249f");
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
exports.PageChatRealtimeData = PageChatRealtimeData;
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { HttpResponse } from "./HttpCommon";
|
|
1
2
|
import { Guid } from "./Guid";
|
|
2
3
|
import { WorkerProxyFunction } from "./Workers";
|
|
3
4
|
export declare const WorkerProxyFuncs: {
|
|
4
5
|
ui: {
|
|
5
6
|
loadManifests: WorkerProxyFunction<Guid[], Guid[]>;
|
|
6
7
|
};
|
|
7
|
-
worker: {
|
|
8
|
+
worker: {
|
|
9
|
+
httpRequest: WorkerProxyFunction<{
|
|
10
|
+
url: string;
|
|
11
|
+
reqInit: Omit<RequestInit, "window" | "signal">;
|
|
12
|
+
}, Promise<HttpResponse<any>>>;
|
|
13
|
+
};
|
|
8
14
|
};
|
|
@@ -5,4 +5,4 @@ var WorkerProxyFunctionInitiators;
|
|
|
5
5
|
(function (WorkerProxyFunctionInitiators) {
|
|
6
6
|
WorkerProxyFunctionInitiators["ui"] = "main";
|
|
7
7
|
WorkerProxyFunctionInitiators["worker"] = "worker";
|
|
8
|
-
})(WorkerProxyFunctionInitiators
|
|
8
|
+
})(WorkerProxyFunctionInitiators || (exports.WorkerProxyFunctionInitiators = WorkerProxyFunctionInitiators = {}));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Guid } from "../Guid";
|
|
2
|
+
import { RealtimeChannel, RealtimeData } from "../Realtime";
|
|
3
|
+
export declare class SocialRealtimeChannel extends RealtimeChannel {
|
|
4
|
+
getId(): string;
|
|
5
|
+
}
|
|
6
|
+
export interface SocialRealtimeMessage {
|
|
7
|
+
reactionCount: number;
|
|
8
|
+
commentCount: number;
|
|
9
|
+
}
|
|
10
|
+
export declare class SocialRealtimeData extends RealtimeData<SocialRealtimeChannel, SocialRealtimeMessage> {
|
|
11
|
+
constructor(channel: SocialRealtimeChannel);
|
|
12
|
+
getId(): Guid;
|
|
13
|
+
}
|