@evoke-platform/context 1.0.0-dev.12 → 1.0.0-dev.121

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 (45) hide show
  1. package/README.md +139 -7
  2. package/dist/api/ApiBaseUrlProvider.js +0 -1
  3. package/dist/api/apiServices.js +12 -10
  4. package/dist/api/callback.js +0 -1
  5. package/dist/api/index.js +0 -1
  6. package/dist/api/paramsSerializer.d.ts +2 -0
  7. package/dist/api/paramsSerializer.js +7 -0
  8. package/dist/app/AppProvider.d.ts +12 -1
  9. package/dist/app/AppProvider.js +53 -7
  10. package/dist/app/index.js +0 -1
  11. package/dist/authentication/AuthenticationContextProvider.js +4 -2
  12. package/dist/authentication/index.js +0 -1
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.js +1 -1
  15. package/dist/notification/NotificationProvider.d.ts +33 -0
  16. package/dist/notification/NotificationProvider.js +134 -0
  17. package/dist/notification/index.d.ts +2 -0
  18. package/dist/notification/index.js +2 -0
  19. package/dist/objects/filters.js +0 -1
  20. package/dist/objects/index.js +0 -1
  21. package/dist/objects/objects.d.ts +260 -14
  22. package/dist/objects/objects.js +2 -3
  23. package/dist/router/index.js +0 -1
  24. package/dist/router/navigation.js +0 -1
  25. package/dist/router/routeParams.js +0 -1
  26. package/dist/signalr/SignalRConnectionProvider.js +40 -130
  27. package/dist/signalr/index.js +0 -1
  28. package/package.json +23 -16
  29. package/dist/api/ApiBaseUrlProvider.js.map +0 -1
  30. package/dist/api/apiServices.js.map +0 -1
  31. package/dist/api/callback.js.map +0 -1
  32. package/dist/api/index.js.map +0 -1
  33. package/dist/app/AppProvider.js.map +0 -1
  34. package/dist/app/index.js.map +0 -1
  35. package/dist/authentication/AuthenticationContextProvider.js.map +0 -1
  36. package/dist/authentication/index.js.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/objects/filters.js.map +0 -1
  39. package/dist/objects/index.js.map +0 -1
  40. package/dist/objects/objects.js.map +0 -1
  41. package/dist/router/index.js.map +0 -1
  42. package/dist/router/navigation.js.map +0 -1
  43. package/dist/router/routeParams.js.map +0 -1
  44. package/dist/signalr/SignalRConnectionProvider.js.map +0 -1
  45. package/dist/signalr/index.js.map +0 -1
@@ -1,29 +1,118 @@
1
1
  import { ApiServices, Callback } from '../api/index.js';
2
2
  import { Filter } from './filters.js';
3
+ export type BaseObjReference = {
4
+ objectId: string;
5
+ discriminatorValue: unknown;
6
+ };
7
+ export type ViewLayoutEntityReference = {
8
+ id: string;
9
+ objectId: string;
10
+ };
11
+ type ViewLayoutEntity = {
12
+ id: string;
13
+ name: string;
14
+ objectId: string;
15
+ };
16
+ export type TableViewLayoutEntity = ViewLayoutEntity & TableViewLayout;
17
+ export type DropdownViewLayoutEntity = ViewLayoutEntity & DropdownViewLayout;
18
+ export type ViewLayout = {
19
+ table?: TableViewLayout;
20
+ dropdown?: DropdownViewLayout;
21
+ };
22
+ export type DropdownViewLayout = {
23
+ secondaryTextExpression: string;
24
+ };
25
+ export type TableViewLayout = {
26
+ properties: PropertyReference[];
27
+ sort?: Sort;
28
+ };
29
+ export type PropertyReference = {
30
+ id: string;
31
+ format?: string;
32
+ };
33
+ export type Sort = {
34
+ colId: string;
35
+ sort?: 'asc' | 'desc';
36
+ };
3
37
  export type Obj = {
4
38
  id: string;
5
39
  name: string;
40
+ typeDiscriminatorProperty?: string;
41
+ viewLayout?: ViewLayout;
42
+ baseObject?: BaseObjReference;
6
43
  properties?: Property[];
7
44
  actions?: Action[];
8
45
  };
9
- export type PropertyType = 'array' | 'boolean' | 'date' | 'date-time' | 'integer' | 'number' | 'object' | 'string';
46
+ export type ObjWithRoot = Obj & {
47
+ rootObjectId: string;
48
+ };
49
+ export type PropertyType = 'address' | 'array' | 'boolean' | 'collection' | 'date' | 'date-time' | 'document' | 'image' | 'integer' | 'number' | 'object' | 'richText' | 'string' | 'time' | 'user';
50
+ export type NumericValidation = {
51
+ errorMessage?: string;
52
+ minimum?: number;
53
+ maximum?: number;
54
+ };
55
+ export type DateValidation = {
56
+ errorMessage?: string;
57
+ to?: string;
58
+ from?: string;
59
+ };
60
+ export type CriteriaValidation = {
61
+ criteria?: Record<string, unknown>;
62
+ };
63
+ export type StringValidation = {
64
+ operator: 'any' | 'all';
65
+ rules?: RegexValidation[];
66
+ };
67
+ export type DocumentValidation = {
68
+ errorMessage?: string;
69
+ maxDocuments?: number;
70
+ minDocuments?: number;
71
+ };
72
+ export type PropertyValidation = StringValidation | NumericValidation | DateValidation | CriteriaValidation | DocumentValidation;
10
73
  export type Property = {
11
74
  id: string;
12
75
  name: string;
13
76
  type: PropertyType;
14
77
  enum?: string[];
15
78
  objectId?: string;
79
+ relatedPropertyId?: string;
16
80
  required?: boolean;
17
81
  searchable?: boolean;
18
82
  formula?: string;
83
+ formulaType?: 'aggregate' | 'custom' | 'arithmetic';
84
+ mask?: string;
85
+ validation?: PropertyValidation;
86
+ manyToManyPropertyId?: string;
87
+ textTransform?: 'titleCase' | 'upperCase' | 'lowerCase' | 'sentenceCase';
19
88
  };
20
89
  export type ActionType = 'create' | 'update' | 'delete';
90
+ export type InputStringValidation = StringValidation & {
91
+ minLength?: number;
92
+ maxLength?: number;
93
+ mask?: string;
94
+ };
95
+ export type InputParameter = {
96
+ id: string;
97
+ name?: string;
98
+ type: PropertyType;
99
+ required?: boolean;
100
+ enum?: string[];
101
+ validation?: PropertyValidation | InputStringValidation;
102
+ objectId?: string;
103
+ relatedPropertyId?: string;
104
+ manyToManyPropertyId?: string;
105
+ };
21
106
  export type Action = {
22
107
  id: string;
23
108
  name: string;
24
109
  type: ActionType;
25
110
  outputEvent: string;
26
- inputProperties?: Property[];
111
+ inputProperties?: ActionInput[];
112
+ parameters?: InputParameter[];
113
+ form?: Form;
114
+ customCode?: string;
115
+ preconditions?: object;
27
116
  };
28
117
  export type ObjectInstance = {
29
118
  id: string;
@@ -31,6 +120,162 @@ export type ObjectInstance = {
31
120
  name: string;
32
121
  [key: string]: unknown;
33
122
  };
123
+ export type RegexValidation = {
124
+ regex: string;
125
+ errorMessage?: string;
126
+ };
127
+ export type SelectOption = {
128
+ label: string;
129
+ value: string;
130
+ };
131
+ export type VisibilityConfiguration = {
132
+ operator?: 'any' | 'all';
133
+ conditions?: {
134
+ property: string;
135
+ operator: 'eq' | 'neq';
136
+ value: string | number | boolean;
137
+ }[];
138
+ };
139
+ export type RelatedObjectDefaultValue = {
140
+ criteria: Record<string, unknown>;
141
+ sortBy?: string;
142
+ orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
143
+ };
144
+ export type DisplayConfiguration = {
145
+ label?: string;
146
+ placeholder?: string;
147
+ required?: boolean;
148
+ description?: string;
149
+ defaultValue?: string | number | string[] | RelatedObjectDefaultValue;
150
+ readOnly?: boolean;
151
+ tooltip?: string;
152
+ prefix?: string;
153
+ suffix?: string;
154
+ placeholderChar?: string;
155
+ rowCount?: number;
156
+ charCount?: boolean;
157
+ mode?: 'default' | 'existingOnly';
158
+ relatedObjectDisplay?: 'dropdown' | 'dialogBox';
159
+ visibility?: VisibilityConfiguration | string;
160
+ viewLayout?: ViewLayoutEntityReference;
161
+ };
162
+ export type InputParameterReference = {
163
+ type: 'input';
164
+ parameterId: string;
165
+ display?: DisplayConfiguration;
166
+ enumWithLabels?: SelectOption[];
167
+ documentMetadata?: Record<string, string>;
168
+ };
169
+ export type Content = {
170
+ type: 'content';
171
+ html: string;
172
+ visibility?: VisibilityConfiguration | string;
173
+ };
174
+ export type Column = {
175
+ width: number;
176
+ entries?: FormEntry[];
177
+ };
178
+ export type Columns = {
179
+ type: 'columns';
180
+ columns: Column[];
181
+ visibility?: VisibilityConfiguration | string;
182
+ };
183
+ export type Section = {
184
+ label: string;
185
+ entries?: FormEntry[];
186
+ };
187
+ export type Sections = {
188
+ type: 'sections';
189
+ sections: Section[];
190
+ visibility?: VisibilityConfiguration | string;
191
+ };
192
+ export type FormEntry = InputParameterReference | Columns | Sections | Content;
193
+ export type Form = {
194
+ entries?: FormEntry[];
195
+ };
196
+ export type ActionInputType = 'button' | 'Section' | 'Columns' | 'Content' | 'Select' | 'TextField' | 'DateTime' | 'Document' | 'RepeatableField' | 'ManyToManyRepeatableField' | 'MultiSelect' | 'Decimal' | 'RichText' | 'Date' | 'Integer' | 'Image' | 'Object' | 'Time' | 'User';
197
+ /**
198
+ * Represents an object action inputProperty object.
199
+ */
200
+ export type ActionInput = {
201
+ id?: string;
202
+ label?: string;
203
+ type?: ActionInputType;
204
+ key?: string;
205
+ initialValue?: string | string[] | number | RelatedObjectDefaultValue | SelectOption[] | SelectOption;
206
+ defaultToCurrentDate?: boolean;
207
+ defaultToCurrentTime?: boolean;
208
+ defaultValueCriteria?: object;
209
+ sortBy?: string;
210
+ orderBy?: 'asc' | 'desc' | 'ASC' | 'DESC';
211
+ html?: string;
212
+ labelPosition?: string;
213
+ placeholder?: string;
214
+ description?: string;
215
+ tooltip?: string;
216
+ prefix?: string;
217
+ suffix?: string;
218
+ data?: {
219
+ /**
220
+ * An array of values required for select options.
221
+ */
222
+ values?: SelectOption[];
223
+ };
224
+ inputMask?: string;
225
+ inputMaskPlaceholderChar?: string;
226
+ tableView?: boolean;
227
+ mode?: 'default' | 'existingOnly';
228
+ displayOption?: 'dropdown' | 'dialogBox';
229
+ rows?: number;
230
+ showCharCount?: boolean;
231
+ readOnly?: boolean;
232
+ isMultiLineText?: boolean;
233
+ verticalLayout?: boolean;
234
+ input?: boolean;
235
+ widget?: string;
236
+ conditional?: {
237
+ json?: string;
238
+ show?: boolean;
239
+ when?: string;
240
+ eq?: string | number | boolean;
241
+ };
242
+ property?: InputParameter;
243
+ viewLayout?: ViewLayoutEntityReference;
244
+ documentMetadata?: Record<string, string>;
245
+ validate?: {
246
+ required?: boolean;
247
+ criteria?: object;
248
+ operator?: 'any' | 'all';
249
+ regexes?: RegexValidation[];
250
+ minLength?: number;
251
+ maxLength?: number;
252
+ minDate?: string;
253
+ maxDate?: string;
254
+ minTime?: string;
255
+ maxTime?: string;
256
+ min?: number;
257
+ max?: number;
258
+ minDocuments?: number;
259
+ maxDocuments?: number;
260
+ customMessage?: string;
261
+ };
262
+ /**
263
+ * An array of sub-components to be rendered inside sections.
264
+ */
265
+ components?: {
266
+ key: string;
267
+ label?: string;
268
+ components: ActionInput[];
269
+ }[];
270
+ /**
271
+ * An array of sub-components to be rendered inside columns.
272
+ */
273
+ columns?: {
274
+ width: number;
275
+ currentWidth?: number;
276
+ components: ActionInput[];
277
+ }[];
278
+ };
34
279
  export type ActionRequest = {
35
280
  actionId: string;
36
281
  input?: Record<string, unknown>;
@@ -62,19 +307,20 @@ export declare class ObjectStore {
62
307
  private services;
63
308
  private objectId;
64
309
  constructor(services: ApiServices, objectId: string);
65
- get(options?: ObjectOptions): Promise<Obj>;
66
- get(cb?: Callback<Obj>): void;
67
- get(options: ObjectOptions, cb?: Callback<Obj>): void;
68
- findInstances(filter?: Filter): Promise<ObjectInstance[]>;
69
- findInstances(cb: Callback<ObjectInstance[]>): void;
70
- findInstances(filter: Filter, cb: Callback<ObjectInstance[]>): void;
71
- getInstance(id: string): Promise<ObjectInstance>;
72
- getInstance(id: string, cb: Callback<ObjectInstance>): void;
310
+ get(options?: ObjectOptions): Promise<ObjWithRoot>;
311
+ get(cb?: Callback<ObjWithRoot>): void;
312
+ get(options: ObjectOptions, cb?: Callback<ObjWithRoot>): void;
313
+ findInstances<T extends ObjectInstance = ObjectInstance>(filter?: Filter): Promise<T[]>;
314
+ findInstances<T extends ObjectInstance = ObjectInstance>(cb: Callback<T[]>): void;
315
+ findInstances<T extends ObjectInstance = ObjectInstance>(filter: Filter, cb: Callback<T[]>): void;
316
+ getInstance<T extends ObjectInstance = ObjectInstance>(id: string): Promise<T>;
317
+ getInstance<T extends ObjectInstance = ObjectInstance>(id: string, cb: Callback<T>): void;
73
318
  getInstanceHistory(id: string): Promise<History[]>;
74
319
  getInstanceHistory(id: string, cb: Callback<History[]>): void;
75
- newInstance(input: ActionRequest): Promise<ObjectInstance>;
76
- newInstance(input: ActionRequest, cb: Callback<ObjectInstance>): void;
77
- instanceAction(id: string, input: ActionRequest): Promise<ObjectInstance>;
78
- instanceAction(id: string, input: ActionRequest, cb: Callback<ObjectInstance>): void;
320
+ newInstance<T extends ObjectInstance = ObjectInstance>(input: ActionRequest): Promise<T>;
321
+ newInstance<T extends ObjectInstance = ObjectInstance>(input: ActionRequest, cb: Callback<T>): void;
322
+ instanceAction<T extends ObjectInstance = ObjectInstance>(id: string, input: ActionRequest): Promise<T>;
323
+ instanceAction<T extends ObjectInstance = ObjectInstance>(id: string, input: ActionRequest, cb: Callback<T>): void;
79
324
  }
80
325
  export declare function useObject(objectId: string): ObjectStore;
326
+ export {};
@@ -24,9 +24,9 @@ export class ObjectStore {
24
24
  },
25
25
  };
26
26
  if (!cb) {
27
- return this.services.get(`data/objects/${this.objectId}`, config);
27
+ return this.services.get(`data/objects/${this.objectId}/effective`, config);
28
28
  }
29
- this.services.get(`data/objects/${this.objectId}`, config, cb);
29
+ this.services.get(`data/objects/${this.objectId}/effective`, config, cb);
30
30
  }
31
31
  findInstances(filterOrCallback, cb) {
32
32
  let filter;
@@ -78,4 +78,3 @@ export function useObject(objectId) {
78
78
  const services = useApiServices();
79
79
  return useMemo(() => new ObjectStore(services, objectId), [services, objectId]);
80
80
  }
81
- //# sourceMappingURL=objects.js.map
@@ -2,4 +2,3 @@
2
2
  // This file is licensed under the MIT License.
3
3
  export * from './navigation.js';
4
4
  export * from './routeParams.js';
5
- //# sourceMappingURL=index.js.map
@@ -8,4 +8,3 @@ export function useNavigate() {
8
8
  navigate(generatePath(page, params));
9
9
  }, [navigate]);
10
10
  }
11
- //# sourceMappingURL=navigation.js.map
@@ -7,4 +7,3 @@ export function usePageParams() {
7
7
  export function usePageParam(param) {
8
8
  return useParams()[param];
9
9
  }
10
- //# sourceMappingURL=routeParams.js.map
@@ -1,143 +1,53 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { jsx as _jsx } from "react/jsx-runtime";
11
2
  // Copyright (c) 2023 System Automation Corporation.
12
3
  // This file is licensed under the MIT License.
13
- import { HubConnectionBuilder, LogLevel } from '@microsoft/signalr/dist/esm/index.js';
14
- import { createContext, useContext, useEffect, useState } from 'react';
15
- import { useApiServices } from '../api/index.js';
4
+ import { createContext, useContext, useState } from 'react';
5
+ import { useNotification } from '../notification/index.js';
16
6
  export const SignalRConnectionContext = createContext({});
17
7
  SignalRConnectionContext.displayName = 'SignalRConnectionContext';
18
8
  function SignalRConnectionProvider({ children }) {
19
- const [instancesSignalRConnection, setInstancesSignalRConnection] = useState();
20
- const [documentsSignalRConnection, setDocumentsSignalRConnection] = useState();
21
- const api = useApiServices();
22
- useEffect(() => {
23
- const getConnectionInfo = (hubName) => {
24
- return api.post(`/signalr/hubs/${hubName}/negotiate`);
25
- };
26
- const getConnection = () => __awaiter(this, void 0, void 0, function* () {
27
- try {
28
- const instancesConnectionInfo = yield getConnectionInfo('instanceChanges');
29
- const documentsConnectionInfo = yield getConnectionInfo('documentChanges');
30
- if (instancesConnectionInfo) {
31
- const options = {
32
- accessTokenFactory: () => __awaiter(this, void 0, void 0, function* () {
33
- if (instancesConnectionInfo.accessToken) {
34
- return instancesConnectionInfo.accessToken;
35
- }
36
- else {
37
- return getConnection();
38
- }
39
- }),
40
- };
41
- const connection = new HubConnectionBuilder()
42
- .withUrl(instancesConnectionInfo.url, options)
43
- .configureLogging(LogLevel.Error)
44
- .withAutomaticReconnect()
45
- .build();
46
- setInstancesSignalRConnection(connection);
47
- }
48
- if (documentsConnectionInfo) {
49
- const options = {
50
- accessTokenFactory: () => __awaiter(this, void 0, void 0, function* () {
51
- if (documentsConnectionInfo.accessToken) {
52
- return documentsConnectionInfo.accessToken;
53
- }
54
- else {
55
- return getConnection();
56
- }
57
- }),
58
- };
59
- const connection = new HubConnectionBuilder()
60
- .withUrl(documentsConnectionInfo.url, options)
61
- .configureLogging(LogLevel.Error)
62
- .withAutomaticReconnect()
63
- .build();
64
- setDocumentsSignalRConnection(connection);
65
- }
66
- // eslint-disable-next-line no-empty
67
- }
68
- catch (err) { }
69
- });
70
- getConnection();
71
- }, []);
72
- useEffect(() => {
73
- let documentsConnectionStopped = false;
74
- const startConnection = (connection, numOfAttempts) => __awaiter(this, void 0, void 0, function* () {
75
- yield connection.start().catch((error) => {
76
- if (numOfAttempts < 4 && !documentsConnectionStopped) {
77
- setTimeout(() => {
78
- if (!documentsConnectionStopped) {
79
- startConnection(connection, numOfAttempts + 1);
80
- }
81
- }, 2000);
82
- }
83
- else {
84
- console.warn(`Cannot start connection to SignalR due to error "${error}"`);
85
- }
86
- });
87
- });
88
- if (documentsSignalRConnection) {
89
- startConnection(documentsSignalRConnection, 0);
90
- }
91
- return () => {
92
- documentsSignalRConnection === null || documentsSignalRConnection === void 0 ? void 0 : documentsSignalRConnection.stop();
93
- documentsConnectionStopped = true;
94
- };
95
- }, [documentsSignalRConnection]);
96
- useEffect(() => {
97
- let instancesConnectionStopped = false;
98
- const startConnection = (connection, numOfAttempts) => __awaiter(this, void 0, void 0, function* () {
99
- yield connection.start().catch((error) => {
100
- if (numOfAttempts < 4 && !instancesConnectionStopped) {
101
- setTimeout(() => {
102
- if (!instancesConnectionStopped) {
103
- startConnection(connection, numOfAttempts + 1);
104
- }
105
- }, 2000);
106
- }
107
- else {
108
- console.warn(`Cannot start connection to SignalR due to error "${error}"`);
109
- }
110
- });
111
- });
112
- if (instancesSignalRConnection) {
113
- startConnection(instancesSignalRConnection, 0);
114
- }
115
- return () => {
116
- instancesSignalRConnection === null || instancesSignalRConnection === void 0 ? void 0 : instancesSignalRConnection.stop();
117
- instancesConnectionStopped = true;
118
- };
119
- }, [instancesSignalRConnection]);
9
+ const notifications = useNotification();
10
+ const [instanceCallbacks] = useState(
11
+ // Map provided callbacks to our wrappers that are sent to the underlying
12
+ // notification provider.
13
+ new WeakMap());
120
14
  return (_jsx(SignalRConnectionContext.Provider, { value: {
121
- documentChanges: documentsSignalRConnection
122
- ? {
123
- subscribe: (topicName, callback) => documentsSignalRConnection.on(topicName, callback),
124
- unsubscribe: (topicName, callback) => callback
125
- ? documentsSignalRConnection.off(topicName, callback)
126
- : documentsSignalRConnection.off(topicName),
127
- }
128
- : undefined,
129
- instanceChanges: instancesSignalRConnection
130
- ? {
131
- subscribe: (topicName, callback) => instancesSignalRConnection.on(topicName, callback),
132
- unsubscribe: (topicName, callback) => callback
133
- ? instancesSignalRConnection.off(topicName, callback)
134
- : instancesSignalRConnection.off(topicName),
135
- }
136
- : undefined,
15
+ documentChanges: {
16
+ subscribe: (topicName, callback) => {
17
+ var _a;
18
+ const [objectId, instanceId] = topicName.split('/');
19
+ (_a = notifications.documentChanges) === null || _a === void 0 ? void 0 : _a.subscribe(objectId, instanceId, callback);
20
+ },
21
+ unsubscribe: (topicName, callback) => {
22
+ var _a;
23
+ const [objectId, instanceId] = topicName.split('/');
24
+ (_a = notifications.documentChanges) === null || _a === void 0 ? void 0 : _a.unsubscribe(objectId, instanceId, callback);
25
+ },
26
+ },
27
+ instanceChanges: {
28
+ subscribe: (objectId, callback) => {
29
+ var _a;
30
+ // If there is already a wrapper for the given callback, we must reuse the
31
+ // same one. Otherwise, if we overwrite the entry in our cache, we'll lose
32
+ // track of the original wrapper.
33
+ let wrapper = instanceCallbacks.get(callback);
34
+ if (!wrapper) {
35
+ wrapper = (...changes) => {
36
+ callback(...changes.map((change) => change.instanceId));
37
+ };
38
+ instanceCallbacks.set(callback, wrapper);
39
+ }
40
+ (_a = notifications.instanceChanges) === null || _a === void 0 ? void 0 : _a.subscribe(objectId, wrapper);
41
+ },
42
+ unsubscribe: (objectId, callback) => {
43
+ var _a;
44
+ (_a = notifications.instanceChanges) === null || _a === void 0 ? void 0 : _a.unsubscribe(objectId, callback && instanceCallbacks.get(callback));
45
+ },
46
+ },
137
47
  }, children: children }));
138
48
  }
139
49
  export function useSignalRConnection() {
50
+ console.warn('Use of useSignalRConnection is deprecated. Use useNotification instead.');
140
51
  return useContext(SignalRConnectionContext);
141
52
  }
142
53
  export default SignalRConnectionProvider;
143
- //# sourceMappingURL=SignalRConnectionProvider.js.map
@@ -2,4 +2,3 @@
2
2
  // This file is licensed under the MIT License.
3
3
  export * from './SignalRConnectionProvider.js';
4
4
  export { default as SignalRConnectionProvider } from './SignalRConnectionProvider.js';
5
- //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/context",
3
- "version": "1.0.0-dev.12",
3
+ "version": "1.0.0-dev.121",
4
4
  "description": "Utilities that provide context to Evoke platform widgets",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -35,24 +35,30 @@
35
35
  "!dist/tests"
36
36
  ],
37
37
  "devDependencies": {
38
- "@azure/msal-browser": "^2.38.0",
38
+ "@azure/msal-browser": "^2.38.4",
39
39
  "@azure/msal-react": "^1.5.9",
40
- "@types/chai": "^4.3.4",
41
- "@types/dirty-chai": "^2.0.2",
42
- "@types/mocha": "^10.0.1",
40
+ "@testing-library/dom": "^10.4.0",
41
+ "@testing-library/react": "^16.0.1",
42
+ "@types/chai": "^4.3.11",
43
+ "@types/dirty-chai": "^2.0.4",
44
+ "@types/mocha": "^10.0.6",
43
45
  "@types/node": "^18.15.7",
44
- "@types/react": "^18.2.15",
45
- "@types/sinon": "^10.0.13",
46
- "chai": "^4.3.7",
47
- "commit-and-tag-version": "^11.2.2",
46
+ "@types/react": "^18.2.28",
47
+ "@types/sinon": "^17.0.3",
48
+ "@types/uuid": "^9.0.8",
49
+ "chai": "^4.4.1",
50
+ "commit-and-tag-version": "^12.1.0",
48
51
  "dirty-chai": "^2.0.1",
49
- "eslint-plugin-react": "^7.32.2",
52
+ "eslint-plugin-react": "^7.33.2",
53
+ "global-jsdom": "^25.0.0",
54
+ "jsdom": "^25.0.1",
50
55
  "mocha": "^10.2.0",
51
- "msw": "^1.2.1",
56
+ "msw": "^1.3.1",
52
57
  "react": "^18.2.0",
53
- "react-router-dom": "^6.14.0",
54
- "sinon": "^15.0.3",
55
- "typescript": "^5.1.6"
58
+ "react-dom": "^18.3.1",
59
+ "react-router-dom": "^6.16.0",
60
+ "sinon": "^18.0.0",
61
+ "typescript": "^5.3.3"
56
62
  },
57
63
  "peerDependencies": {
58
64
  "@azure/msal-browser": ">=2",
@@ -61,7 +67,8 @@
61
67
  "react-router-dom": ">=6"
62
68
  },
63
69
  "dependencies": {
64
- "@microsoft/signalr": "^7.0.5",
65
- "axios": "^1.4.0"
70
+ "@microsoft/signalr": "^7.0.12",
71
+ "axios": "^1.7.9",
72
+ "uuid": "^9.0.1"
66
73
  }
67
74
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApiBaseUrlProvider.js","sourceRoot":"","sources":["../../src/api/ApiBaseUrlProvider.tsx"],"names":[],"mappings":";;AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,OAAO,EAAE,aAAa,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AAE7D,MAAM,iBAAiB,GAAG,aAAa,CAAC,GAAG,MAAA,UAAU,CAAC,QAAQ,0CAAE,MAAM,MAAM,CAAC,CAAC;AAE9E,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAOpD,SAAS,kBAAkB,CAAC,KAA8B;IACtD,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEhC,OAAO,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,YAAG,QAAQ,GAA8B,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,aAAa;IACz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,IAAI,MAAyC,CAAC;YAE9C,IAAI,EAAE,EAAE;gBACJ,MAAM,GAAG,gBAAyC,CAAC;aACtD;iBAAM,IAAI,OAAO,gBAAgB,KAAK,UAAU,EAAE;gBAC/C,EAAE,GAAG,gBAAgB,CAAC;aACzB;iBAAM;gBACH,MAAM,GAAG,gBAAgB,CAAC;aAC7B;YAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAyB,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5F,CAAC;KAAA;CACJ;AAED,MAAM,UAAU,cAAc;IAC1B,MAAM,WAAW,GAAG,wBAAwB,EAAE,CAAC;IAC/C,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;IAEhC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnH,OAAO,WAAW,CAAC;AACvB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"callback.js","sourceRoot":"","sources":["../../src/api/callback.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAI/C,MAAM,UAAU,QAAQ,CAAI,SAA+B,EAAE,OAA8B;IACvF,OAAO,CAAC,GAAkB,EAAE,MAAU,EAAE,EAAE;QACtC,IAAI,GAAG,EAAE;YACL,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,GAAG,CAAC,CAAC;SAClB;aAAM;YACH,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,MAAW,CAAC,CAAC;SAC5B;IACL,CAAC,CAAC;AACN,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AppProvider.js","sourceRoot":"","sources":["../../src/app/AppProvider.tsx"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,OAAO,EAAE,aAAa,EAAa,UAAU,EAAE,MAAM,OAAO,CAAC;AA+C7D,MAAM,UAAU,GAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AACjF,MAAM,UAAU,GAAG,aAAa,CAAM,UAAU,CAAC,CAAC;AAElD,UAAU,CAAC,WAAW,GAAG,YAAY,CAAC;AAOtC,SAAS,WAAW,CAAC,KAAuB;IACxC,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEhC,OAAO,KAAC,UAAU,CAAC,QAAQ,IAAC,KAAK,EAAE,GAAG,YAAG,QAAQ,GAAuB,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,MAAM;IAClB,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;AAClC,CAAC;AAED,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/app/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthenticationContextProvider.js","sourceRoot":"","sources":["../../src/authentication/AuthenticationContextProvider.tsx"],"names":[],"mappings":";;;;;;;;;;AAKA,OAAO,EAAa,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CA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AC;AAC3E,CAAC;AAED,MAAM,UAAU,wBAAwB;IACpC,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC;AAED,eAAe,6BAA6B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/authentication/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,cAAc,oCAAoC,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,oCAAoC,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"filters.js","sourceRoot":"","sources":["../../src/objects/filters.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/objects/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,+CAA+C;AAE/C,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}