@things-factory/organization 10.1.283 → 10.1.288

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.
@@ -1 +1 @@
1
- export default function route(page: string): "my-approval-line-templates-page" | "common-approval-line-templates-page" | "approval-line-list" | "employee-list" | "department-list" | "my-employee-profile" | "employee-profile-list" | undefined;
1
+ export default function route(page: string): "approval-line-list" | "common-approval-line-templates-page" | "my-approval-line-templates-page" | "employee-list" | "department-list" | "my-employee-profile" | "employee-profile-list" | undefined;
@@ -23,7 +23,8 @@ export declare function audienceMemberOf(domain: Partial<Domain>, user: {
23
23
  }>;
24
24
  /**
25
25
  * The people an audience names: those who may be given work in the domain (its active members and owners -
26
- * getDomainAssignees), narrowed to the targets. A department names the active employees of it and of every department
27
- * under it; a role, whoever holds it.
26
+ * getDomainAssignees), narrowed to the targets. The whole domain names its active employees - an account that is no
27
+ * one's employee record (the administrator, a partner's) is not one of them, nor is one who left; a department names the
28
+ * active employees of it and of every department under it; a role, whoever holds it.
28
29
  */
29
30
  export declare function audienceUserIds(domain: Partial<Domain>, targets: readonly AudienceTarget[], tx?: EntityManager): Promise<string[]>;
@@ -51,15 +51,18 @@ async function audienceMemberOf(domain, user, tx) {
51
51
  }
52
52
  /**
53
53
  * The people an audience names: those who may be given work in the domain (its active members and owners -
54
- * getDomainAssignees), narrowed to the targets. A department names the active employees of it and of every department
55
- * under it; a role, whoever holds it.
54
+ * getDomainAssignees), narrowed to the targets. The whole domain names its active employees - an account that is no
55
+ * one's employee record (the administrator, a partner's) is not one of them, nor is one who left; a department names the
56
+ * active employees of it and of every department under it; a role, whoever holds it.
56
57
  */
57
58
  async function audienceUserIds(domain, targets, tx) {
58
59
  if (!domain?.id || !targets?.length)
59
60
  return [];
60
61
  const assignees = new Set((await (0, auth_base_1.getDomainAssignees)(domain, tx)).map(one => one.id));
61
- if (targets.some(one => one.scope === 'DOMAIN' && one.targetId === domain.id))
62
- return [...assignees];
62
+ if (targets.some(one => one.scope === 'DOMAIN' && one.targetId === domain.id)) {
63
+ const employees = await (0, shell_1.getRepository)(employee_1.Employee, tx).find({ where: { domain: { id: domain.id }, active: true }, relations: ['user'] });
64
+ return [...new Set(employees.map(one => one.user?.id).filter((id) => !!id && assignees.has(id)))];
65
+ }
63
66
  const named = new Set();
64
67
  for (const one of targets)
65
68
  if (one.scope === 'USER')
@@ -2,4 +2,4 @@ import { EmployeeProfile } from './employee-profile';
2
2
  import { EmployeeProfileMutation } from './employee-profile-mutation';
3
3
  import { EmployeeProfileQuery } from './employee-profile-query';
4
4
  export declare const entities: (typeof EmployeeProfile)[];
5
- export declare const resolvers: (typeof EmployeeProfileQuery | typeof EmployeeProfileMutation)[];
5
+ export declare const resolvers: (typeof EmployeeProfileMutation | typeof EmployeeProfileQuery)[];
@@ -5,8 +5,8 @@ export * from './employee/working-employees';
5
5
  export * from './employee-profile/employee-profile';
6
6
  export * from './audience/audience';
7
7
  export * from './audience/audience-member';
8
- export declare const entities: (typeof import("./employee-profile/employee-profile").EmployeeProfile | typeof import("./employee/employee").Employee | typeof import("./approval-line/approval-line").ApprovalLine | typeof import("./department/department").Department | typeof import("./department/department-history").DepartmentHistory | typeof import("./employee/employee-history").EmployeeHistory)[];
8
+ export declare const entities: (typeof import("./department/department").Department | typeof import("./employee/employee").Employee | typeof import("./approval-line/approval-line").ApprovalLine | typeof import("./employee-profile/employee-profile").EmployeeProfile | typeof import("./department/department-history").DepartmentHistory | typeof import("./employee/employee-history").EmployeeHistory)[];
9
9
  export declare const subscribers: (typeof import("./department/event-subscriber").DepartmentHistoryEntitySubscriber | typeof import("./employee/event-subscriber").EmployeeHistoryEntitySubscriber)[];
10
10
  export declare const schema: {
11
- resolverClasses: (typeof import("./employee-profile/employee-profile-query").EmployeeProfileQuery | typeof import("./employee-profile/employee-profile-mutation").EmployeeProfileMutation | typeof import("./approval-line/approval-line-query").ApprovalLineQuery | typeof import("./approval-line/approval-line-mutation").ApprovalLineMutation | typeof import("./department/department-query").DepartmentQuery | typeof import("./department/department-mutation").DepartmentMutation | typeof import("./employee/employee-query").EmployeeQuery | typeof import("./employee/employee-mutation").EmployeeMutation)[];
11
+ resolverClasses: (typeof import("./approval-line/approval-line-query").ApprovalLineQuery | typeof import("./approval-line/approval-line-mutation").ApprovalLineMutation | typeof import("./department/department-query").DepartmentQuery | typeof import("./department/department-mutation").DepartmentMutation | typeof import("./employee/employee-query").EmployeeQuery | typeof import("./employee/employee-mutation").EmployeeMutation | typeof import("./employee-profile/employee-profile-mutation").EmployeeProfileMutation | typeof import("./employee-profile/employee-profile-query").EmployeeProfileQuery)[];
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/organization",
3
- "version": "10.1.283",
3
+ "version": "10.1.288",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "files": [
@@ -54,13 +54,13 @@
54
54
  "@operato/p13n": "^10.0.0",
55
55
  "@operato/popup": "^10.15.0",
56
56
  "@operato/shell": "^10.29.69",
57
- "@things-factory/ai-assistant": "^10.1.283",
57
+ "@things-factory/ai-assistant": "^10.1.288",
58
58
  "@things-factory/auth-base": "^10.1.283",
59
- "@things-factory/code-ui": "^10.1.283",
59
+ "@things-factory/code-ui": "^10.1.288",
60
60
  "@things-factory/contact": "^10.1.283",
61
- "@things-factory/pdf": "^10.1.283",
61
+ "@things-factory/pdf": "^10.1.288",
62
62
  "@things-factory/shell": "^10.1.283",
63
63
  "exceljs": "4.2.0"
64
64
  },
65
- "gitHead": "912e4835a175273005bba4a98da160906caa2b40"
65
+ "gitHead": "78eaee46dd9b425ed845b02952b082f35a0faca7"
66
66
  }