avvir 4.0.0 → 4.1.1
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.
- package/dist/avvir_api.node.js +127 -66
- package/dist/esm/avvir_api.d.ts +20 -37
- package/dist/esm/avvir_api.js +19 -34
- package/dist/esm/avvir_api.js.map +1 -1
- package/dist/esm/config.d.ts +1 -3
- package/dist/esm/config.js +4 -4
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/index.d.ts +1 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/api/api_project_settings.d.ts +0 -1
- package/dist/esm/models/api/api_project_settings.js.map +1 -1
- package/dist/esm/models/custom_error.d.ts +1 -1
- package/dist/esm/models/custom_error.js.map +1 -1
- package/dist/esm/models/domain/index.d.ts +1 -1
- package/dist/esm/models/domain/index.js +1 -1
- package/dist/esm/models/domain/index.js.map +1 -1
- package/dist/esm/models/domain/user.d.ts +9 -2
- package/dist/esm/models/domain/user.js +2 -0
- package/dist/esm/models/domain/user.js.map +1 -1
- package/dist/esm/models/enums/index.d.ts +21 -21
- package/dist/esm/models/enums/index.js +21 -21
- package/dist/esm/models/enums/index.js.map +1 -1
- package/dist/esm/models/enums/user_auth_type.d.ts +3 -1
- package/dist/esm/models/enums/user_auth_type.js +2 -0
- package/dist/esm/models/enums/user_auth_type.js.map +1 -1
- package/dist/esm/models/index.d.ts +2 -2
- package/dist/esm/models/index.js +2 -2
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/utilities/get_authorization_headers.d.ts +6 -0
- package/dist/esm/utilities/get_authorization_headers.js +6 -1
- package/dist/esm/utilities/get_authorization_headers.js.map +1 -1
- package/dist/esm/utilities/http.js +5 -2
- package/dist/esm/utilities/http.js.map +1 -1
- package/package.json +1 -1
- package/source/avvir_api.ts +21 -36
- package/source/config.ts +35 -35
- package/source/index.ts +1 -1
- package/source/models/api/api_project_settings.ts +0 -1
- package/source/models/custom_error.ts +8 -7
- package/source/models/domain/index.ts +1 -1
- package/source/models/domain/user.ts +38 -30
- package/source/models/enums/index.ts +21 -21
- package/source/models/enums/user_auth_type.ts +3 -1
- package/source/models/index.ts +2 -2
- package/source/utilities/get_authorization_headers.ts +6 -1
- package/source/utilities/http.ts +4 -2
- package/dist/esm/models/domain/masterformat_filter.d.ts +0 -0
- package/dist/esm/models/domain/masterformat_filter.js +0 -1
- package/dist/esm/models/domain/masterformat_filter.js.map +0 -1
- package/source/models/domain/masterformat_filter.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom_error.js","sourceRoot":"","sources":["../../../source/models/custom_error.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,MAAM,OAAO,WAAY,SAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"custom_error.js","sourceRoot":"","sources":["../../../source/models/custom_error.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,MAAM,OAAO,WAAY,SAAQ,aAAa;IAC5C,YAAY,OAAe,EAAE,cAAsB,EAAE,QAAkB,EAAE,YAAiB,EAAE,kBAA2B;QACrH,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;IAC/C,CAAC;CAGF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./user";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./user";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/models/domain/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/models/domain/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BASIC, FIREBASE, GATEWAY_JWT } from "../enums/user_auth_type";
|
|
1
|
+
import { BASIC, FIREBASE, GATEWAY_JWT, HXAUTH_ACCESS_TOKEN } from "../enums/user_auth_type";
|
|
2
2
|
import { UserRole } from "../enums";
|
|
3
3
|
export declare class GatewayUser {
|
|
4
4
|
authType: typeof GATEWAY_JWT;
|
|
@@ -25,7 +25,14 @@ export declare type BasicUser = {
|
|
|
25
25
|
username: string;
|
|
26
26
|
password: string;
|
|
27
27
|
};
|
|
28
|
-
export declare type
|
|
28
|
+
export declare type HxAuthUser = {
|
|
29
|
+
authType: typeof HXAUTH_ACCESS_TOKEN;
|
|
30
|
+
hxAuthUser: {
|
|
31
|
+
accessToken: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare type User = BasicUser | GatewayUser | FirebaseUser | HxAuthUser | null;
|
|
29
35
|
export declare const isFirebaseUser: (user: User) => user is FirebaseUser;
|
|
30
36
|
export declare const isGatewayUser: (user: User) => user is GatewayUser;
|
|
37
|
+
export declare const isHxAuthUser: (user: User) => user is HxAuthUser;
|
|
31
38
|
export default User;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HXAUTH_ACCESS_TOKEN } from "../enums/user_auth_type";
|
|
1
2
|
export class GatewayUser {
|
|
2
3
|
constructor(authType, idToken, role, storageToken, redirectUrl) {
|
|
3
4
|
this.authType = authType;
|
|
@@ -11,4 +12,5 @@ export class GatewayUser {
|
|
|
11
12
|
}
|
|
12
13
|
export const isFirebaseUser = (user) => { var _a; return !!((_a = user) === null || _a === void 0 ? void 0 : _a.firebaseUser); };
|
|
13
14
|
export const isGatewayUser = (user) => { var _a; return !!((_a = user) === null || _a === void 0 ? void 0 : _a.gatewayUser); };
|
|
15
|
+
export const isHxAuthUser = (user) => (user === null || user === void 0 ? void 0 : user.authType) == HXAUTH_ACCESS_TOKEN;
|
|
14
16
|
//# sourceMappingURL=user.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../source/models/domain/user.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"user.js","sourceRoot":"","sources":["../../../../source/models/domain/user.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAG5F,MAAM,OAAO,WAAW;IAStB,YAAY,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,YAAa,EAAE,WAAY;QAC9D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG;YACjB,OAAO;YACP,IAAI;YACJ,YAAY;YACZ,WAAW;SACZ,CAAC;IACJ,CAAC;CACF;AA4BD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAU,EAAwB,EAAE,WAAC,OAAA,CAAC,CAAC,CAAA,MAAC,IAAqB,0CAAE,YAAY,CAAA,CAAA,EAAA,CAAC;AAC3G,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAU,EAAuB,EAAE,WAAC,OAAA,CAAC,CAAC,CAAA,MAAC,IAAoB,0CAAE,WAAW,CAAA,CAAA,EAAA,CAAC;AACvG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAsB,EAAE,CAAC,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,KAAI,mBAAmB,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
1
|
+
export * from "./deviation_status";
|
|
2
|
+
export * from "./inspection_modes";
|
|
3
|
+
export * from "./event_type";
|
|
4
|
+
export * from "./notification_level";
|
|
5
|
+
export * from "./photo_projection_type";
|
|
6
|
+
export * from "./photo_rotation_type";
|
|
7
|
+
export * from "./pipeline_types";
|
|
8
|
+
export * from "./process_status";
|
|
9
|
+
export * from "./running_process_status";
|
|
10
|
+
export * from "./api_built_status";
|
|
11
|
+
export * from "./system_of_measurement";
|
|
12
|
+
export * from "./uploader_status";
|
|
13
|
+
export * from "./user_auth_type";
|
|
14
|
+
export * from "./user_role";
|
|
15
|
+
export * from "./user_action_type";
|
|
16
|
+
export * from "./api_integration_credentials_type";
|
|
17
|
+
export * from "./user_permission_action";
|
|
18
|
+
export * from "./user_permission_type";
|
|
19
|
+
export * from "./association_type";
|
|
20
|
+
export * from "./project_work_package_type";
|
|
21
|
+
export * from "./progress_type";
|
|
22
22
|
export { ProjectPurposeType, FloorPurposeType, ScanDatasetPurposeType, PhotoAreaPurposeType, ProjectTypeKeys, FloorTypeKeys, ScanDatasetTypeKeys, PhotoAreaTypeKeys, PurposeTypeKeys, PurposeType, isPurposeType, UploadHistoryPurposeTypes, PurposeTypeMap, uploadHistoryPurposeTypes, floorPurposeTypes } from "./purpose_type";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
1
|
+
export * from "./deviation_status";
|
|
2
|
+
export * from "./inspection_modes";
|
|
3
|
+
export * from "./event_type";
|
|
4
|
+
export * from "./notification_level";
|
|
5
|
+
export * from "./photo_projection_type";
|
|
6
|
+
export * from "./photo_rotation_type";
|
|
7
|
+
export * from "./pipeline_types";
|
|
8
|
+
export * from "./process_status";
|
|
9
|
+
export * from "./running_process_status";
|
|
10
|
+
export * from "./api_built_status";
|
|
11
|
+
export * from "./system_of_measurement";
|
|
12
|
+
export * from "./uploader_status";
|
|
13
|
+
export * from "./user_auth_type";
|
|
14
|
+
export * from "./user_role";
|
|
15
|
+
export * from "./user_action_type";
|
|
16
|
+
export * from "./api_integration_credentials_type";
|
|
17
|
+
export * from "./user_permission_action";
|
|
18
|
+
export * from "./user_permission_type";
|
|
19
|
+
export * from "./association_type";
|
|
20
|
+
export * from "./project_work_package_type";
|
|
21
|
+
export * from "./progress_type";
|
|
22
22
|
export { ProjectPurposeType, FloorPurposeType, ScanDatasetPurposeType, PhotoAreaPurposeType, isPurposeType, PurposeTypeMap, uploadHistoryPurposeTypes, floorPurposeTypes } from "./purpose_type";
|
|
23
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/models/enums/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/models/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oCAAoC,CAAC;AACnD,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EAOpB,aAAa,EAEb,cAAc,EACd,yBAAyB,EACzB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export declare enum UserAuthType {
|
|
2
2
|
GATEWAY_JWT = "GATEWAY_JWT",
|
|
3
3
|
BASIC = "BASIC",
|
|
4
|
-
FIREBASE = "FIREBASE"
|
|
4
|
+
FIREBASE = "FIREBASE",
|
|
5
|
+
HXAUTH_ACCESS_TOKEN = "HXAUTH_ACCESS_TOKEN"
|
|
5
6
|
}
|
|
6
7
|
export declare const GATEWAY_JWT = UserAuthType.GATEWAY_JWT;
|
|
7
8
|
export declare const BASIC = UserAuthType.BASIC;
|
|
8
9
|
export declare const FIREBASE = UserAuthType.FIREBASE;
|
|
10
|
+
export declare const HXAUTH_ACCESS_TOKEN = UserAuthType.HXAUTH_ACCESS_TOKEN;
|
|
9
11
|
export default UserAuthType;
|
|
@@ -3,9 +3,11 @@ export var UserAuthType;
|
|
|
3
3
|
UserAuthType["GATEWAY_JWT"] = "GATEWAY_JWT";
|
|
4
4
|
UserAuthType["BASIC"] = "BASIC";
|
|
5
5
|
UserAuthType["FIREBASE"] = "FIREBASE";
|
|
6
|
+
UserAuthType["HXAUTH_ACCESS_TOKEN"] = "HXAUTH_ACCESS_TOKEN";
|
|
6
7
|
})(UserAuthType || (UserAuthType = {}));
|
|
7
8
|
export const GATEWAY_JWT = UserAuthType.GATEWAY_JWT;
|
|
8
9
|
export const BASIC = UserAuthType.BASIC;
|
|
9
10
|
export const FIREBASE = UserAuthType.FIREBASE;
|
|
11
|
+
export const HXAUTH_ACCESS_TOKEN = UserAuthType.HXAUTH_ACCESS_TOKEN;
|
|
10
12
|
export default UserAuthType;
|
|
11
13
|
//# sourceMappingURL=user_auth_type.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user_auth_type.js","sourceRoot":"","sources":["../../../../source/models/enums/user_auth_type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"user_auth_type.js","sourceRoot":"","sources":["../../../../source/models/enums/user_auth_type.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAKX;AALD,WAAY,YAAY;IACtB,2CAA2B,CAAA;IAC3B,+BAAe,CAAA;IACf,qCAAqB,CAAA;IACrB,2DAA2C,CAAA;AAC7C,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AACpD,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC;AACxC,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC;AAC9C,MAAM,CAAC,MAAM,mBAAmB,GAAG,YAAY,CAAC,mBAAmB,CAAC;AAEpE,eAAe,YAAY,CAAC"}
|
package/dist/esm/models/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./api";
|
|
2
2
|
export * from "./domain";
|
|
3
3
|
export * from "./enums";
|
|
4
|
-
export
|
|
5
|
-
export
|
|
4
|
+
export * from "./response_error";
|
|
5
|
+
export * from "./custom_error";
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
|
@@ -3,8 +3,14 @@ export { User, BasicUser, FirebaseUser, GatewayUser } from "../models/domain/use
|
|
|
3
3
|
declare const getAuthorizationHeaders: (user: User) => {
|
|
4
4
|
Authorization: string;
|
|
5
5
|
firebaseIdToken?: undefined;
|
|
6
|
+
hxAuthAccessToken?: undefined;
|
|
6
7
|
} | {
|
|
7
8
|
firebaseIdToken: string;
|
|
8
9
|
Authorization?: undefined;
|
|
10
|
+
hxAuthAccessToken?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
hxAuthAccessToken: string;
|
|
13
|
+
Authorization?: undefined;
|
|
14
|
+
firebaseIdToken?: undefined;
|
|
9
15
|
};
|
|
10
16
|
export default getAuthorizationHeaders;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BASIC, FIREBASE, GATEWAY_JWT } from "../models/enums/user_auth_type";
|
|
1
|
+
import { BASIC, FIREBASE, GATEWAY_JWT, HXAUTH_ACCESS_TOKEN } from "../models/enums/user_auth_type";
|
|
2
2
|
export { GatewayUser } from "../models/domain/user";
|
|
3
3
|
const getAuthorizationHeaders = (user) => {
|
|
4
4
|
if (!user) {
|
|
@@ -20,6 +20,11 @@ const getAuthorizationHeaders = (user) => {
|
|
|
20
20
|
firebaseIdToken: user.firebaseUser.idToken
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
+
case HXAUTH_ACCESS_TOKEN: {
|
|
24
|
+
return {
|
|
25
|
+
hxAuthAccessToken: user.hxAuthUser.accessToken
|
|
26
|
+
};
|
|
27
|
+
}
|
|
23
28
|
default: {
|
|
24
29
|
console.warn("no authentication");
|
|
25
30
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get_authorization_headers.js","sourceRoot":"","sources":["../../../source/utilities/get_authorization_headers.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"get_authorization_headers.js","sourceRoot":"","sources":["../../../source/utilities/get_authorization_headers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAGnG,OAAO,EAA6B,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAE9E,MAAM,uBAAuB,GAAG,CAAC,IAAU,EAAE,EAAE;IAC7C,IAAG,CAAC,IAAI,EAAC;QACP,OAAO,IAAI,CAAC;KACb;IACD,QAAQ,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,EAAE;QACtB,KAAK,WAAW,CAAC,CAAC;YAChB,OAAO;gBACL,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE;aACpD,CAAC;SACH;QACD,KAAK,KAAK,CAAC,CAAC;YACV,OAAO;gBACL,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;aAC9F,CAAC;SACH;QACD,KAAK,QAAQ,CAAC,CAAC;YACb,OAAO;gBACL,eAAe,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;aAC3C,CAAC;SACH;QACD,KAAK,mBAAmB,CAAC,CAAC;YACxB,OAAO;gBACL,iBAAiB,EAAE,IAAI,CAAC,UAAU,CAAC,WAAW;aAC/C,CAAA;SACF;QACD,OAAO,CAAC,CAAC;YACP,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;YAClC,OAAO,IAAI,CAAC;SACb;KACF;AACH,CAAC,CAAC;AAEF,eAAe,uBAAuB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import getAuthorizationHeaders from "./get_authorization_headers";
|
|
2
2
|
import { httpGetHeaders, httpPostHeaders } from "./request_headers";
|
|
3
|
-
import { isFirebaseUser, isGatewayUser } from "../models";
|
|
3
|
+
import { isFirebaseUser, isGatewayUser, isHxAuthUser } from "../models";
|
|
4
4
|
import Config from "../config";
|
|
5
5
|
export default class Http {
|
|
6
6
|
static fetch(url, data) {
|
|
@@ -45,7 +45,10 @@ export default class Http {
|
|
|
45
45
|
}
|
|
46
46
|
static addAuthToDownloadUrl(baseUrl, user) {
|
|
47
47
|
if (user) {
|
|
48
|
-
if (
|
|
48
|
+
if (isHxAuthUser(user)) {
|
|
49
|
+
return `${baseUrl}?auth=${user.hxAuthUser.accessToken}`;
|
|
50
|
+
}
|
|
51
|
+
else if (isGatewayUser(user)) {
|
|
49
52
|
return `${baseUrl}?auth=${user.gatewayUser.idToken}`;
|
|
50
53
|
}
|
|
51
54
|
else if (isFirebaseUser(user)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../source/utilities/http.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../../source/utilities/http.ts"],"names":[],"mappings":"AAAA,OAAO,uBAAiC,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAC,cAAc,EAAE,aAAa,EAAE,YAAY,EAAC,MAAM,WAAW,CAAC;AACtE,OAAO,MAAM,MAAM,WAAW,CAAC;AAE/B,MAAM,CAAC,OAAO,OAAO,IAAI;IAGvB,MAAM,CAAC,KAAK,CAAC,GAAgB,EAAE,IAAI;QACjC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC,QAAQ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./config";
|
|
3
|
-
import
|
|
4
|
-
import ElementApi from "./api/element_api";
|
|
5
|
-
import FileInformationApi from "./api/file_information_api";
|
|
6
|
-
import FloorApi from "./api/floor_api";
|
|
7
|
-
import IntegrationsApi from "./api/integrations_api";
|
|
8
|
-
import OrganizationApi from "./api/organization_api";
|
|
9
|
-
import PhotoAreaApi from "./api/photo_area_api";
|
|
10
|
-
import PipelineApi from "./api/pipeline_api";
|
|
11
|
-
import ProjectApi from "./api/project_api";
|
|
12
|
-
import ProjectSummaryApi from "./api/project_summary_api";
|
|
13
|
-
import ReportApi from "./api/report_api";
|
|
14
|
-
import ScanDatasetApi from "./api/scan_dataset_api";
|
|
15
|
-
import WebGatewayApi from "./api/web_gateway_api";
|
|
16
|
-
import UserApi from "./api/user_api";
|
|
17
|
-
import {GroupApi, WebRpcApi, RecipeApi} from "./api";
|
|
2
|
+
import * as Api from "./api";
|
|
18
3
|
|
|
19
4
|
export default {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
5
|
+
auth: Api.AuthApi,
|
|
6
|
+
config: Config,
|
|
7
|
+
comments: Api.CommentApi,
|
|
8
|
+
elements: Api.ElementApi,
|
|
9
|
+
files: Api.FileInformationApi,
|
|
10
|
+
floors: Api.FloorApi,
|
|
11
|
+
groups: Api.GroupApi,
|
|
12
|
+
integrations: Api.IntegrationsApi,
|
|
13
|
+
organizations: Api.OrganizationApi,
|
|
14
|
+
photos: Api.PhotoAreaApi,
|
|
15
|
+
pipelines: Api.PipelineApi,
|
|
16
|
+
projects: Api.ProjectApi,
|
|
17
|
+
projectSummary: Api.ProjectSummaryApi,
|
|
18
|
+
recipes: Api.RecipeApi,
|
|
19
|
+
reports: Api.ReportApi,
|
|
20
|
+
scanDatasets: Api.ScanDatasetApi,
|
|
21
|
+
other: Api.WebGatewayApi,
|
|
22
|
+
webRpcApi: Api.WebRpcApi,
|
|
23
|
+
user: Api.UserApi,
|
|
24
|
+
};
|
package/source/config.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _ from "underscore";
|
|
2
2
|
|
|
3
|
-
let configuration:
|
|
3
|
+
let configuration: Record<string, any> = { logFetch: false };
|
|
4
4
|
|
|
5
5
|
const addEnvironmentVariablesToConfiguration = () => {
|
|
6
6
|
_.forEach(configuration, (value, varName) => {
|
|
@@ -9,75 +9,75 @@ const addEnvironmentVariablesToConfiguration = () => {
|
|
|
9
9
|
configuration[varName] = envValue;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
}
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
const useQAConfiguration = () => {
|
|
15
15
|
configuration = {
|
|
16
16
|
AVVIR_GATEWAY_URL: "https://qa-api.avvir.io",
|
|
17
17
|
AVVIR_ENVIRONMENT: "qa"
|
|
18
|
-
}
|
|
19
|
-
addEnvironmentVariablesToConfiguration()
|
|
20
|
-
}
|
|
18
|
+
};
|
|
19
|
+
addEnvironmentVariablesToConfiguration();
|
|
20
|
+
};
|
|
21
21
|
|
|
22
22
|
const useAcceptanceConfiguration = () => {
|
|
23
23
|
configuration = {
|
|
24
24
|
AVVIR_GATEWAY_URL: "https://acceptance-api.avvir.io",
|
|
25
25
|
AVVIR_ENVIRONMENT: "acceptance"
|
|
26
|
-
}
|
|
27
|
-
addEnvironmentVariablesToConfiguration()
|
|
28
|
-
}
|
|
26
|
+
};
|
|
27
|
+
addEnvironmentVariablesToConfiguration();
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
const useProductionConfiguration = () => {
|
|
31
31
|
configuration = {
|
|
32
32
|
AVVIR_GATEWAY_URL: "https://api.avvir.io",
|
|
33
33
|
AVVIR_ENVIRONMENT: "production"
|
|
34
|
-
}
|
|
35
|
-
addEnvironmentVariablesToConfiguration()
|
|
36
|
-
}
|
|
34
|
+
};
|
|
35
|
+
addEnvironmentVariablesToConfiguration();
|
|
36
|
+
};
|
|
37
37
|
|
|
38
38
|
const useLocalProductionConfiguration = () => {
|
|
39
39
|
configuration = {
|
|
40
40
|
AVVIR_GATEWAY_URL: "https://api.avvir.io",
|
|
41
41
|
AVVIR_ENVIRONMENT: "local-production"
|
|
42
|
-
}
|
|
43
|
-
addEnvironmentVariablesToConfiguration()
|
|
44
|
-
}
|
|
42
|
+
};
|
|
43
|
+
addEnvironmentVariablesToConfiguration();
|
|
44
|
+
};
|
|
45
45
|
|
|
46
46
|
const useLocalConfiguration = () => {
|
|
47
|
-
addEnvironmentVariablesToConfiguration()
|
|
47
|
+
addEnvironmentVariablesToConfiguration();
|
|
48
48
|
configuration = {
|
|
49
49
|
AVVIR_GATEWAY_URL: "http://localhost:8080",
|
|
50
50
|
AVVIR_ENVIRONMENT: "local"
|
|
51
|
-
}
|
|
52
|
-
}
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
53
|
|
|
54
54
|
const setConfigurationFromEnvironmentVariable = () => {
|
|
55
55
|
setConfigurationForEnvironment(process.env.AVVIR_ENVIRONMENT);
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
|
|
58
58
|
const setConfigurationForEnvironment = (env) => {
|
|
59
|
-
if(env ===
|
|
60
|
-
useAcceptanceConfiguration()
|
|
61
|
-
} else if(env ===
|
|
62
|
-
useLocalProductionConfiguration()
|
|
63
|
-
} else if(env ===
|
|
64
|
-
useLocalConfiguration()
|
|
65
|
-
} else if(env ===
|
|
66
|
-
useQAConfiguration()
|
|
59
|
+
if (env === "acceptance") {
|
|
60
|
+
useAcceptanceConfiguration();
|
|
61
|
+
} else if (env === "local-production") {
|
|
62
|
+
useLocalProductionConfiguration();
|
|
63
|
+
} else if (env === "local") {
|
|
64
|
+
useLocalConfiguration();
|
|
65
|
+
} else if (env === "qa") {
|
|
66
|
+
useQAConfiguration();
|
|
67
67
|
} else {
|
|
68
|
-
useProductionConfiguration()
|
|
68
|
+
useProductionConfiguration();
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
|
|
72
|
-
setConfigurationFromEnvironmentVariable()
|
|
72
|
+
setConfigurationFromEnvironmentVariable();
|
|
73
73
|
|
|
74
|
-
const sharedErrorHandler = ({error}: any) => {
|
|
74
|
+
const sharedErrorHandler = ({ error }: any) => {
|
|
75
75
|
throw error;
|
|
76
|
-
}
|
|
76
|
+
};
|
|
77
77
|
|
|
78
78
|
const getConfiguration = () => {
|
|
79
|
-
return configuration
|
|
80
|
-
}
|
|
79
|
+
return configuration;
|
|
80
|
+
};
|
|
81
81
|
|
|
82
82
|
const Config = {
|
|
83
83
|
useAcceptanceConfiguration,
|
|
@@ -89,6 +89,6 @@ const Config = {
|
|
|
89
89
|
sharedErrorHandler,
|
|
90
90
|
setConfigurationForEnvironment,
|
|
91
91
|
setConfigurationFromEnvironmentVariable
|
|
92
|
-
}
|
|
92
|
+
};
|
|
93
93
|
|
|
94
|
-
export default Config
|
|
94
|
+
export default Config;
|
package/source/index.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import ResponseError from "./response_error";
|
|
2
2
|
|
|
3
|
-
export class CustomError extends ResponseError{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export class CustomError extends ResponseError {
|
|
4
|
+
constructor(message: string, verboseMessage: string, response: Response, responseBody: any, displayMessageToUI: boolean) {
|
|
5
|
+
super(message, verboseMessage, response, responseBody);
|
|
6
|
+
this.displayMessageToUI = displayMessageToUI;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
displayMessageToUI: boolean;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
export default CustomError;
|
|
12
|
+
export default CustomError;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from "./user";
|
|
@@ -1,46 +1,54 @@
|
|
|
1
|
-
import {BASIC, FIREBASE, GATEWAY_JWT} from "../enums/user_auth_type";
|
|
1
|
+
import { BASIC, FIREBASE, GATEWAY_JWT, HXAUTH_ACCESS_TOKEN } from "../enums/user_auth_type";
|
|
2
2
|
import { UserRole } from "../enums";
|
|
3
3
|
|
|
4
4
|
export class GatewayUser {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
authType: typeof GATEWAY_JWT;
|
|
6
|
+
gatewayUser?: {
|
|
7
|
+
idToken?: string,
|
|
8
|
+
role?: UserRole,
|
|
9
|
+
redirectUrl?: string,
|
|
10
|
+
storageToken?: string
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
constructor(authType, idToken, role, storageToken?, redirectUrl?) {
|
|
14
|
+
this.authType = authType;
|
|
15
|
+
this.gatewayUser = {
|
|
16
|
+
idToken,
|
|
17
|
+
role,
|
|
18
|
+
storageToken,
|
|
19
|
+
redirectUrl
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export type FirebaseUser = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
25
|
+
firebaseUser: {
|
|
26
|
+
uid?: string
|
|
27
|
+
role?: UserRole
|
|
28
|
+
displayName?: string
|
|
29
|
+
idToken?: string
|
|
30
|
+
email?: string
|
|
31
|
+
}
|
|
32
|
+
authType: typeof FIREBASE
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export type BasicUser = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
authType: typeof BASIC,
|
|
37
|
+
username: string,
|
|
38
|
+
password: string
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export type HxAuthUser = {
|
|
42
|
+
authType: typeof HXAUTH_ACCESS_TOKEN,
|
|
43
|
+
hxAuthUser: {
|
|
44
|
+
accessToken: string,
|
|
45
|
+
}
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
export type User = BasicUser | GatewayUser | FirebaseUser | null
|
|
48
|
+
export type User = BasicUser | GatewayUser | FirebaseUser | HxAuthUser | null;
|
|
42
49
|
|
|
43
50
|
export const isFirebaseUser = (user: User): user is FirebaseUser => !!(user as FirebaseUser)?.firebaseUser;
|
|
44
51
|
export const isGatewayUser = (user: User): user is GatewayUser => !!(user as GatewayUser)?.gatewayUser;
|
|
52
|
+
export const isHxAuthUser = (user: User): user is HxAuthUser => user?.authType == HXAUTH_ACCESS_TOKEN;
|
|
45
53
|
|
|
46
54
|
export default User;
|