@trakit/objects 0.0.9 → 0.0.10

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 (81) hide show
  1. package/API/Geography/Functions.d.ts +237 -0
  2. package/API/Geography/Interfaces.d.ts +151 -0
  3. package/API/Geography/LatLng.d.ts +87 -0
  4. package/API/Geography/LatLngBounds.d.ts +147 -0
  5. package/API/Geography/Position.d.ts +75 -0
  6. package/API/Geography/StreetAddress.d.ts +60 -0
  7. package/API/Geometry/Functions.d.ts +115 -0
  8. package/API/Geometry/Interfaces.d.ts +112 -0
  9. package/API/Geometry/Point.d.ts +82 -0
  10. package/API/Geometry/Radial.d.ts +111 -0
  11. package/API/Geometry/Rectangle.d.ts +160 -0
  12. package/API/Geometry/Size.d.ts +59 -0
  13. package/API/Interfaces/IAmCompany.d.ts +12 -0
  14. package/API/Interfaces/IBelongAsset.d.ts +16 -0
  15. package/API/Interfaces/IBelongBillingProfile.d.ts +16 -0
  16. package/API/Interfaces/IBelongCompany.d.ts +16 -0
  17. package/API/Interfaces/IDeserializable.d.ts +14 -0
  18. package/API/Interfaces/IEnabled.d.ts +11 -0
  19. package/API/Interfaces/IFileSize.d.ts +10 -0
  20. package/API/Interfaces/IGlobal.d.ts +12 -0
  21. package/API/Interfaces/IHavePermissions.d.ts +21 -0
  22. package/API/Interfaces/IHavePreferences.d.ts +30 -0
  23. package/API/Interfaces/IIconic.d.ts +16 -0
  24. package/API/Interfaces/IIdUlong.d.ts +11 -0
  25. package/API/Interfaces/ILabelled.d.ts +11 -0
  26. package/API/Interfaces/INamed.d.ts +14 -0
  27. package/API/Interfaces/IPictured.d.ts +16 -0
  28. package/API/Interfaces/IRequestable.d.ts +23 -0
  29. package/API/Interfaces/ISerializable.d.ts +11 -0
  30. package/API/Interfaces/ISuspendable.d.ts +17 -0
  31. package/API/Interfaces/IVisual.d.ts +19 -0
  32. package/Accounts/Permissions/Authorizer.d.ts +205 -0
  33. package/Accounts/Permissions/Permission.d.ts +57 -0
  34. package/Accounts/Permissions/PermissionEscalation.d.ts +42 -0
  35. package/Accounts/Permissions/PermissionEscalationState.d.ts +20 -0
  36. package/Accounts/Permissions/PermissionEscalationType.d.ts +14 -0
  37. package/Accounts/Permissions/PermissionLevel.d.ts +18 -0
  38. package/Accounts/Permissions/PermissionMethod.d.ts +14 -0
  39. package/Accounts/Permissions/PermissionType.d.ts +281 -0
  40. package/Billing/Hosting/BillableHostingBase.d.ts +42 -0
  41. package/Billing/Hosting/BillableHostingLicense.d.ts +31 -0
  42. package/Billing/Hosting/BillableHostingLicenseType.d.ts +21 -0
  43. package/Billing/Hosting/BillableHostingRule.d.ts +31 -0
  44. package/Billing/Hosting/BillableHostingType.d.ts +42 -0
  45. package/Billing/Report/BillingReport.d.ts +113 -0
  46. package/Billing/Report/BillingReportBreakdown.d.ts +35 -0
  47. package/Billing/Report/BillingReportHostingSummary.d.ts +37 -0
  48. package/Billing/Report/BillingReportLicenseBreakdown.d.ts +80 -0
  49. package/Billing/Report/BillingReportServiceBreakdown.d.ts +125 -0
  50. package/Billing/Report/BillingReportStatus.d.ts +26 -0
  51. package/Billing/Report/BillingReportSummary.d.ts +50 -0
  52. package/Hosting/Fields/FormFieldAttachments.d.ts +32 -0
  53. package/Hosting/Fields/FormFieldBase.d.ts +57 -0
  54. package/Hosting/Fields/FormFieldBase_fromJSON.d.ts +2 -0
  55. package/Hosting/Fields/FormFieldBoolean.d.ts +39 -0
  56. package/Hosting/Fields/FormFieldChoice.d.ts +47 -0
  57. package/Hosting/Fields/FormFieldDate.d.ts +27 -0
  58. package/Hosting/Fields/FormFieldNumeric.d.ts +55 -0
  59. package/Hosting/Fields/FormFieldNumericSize.d.ts +33 -0
  60. package/Hosting/Fields/FormFieldSignature.d.ts +18 -0
  61. package/Hosting/Fields/FormFieldText.d.ts +33 -0
  62. package/Hosting/Fields/FormFieldTime.d.ts +38 -0
  63. package/Hosting/Fields/FormFieldTimezone.d.ts +15 -0
  64. package/Providers/Config/ProviderConfig.d.ts +71 -0
  65. package/Providers/Config/ProviderRegistration.d.ts +120 -0
  66. package/Providers/Config/ProviderScript.d.ts +87 -0
  67. package/Providers/Config/ProviderScriptBlock.d.ts +42 -0
  68. package/Providers/Config/ProviderScriptParameter.d.ts +50 -0
  69. package/Providers/Config/ProviderScriptParameterType.d.ts +18 -0
  70. package/Providers/Configuration/ProviderConfiguration.d.ts +67 -0
  71. package/Providers/Configuration/ProviderConfigurationNode.d.ts +67 -0
  72. package/Providers/Configuration/ProviderConfigurationType.d.ts +63 -0
  73. package/Providers/Configuration/ProviderGeofenceBase.d.ts +30 -0
  74. package/Providers/Configuration/ProviderGeofenceBase_fromJSON.d.ts +2 -0
  75. package/Providers/Configuration/ProviderGeofenceCircular.d.ts +29 -0
  76. package/Providers/Configuration/ProviderGeofencePoint.d.ts +13 -0
  77. package/Providers/Configuration/ProviderGeofencePolygon.d.ts +24 -0
  78. package/Providers/Configuration/ProviderGeofenceRectangle.d.ts +29 -0
  79. package/index.d.ts +1 -1
  80. package/package.json +5 -7
  81. package/trakit-objects.min.js +1 -1
@@ -0,0 +1,12 @@
1
+ import { ulong } from '../Types';
2
+ import { IIdUlong } from './IIdUlong';
3
+ /**
4
+ * An interface for all the Company___ classes.
5
+ */
6
+ export interface IAmCompany extends IIdUlong {
7
+ /**
8
+ * The {@link Company} to which this {@link Company} belongs.
9
+ */
10
+ parentId: ulong;
11
+ }
12
+ //# sourceMappingURL=IAmCompany.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { Asset } from "../../Assets/Asset";
2
+ import { ulong } from "../Types";
3
+ /**
4
+ * An interface for objects that belong to a single asset.
5
+ */
6
+ export interface IBelongAsset {
7
+ /**
8
+ * The {@link Asset.id} to which this object belongs.
9
+ */
10
+ assetId: ulong;
11
+ /**
12
+ * The {@link Asset} to which this object belongs.
13
+ */
14
+ get asset(): Asset;
15
+ }
16
+ //# sourceMappingURL=IBelongAsset.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { BillingProfile } from "../../Billing/BillingProfile";
2
+ import { ulong } from "../Types";
3
+ /**
4
+ * An interface for objects that belong to a single billing profile.
5
+ */
6
+ export interface IBelongBillingProfile {
7
+ /**
8
+ * The {@link BillingProfile} to which this object belongs.
9
+ */
10
+ get profileId(): ulong;
11
+ /**
12
+ * The {@link BillingProfile} to which this object belongs.
13
+ */
14
+ readonly profile: BillingProfile;
15
+ }
16
+ //# sourceMappingURL=IBelongBillingProfile.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { ulong } from "../Types";
2
+ import { Company } from "../../Companies/Company";
3
+ /**
4
+ * An interface for objects that belong to a single company.
5
+ */
6
+ export interface IBelongCompany {
7
+ /**
8
+ * The {@link Company} to which this object belongs.
9
+ */
10
+ get companyId(): ulong;
11
+ /**
12
+ * The {@link Company} to which this object belongs.
13
+ */
14
+ get company(): Company;
15
+ }
16
+ //# sourceMappingURL=IBelongCompany.d.ts.map
@@ -0,0 +1,14 @@
1
+ import { JsonObject } from "../../API/Types";
2
+ /**
3
+ * An interface for types that are updated using JSON values.
4
+ */
5
+ export interface IDeserializable {
6
+ /**
7
+ * Updates this {@link IDeserializable} from the given input.
8
+ * @param json A JSON value used to update this class.
9
+ * @param forced When true, forces the update.
10
+ * @returns True when an update was completed.
11
+ */
12
+ fromJSON(json: JsonObject, force?: boolean): boolean;
13
+ }
14
+ //# sourceMappingURL=IDeserializable.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * An interface for objects that can be marked as "enabled".
3
+ * "Enabled" objects remain in the system, but are inactive.
4
+ */
5
+ export interface IEnabled {
6
+ /**
7
+ * Marked as true for objects that have been deleted.
8
+ */
9
+ enabled: boolean;
10
+ }
11
+ //# sourceMappingURL=IEnabled.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * An interface for an object's size on a disk.
3
+ */
4
+ export interface IFileSize {
5
+ /**
6
+ * Size (in bytes) of the object on the HDD or SSD.
7
+ */
8
+ bytes: number;
9
+ }
10
+ //# sourceMappingURL=IFileSize.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { IBelongCompany } from './IBelongCompany';
2
+ /**
3
+ * An interface for objects that can be marked as "global".
4
+ * "Global" objects can be listed in child companies.
5
+ */
6
+ export interface IGlobal extends IBelongCompany {
7
+ /**
8
+ * Indicates whether this icon is available to child companies.
9
+ */
10
+ global: boolean;
11
+ }
12
+ //# sourceMappingURL=IGlobal.d.ts.map
@@ -0,0 +1,21 @@
1
+ import { Permission } from '../../Accounts/Permissions/Permission';
2
+ import { UserGroup } from '../../Accounts/UserGroup';
3
+ import { ulong } from '../Types';
4
+ /**
5
+ * This interface exists so that I can work with Machine and UserAdvanced objects the same way.
6
+ */
7
+ export interface IHavePermissions {
8
+ /**
9
+ * A list of groups to which this object.
10
+ */
11
+ get groups(): UserGroup[];
12
+ /**
13
+ * A list of groups to which this object.
14
+ */
15
+ groupIds: ulong[];
16
+ /**
17
+ * Permission rules which override the group rules.
18
+ */
19
+ permissions: Permission[];
20
+ }
21
+ //# sourceMappingURL=IHavePermissions.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { SystemsOfUnits } from '../../Accounts/SystemsOfUnits';
2
+ import { Timezone } from '../Timezone';
3
+ import { codified } from '../Types';
4
+ /**
5
+ * This interface exists so that I can work with Machine and UserGeneral objects the same way.
6
+ */
7
+ export interface IHavePreferences {
8
+ /**
9
+ * The local timezone for this object.
10
+ */
11
+ timezone: Timezone;
12
+ /**
13
+ * Preferred region/language for the UI and notifications.
14
+ * Valid formats use <ISO 639-1><dash><ISO 3166-2> such as "fr-CA" or "en-US".
15
+ */
16
+ language: codified;
17
+ /**
18
+ * The format strings defining the preferred way to display ambiguous values.
19
+ */
20
+ formats: Map<codified, string>;
21
+ /**
22
+ * Preferred way of displaying ambiguous numbers in the context of measurements.
23
+ */
24
+ measurements: Map<codified, SystemsOfUnits>;
25
+ /**
26
+ * Additional options which do not fit in with the formats or measurements preferences.
27
+ */
28
+ options: Map<codified, string>;
29
+ }
30
+ //# sourceMappingURL=IHavePreferences.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { Icon } from '../../Images/Icon';
2
+ import { ulong } from '../Types';
3
+ /**
4
+ * An interface for objcts that have an "icon".
5
+ */
6
+ export interface IIconic {
7
+ /**
8
+ * This thing's {@link Icon.id}.
9
+ */
10
+ iconId: ulong;
11
+ /**
12
+ * This thing's {@link Icon}.
13
+ */
14
+ get icon(): Icon;
15
+ }
16
+ //# sourceMappingURL=IIconic.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { ulong } from '../Types';
2
+ /**
3
+ * An interface for objects with a ulong "id".
4
+ */
5
+ export interface IIdUlong {
6
+ /**
7
+ * Unique identifier of this object.
8
+ */
9
+ id: ulong;
10
+ }
11
+ //# sourceMappingURL=IIdUlong.d.ts.map
@@ -0,0 +1,11 @@
1
+ import { codified } from "../Types";
2
+ /**
3
+ * An interface for objects that have "labels".
4
+ */
5
+ export interface ILabelled {
6
+ /**
7
+ * A list of codified labels for this asset or place.
8
+ */
9
+ labels: codified[];
10
+ }
11
+ //# sourceMappingURL=ILabelled.d.ts.map
@@ -0,0 +1,14 @@
1
+ /**
2
+ * An interface for objects that have a "name" and "notes".
3
+ */
4
+ export interface INamed {
5
+ /**
6
+ * This thing's name.
7
+ */
8
+ name: string;
9
+ /**
10
+ * This thing's notes.
11
+ */
12
+ notes: string;
13
+ }
14
+ //# sourceMappingURL=INamed.d.ts.map
@@ -0,0 +1,16 @@
1
+ import { ulong } from '../Types';
2
+ import { Picture } from '../../Images/Picture';
3
+ /**
4
+ * An interface for objects that have "pictures".
5
+ */
6
+ export interface IPictured {
7
+ /**
8
+ * An array of picture identifiers of this object.
9
+ */
10
+ pictureIds: ulong[];
11
+ /**
12
+ * An array of {@link Picture}s of this object.
13
+ */
14
+ get pictures(): Picture[];
15
+ }
16
+ //# sourceMappingURL=IPictured.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { codified, email, guid, ulong } from "../Types";
2
+ /**
3
+ * The main interface for an object in the Trak-iT system.
4
+ */
5
+ export interface IRequestable {
6
+ /**
7
+ * Returns a unique identifier as a string.
8
+ * {@link Dashcam.guid}
9
+ * {@link IIdUlong.id}
10
+ * {@link Machine.key}
11
+ * {@link Provider.id}
12
+ * {@link ProviderGeneral.id}
13
+ * {@link ProviderAdvanced.id}
14
+ * {@link ProviderControl.id}
15
+ * {@link ProviderRegistration.code}
16
+ * {@link User.login}
17
+ * {@link UserGeneral.login}
18
+ * {@link UserAdvanced.login}
19
+ * {@link Timezone.code}
20
+ */
21
+ getKey(): ulong | email | guid | codified | string;
22
+ }
23
+ //# sourceMappingURL=IRequestable.d.ts.map
@@ -0,0 +1,11 @@
1
+ /**
2
+ * An interface for types that can be converted to JSON for transmission or storage.
3
+ */
4
+ export interface ISerializable {
5
+ /**
6
+ * Creates a literal of this {@link ISerializable} object.
7
+ * Used internally by {@link JSON.stringify}.
8
+ */
9
+ toJSON(): any;
10
+ }
11
+ //# sourceMappingURL=ISerializable.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * An interface for objects that can be marked as "suspended".
3
+ * "Suspended" objects can be "revived", but are otherwise treated as "achived" or "inert" (events are not processed).
4
+ */
5
+ export interface ISuspendable {
6
+ /**
7
+ * Marked as true for objects that have been suspended.
8
+ * This value is not present in the JSON scheme when {@link deleted} is false.
9
+ */
10
+ suspended?: boolean;
11
+ /**
12
+ * A timestamp from when the object was most recently suspended or revived.
13
+ * This value is not present in the JSON scheme when {@link suspended} is false.
14
+ */
15
+ since?: Date;
16
+ }
17
+ //# sourceMappingURL=ISuspendable.d.ts.map
@@ -0,0 +1,19 @@
1
+ import { codified, colour } from "../Types";
2
+ /**
3
+ * An interface for objects that make them more easily visually identifiable.
4
+ */
5
+ export interface IVisual {
6
+ /**
7
+ * The background colour of the graphic.
8
+ */
9
+ fill: colour;
10
+ /**
11
+ * Outline and graphic colour.
12
+ */
13
+ stroke: colour;
14
+ /**
15
+ * The name of the symbol for this object.
16
+ */
17
+ graphic: codified;
18
+ }
19
+ //# sourceMappingURL=IVisual.d.ts.map
@@ -0,0 +1,205 @@
1
+ import { codified, ulong } from '../../API/Types';
2
+ import { Permission } from './Permission';
3
+ import { PermissionEscalation } from './PermissionEscalation';
4
+ import { PermissionLevel } from './PermissionLevel';
5
+ import { PermissionType } from './PermissionType';
6
+ /**
7
+ * Users have implied read access to their company's general, labels, policies, icons, and pictures.
8
+ */
9
+ export declare const IMPLIED_PERMS: PermissionType[];
10
+ /**
11
+ * These are the permissions which require label-based calculations.
12
+ */
13
+ export declare const LABEL_BASED_PERMS: PermissionType[];
14
+ /**
15
+ * Creates a {@link Dictionary} where the key is a {@link Company#id} and the values are well ordered arrays of {@link Permission}s which can be used to further calculate a user's permissions.
16
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
17
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
18
+ * @param fromUser The User's user-specific permissions.
19
+ * @param skipImpliedPermissions When true, does not automatically add implied permissions for the user's company.
20
+ */
21
+ export declare function computeAll(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], skipImpliedPermissions?: boolean): Map<number, Permission[]>;
22
+ /**
23
+ * Creates a well ordered array of {@link Permission}s which can be used to further calculate a user's permissions for the target company.
24
+ * @param userCompanyId Unique identifier of the {@link Company#id} to which the User belongs.
25
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
26
+ * @param fromUser The User's user-specific permissions.
27
+ * @param targetCompanyId Unique identifier of the {@link Company#id} being tested for access.
28
+ * @param skipImpliedPermissions When true, does not automatically add implied permissions for the user's company.
29
+ */
30
+ export declare function compute(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId?: ulong, skipImpliedPermissions?: boolean): Permission[];
31
+ /**
32
+ * Creates a {@link Dictionary} where the key is a {@link Company#id} and the values are well ordered arrays of simple {@link Permission}s which can be used to further calculate a user's permissions.
33
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
34
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
35
+ * @param fromUser The User's user-specific permissions.
36
+ */
37
+ export declare function computeAllSimple(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[]): Map<number, Permission[]>;
38
+ /**
39
+ * Creates a well ordered array of simple {@link Permission}s which can be used to further calculate a user's permissions.
40
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
41
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
42
+ * @param fromUser The User's user-specific permissions.
43
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
44
+ */
45
+ export declare function computeSimple(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong): Permission[];
46
+ /**
47
+ * Creates a {@link Dictionary} where the key is a {@link PermissionType} and the values are {@link PermissionLevel}s.
48
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
49
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
50
+ * @param fromUser The User's user-specific permissions.
51
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
52
+ */
53
+ export declare function computeSimpleLevels(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong): Map<PermissionType, PermissionLevel>;
54
+ /**
55
+ * Gets the permission level of the given simple permission type.
56
+ * If the permission type specified is not found, undefined is returned instead.
57
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
58
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
59
+ * @param fromUser The User's user-specific permissions.
60
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
61
+ * @param targetType The specific {@link PermissionType}s to check.
62
+ */
63
+ export declare function getSimpleLevel(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong, targetType: PermissionType): PermissionLevel | undefined;
64
+ /**
65
+ * Checks a specific simple permission type and level, and returns true if access is granted.
66
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
67
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
68
+ * @param fromUser The User's user-specific permissions.
69
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
70
+ * @param targetType The specific {@link PermissionType}s to check.
71
+ * @param targetLevel Minimum requested level of access.
72
+ */
73
+ export declare function hasSimple(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong, targetType: PermissionType, targetLevel: PermissionLevel): boolean;
74
+ /**
75
+ * Checks a specific simple permission type and level from a pre-computed array of permissions, and returns true if access is granted.
76
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
77
+ * @param permissions Pre-computed and ordered array of {@link Permission} like the kind returned by {@link authorizer.computeSimple}.
78
+ * @param targetType The specific {@link PermissionType}s to check.
79
+ * @param targetLevel Minimum requested level of access.
80
+ */
81
+ export declare function findSimple(userCompanyId: ulong, permissions: Permission[], targetType: PermissionType, targetLevel: PermissionLevel): boolean;
82
+ /**
83
+ * Retrieves the specified simple permission level from a pre-computed array of permissions.
84
+ * If the permission type specified is not found, undefined is returned instead.
85
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
86
+ * @param permissions Pre-computed and ordered array of {@link Permission} like the kind returned by {@link authorizer.computeSimple}.
87
+ * @param targetType The specific {@link PermissionType}s to check.
88
+ */
89
+ export declare function findSimpleLevel(userCompanyId: ulong, permissions: Permission[], targetType: PermissionType): PermissionLevel | undefined;
90
+ /**
91
+ * Creates a {@link Dictionary} where the key is a {@link Company#id} and the values are well ordered arrays of complex {@link Permission}s which can be used to further calculate a user's permissions.
92
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
93
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
94
+ * @param fromUser The User's user-specific permissions.
95
+ */
96
+ export declare function computeAllComplex(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[]): Map<number, Permission[]>;
97
+ /**
98
+ * Creates a well ordered array of complex {@link Permission}s which can be used to further calculate a user's permissions.
99
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
100
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
101
+ * @param fromUser The User's user-specific permissions.
102
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
103
+ */
104
+ export declare function computeComplex(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId?: ulong): Permission[];
105
+ /**
106
+ * Gets the permission level of the given complex permission type.
107
+ * If the permission type specified is not found, undefined is returned instead.
108
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
109
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
110
+ * @param fromUser The User's user-specific permissions.
111
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
112
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the Company.
113
+ * @param targetType The specific {@link PermissionType}s to check.
114
+ * @param targetLabels List of codified {@link LabelStyle} names used by the target.
115
+ */
116
+ export declare function getComplexLevel(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong, targetCompanyLabels: codified[], targetType: PermissionType, targetLabels: codified[]): PermissionLevel | undefined;
117
+ /**
118
+ * Checks a specific complex permission type, level, and labels, and returns true if access is granted.
119
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
120
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
121
+ * @param fromUser The User's user-specific permissions.
122
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
123
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the Company.
124
+ * @param targetType The specific {@link PermissionType}s to check.
125
+ * @param targetLabels List of codified {@link LabelStyle} names used by the target.
126
+ * @param targetLevel Minimum requested level of access.
127
+ */
128
+ export declare function hasComplex(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong, targetCompanyLabels: codified[], targetType: PermissionType, targetLabels: codified[], targetLevel: PermissionLevel): boolean;
129
+ /**
130
+ * Checks a specific complex permission type, level, and labels from a pre-computed array of permissions, and returns true if access is granted.
131
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
132
+ * @param permissions Pre-computed and ordered array of {@link Permission} like the kind returned by {@link authorizer.computeComplex}.
133
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the Company
134
+ * @param targetType The specific {@link PermissionType}s to check.
135
+ * @param targetLabels List of codified {@link LabelStyle} names used by the target.
136
+ * @param targetLevel Minimum requested level of access.
137
+ */
138
+ export declare function findComplex(userCompanyId: ulong, permissions: Permission[], targetCompanyLabels: codified[], targetType: PermissionType, targetLabels: codified[], targetLevel: PermissionLevel): boolean;
139
+ /**
140
+ * Retrieves the specified complex permission level from a pre-computed array of permissions.
141
+ * If the permission type specified is not found, undefined is returned instead.
142
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
143
+ * @param permissions Pre-computed and ordered array of {@link Permission} like the kind returned by {@link authorizer.computeComplex}.
144
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the Company
145
+ * @param targetType The specific {@link PermissionType}s to check.
146
+ * @param targetLabels List of codified {@link LabelStyle} names used by the target.
147
+ */
148
+ export declare function findComplexLevel(userCompanyId: ulong, permissions: Permission[], targetCompanyLabels: codified[], targetType: PermissionType, targetLabels: codified[]): PermissionLevel | undefined;
149
+ /**
150
+ * Checks a specific complex permission type, level, but not the labels, and returns true if access is granted.
151
+ * This method can be used as a short-circuit to diving deeper into check label specific permissions.
152
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
153
+ * @param fromGroups Collection of permissions from {@link UserGroup}s to which the User belongs.
154
+ * @param fromUser The User's user-specific permissions.
155
+ * @param targetCompanyId Unique identifier of the {@link Company} being tested for access.
156
+ * @param targetType The specific {@link PermissionType}s to check.
157
+ * @param targetLevel Optional level of access. If not specified, default is {@link PermissionLevel.read}.
158
+ */
159
+ export declare function hasAnyComplex(userCompanyId: ulong, fromGroups: Permission[], fromUser: Permission[], targetCompanyId: ulong, targetType: PermissionType, targetLevel: PermissionLevel): boolean;
160
+ /**
161
+ * Checks a specific complex permission type, level, but not the labels, and returns true if access is granted.
162
+ * This method can be used as a short-circuit to diving deeper into check label specific permissions.
163
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
164
+ * @param permissions Pre-computed and ordered array of {@link Permission} like the kind returned by {@link authorizer.computeComplex}.
165
+ * @param targetType The specific {@link PermissionType}s to check.
166
+ * @param targetLevel Optional level of access. If not specified, default is {@link PermissionLevel.read}.
167
+ */
168
+ export declare function findAnyComplex(userCompanyId: ulong, permissions: Permission[], targetType: PermissionType, targetLevel: PermissionLevel): boolean;
169
+ /**
170
+ * Generates a {@link Dictionary} (company identifier as the key) of permissions being escalated between two computed permission states.
171
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
172
+ * @param before Initial state of fully computed list of permissions (like returned by returned by {@link authorizer.computeAll}).
173
+ * @param after Proposed state of computed permissions (like returned by {@link authorizer.computeAll}).
174
+ * @param targetCompaniesLabels {@link Dictionary} of company and list of codified {@link LabelStyle} names available. If not specified, complex permissions will not be evaluated correctly.
175
+ */
176
+ export declare function findAllEscalations(userCompanyId: ulong, before: Map<ulong, Permission[]>, after: Map<ulong, Permission[]>, targetCompaniesLabels: Map<ulong, codified[]>): Map<number, PermissionEscalation[]>;
177
+ /**
178
+ * Generates an array of permissions being escalated between two computed permission states for a target company.
179
+ * @param userCompanyId Unique identifier of the {@link Company} to which the User belongs.
180
+ * @param before Initial list of computed permissions for a company (like returned by {@link authorizer.compute}).
181
+ * @param after Proposed list of computed permissions for a company (like returned by {@link authorizer.compute}).
182
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the Company. If not specified, complex permissions will not be evaluated correctly.
183
+ */
184
+ export declare function findEscalations(userCompanyId: ulong, before: Permission[], after: Permission[], targetCompanyLabels: codified[]): PermissionEscalation[];
185
+ /**
186
+ * Generates a list of labels that create an escalated permission state after the proposed modification.
187
+ * @param userCompanyId Unique identifier of the Company to which the User belongs.
188
+ * @param targetCompanyPermissions List of computed permissions for a company (like returned by {@link authorizer.compute}).
189
+ * @param targetTypes List of {@link PermissionType}s to check.
190
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the {@link Company}.
191
+ * @param targetBeforeLabels The labels appled to the ILabelled object before the proposed change.
192
+ * @param targetAfterLabels The labels appled to the ILabelled object after the proposed change.
193
+ */
194
+ export declare function findAllLabelEscalations(userCompanyId: ulong, targetCompanyPermissions: Permission[], targetTypes: PermissionType[], targetCompanyLabels: codified[], targetBeforeLabels: codified[], targetAfterLabels: codified[]): PermissionEscalation[];
195
+ /**
196
+ * Generates a list of labels that create an escalated permission state after the proposed modification to an labelled object.
197
+ * @param userCompanyId Unique identifier of the Company to which the User belongs.
198
+ * @param targetCompanyPermissions List of computed permissions for a single company (like returned by {@link authorizer.compute}).
199
+ * @param targetType The specific {@link PermissionType} to check.
200
+ * @param targetCompanyLabels List of codified {@link LabelStyle} names available in the {@link Company}.
201
+ * @param targetBeforeLabels The labels appled to the ILabelled object before the proposed change.
202
+ * @param targetAfterLabels The labels appled to the ILabelled object after the proposed change.
203
+ */
204
+ export declare function findLabelEscalation(userCompanyId: ulong, targetCompanyPermissions: Permission[], targetType: PermissionType, targetCompanyLabels: codified[], targetBeforeLabels?: codified[], targetAfterLabels?: codified[]): PermissionEscalation | null;
205
+ //# sourceMappingURL=Authorizer.d.ts.map
@@ -0,0 +1,57 @@
1
+ import { IBelongCompany } from '../../API/Interfaces/IBelongCompany';
2
+ import { ISerializable } from '../../API/Interfaces/ISerializable';
3
+ import { codified, JsonObject, nothing, ulong } from '../../API/Types';
4
+ import { Company } from '../../Companies/Company';
5
+ import { PermissionLevel } from './PermissionLevel';
6
+ import { PermissionMethod } from './PermissionMethod';
7
+ import { PermissionType } from './PermissionType';
8
+ /**
9
+ * A defined permission for {@link User}s, {@link UserGroup}s, and {@link Machine}s.
10
+ */
11
+ export declare class Permission implements IBelongCompany, ISerializable {
12
+ /**
13
+ *
14
+ * @param json
15
+ * @returns
16
+ */
17
+ static fromJSON(json: JsonObject): Permission;
18
+ /**
19
+ * The {@link Company.id} that this permission targets.
20
+ */
21
+ companyId: ulong;
22
+ /**
23
+ * The {@link Company} that this permission targets.
24
+ */
25
+ get company(): Company;
26
+ /**
27
+ * The type of permission.
28
+ */
29
+ kind: PermissionType;
30
+ /**
31
+ * The kind of permission.
32
+ * @deprecated Use {@link kind} instead.
33
+ */
34
+ get type(): string;
35
+ set type(value: string);
36
+ /**
37
+ * The level of access being defined.
38
+ */
39
+ level: PermissionLevel;
40
+ /**
41
+ * The way the access is used.
42
+ */
43
+ method: PermissionMethod;
44
+ /**
45
+ * Codified names of {@link LabelStyle}s. If list is empty, this permission applies for all labels.
46
+ */
47
+ labels: codified[];
48
+ constructor(company?: ulong | nothing, kind?: PermissionType | nothing, level?: PermissionLevel | nothing, method?: PermissionMethod | nothing, labels?: codified[] | nothing);
49
+ toJSON(): {
50
+ company: number | null;
51
+ kind: PermissionType;
52
+ level: PermissionLevel;
53
+ method: PermissionMethod;
54
+ labels: string[];
55
+ };
56
+ }
57
+ //# sourceMappingURL=Permission.d.ts.map
@@ -0,0 +1,42 @@
1
+ import { ISerializable } from "../../API/Interfaces/ISerializable";
2
+ import { codified, JsonObject, nothing, ulong } from "../../API/Types";
3
+ import { PermissionEscalationState } from "./PermissionEscalationState";
4
+ import { PermissionEscalationType } from "./PermissionEscalationType";
5
+ import { PermissionLevel } from "./PermissionLevel";
6
+ import { PermissionType } from "./PermissionType";
7
+ /**
8
+ * Used to throw permission escalation exceptions, this is similar to a {@link Permission},
9
+ * but defines a {@link before} and {@link after} for a proposed change.
10
+ */
11
+ export declare class PermissionEscalation implements ISerializable {
12
+ /**
13
+ * Parses a JSON object into a PermissionEscalation instance.
14
+ * @param json The JSON to parse.
15
+ * @returns A PermissionEscalation instance.
16
+ */
17
+ static fromJSON(json: JsonObject): PermissionEscalation;
18
+ /**
19
+ * Gets the direction of the escalation.
20
+ */
21
+ direction: PermissionEscalationType;
22
+ /**
23
+ * The {@link Company} that this permission targets.
24
+ * {@link Company.id}
25
+ */
26
+ company: ulong;
27
+ /**
28
+ * The type of permission.
29
+ */
30
+ kind: PermissionType;
31
+ /**
32
+ * Effective permission after the proposed change.
33
+ */
34
+ after: PermissionEscalationState;
35
+ /**
36
+ * Effective permission before the proposed change.
37
+ */
38
+ before: PermissionEscalationState;
39
+ constructor(direction: PermissionEscalationType, company: ulong, kind: PermissionType, levelAfter: PermissionLevel, labelsAfter?: codified[] | nothing, levelBefore?: PermissionLevel | nothing, labelsBefore?: codified[] | nothing);
40
+ toJSON(): JsonObject;
41
+ }
42
+ //# sourceMappingURL=PermissionEscalation.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { ISerializable } from "../../API/Interfaces/ISerializable";
2
+ import { codified, JsonObject, nothing } from "../../API/Types";
3
+ import { PermissionLevel } from "./PermissionLevel";
4
+ /**
5
+ * Describes the changes in state that raised the escalation.
6
+ */
7
+ export declare class PermissionEscalationState implements ISerializable {
8
+ /**
9
+ * The level of access defined before the proposed change.
10
+ */
11
+ level: PermissionLevel | null;
12
+ /**
13
+ * Codified names of {@link LabelStyle}s.
14
+ * If list is empty, this permission applies for all labels.
15
+ */
16
+ labels: codified[] | null;
17
+ constructor(level?: PermissionLevel | nothing, labels?: codified[] | nothing);
18
+ toJSON(): JsonObject;
19
+ }
20
+ //# sourceMappingURL=PermissionEscalationState.d.ts.map