bruce-models 4.1.4 → 4.1.6

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,186 @@
1
+ import { Api, ApiGetters, GuardianApi, IDictionary } from "../bruce-models";
2
+ export declare namespace AccountLimits {
3
+ enum ELimit {
4
+ MaxProjectViewCount = "MaxProjectViewCount",
5
+ MaxStorageUseGigabytes = "MaxStorageUseGigabytes",
6
+ MaxEntitiesCount = "MaxEntitiesCount",
7
+ MaxFileImportSizeGigabytes = "MaxFileImportSizeGigabytes",
8
+ OperatorAccessAllowed = "OperatorAccessAllowed",
9
+ DenyPublicAccess = "DenyPublicAccess",
10
+ EnableSSOLogin = "EnableSSOLogin",
11
+ EnableSSOLoginAutoRedirect = "EnableSSOLoginAutoRedirect"
12
+ }
13
+ type Limit = ELimit | string;
14
+ /**
15
+ * Represents a limit for an account.
16
+ * The value type of interest is determined by the limit key.
17
+ */
18
+ interface ILimit {
19
+ "Numeric": number;
20
+ "String": string;
21
+ "Boolean": boolean;
22
+ }
23
+ /**
24
+ * Returns a dictionary of limits for the given account.
25
+ * @param params
26
+ * @returns
27
+ */
28
+ function GetLimits(params: {
29
+ accountId: string;
30
+ api?: GuardianApi.Api;
31
+ req?: Api.IReqParams;
32
+ }): Promise<{
33
+ limits: IDictionary<ILimit>;
34
+ }>;
35
+ /**
36
+ * Returns a numeric limit for the given account.
37
+ * @param params
38
+ */
39
+ function GetNumericLimit(params: {
40
+ key: Limit;
41
+ accountId: string;
42
+ api?: GuardianApi.Api;
43
+ req?: Api.IReqParams;
44
+ onErrorValue: any;
45
+ onEmptyValue: number;
46
+ }): Promise<number>;
47
+ /**
48
+ * Returns a boolean limit for the given account.
49
+ * @param params
50
+ */
51
+ function GetBooleanLimit(params: {
52
+ key: Limit;
53
+ accountId: string;
54
+ api?: GuardianApi.Api;
55
+ req?: Api.IReqParams;
56
+ onErrorValue: any;
57
+ onEmptyValue: boolean;
58
+ }): Promise<boolean>;
59
+ /**
60
+ * Returns a string limit for the given account.
61
+ * @param params
62
+ */
63
+ function GetStringLimit(params: {
64
+ key: Limit;
65
+ accountId: string;
66
+ api?: GuardianApi.Api;
67
+ req?: Api.IReqParams;
68
+ onErrorValue: any;
69
+ onEmptyValue: string;
70
+ }): Promise<string>;
71
+ /**
72
+ * Functions for validating if a user can do things sit here.
73
+ */
74
+ namespace Assert {
75
+ /**
76
+ * Returns if project view creation is allowed for the account.
77
+ */
78
+ function GetCanCreateProjectView(params: {
79
+ accountId?: string;
80
+ getters?: ApiGetters;
81
+ }): Promise<{
82
+ allowed: boolean;
83
+ errorText?: string;
84
+ }>;
85
+ /**
86
+ * Returns the project view limit for an account.
87
+ * If -1 is returned then it is unlimited.
88
+ * @param params
89
+ * @returns
90
+ */
91
+ function GetProjectViewLimit(params: {
92
+ accountId?: string;
93
+ api?: GuardianApi.Api;
94
+ }): Promise<number>;
95
+ /**
96
+ * Returns if file uploads are allowed for the account.
97
+ */
98
+ function GetCanUploadFile(params: {
99
+ accountId?: string;
100
+ getters?: ApiGetters;
101
+ fileSize?: number;
102
+ thoroughCheck?: boolean;
103
+ }): Promise<{
104
+ allowed: boolean;
105
+ errorText?: string;
106
+ }>;
107
+ /**
108
+ * Returns the file limit for an account.
109
+ * If -1 is returned then it is unlimited.
110
+ * @param params
111
+ * @returns
112
+ */
113
+ function GetFileGBLimit(params: {
114
+ accountId?: string;
115
+ api?: GuardianApi.Api;
116
+ }): Promise<number>;
117
+ /**
118
+ * Returns the maximum file import size for an account.
119
+ * If -1 is returned then it is unlimited.
120
+ * @param params
121
+ * @returns
122
+ */
123
+ function GetMaxImportSizeGB(params: {
124
+ accountId?: string;
125
+ api?: GuardianApi.Api;
126
+ }): Promise<number>;
127
+ /**
128
+ * Returns if entity creation is allowed for the account.
129
+ */
130
+ function GetCanCreateEntity(params: {
131
+ accountId?: string;
132
+ getters?: ApiGetters;
133
+ count?: number;
134
+ }): Promise<{
135
+ allowed: boolean;
136
+ errorText?: string;
137
+ }>;
138
+ /**
139
+ * Returns the entity limit for an account.
140
+ * If -1 is returned then it is unlimited.
141
+ */
142
+ function GetEntityLimit(params: {
143
+ accountId?: string;
144
+ api?: GuardianApi.Api;
145
+ }): Promise<number>;
146
+ /**
147
+ * Returns if Operator access is allowed for the account.
148
+ * @param params
149
+ * @returns
150
+ */
151
+ function GetCanOpenOperator(params: {
152
+ accountId?: string;
153
+ api?: GuardianApi.Api;
154
+ }): Promise<{
155
+ allowed: boolean;
156
+ errorText?: string;
157
+ }>;
158
+ /**
159
+ * Returns SSO login settings for the account.
160
+ * @param params
161
+ * @returns
162
+ */
163
+ function GetSSOLoginSettings(params: {
164
+ accountId?: string;
165
+ api?: GuardianApi.Api;
166
+ }): Promise<{
167
+ enabled: boolean;
168
+ autoRedirect: boolean;
169
+ errorText?: string;
170
+ }>;
171
+ /**
172
+ * Returns if public access is denied to this account.
173
+ * @param params
174
+ * @returns
175
+ */
176
+ function GetDenyPublicAccess(params: {
177
+ accountId?: string;
178
+ api?: GuardianApi.Api;
179
+ }): Promise<boolean>;
180
+ }
181
+ /**
182
+ * Cache key for requesting account limits for a specific account.
183
+ * @param accountId
184
+ */
185
+ function GetLimitsCacheKey(accountId: string): string;
186
+ }
@@ -53,7 +53,8 @@ export declare namespace Api {
53
53
  PluginIndexFile = "pluginindexfile",
54
54
  EntityHistoricData = "entityhistoricdata",
55
55
  EntityHistoricDataRec = "entityhistoricdatarec",
56
- EntityHistoricDataStats = "entityhistoricdatastats"
56
+ EntityHistoricDataStats = "entityhistoricdatastats",
57
+ AccountLimits = "accountlimits"
57
58
  }
58
59
  const DEFAULT_CACHE_DURATION: number;
59
60
  const TEMPLATE_ACCOUNT_ID = "template";
@@ -39,6 +39,7 @@ export * from "./entity/entity-coords";
39
39
  export * from "./entity/entity-type-visual-settings";
40
40
  export * from "./entity/entity-attribute";
41
41
  export * from "./entity/entity-historic-data";
42
+ export * from "./entity-type-model/comment";
42
43
  export * from "./client-file/client-file";
43
44
  export * from "./program-key/program-key";
44
45
  export * from "./project/zoom-control";
@@ -63,6 +64,7 @@ export * from "./account/account";
63
64
  export * from "./account/account-settings";
64
65
  export * from "./account/account-invite";
65
66
  export * from "./account/account-features";
67
+ export * from "./account/account-limits";
66
68
  export * from "./util/encrypt-utils";
67
69
  export * from "./util/math-utils";
68
70
  export * from "./util/object-utils";
@@ -79,4 +81,4 @@ export * from "./internal/uploader";
79
81
  export * from "./plugin/plugin";
80
82
  export * from "./environment";
81
83
  export * from "./data-source/data-source";
82
- export declare const VERSION = "4.1.4";
84
+ export declare const VERSION = "4.1.6";
@@ -24,6 +24,31 @@ export declare namespace UTC {
24
24
  ss: number;
25
25
  y: number;
26
26
  }
27
+ /**
28
+ * Returns an ISO 8601 string representation of the provided date.
29
+ * @param utc
30
+ */
31
+ function ToString(utc: IUTC): string;
27
32
  function ToDate(utc: IUTC): Date;
28
- function FromDate(date: Date): IUTC;
33
+ function FromDate(utc: Date): IUTC;
34
+ /**
35
+ * Returns how many seconds have passed between two dates.
36
+ * If the second date is not provided, it will be the current date.
37
+ * @param from
38
+ * @param to
39
+ * @returns
40
+ */
41
+ function GetPassedSeconds(from: IUTC, to?: IUTC): number;
42
+ /**
43
+ * Returns a human-readable string that describes how much time has passed since the provided date.
44
+ * @param utc
45
+ */
46
+ function GetPassedTime(utc: IUTC): string;
47
+ /**
48
+ * Returns a human-readable string that describes the provided date.
49
+ * If a timezone is not provided then it will use the locale timezone.
50
+ * @param utc
51
+ * @param timezone
52
+ */
53
+ function GetDateTime(utc: IUTC, timezone?: string): string;
29
54
  }
@@ -0,0 +1,71 @@
1
+ import { Api } from "../api/api";
2
+ import { BruceApi } from "../api/bruce-api";
3
+ import { UTC } from "../common/utc";
4
+ import { Entity } from "../entity/entity";
5
+ import { ProjectViewBookmark } from "../project/project-view-bookmark";
6
+ /**
7
+ * Generic comment record and related functions.
8
+ * This uses Entity records with a specific Entity Type.
9
+ * This replaced the original comment system and allows for comments to be placed on any Entity, or by themselves.
10
+ */
11
+ export declare namespace Comment {
12
+ const ENTITY_TYPE_ID = "COMMENTS";
13
+ const REPLY_RELATIONSHIP_TYPE_ID = "COMMENTS_REPLY";
14
+ enum EType {
15
+ Comment = "COMMENT",
16
+ Reply = "REPLY"
17
+ }
18
+ /**
19
+ * Represents a comment Entity record.
20
+ */
21
+ interface IRecord extends Entity.IEntity {
22
+ viewId: string;
23
+ bookmarkId?: string;
24
+ text: string;
25
+ type: EType;
26
+ lastUpdateTime?: UTC.IUTC;
27
+ updates?: number;
28
+ entityId?: string;
29
+ edited?: boolean;
30
+ camera?: ProjectViewBookmark.Web3d.ICamera;
31
+ parentId?: string;
32
+ }
33
+ /**
34
+ * Returns a list of comments based on the provided filter.
35
+ * @param params
36
+ * @returns
37
+ */
38
+ function GetList(params: {
39
+ api?: BruceApi.Api;
40
+ req?: Api.IReqParams;
41
+ filter: {
42
+ viewId?: string;
43
+ bookmarkId?: string;
44
+ userId?: string;
45
+ amount?: number;
46
+ index?: number;
47
+ text?: string;
48
+ entityId?: string;
49
+ };
50
+ }): Promise<{
51
+ comments: IRecord[];
52
+ }>;
53
+ /**
54
+ * Ensure the Entity Type exists.
55
+ * If it does not exist, it will be created.
56
+ * @param params
57
+ */
58
+ function AssertEntityType(params: {
59
+ api?: BruceApi.Api;
60
+ req?: Api.IReqParams;
61
+ }): Promise<void>;
62
+ /**
63
+ * Ensure the Relation Type exists.
64
+ * If it does not exist, it will be created.
65
+ * @param params
66
+ */
67
+ function AssertRelationType(params: {
68
+ api?: BruceApi.Api;
69
+ req?: Api.IReqParams;
70
+ }): Promise<void>;
71
+ }
@@ -241,6 +241,7 @@ export declare namespace ProjectViewBookmark {
241
241
  interface IRelationship {
242
242
  typeId: string;
243
243
  entityIds?: string[];
244
+ width?: number;
244
245
  }
245
246
  interface IRelationMetadata {
246
247
  parentEntityId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bruce-models",
3
- "version": "4.1.4",
3
+ "version": "4.1.6",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "main": "dist/bruce-models.umd.js",