@hawk.so/types 0.3.0 → 0.4.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/build/index.d.ts CHANGED
@@ -1,32 +1,34 @@
1
- export * from "./src/auth/tokensPair";
2
- export * from "./src/base/businessOperation/businessOperation";
3
- export * from "./src/billing/planProlongrationPayload";
4
- export * from "./src/base/event/affectedUser";
5
- export * from "./src/base/event/backtraceFrame";
6
- export * from "./src/base/event/breadcrumb";
7
- export * from "./src/base/event/event";
8
- export * from "./src/base/event/sourceCodeLine";
9
- export * from "./src/base/event/addons";
10
- export * from "./src/base/integrations/integrationToken";
11
- export * from "./src/dbScheme/businessOperation";
12
- export * from "./src/dbScheme/groupedEvent";
13
- export * from "./src/dbScheme/notificationsChannels";
14
- export * from "./src/dbScheme/notificationsChannelSettings";
15
- export * from "./src/dbScheme/membership";
16
- export * from "./src/dbScheme/plan";
17
- export * from "./src/dbScheme/project";
18
- export * from "./src/dbScheme/projectNotificationsRule";
19
- export * from "./src/dbScheme/release";
20
- export * from "./src/dbScheme/repetition";
21
- export * from "./src/dbScheme/sourceMap";
22
- export * from "./src/dbScheme/user";
23
- export * from "./src/dbScheme/userNotifications";
24
- export * from "./src/dbScheme/workspace";
25
- export * from "./src/dbScheme/bankCard";
26
- export * from "./src/dbScheme/projectEventGroupingPattern";
27
- export * from "./src/notifications/createProjectNotifications";
28
- export * from "./src/notifications/receiveTypes";
29
- export * from "./src/notifications/updateProjectNotifications";
30
- export * from "./src/notifications/userNotification";
31
- export * from "./src/catchers/catcher-message";
32
- export * from './src/utils';
1
+ export type * from './src/auth/tokensPair';
2
+ export type * from './src/base/businessOperation/businessOperation';
3
+ export type * from './src/billing/planProlongrationPayload';
4
+ export type * from './src/base/event/affectedUser';
5
+ export type * from './src/base/event/backtraceFrame';
6
+ export type * from './src/base/event/breadcrumb';
7
+ export type * from './src/base/event/event';
8
+ export type * from './src/base/event/sourceCodeLine';
9
+ export type * from './src/base/event/addons';
10
+ export type * from './src/base/integrations/integrationToken';
11
+ export type * from './src/dbScheme/businessOperation';
12
+ export type * from './src/dbScheme/groupedEvent';
13
+ export type * from './src/dbScheme/notificationsChannels';
14
+ export type * from './src/dbScheme/notificationsChannelSettings';
15
+ export type * from './src/dbScheme/membership';
16
+ export type * from './src/dbScheme/userProjectsLastVisit';
17
+ export type * from './src/dbScheme/plan';
18
+ export type * from './src/dbScheme/project';
19
+ export type * from './src/dbScheme/projectNotificationsRule';
20
+ export type * from './src/dbScheme/release';
21
+ export type * from './src/dbScheme/repetition';
22
+ export type * from './src/dbScheme/sourceMap';
23
+ export type * from './src/dbScheme/user';
24
+ export type * from './src/dbScheme/userNotifications';
25
+ export type * from './src/dbScheme/workspace';
26
+ export type * from './src/dbScheme/bankCard';
27
+ export type * from './src/dbScheme/sso';
28
+ export type * from './src/dbScheme/projectEventGroupingPattern';
29
+ export type * from './src/notifications/createProjectNotifications';
30
+ export type * from './src/notifications/receiveTypes';
31
+ export type * from './src/notifications/updateProjectNotifications';
32
+ export type * from './src/notifications/userNotification';
33
+ export type * from './src/catchers/catcher-message';
34
+ export type * from './src/utils';
package/build/index.js CHANGED
@@ -1,48 +1,2 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/auth/tokensPair"), exports);
18
- __exportStar(require("./src/base/businessOperation/businessOperation"), exports);
19
- __exportStar(require("./src/billing/planProlongrationPayload"), exports);
20
- __exportStar(require("./src/base/event/affectedUser"), exports);
21
- __exportStar(require("./src/base/event/backtraceFrame"), exports);
22
- __exportStar(require("./src/base/event/breadcrumb"), exports);
23
- __exportStar(require("./src/base/event/event"), exports);
24
- __exportStar(require("./src/base/event/sourceCodeLine"), exports);
25
- __exportStar(require("./src/base/event/addons"), exports);
26
- __exportStar(require("./src/base/integrations/integrationToken"), exports);
27
- __exportStar(require("./src/dbScheme/businessOperation"), exports);
28
- __exportStar(require("./src/dbScheme/groupedEvent"), exports);
29
- __exportStar(require("./src/dbScheme/notificationsChannels"), exports);
30
- __exportStar(require("./src/dbScheme/notificationsChannelSettings"), exports);
31
- __exportStar(require("./src/dbScheme/membership"), exports);
32
- __exportStar(require("./src/dbScheme/plan"), exports);
33
- __exportStar(require("./src/dbScheme/project"), exports);
34
- __exportStar(require("./src/dbScheme/projectNotificationsRule"), exports);
35
- __exportStar(require("./src/dbScheme/release"), exports);
36
- __exportStar(require("./src/dbScheme/repetition"), exports);
37
- __exportStar(require("./src/dbScheme/sourceMap"), exports);
38
- __exportStar(require("./src/dbScheme/user"), exports);
39
- __exportStar(require("./src/dbScheme/userNotifications"), exports);
40
- __exportStar(require("./src/dbScheme/workspace"), exports);
41
- __exportStar(require("./src/dbScheme/bankCard"), exports);
42
- __exportStar(require("./src/dbScheme/projectEventGroupingPattern"), exports);
43
- __exportStar(require("./src/notifications/createProjectNotifications"), exports);
44
- __exportStar(require("./src/notifications/receiveTypes"), exports);
45
- __exportStar(require("./src/notifications/updateProjectNotifications"), exports);
46
- __exportStar(require("./src/notifications/userNotification"), exports);
47
- __exportStar(require("./src/catchers/catcher-message"), exports);
48
- __exportStar(require("./src/utils"), exports);
@@ -33,3 +33,13 @@ export interface PendingMemberDBScheme {
33
33
  * Represents full structure of team collection documents
34
34
  */
35
35
  export type MemberDBScheme = ConfirmedMemberDBScheme | PendingMemberDBScheme;
36
+ /**
37
+ * User workspace membership info stored in user document
38
+ * Record of workspace IDs to membership data
39
+ */
40
+ export type MembershipDBScheme = Record<string, {
41
+ /**
42
+ * Whether the user's membership is pending confirmation
43
+ */
44
+ isPending?: boolean;
45
+ }>;
@@ -0,0 +1,77 @@
1
+ /**
2
+ * SSO configuration types for database schema
3
+ */
4
+ /**
5
+ * SAML attribute mapping configuration
6
+ */
7
+ export interface SamlAttributeMapping {
8
+ /**
9
+ * Attribute name for email in SAML Assertion
10
+ * @example "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
11
+ * to get email from XML like this:
12
+ * <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
13
+ * <AttributeValue>alice@company.com</AttributeValue>
14
+ * </Attribute>
15
+ */
16
+ email: string;
17
+ /**
18
+ * Attribute name for user name in SAML Assertion
19
+ */
20
+ name?: string;
21
+ }
22
+ /**
23
+ * SAML SSO configuration
24
+ */
25
+ export interface SamlConfig {
26
+ /**
27
+ * IdP Entity ID.
28
+ * Used to validate "this response is intended for Hawk"
29
+ * @example "urn:hawk:tracker:saml"
30
+ */
31
+ idpEntityId: string;
32
+ /**
33
+ * SSO URL for redirecting user to IdP
34
+ * Used to redirect user to IdP for authentication
35
+ * @example "https://idp.example.com/sso"
36
+ */
37
+ ssoUrl: string;
38
+ /**
39
+ * X.509 certificate for signature verification
40
+ * @example "-----BEGIN CERTIFICATE-----\nMIIDYjCCAkqgAwIBAgI...END CERTIFICATE-----"
41
+ */
42
+ x509Cert: string;
43
+ /**
44
+ * Desired NameID format
45
+ * @example "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
46
+ */
47
+ nameIdFormat?: string;
48
+ /**
49
+ * Attribute mapping configuration
50
+ * Used to extract user attributes from SAML Response
51
+ */
52
+ attributeMapping: SamlAttributeMapping;
53
+ }
54
+ /**
55
+ * SSO configuration for workspace
56
+ */
57
+ export interface WorkspaceSsoConfig {
58
+ /**
59
+ * Is SSO enabled
60
+ */
61
+ enabled: boolean;
62
+ /**
63
+ * Is SSO enforced (only SSO login allowed)
64
+ * If true, login via email/password is not allowed
65
+ */
66
+ enforced: boolean;
67
+ /**
68
+ * SSO provider type
69
+ * Currently only SAML is supported. In future we can add other providers (OAuth 2, etc.)
70
+ */
71
+ type: 'saml';
72
+ /**
73
+ * SAML-specific configuration.
74
+ * Got from IdP metadata.
75
+ */
76
+ saml: SamlConfig;
77
+ }
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * SSO configuration types for database schema
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,8 @@
1
1
  import type { ObjectId } from 'bson';
2
2
  import type { UserNotificationsDBScheme } from '../../index.ts';
3
3
  import type { BankCard } from './bankCard.ts';
4
+ import type { MembershipDBScheme } from './membership.ts';
5
+ import type { UserProjectsLastVisitDBScheme } from './userProjectsLastVisit.ts';
4
6
  /**
5
7
  * Interface representing how user is stored in DB
6
8
  */
@@ -29,6 +31,11 @@ export interface UserDBScheme {
29
31
  * User's GitHub profile id
30
32
  */
31
33
  githubId?: string;
34
+ /**
35
+ * User's workspaces membership
36
+ * Record of workspace IDs to membership data
37
+ */
38
+ workspaces?: MembershipDBScheme;
32
39
  /**
33
40
  * User's original password (this field appears only after registration).
34
41
  * Using to send password to user after registration
@@ -38,6 +45,10 @@ export interface UserDBScheme {
38
45
  * User notifications settings
39
46
  */
40
47
  notifications?: UserNotificationsDBScheme;
48
+ /**
49
+ * User's last visit timestamps for projects
50
+ */
51
+ projectsLastVisit?: UserProjectsLastVisitDBScheme;
41
52
  /**
42
53
  * Saved bank cards for one-click payments
43
54
  */
@@ -67,4 +78,24 @@ export interface UserDBScheme {
67
78
  */
68
79
  term?: string;
69
80
  };
81
+ /**
82
+ * External identities for SSO (keyed by workspaceId)
83
+ */
84
+ identities?: {
85
+ [workspaceId: string]: {
86
+ /**
87
+ * SAML-mode params
88
+ */
89
+ saml: {
90
+ /**
91
+ * NameID value from IdP (stable identifier)
92
+ */
93
+ id: string;
94
+ /**
95
+ * Email at the time of linking (for audit)
96
+ */
97
+ email: string;
98
+ };
99
+ };
100
+ };
70
101
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * User's last visit timestamps for projects
3
+ * Record of project IDs to Unix timestamps
4
+ */
5
+ export type UserProjectsLastVisitDBScheme = Record<string, number>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,5 @@
1
1
  import type { ObjectId } from 'bson';
2
+ import type { WorkspaceSsoConfig } from './sso.ts';
2
3
  /**
3
4
  * Workspace representation in DataBase
4
5
  */
@@ -68,4 +69,8 @@ export interface WorkspaceDBScheme {
68
69
  lastNotificationDate?: {
69
70
  [key: string]: Date;
70
71
  };
72
+ /**
73
+ * SSO configuration (optional, only for workspaces with SSO enabled)
74
+ */
75
+ sso?: WorkspaceSsoConfig;
71
76
  }
package/index.ts CHANGED
@@ -1,40 +1,42 @@
1
- export * from "./src/auth/tokensPair";
2
-
3
- export * from "./src/base/businessOperation/businessOperation";
4
-
5
- export * from "./src/billing/planProlongrationPayload";
6
-
7
- export * from "./src/base/event/affectedUser";
8
- export * from "./src/base/event/backtraceFrame";
9
- export * from "./src/base/event/breadcrumb";
10
- export * from "./src/base/event/event";
11
- export * from "./src/base/event/sourceCodeLine";
12
- export * from "./src/base/event/addons";
13
-
14
- export * from "./src/base/integrations/integrationToken";
15
-
16
- export * from "./src/dbScheme/businessOperation";
17
- export * from "./src/dbScheme/groupedEvent";
18
- export * from "./src/dbScheme/notificationsChannels";
19
- export * from "./src/dbScheme/notificationsChannelSettings";
20
- export * from "./src/dbScheme/membership";
21
- export * from "./src/dbScheme/plan";
22
- export * from "./src/dbScheme/project";
23
- export * from "./src/dbScheme/projectNotificationsRule";
24
- export * from "./src/dbScheme/release";
25
- export * from "./src/dbScheme/repetition";
26
- export * from "./src/dbScheme/sourceMap";
27
- export * from "./src/dbScheme/user";
28
- export * from "./src/dbScheme/userNotifications";
29
- export * from "./src/dbScheme/workspace";
30
- export * from "./src/dbScheme/bankCard";
31
- export * from "./src/dbScheme/projectEventGroupingPattern";
32
-
33
- export * from "./src/notifications/createProjectNotifications";
34
- export * from "./src/notifications/receiveTypes";
35
- export * from "./src/notifications/updateProjectNotifications";
36
- export * from "./src/notifications/userNotification";
37
-
38
- export * from "./src/catchers/catcher-message";
39
-
40
- export * from './src/utils';
1
+ export type * from './src/auth/tokensPair';
2
+
3
+ export type * from './src/base/businessOperation/businessOperation';
4
+
5
+ export type * from './src/billing/planProlongrationPayload';
6
+
7
+ export type * from './src/base/event/affectedUser';
8
+ export type * from './src/base/event/backtraceFrame';
9
+ export type * from './src/base/event/breadcrumb';
10
+ export type * from './src/base/event/event';
11
+ export type * from './src/base/event/sourceCodeLine';
12
+ export type * from './src/base/event/addons';
13
+
14
+ export type * from './src/base/integrations/integrationToken';
15
+
16
+ export type * from './src/dbScheme/businessOperation';
17
+ export type * from './src/dbScheme/groupedEvent';
18
+ export type * from './src/dbScheme/notificationsChannels';
19
+ export type * from './src/dbScheme/notificationsChannelSettings';
20
+ export type * from './src/dbScheme/membership';
21
+ export type * from './src/dbScheme/userProjectsLastVisit';
22
+ export type * from './src/dbScheme/plan';
23
+ export type * from './src/dbScheme/project';
24
+ export type * from './src/dbScheme/projectNotificationsRule';
25
+ export type * from './src/dbScheme/release';
26
+ export type * from './src/dbScheme/repetition';
27
+ export type * from './src/dbScheme/sourceMap';
28
+ export type * from './src/dbScheme/user';
29
+ export type * from './src/dbScheme/userNotifications';
30
+ export type * from './src/dbScheme/workspace';
31
+ export type * from './src/dbScheme/bankCard';
32
+ export type * from './src/dbScheme/sso';
33
+ export type * from './src/dbScheme/projectEventGroupingPattern';
34
+
35
+ export type * from './src/notifications/createProjectNotifications';
36
+ export type * from './src/notifications/receiveTypes';
37
+ export type * from './src/notifications/updateProjectNotifications';
38
+ export type * from './src/notifications/userNotification';
39
+
40
+ export type * from './src/catchers/catcher-message';
41
+
42
+ export type * from './src/utils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hawk.so/types",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "TypeScript definitions for Hawk",
5
5
  "types": "build/index.d.ts",
6
6
  "main": "build/index.js",
@@ -39,3 +39,14 @@ export interface PendingMemberDBScheme {
39
39
  * Represents full structure of team collection documents
40
40
  */
41
41
  export type MemberDBScheme = ConfirmedMemberDBScheme | PendingMemberDBScheme;
42
+
43
+ /**
44
+ * User workspace membership info stored in user document
45
+ * Record of workspace IDs to membership data
46
+ */
47
+ export type MembershipDBScheme = Record<string, {
48
+ /**
49
+ * Whether the user's membership is pending confirmation
50
+ */
51
+ isPending?: boolean;
52
+ }>;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * SSO configuration types for database schema
3
+ */
4
+
5
+ /**
6
+ * SAML attribute mapping configuration
7
+ */
8
+ export interface SamlAttributeMapping {
9
+ /**
10
+ * Attribute name for email in SAML Assertion
11
+ * @example "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
12
+ * to get email from XML like this:
13
+ * <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
14
+ * <AttributeValue>alice@company.com</AttributeValue>
15
+ * </Attribute>
16
+ */
17
+ email: string;
18
+
19
+ /**
20
+ * Attribute name for user name in SAML Assertion
21
+ */
22
+ name?: string;
23
+ }
24
+
25
+ /**
26
+ * SAML SSO configuration
27
+ */
28
+ export interface SamlConfig {
29
+ /**
30
+ * IdP Entity ID.
31
+ * Used to validate "this response is intended for Hawk"
32
+ * @example "urn:hawk:tracker:saml"
33
+ */
34
+ idpEntityId: string;
35
+
36
+ /**
37
+ * SSO URL for redirecting user to IdP
38
+ * Used to redirect user to IdP for authentication
39
+ * @example "https://idp.example.com/sso"
40
+ */
41
+ ssoUrl: string;
42
+
43
+ /**
44
+ * X.509 certificate for signature verification
45
+ * @example "-----BEGIN CERTIFICATE-----\nMIIDYjCCAkqgAwIBAgI...END CERTIFICATE-----"
46
+ */
47
+ x509Cert: string;
48
+
49
+ /**
50
+ * Desired NameID format
51
+ * @example "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
52
+ */
53
+ nameIdFormat?: string;
54
+
55
+ /**
56
+ * Attribute mapping configuration
57
+ * Used to extract user attributes from SAML Response
58
+ */
59
+ attributeMapping: SamlAttributeMapping;
60
+ }
61
+
62
+ /**
63
+ * SSO configuration for workspace
64
+ */
65
+ export interface WorkspaceSsoConfig {
66
+ /**
67
+ * Is SSO enabled
68
+ */
69
+ enabled: boolean;
70
+
71
+ /**
72
+ * Is SSO enforced (only SSO login allowed)
73
+ * If true, login via email/password is not allowed
74
+ */
75
+ enforced: boolean;
76
+
77
+ /**
78
+ * SSO provider type
79
+ * Currently only SAML is supported. In future we can add other providers (OAuth 2, etc.)
80
+ */
81
+ type: 'saml';
82
+
83
+ /**
84
+ * SAML-specific configuration.
85
+ * Got from IdP metadata.
86
+ */
87
+ saml: SamlConfig;
88
+ }
@@ -1,6 +1,8 @@
1
1
  import type { ObjectId } from 'bson';
2
2
  import type { UserNotificationsDBScheme } from '../../index.ts';
3
3
  import type { BankCard } from './bankCard.ts';
4
+ import type { MembershipDBScheme } from './membership.ts';
5
+ import type { UserProjectsLastVisitDBScheme } from './userProjectsLastVisit.ts';
4
6
 
5
7
  /**
6
8
  * Interface representing how user is stored in DB
@@ -36,6 +38,12 @@ export interface UserDBScheme {
36
38
  */
37
39
  githubId?: string;
38
40
 
41
+ /**
42
+ * User's workspaces membership
43
+ * Record of workspace IDs to membership data
44
+ */
45
+ workspaces?: MembershipDBScheme;
46
+
39
47
  /**
40
48
  * User's original password (this field appears only after registration).
41
49
  * Using to send password to user after registration
@@ -47,6 +55,11 @@ export interface UserDBScheme {
47
55
  */
48
56
  notifications?: UserNotificationsDBScheme;
49
57
 
58
+ /**
59
+ * User's last visit timestamps for projects
60
+ */
61
+ projectsLastVisit?: UserProjectsLastVisitDBScheme;
62
+
50
63
  /**
51
64
  * Saved bank cards for one-click payments
52
65
  */
@@ -81,4 +94,26 @@ export interface UserDBScheme {
81
94
  */
82
95
  term?: string;
83
96
  };
97
+
98
+ /**
99
+ * External identities for SSO (keyed by workspaceId)
100
+ */
101
+ identities?: {
102
+ [workspaceId: string]: {
103
+ /**
104
+ * SAML-mode params
105
+ */
106
+ saml: {
107
+ /**
108
+ * NameID value from IdP (stable identifier)
109
+ */
110
+ id: string;
111
+
112
+ /**
113
+ * Email at the time of linking (for audit)
114
+ */
115
+ email: string;
116
+ };
117
+ };
118
+ };
84
119
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * User's last visit timestamps for projects
3
+ * Record of project IDs to Unix timestamps
4
+ */
5
+ export type UserProjectsLastVisitDBScheme = Record<string, number>;
@@ -1,4 +1,5 @@
1
1
  import type { ObjectId } from 'bson';
2
+ import type { WorkspaceSsoConfig } from './sso.ts';
2
3
 
3
4
  /**
4
5
  * Workspace representation in DataBase
@@ -81,4 +82,9 @@ export interface WorkspaceDBScheme {
81
82
  * Used to reduce frequency of some system messages
82
83
  */
83
84
  lastNotificationDate?: { [key: string]: Date };
85
+
86
+ /**
87
+ * SSO configuration (optional, only for workspaces with SSO enabled)
88
+ */
89
+ sso?: WorkspaceSsoConfig;
84
90
  }