bruce-models 7.1.44 → 7.1.45

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.
@@ -0,0 +1,332 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RecordChangeFeed = void 0;
4
+ const account_concept_1 = require("../account/account-concept");
5
+ const api_1 = require("../api/api");
6
+ /**
7
+ * Handles change events from Bruce API for various concepts.
8
+ * Apps/utils can subscribe to specific concept changes, eg: N Entity was updated so we should reload a panel.
9
+ */
10
+ var RecordChangeFeed;
11
+ (function (RecordChangeFeed) {
12
+ const VALID_ACTIONS = ["C", "U", "D"];
13
+ const ENTITY_CONCEPT = account_concept_1.AccountConcept.EConcept.ENTITY;
14
+ const getTopicEnvPrefix = (env) => {
15
+ if (env === api_1.Api.EEnv.DEV) {
16
+ return "D";
17
+ }
18
+ if (env === api_1.Api.EEnv.UAT) {
19
+ return "U";
20
+ }
21
+ return "P";
22
+ };
23
+ const isValidAction = (value) => {
24
+ return VALID_ACTIONS.includes(value);
25
+ };
26
+ /**
27
+ * Parses a raw broker message into a typed record-change event.
28
+ * Returns null if the message does not conform to the record-change format.
29
+ */
30
+ RecordChangeFeed.parseEvent = (message) => {
31
+ if (!(message === null || message === void 0 ? void 0 : message.event) || typeof message.event !== "string") {
32
+ return null;
33
+ }
34
+ const parts = message.event.split(".");
35
+ if (parts.length !== 2) {
36
+ return null;
37
+ }
38
+ const [conceptCode, actionCode] = parts;
39
+ if (!conceptCode || !actionCode || !isValidAction(actionCode)) {
40
+ return null;
41
+ }
42
+ return {
43
+ topic: message.topic,
44
+ concept: conceptCode.toLowerCase(),
45
+ action: actionCode,
46
+ data: message.data,
47
+ user: message.user,
48
+ message
49
+ };
50
+ };
51
+ /**
52
+ * Returns true if the given Entity internal ID falls within the reported range string.
53
+ *
54
+ * @example
55
+ * isEntityInternalIdInRangeString("100-200,305,400-450", 150) // true
56
+ * isEntityInternalIdInRangeString("100-200,305,400-450", 301) // false
57
+ */
58
+ RecordChangeFeed.isEntityInternalIdInRangeString = (rangeString, entityInternalId) => {
59
+ if (!rangeString || !Number.isInteger(entityInternalId)) {
60
+ return false;
61
+ }
62
+ for (const part of rangeString.split(",")) {
63
+ const token = part.trim();
64
+ if (!token) {
65
+ continue;
66
+ }
67
+ const [startText, endText] = token.split("-");
68
+ const start = Number(startText);
69
+ const end = endText === undefined ? start : Number(endText);
70
+ if (!Number.isInteger(start) || !Number.isInteger(end)) {
71
+ continue;
72
+ }
73
+ const min = Math.min(start, end);
74
+ const max = Math.max(start, end);
75
+ if (entityInternalId >= min && entityInternalId <= max) {
76
+ return true;
77
+ }
78
+ }
79
+ return false;
80
+ };
81
+ /**
82
+ * Returns true if the given record ID appears in a comma-separated list string.
83
+ *
84
+ * @example
85
+ * isRecordIdInListString("abc,def,ghi", "def") // true
86
+ * isRecordIdInListString("abc,def,ghi", "xyz") // false
87
+ */
88
+ RecordChangeFeed.isRecordIdInListString = (listString, recordId) => {
89
+ const normalizedId = String(recordId !== null && recordId !== void 0 ? recordId : "").trim();
90
+ if (!listString || !normalizedId) {
91
+ return false;
92
+ }
93
+ for (const part of listString.split(",")) {
94
+ if (part.trim() === normalizedId) {
95
+ return true;
96
+ }
97
+ }
98
+ return false;
99
+ };
100
+ /**
101
+ * Returns the set of {@link Api.ECacheKey} namespaces that should be
102
+ * invalidated when a record-change event arrives for the given concept.
103
+ *
104
+ * A concept can map to multiple cache namespaces (e.g. a tileset change
105
+ * also invalidates the publish-tileset and tileset-access caches).
106
+ */
107
+ RecordChangeFeed.getConceptCacheKeys = (concept) => {
108
+ switch (concept) {
109
+ case account_concept_1.AccountConcept.EConcept.ASSEMBLY:
110
+ return [api_1.Api.ECacheKey.Assembly];
111
+ case account_concept_1.AccountConcept.EConcept.ATTACHMENT_TYPE:
112
+ return [api_1.Api.ECacheKey.AttachmentType];
113
+ case account_concept_1.AccountConcept.EConcept.CLIENT_FILE:
114
+ return [
115
+ api_1.Api.ECacheKey.ClientFile,
116
+ api_1.Api.ECacheKey.ClientFileCountsPurpose,
117
+ api_1.Api.ECacheKey.ClientFileCountsExtension,
118
+ api_1.Api.ECacheKey.ClientFileCountsMIMEType,
119
+ api_1.Api.ECacheKey.ClientFileCountsUser
120
+ ];
121
+ case account_concept_1.AccountConcept.EConcept.CUSTOM_FORM:
122
+ return [api_1.Api.ECacheKey.CustomForm];
123
+ case account_concept_1.AccountConcept.EConcept.DATA_FEED:
124
+ return [api_1.Api.ECacheKey.DataFeed];
125
+ case account_concept_1.AccountConcept.EConcept.DATA_SOURCE:
126
+ return [api_1.Api.ECacheKey.DataSource, api_1.Api.ECacheKey.EntitySource];
127
+ case account_concept_1.AccountConcept.EConcept.DOCUMENT_VIEW:
128
+ return [api_1.Api.ECacheKey.AnnDocument];
129
+ case account_concept_1.AccountConcept.EConcept.ENTITY:
130
+ return [
131
+ api_1.Api.ECacheKey.Entity,
132
+ api_1.Api.ECacheKey.EntityCoords,
133
+ api_1.Api.ECacheKey.Attachment,
134
+ api_1.Api.ECacheKey.Comment,
135
+ api_1.Api.ECacheKey.Link
136
+ ];
137
+ case account_concept_1.AccountConcept.EConcept.ENTITY_LOD:
138
+ return [api_1.Api.ECacheKey.Lod];
139
+ case account_concept_1.AccountConcept.EConcept.ENTITY_RELATION:
140
+ return [api_1.Api.ECacheKey.Relation];
141
+ case account_concept_1.AccountConcept.EConcept.ENTITY_TYPE:
142
+ return [api_1.Api.ECacheKey.EntityType, api_1.Api.ECacheKey.EntityTypeTrigger];
143
+ case account_concept_1.AccountConcept.EConcept.ENTITY_TYPE_LOD:
144
+ return [api_1.Api.ECacheKey.Lod];
145
+ case account_concept_1.AccountConcept.EConcept.LAYER:
146
+ return [api_1.Api.ECacheKey.Tag];
147
+ case account_concept_1.AccountConcept.EConcept.LOD_CATEGORY:
148
+ return [api_1.Api.ECacheKey.LodCategory];
149
+ case account_concept_1.AccountConcept.EConcept.PENDING_ACTION:
150
+ return [api_1.Api.ECacheKey.PendingAction];
151
+ case account_concept_1.AccountConcept.EConcept.PROGRAM_KEY:
152
+ return [api_1.Api.ECacheKey.ProgramKey];
153
+ case account_concept_1.AccountConcept.EConcept.PROJECT_VIEW:
154
+ return [api_1.Api.ECacheKey.ProjectView, api_1.Api.ECacheKey.ProjectViewBookmark];
155
+ case account_concept_1.AccountConcept.EConcept.RELATION_TYPE:
156
+ return [api_1.Api.ECacheKey.RelationType];
157
+ case account_concept_1.AccountConcept.EConcept.TILESET:
158
+ return [api_1.Api.ECacheKey.Tileset, api_1.Api.ECacheKey.PublishTileset, api_1.Api.ECacheKey.TilesetAccess];
159
+ case account_concept_1.AccountConcept.EConcept.UI_ENTITY_DISPLAY_SETTING:
160
+ return [api_1.Api.ECacheKey.Style];
161
+ case account_concept_1.AccountConcept.EConcept.UI_PLUGIN:
162
+ return [api_1.Api.ECacheKey.Plugin, api_1.Api.ECacheKey.PluginIndexFile];
163
+ case account_concept_1.AccountConcept.EConcept.UI_SLIDE:
164
+ case account_concept_1.AccountConcept.EConcept.UI_SLIDE_GROUP:
165
+ return [api_1.Api.ECacheKey.ProjectViewBookmark];
166
+ default:
167
+ return [];
168
+ }
169
+ };
170
+ /**
171
+ * Evicts relevant cache entries in response to a record-change event.
172
+ */
173
+ RecordChangeFeed.clearCachesForEvent = (event, cache) => {
174
+ const cacheKeys = RecordChangeFeed.getConceptCacheKeys(event.concept);
175
+ if (!cacheKeys.length) {
176
+ return;
177
+ }
178
+ // Entity-concept events use internal ID ranges, not public record IDs,
179
+ // so individual entity cache entries cannot be matched.
180
+ const isEntityConcept = event.concept === ENTITY_CONCEPT;
181
+ const recordIds = [];
182
+ if (!isEntityConcept && typeof event.data === "string" && event.data) {
183
+ for (const part of event.data.split(",")) {
184
+ const id = part.trim();
185
+ if (id) {
186
+ recordIds.push(id);
187
+ }
188
+ }
189
+ }
190
+ for (const cacheKey of cacheKeys) {
191
+ // Phase 1: evict record-specific cache entries.
192
+ for (const recordId of recordIds) {
193
+ cache.RemoveByContains(cacheKey + api_1.Api.ECacheKey.Id + recordId);
194
+ }
195
+ // Phase 2: evict list / concept-level entries.
196
+ cache.RemoveByCallback((key) => {
197
+ const keyStr = key == null ? "" : String(key);
198
+ for (const recordId of recordIds) {
199
+ if (keyStr.includes(recordId)) {
200
+ return false;
201
+ }
202
+ }
203
+ return keyStr === cacheKey || keyStr.startsWith(cacheKey + api_1.Api.ECacheKey.Id);
204
+ });
205
+ }
206
+ };
207
+ /**
208
+ * A typed, self-managing live feed for Bruce record-change events.
209
+ *
210
+ * Wraps a {@link MessageBroker.IBroker} and routes incoming WebSocket messages
211
+ * to strongly-typed, optionally-filtered subscriber callbacks.
212
+ *
213
+ * When a "cache" is provided (via the {@link BruceApi.Api} constructor),
214
+ * relevant cache entries are automatically evicted on every incoming event
215
+ * before subscribers are notified.
216
+ *
217
+ * Reconnection is handled by the underlying broker, subscribers do not need
218
+ * to re-register after a disconnect/reconnect cycle.
219
+ *
220
+ * @example
221
+ * const unsub = api.RecordChangeFeed.Subscribe(
222
+ * { concepts: [AccountConcept.EConcept.ENTITY_TYPE] },
223
+ * (event) => console.log("Entity type changed:", event)
224
+ * );
225
+ *
226
+ * // Later:
227
+ * unsub();
228
+ */
229
+ class Client {
230
+ /**
231
+ * Initialize new instance. Done through a BruceAPI instance in all current uses.
232
+ * @param broker
233
+ * @param accountId
234
+ * @param env
235
+ * @param cache
236
+ */
237
+ constructor(broker, accountId, env, cache) {
238
+ this.subscribers = [];
239
+ this.topic = `${getTopicEnvPrefix(env)}_${accountId}_API_DATA`;
240
+ this.broker = broker;
241
+ this.cache = cache;
242
+ this.brokerCallback = this.onBrokerMessage.bind(this);
243
+ this.broker.Subscribe(this.topic, this.brokerCallback);
244
+ }
245
+ /**
246
+ * Whether the underlying WebSocket connection is currently open.
247
+ */
248
+ get IsConnected() {
249
+ return this.broker.IsConnected;
250
+ }
251
+ /**
252
+ * Forward the authenticated user ID to the underlying broker.
253
+ */
254
+ SetUserId(userId) {
255
+ this.broker.SetUserId(userId);
256
+ }
257
+ onBrokerMessage(message) {
258
+ if ((message === null || message === void 0 ? void 0 : message.event) === "usersUpdate") {
259
+ return;
260
+ }
261
+ const event = RecordChangeFeed.parseEvent(message);
262
+ if (!event) {
263
+ return;
264
+ }
265
+ // Auto-evict relevant cache entries before notifying subscribers.
266
+ if (this.cache) {
267
+ RecordChangeFeed.clearCachesForEvent(event, this.cache);
268
+ }
269
+ for (const { params, callback } of this.subscribers) {
270
+ if (!this.matchesFilter(event, params)) {
271
+ continue;
272
+ }
273
+ callback(event);
274
+ }
275
+ }
276
+ matchesFilter(event, params) {
277
+ var _a, _b;
278
+ if (((_a = params.concepts) === null || _a === void 0 ? void 0 : _a.length) && !params.concepts.includes(event.concept)) {
279
+ return false;
280
+ }
281
+ if (((_b = params.actions) === null || _b === void 0 ? void 0 : _b.length) && !params.actions.includes(event.action)) {
282
+ return false;
283
+ }
284
+ const isEntityConcept = event.concept === ENTITY_CONCEPT;
285
+ if (!isEntityConcept && params.recordId !== undefined) {
286
+ const list = typeof event.data === "string" ? event.data : "";
287
+ if (!RecordChangeFeed.isRecordIdInListString(list, params.recordId)) {
288
+ return false;
289
+ }
290
+ }
291
+ // Entity events don't carry public record IDs, skip if caller only
292
+ // specified recordId (they need entityInternalId for entity filtering).
293
+ if (isEntityConcept && params.recordId !== undefined && params.entityInternalId === undefined) {
294
+ return false;
295
+ }
296
+ if (isEntityConcept && params.entityInternalId !== undefined) {
297
+ const range = typeof event.data === "string" ? event.data : "";
298
+ if (!RecordChangeFeed.isEntityInternalIdInRangeString(range, params.entityInternalId)) {
299
+ return false;
300
+ }
301
+ }
302
+ return true;
303
+ }
304
+ /**
305
+ * Register a typed callback for record-change events.
306
+ *
307
+ * @param params Filtering criteria. All fields are optional.
308
+ * @param callback Invoked for each matching event.
309
+ * @returns An unsubscribe function. Call it to stop receiving events.
310
+ */
311
+ Subscribe(params, callback) {
312
+ const subscriber = { params, callback };
313
+ this.subscribers.push(subscriber);
314
+ return () => {
315
+ const index = this.subscribers.indexOf(subscriber);
316
+ if (index !== -1) {
317
+ this.subscribers.splice(index, 1);
318
+ }
319
+ };
320
+ }
321
+ /**
322
+ * Unsubscribes from the broker topic and clears all local subscribers.
323
+ * Call this when the owning API instance is being torn down.
324
+ */
325
+ Destroy() {
326
+ this.subscribers.length = 0;
327
+ this.broker.Unsubscribe(this.topic, this.brokerCallback);
328
+ }
329
+ }
330
+ RecordChangeFeed.Client = Client;
331
+ })(RecordChangeFeed = exports.RecordChangeFeed || (exports.RecordChangeFeed = {}));
332
+ //# sourceMappingURL=record-change-feed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record-change-feed.js","sourceRoot":"","sources":["../../../src/server/record-change-feed.ts"],"names":[],"mappings":";;;AAAA,gEAA4D;AAC5D,oCAAiC;AAIjC;;;GAGG;AACH,IAAiB,gBAAgB,CAoZhC;AApZD,WAAiB,gBAAgB;IAG7B,MAAM,aAAa,GAAuB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAmC1D,MAAM,cAAc,GAAG,gCAAc,CAAC,QAAQ,CAAC,MAAM,CAAC;IAEtD,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAU,EAAE;QAC/C,IAAI,GAAG,KAAK,SAAG,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,OAAO,GAAG,CAAC;SACd;QACD,IAAI,GAAG,KAAK,SAAG,CAAC,IAAI,CAAC,GAAG,EAAE;YACtB,OAAO,GAAG,CAAC;SACd;QACD,OAAO,GAAG,CAAC;IACf,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,CAAC,KAAa,EAAoB,EAAE;QACtD,OAAQ,aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChE,CAAC,CAAA;IAED;;;OAGG;IACU,2BAAU,GAAG,CAAC,OAA+B,EAAiB,EAAE;QACzE,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAA,IAA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KAAhB,wBAAgB,QAoZhC"}
@@ -1,8 +1,9 @@
1
+ import { Account, IDictionary } from "../bruce-models";
2
+ import { MessageBroker } from "../server/message-broker";
3
+ import { RecordChangeFeed } from "../server/record-change-feed";
1
4
  import { AbstractApi } from "./abstract-api";
2
5
  import { Api as A } from "./api";
3
- import { MessageBroker } from "../server/message-broker";
4
6
  import { GuardianApi } from "./guardian-api";
5
- import { Account, IDictionary } from "../bruce-models";
6
7
  /**
7
8
  * The primary API for communication with Nextspace.
8
9
  * This API is used to manage your data.
@@ -27,7 +28,18 @@ export declare namespace BruceApi {
27
28
  private env;
28
29
  private loadCancelled;
29
30
  private messageBroker;
31
+ /**
32
+ * General-purpose WebSocket message broker for this API instance.
33
+ * Use this to subscribe to custom topics.
34
+ * For typed record-change events, prefer {@link RecordChangeFeed}.
35
+ */
30
36
  get MessageBroker(): MessageBroker.IBroker;
37
+ private _recordChangeFeed;
38
+ /**
39
+ * Typed live feed for Bruce record-change events.
40
+ * Available once the API has finished loading (await api.Loading) when `loadWebSocket: true` was passed to the constructor.
41
+ */
42
+ get RecordChangeFeed(): RecordChangeFeed.Client | null;
31
43
  private configLoadAttempted;
32
44
  get ConfigLoadAttempted(): boolean;
33
45
  private cdnBaseUrl;
@@ -1,16 +1,25 @@
1
- export * from "./assembly/assembly";
1
+ export * from "./account/account";
2
+ export * from "./account/account-concept";
3
+ export * from "./account/account-features";
4
+ export * from "./account/account-invite";
5
+ export * from "./account/account-limits";
6
+ export * from "./account/account-settings";
7
+ export * from "./account/account-template";
8
+ export * from "./account/account-type";
2
9
  export * from "./ann-document/ann-document";
3
- export * from "./custom-form/custom-form";
4
- export * from "./custom-form/custom-form-content";
5
10
  export * from "./api/abstract-api";
6
11
  export * from "./api/api";
12
+ export * from "./api/api-getters";
7
13
  export * from "./api/bruce-api";
8
14
  export * from "./api/global-api";
9
15
  export * from "./api/guardian-api";
10
- export * from "./api/api-getters";
16
+ export * from "./assembly/assembly";
11
17
  export * from "./calculator/calculator";
18
+ export * from "./change-set/change-set";
19
+ export * from "./client-file/client-file";
12
20
  export * from "./common/bounds";
13
21
  export * from "./common/bruce-event";
22
+ export * from "./common/bruce-variable";
14
23
  export * from "./common/cache";
15
24
  export * from "./common/camera";
16
25
  export * from "./common/cartes";
@@ -18,91 +27,83 @@ export * from "./common/carto";
18
27
  export * from "./common/color";
19
28
  export * from "./common/delay-queue";
20
29
  export * from "./common/dictionary";
30
+ export * from "./common/geojson";
21
31
  export * from "./common/geometry";
22
- export * from "./common/transform";
23
- export * from "./common/utc";
24
- export * from "./common/bruce-variable";
25
32
  export * from "./common/lru-cache";
26
33
  export * from "./common/section";
27
- export * from "./common/geojson";
28
- export * from "./entity/entity-attachment-type";
34
+ export * from "./common/transform";
35
+ export * from "./common/utc";
36
+ export * from "./custom-form/custom-form";
37
+ export * from "./custom-form/custom-form-content";
38
+ export * from "./dashboard/dashboard-view";
39
+ export * from "./data-feed/data-feed";
40
+ export * from "./data-lab/data-lab";
41
+ export * from "./data-lab/data-lab-group";
42
+ export * from "./data-source/data-source";
43
+ export * from "./data-transform/data-transform";
44
+ export * from "./entity-type-model/comment";
45
+ export * from "./entity/entity";
29
46
  export * from "./entity/entity-attachment";
47
+ export * from "./entity/entity-attachment-type";
48
+ export * from "./entity/entity-attribute";
30
49
  export * from "./entity/entity-comment";
50
+ export * from "./entity/entity-coords";
51
+ export * from "./entity/entity-historic-data";
31
52
  export * from "./entity/entity-link";
32
53
  export * from "./entity/entity-lod";
33
54
  export * from "./entity/entity-lod-category";
34
- export * from "./entity/entity-relation-type";
35
55
  export * from "./entity/entity-relation";
56
+ export * from "./entity/entity-relation-type";
36
57
  export * from "./entity/entity-source";
58
+ export * from "./entity/entity-table-view";
37
59
  export * from "./entity/entity-tag";
38
- export * from "./entity/entity-type-trigger";
39
60
  export * from "./entity/entity-type";
40
- export * from "./entity/entity";
41
- export * from "./entity/entity-coords";
42
- export * from "./entity/entity-attribute";
43
- export * from "./entity/entity-historic-data";
44
- export * from "./entity/entity-table-view";
45
- export * from "./dashboard/dashboard-view";
46
- export * from "./entity-type-model/comment";
47
- export * from "./client-file/client-file";
61
+ export * from "./entity/entity-type-trigger";
62
+ export * from "./environment";
63
+ export * from "./export/export-brz";
64
+ export * from "./export/export-usd";
65
+ export * from "./import/import-assembly";
66
+ export * from "./import/import-cad";
67
+ export * from "./import/import-csv";
68
+ export * from "./import/import-geojson";
69
+ export * from "./import/import-json";
70
+ export * from "./import/import-kml";
71
+ export * from "./import/import-lcc";
72
+ export * from "./import/imported-file";
73
+ export * from "./internal/uploader";
74
+ export * from "./markup/markup";
75
+ export * from "./mcp/navigator-chat";
76
+ export * from "./mcp/navigator-mcp-websocket";
77
+ export * from "./plugin/plugin";
48
78
  export * from "./program-key/program-key";
49
- export * from "./project/zoom-control";
50
79
  export * from "./project/menu-item";
51
- export * from "./project/project-view-bookmark";
52
80
  export * from "./project/project-view";
53
- export * from "./project/project-view-legacy-tile";
54
- export * from "./project/project-view-tile";
55
- export * from "./project/project-view-selection";
81
+ export * from "./project/project-view-bookmark";
82
+ export * from "./project/project-view-bookmark-group";
56
83
  export * from "./project/project-view-legacy";
57
84
  export * from "./project/project-view-legacy-bookmark";
58
- export * from "./project/project-view-bookmark-group";
59
- export * from "./server/pending-action";
60
- export * from "./server/message-broker";
61
- export * from "./server/hosting-location";
85
+ export * from "./project/project-view-legacy-tile";
86
+ export * from "./project/project-view-selection";
87
+ export * from "./project/project-view-tile";
88
+ export * from "./project/zoom-control";
89
+ export * from "./scenario/scenario";
62
90
  export * from "./server/database-server";
63
91
  export * from "./server/file-store-location";
92
+ export * from "./server/hosting-location";
93
+ export * from "./server/message-broker";
94
+ export * from "./server/pending-action";
95
+ export * from "./server/record-change-feed";
64
96
  export * from "./style/style";
65
97
  export * from "./tileset/tileset";
98
+ export * from "./tracking/tracking";
66
99
  export * from "./user/permission";
67
100
  export * from "./user/session";
68
- export * from "./user/user-group";
69
101
  export * from "./user/user";
102
+ export * from "./user/user-group";
70
103
  export * from "./user/user-mfa-method";
71
- export * from "./account/account";
72
- export * from "./account/account-concept";
73
- export * from "./account/account-settings";
74
- export * from "./account/account-invite";
75
- export * from "./account/account-features";
76
- export * from "./account/account-limits";
77
- export * from "./account/account-template";
78
- export * from "./account/account-type";
79
104
  export * from "./util/encrypt-utils";
80
105
  export * from "./util/math-utils";
81
106
  export * from "./util/object-utils";
82
107
  export * from "./util/path-utils";
83
108
  export * from "./util/url-utils";
84
- export * from "./data-lab/data-lab";
85
- export * from "./data-transform/data-transform";
86
- export * from "./data-lab/data-lab-group";
87
- export * from "./data-feed/data-feed";
88
- export * from "./import/import-assembly";
89
- export * from "./import/import-cad";
90
- export * from "./import/import-csv";
91
- export * from "./import/import-json";
92
- export * from "./import/import-geojson";
93
- export * from "./import/import-kml";
94
- export * from "./import/import-lcc";
95
- export * from "./import/imported-file";
96
- export * from "./export/export-brz";
97
- export * from "./export/export-usd";
98
- export * from "./markup/markup";
99
- export * from "./internal/uploader";
100
- export * from "./plugin/plugin";
101
- export * from "./environment";
102
- export * from "./data-source/data-source";
103
- export * from "./scenario/scenario";
104
- export * from "./tracking/tracking";
105
- export * from "./mcp/navigator-chat";
106
- export * from "./mcp/navigator-mcp-websocket";
107
- export * from "./change-set/change-set";
108
- export declare const VERSION = "7.1.44";
109
+ export declare const VERSION = "7.1.45";