@omnia/velcron 8.0.110-vnext → 8.0.112-vnext

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.
Files changed (37) hide show
  1. package/actions/Http.js +23 -6
  2. package/internal-do-not-import-from-here/shared/models/Bring.d.ts +1 -0
  3. package/internal-do-not-import-from-here/shared/models/DynamicState.d.ts +1 -0
  4. package/internal-do-not-import-from-here/shared/models/DynamicState.js +2 -0
  5. package/internal-do-not-import-from-here/shared/models/Equals.js +8 -0
  6. package/internal-do-not-import-from-here/shared/models/Future.d.ts +4 -1
  7. package/internal-do-not-import-from-here/shared/models/Future.js +7 -7
  8. package/internal-do-not-import-from-here/shared/models/OmniaSharedBootstrapData.d.ts +5 -0
  9. package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.d.ts +7 -1
  10. package/internal-do-not-import-from-here/shared/models/WorkerProxyFuncs.js +5 -1
  11. package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.d.ts +29 -0
  12. package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.js +9 -0
  13. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.d.ts +6 -0
  14. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.js +6 -0
  15. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.d.ts +9 -0
  16. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.js +6 -0
  17. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.d.ts +11 -0
  18. package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySender.js +6 -0
  19. package/internal-do-not-import-from-here/shared/models/hub/activities/FeedResult.d.ts +9 -0
  20. package/internal-do-not-import-from-here/shared/models/hub/activities/FeedResult.js +2 -0
  21. package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.d.ts +18 -0
  22. package/internal-do-not-import-from-here/shared/models/hub/activities/IdentityActivity.js +31 -0
  23. package/internal-do-not-import-from-here/shared/models/hub/activities/index.d.ts +6 -0
  24. package/internal-do-not-import-from-here/shared/models/hub/activities/index.js +9 -0
  25. package/internal-do-not-import-from-here/shared/models/hub/index.d.ts +1 -0
  26. package/internal-do-not-import-from-here/shared/models/hub/index.js +4 -0
  27. package/internal-do-not-import-from-here/shared/models/index.d.ts +2 -0
  28. package/internal-do-not-import-from-here/shared/models/index.js +2 -0
  29. package/models/ActionHooks.d.ts +12 -0
  30. package/models/ActionHooks.js +2 -0
  31. package/models/VelcronDefinitions.d.ts +1 -2
  32. package/models/index.d.ts +1 -0
  33. package/models/index.js +1 -0
  34. package/package.json +1 -1
  35. package/parser/VelcronActions.d.ts +7 -1
  36. package/parser/VelcronActions.js +17 -0
  37. package/parser/VelcronRenderers.d.ts +2 -1
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 VelcronData_1 = require("../parser/VelcronData");
4
+ const parser_1 = require("../parser");
5
5
  exports.httpGet = {
6
6
  name: "@http.get",
7
- action: (action, value) => {
7
+ action: (action, incomingUrl) => {
8
8
  return new Promise(function (resolve) {
9
- value = VelcronData_1.VelcronData.dataBind(action, value);
10
- fetch(value)
11
- .then(response => response.json())
12
- .then(json => resolve(json));
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
  };
@@ -14,6 +14,7 @@ export interface BringConfig {
14
14
  interceptors?: BringInterceptOptions;
15
15
  abortable?: boolean;
16
16
  credentials?: BringCredentials;
17
+ executeOnWorker?: boolean;
17
18
  }
18
19
  export interface BringResponse<TData> {
19
20
  data?: TData;
@@ -0,0 +1 @@
1
+ export type DynamicState = object;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -19,6 +19,14 @@ if (globalThis.omnia) {
19
19
  configurable: false,
20
20
  enumerable: false
21
21
  });
22
+ Object.defineProperty(Object.prototype, "equals", {
23
+ value: function () {
24
+ return _equalsObject;
25
+ },
26
+ writable: true,
27
+ configurable: false,
28
+ enumerable: false
29
+ });
22
30
  // Object.defineProperty(String.prototype["equals"], "element", {
23
31
  // value: function () {
24
32
  // return function (cb: (elements) => any) {
@@ -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<[success: T, error: Error]>;
17
+ tryCatch(): Future<{
18
+ success: T;
19
+ error: Error;
20
+ }>;
18
21
  /**
19
22
  * Aborts the request
20
23
  *
@@ -5,16 +5,16 @@ class Future extends Promise {
5
5
  constructor(executor) {
6
6
  let resolveLocal;
7
7
  let rejectLocal;
8
- const onAborted = (cb) => {
8
+ function onAborted(cb) {
9
9
  setTimeout(() => {
10
10
  this.onAborted = cb;
11
11
  });
12
- };
13
- const exec = (resolve, reject) => {
12
+ }
13
+ function exec(resolve, reject) {
14
14
  // assign to local to prevent error assignbefore call super;
15
15
  resolveLocal = resolve;
16
16
  rejectLocal = reject;
17
- };
17
+ }
18
18
  super(exec);
19
19
  this.resolving = false;
20
20
  this._resolved = false;
@@ -46,10 +46,10 @@ class Future extends Promise {
46
46
  return new Future(async (resolve) => {
47
47
  try {
48
48
  const data = await this;
49
- resolve([data, undefined]);
49
+ resolve({ success: data, error: undefined });
50
50
  }
51
- catch (err) {
52
- resolve([undefined, err]);
51
+ catch (error) {
52
+ resolve({ success: undefined, error });
53
53
  }
54
54
  });
55
55
  }
@@ -21,6 +21,11 @@ export interface OmniaSharedBootstrapData {
21
21
  servingMode?: boolean;
22
22
  serviceDnsMapping: OmniaServiceToDnsMapping;
23
23
  authDisabled?: boolean;
24
+ analytics: OmniaAnalytics;
25
+ }
26
+ export interface OmniaAnalytics {
27
+ paq: any[];
28
+ enabled: boolean;
24
29
  }
25
30
  export interface OmniaServiceToDnsMapping {
26
31
  [serviceId: string]: string;
@@ -1,8 +1,14 @@
1
+ import { BringResponse } from "./Bring";
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<BringResponse<any>>>;
13
+ };
8
14
  };
@@ -10,5 +10,9 @@ exports.WorkerProxyFuncs = {
10
10
  }
11
11
  },
12
12
  //Ui to worker functions
13
- worker: {}
13
+ worker: {
14
+ httpRequest: {
15
+ id: new Guid_1.Guid("c77c5845-4ceb-4fe2-939a-36de94be6f6b")
16
+ }
17
+ }
14
18
  };
@@ -0,0 +1,29 @@
1
+ import { DynamicState } from "../..";
2
+ import { ChannelId } from "./ActivityChannel";
3
+ import { ActivitySenderId } from "./ActivitySender";
4
+ export declare enum ActivityId {
5
+ }
6
+ export declare enum ActivityTypeId {
7
+ }
8
+ export interface Activity<TRenderState = DynamicState> extends ActivityBase {
9
+ id: ActivityId;
10
+ state: TRenderState;
11
+ senderId: ActivitySenderId;
12
+ }
13
+ export interface ActivityBase {
14
+ channelId: ChannelId;
15
+ activityTypeId: ActivityTypeId;
16
+ targeting: Array<Array<HubIdentityProperty>>;
17
+ notificationTeaser: NotificationTeaser;
18
+ expires?: Date;
19
+ createdAt: Date;
20
+ }
21
+ export interface HubIdentityProperty {
22
+ name: string;
23
+ values: Array<string>;
24
+ }
25
+ export interface NotificationTeaser {
26
+ title: string;
27
+ description: string;
28
+ url: string;
29
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivityTypeId = exports.ActivityId = void 0;
4
+ var ActivityId;
5
+ (function (ActivityId) {
6
+ })(ActivityId = exports.ActivityId || (exports.ActivityId = {}));
7
+ var ActivityTypeId;
8
+ (function (ActivityTypeId) {
9
+ })(ActivityTypeId = exports.ActivityTypeId || (exports.ActivityTypeId = {}));
@@ -0,0 +1,6 @@
1
+ export declare enum ChannelId {
2
+ }
3
+ export interface ActivityChannel {
4
+ id: ChannelId;
5
+ createdAt: Date;
6
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChannelId = void 0;
4
+ var ChannelId;
5
+ (function (ChannelId) {
6
+ })(ChannelId = exports.ChannelId || (exports.ChannelId = {}));
@@ -0,0 +1,9 @@
1
+ export declare enum ActivityRendererId {
2
+ }
3
+ export interface ActivityRendererReference {
4
+ id: ActivityRendererId;
5
+ version: string;
6
+ }
7
+ export interface ActivityRenderer extends ActivityRendererReference {
8
+ definition: string;
9
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivityRendererId = void 0;
4
+ var ActivityRendererId;
5
+ (function (ActivityRendererId) {
6
+ })(ActivityRendererId = exports.ActivityRendererId || (exports.ActivityRendererId = {}));
@@ -0,0 +1,11 @@
1
+ export declare enum ActivitySenderId {
2
+ }
3
+ export interface ActivitySender extends ActivitySenderBase {
4
+ id: ActivitySenderId;
5
+ imageUrl: string;
6
+ }
7
+ export interface ActivitySenderBase {
8
+ name: Record<string, string>;
9
+ description: Record<string, string>;
10
+ externalId: string;
11
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActivitySenderId = void 0;
4
+ var ActivitySenderId;
5
+ (function (ActivitySenderId) {
6
+ })(ActivitySenderId = exports.ActivitySenderId || (exports.ActivitySenderId = {}));
@@ -0,0 +1,9 @@
1
+ import { Activity, ActivityId } from "./Activity";
2
+ import { ActivityRenderer } from "./ActivityRenderer";
3
+ import { IdentityActivity } from "./IdentityActivity";
4
+ export interface FeedResult {
5
+ renderers: Array<ActivityRenderer>;
6
+ identityActivities: Array<IdentityActivity>;
7
+ activities: Array<Activity>;
8
+ nextStartingFromId: ActivityId;
9
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,18 @@
1
+ import { DynamicState } from "../..";
2
+ import { Activity, ActivityId } from "./Activity";
3
+ export declare enum IdentityActivityStatus {
4
+ unRead = 0,
5
+ read = 1,
6
+ completed = 2
7
+ }
8
+ export interface IdentityActivityBase {
9
+ activityId: ActivityId;
10
+ status: IdentityActivityStatus;
11
+ }
12
+ export interface IdentityActivity<TRenderState extends DynamicState | undefined = undefined, TState extends DynamicState | undefined = undefined> extends IdentityActivityBase {
13
+ activity: Activity<TRenderState>;
14
+ state?: TState;
15
+ }
16
+ export interface IdentityActivityWithJson extends IdentityActivityBase {
17
+ stateJson: string;
18
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IdentityActivityStatus = void 0;
4
+ var IdentityActivityStatus;
5
+ (function (IdentityActivityStatus) {
6
+ IdentityActivityStatus[IdentityActivityStatus["unRead"] = 0] = "unRead";
7
+ IdentityActivityStatus[IdentityActivityStatus["read"] = 1] = "read";
8
+ IdentityActivityStatus[IdentityActivityStatus["completed"] = 2] = "completed";
9
+ })(IdentityActivityStatus = exports.IdentityActivityStatus || (exports.IdentityActivityStatus = {}));
10
+ // Usage
11
+ // const activity1: IdentityActivity<SomeRenderState> = {
12
+ // activity: {
13
+ // // Initialize your Activity here
14
+ // },
15
+ // state: {
16
+ // // Initialize your State here
17
+ // },
18
+ // };
19
+ // const activity2: IdentityActivity<SomeRenderState, SomeState> = {
20
+ // activity: {
21
+ // // Initialize your Activity here
22
+ // },
23
+ // state: {
24
+ // // Initialize your State here
25
+ // },
26
+ // };
27
+ // const activity3: IdentityActivityWithJson = {
28
+ // activityId: 22,
29
+ // status: IdentityActivityStatus.unRead,
30
+ // stateJson: "someJson",
31
+ // };
@@ -0,0 +1,6 @@
1
+ export * from "./Activity";
2
+ export * from "./IdentityActivity";
3
+ export * from "./ActivityRenderer";
4
+ export * from "./ActivitySender";
5
+ export * from "./ActivityChannel";
6
+ export * from "./FeedResult";
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./Activity"), exports);
5
+ tslib_1.__exportStar(require("./IdentityActivity"), exports);
6
+ tslib_1.__exportStar(require("./ActivityRenderer"), exports);
7
+ tslib_1.__exportStar(require("./ActivitySender"), exports);
8
+ tslib_1.__exportStar(require("./ActivityChannel"), exports);
9
+ tslib_1.__exportStar(require("./FeedResult"), exports);
@@ -0,0 +1 @@
1
+ export * from "./activities";
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./activities"), exports);
@@ -12,4 +12,6 @@ export * from "./Tenant";
12
12
  export * from "./Realtime";
13
13
  export * from "./OmniaSharedBootstrapData";
14
14
  export * from "./StringExtensions";
15
+ export * from "./DynamicState";
15
16
  export * from "./theming";
17
+ export * from "./hub";
@@ -16,4 +16,6 @@ tslib_1.__exportStar(require("./Tenant"), exports);
16
16
  tslib_1.__exportStar(require("./Realtime"), exports);
17
17
  tslib_1.__exportStar(require("./OmniaSharedBootstrapData"), exports);
18
18
  tslib_1.__exportStar(require("./StringExtensions"), exports);
19
+ tslib_1.__exportStar(require("./DynamicState"), exports);
19
20
  tslib_1.__exportStar(require("./theming"), exports);
21
+ tslib_1.__exportStar(require("./hub"), exports);
@@ -0,0 +1,12 @@
1
+ export interface VelcronActionHooks<TBefore = any, TAfter = any> {
2
+ beforeHandler?: (args: TBefore) => TBefore;
3
+ afterHandler?: (args: TBefore) => TAfter;
4
+ }
5
+ export interface HttpGetBeforeActionHookArgs {
6
+ url: string;
7
+ requestInit: RequestInit;
8
+ }
9
+ export interface HttpGetAfterActionHookArgs {
10
+ json: string;
11
+ response: Response;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,7 +1,7 @@
1
1
  import { VelcronEvent, VelcronOnUpdatedEvent, VelcronOnClosedEvent, VelcronOnCloseRequestedEvent, VelcronOnEditModeEvent, VelcronOnLoadEvent, VelcronOnPressEvent } from "./VelcronEvents";
2
2
  import { VelcroncomponentArrayType, VelcronPrimitiveType } from "./VelcronTypes";
3
3
  import { AssignOperators, VelcronHorizontalAlignments, VelcronIconTypes, VelcronActionTypes, VelcronVerticalAlignments } from "./Enums";
4
- import { VelcronPropertyEditor, useVelcronThemingStore } from "..";
4
+ import { DynamicState, VelcronPropertyEditor, useVelcronThemingStore } from "..";
5
5
  import { GuidValue, PropertyConfiguration, PropertyValue, PropertyDefinition, PropertySetupBase } from "@omnia/fx/models";
6
6
  import { useVelcronColorSchemaStore } from "../stores/VelcronColorSchema";
7
7
  import { useVelcronBlueprintStore } from "../stores/VelcronBlueprint";
@@ -31,7 +31,6 @@ export interface ColorSchemaReference {
31
31
  name: string;
32
32
  schema: string;
33
33
  }
34
- export type DynamicState = object;
35
34
  export interface OnItemRenderedHookResult {
36
35
  cssClass: string;
37
36
  containerRenderer?: VelcronContainerRenderer;
package/models/index.d.ts CHANGED
@@ -5,3 +5,4 @@ export * from "./VelcronTypes";
5
5
  export * from "./Enums";
6
6
  export * from "./VelcronUnitProvider";
7
7
  export * from "./VelcronPropertyEditorDefinitions";
8
+ export * from "./ActionHooks";
package/models/index.js CHANGED
@@ -8,3 +8,4 @@ tslib_1.__exportStar(require("./VelcronTypes"), exports);
8
8
  tslib_1.__exportStar(require("./Enums"), exports);
9
9
  tslib_1.__exportStar(require("./VelcronUnitProvider"), exports);
10
10
  tslib_1.__exportStar(require("./VelcronPropertyEditorDefinitions"), exports);
11
+ tslib_1.__exportStar(require("./ActionHooks"), exports);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.110-vnext",
4
+ "version": "8.0.112-vnext",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,9 +1,12 @@
1
- import { VelcronAction, VelcronActionWithAutoAwait, VelcronRenderContext, DeferredPromise } from "../models";
1
+ import { VelcronAction, VelcronActionWithAutoAwait, VelcronRenderContext, DeferredPromise, VelcronActionHooks } from "../models";
2
2
  import { IActionHandler } from "../actions";
3
3
  export declare class VelcronActions {
4
4
  static _actionHandlers: {
5
5
  [name: string]: IActionHandler;
6
6
  } | null;
7
+ static actionHooks: {
8
+ [name: string]: VelcronActionHooks;
9
+ };
7
10
  static registerAction(name: string, handler: IActionHandler): void;
8
11
  static parseAndExecuteActions(templates: Array<string>, renderContext: VelcronRenderContext, customActionContext?: VelcronCustomActionExecutionContext): void;
9
12
  static parseFunction(target: {
@@ -15,6 +18,9 @@ export declare class VelcronActions {
15
18
  static executeAction(awAction: VelcronActionWithAutoAwait, callback: (continueExecution: boolean) => void): void;
16
19
  static dataBindComputed(renderContext: VelcronRenderContext, template: string): string;
17
20
  static parseAndExecuteComputed(renderContext: VelcronRenderContext, template: string): string;
21
+ static registerActionHook<TBefore, TAfter>(actionName: string, handler: VelcronActionHooks<TBefore, TAfter>): void;
22
+ static tryTriggerBeforeActionHook<T>(actionName: string, args: T): T;
23
+ static tryTriggerAfterActionHook<T>(actionName: string, args: T): T;
18
24
  private static extractParameterValues;
19
25
  }
20
26
  interface VelcronActionParameterValue {
@@ -351,6 +351,22 @@ class VelcronActions {
351
351
  });
352
352
  return template;
353
353
  }
354
+ static registerActionHook(actionName, handler) {
355
+ VelcronActions.actionHooks ?? (VelcronActions.actionHooks = {});
356
+ VelcronActions.actionHooks[actionName] = handler;
357
+ }
358
+ static tryTriggerBeforeActionHook(actionName, args) {
359
+ if (VelcronActions.actionHooks && VelcronActions.actionHooks[actionName] && VelcronActions.actionHooks[actionName].beforeHandler) {
360
+ return VelcronActions.actionHooks[actionName].beforeHandler(args);
361
+ }
362
+ return args;
363
+ }
364
+ static tryTriggerAfterActionHook(actionName, args) {
365
+ if (VelcronActions.actionHooks && VelcronActions.actionHooks[actionName] && VelcronActions.actionHooks[actionName].afterHandler) {
366
+ return VelcronActions.actionHooks[actionName].afterHandler(args);
367
+ }
368
+ return args;
369
+ }
354
370
  static extractParameterValues(template, action) {
355
371
  const params = [];
356
372
  let hasMoreParams = true;
@@ -436,6 +452,7 @@ class VelcronActions {
436
452
  }
437
453
  }
438
454
  VelcronActions._actionHandlers = null;
455
+ VelcronActions.actionHooks = {};
439
456
  exports.VelcronActions = VelcronActions;
440
457
  var VelcronActionParameterDataType;
441
458
  (function (VelcronActionParameterDataType) {
@@ -1,4 +1,5 @@
1
- import { BuiltInComponentRenderers, DynamicState, ResolvedComponentRenderer, VelcronDefinition, VelcronRenderContext } from "../models";
1
+ import { BuiltInComponentRenderers, ResolvedComponentRenderer, VelcronDefinition, VelcronRenderContext } from "../models";
2
+ import { DynamicState } from "..";
2
3
  export declare class VelcronRenderers {
3
4
  private static components;
4
5
  static registerComponent(type: string, component: any): void;