@things-factory/organization 10.1.215 → 10.1.222
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-client/bootstrap.js +3 -0
- package/dist-client/bootstrap.js.map +1 -1
- package/dist-client/my-picture-model.d.ts +16 -0
- package/dist-client/my-picture-model.js +5 -0
- package/dist-client/my-picture-model.js.map +1 -0
- package/dist-client/my-picture.d.ts +8 -0
- package/dist-client/my-picture.js +38 -0
- package/dist-client/my-picture.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/audience/audience-member.d.ts +29 -0
- package/dist-server/service/audience/audience-member.js +84 -0
- package/dist-server/service/audience/audience-member.js.map +1 -0
- package/dist-server/service/audience/audience.d.ts +43 -0
- package/dist-server/service/audience/audience.js +81 -0
- package/dist-server/service/audience/audience.js.map +1 -0
- package/dist-server/service/index.d.ts +2 -0
- package/dist-server/service/index.js +2 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/tests/audience.test.ts +85 -0
- package/tests/my-picture.test.ts +21 -0
package/dist-client/bootstrap.js
CHANGED
|
@@ -12,9 +12,12 @@ import { GristEditorApprovalLine } from './grist-editor/grist-editor-approval-li
|
|
|
12
12
|
import { GristRendererApprovalLine } from './grist-editor/grist-renderer-approval-line';
|
|
13
13
|
import { registerDepartmentKind } from './entity360/department-360.js';
|
|
14
14
|
import { registerPersonMembershipSection } from './entity360/person-membership-section.js';
|
|
15
|
+
import { loadMyPicture } from './my-picture.js';
|
|
15
16
|
export default function bootstrap() {
|
|
16
17
|
registerDepartmentKind();
|
|
17
18
|
registerPersonMembershipSection();
|
|
19
|
+
/* The header's avatar shows the person's own picture (the avatar is apptool-ui's, the face is the roster's). */
|
|
20
|
+
loadMyPicture();
|
|
18
21
|
/* register grist renderer/editor for id */
|
|
19
22
|
registerEditor('department-object', GristEditorDepartmentObject);
|
|
20
23
|
registerEditor('approval-line', GristEditorApprovalLine);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AAEnF,OAAO,EAAE,6BAA6B,EAAE,MAAM,iDAAiD,CAAA;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAA;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAA;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAA;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAA;AAClF,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAA;AACvF,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAA;
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../client/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAA;AAE9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAA;AAEnF,O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,QAAQ,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACxD,sBAAsB,CAAC,iBAAiB,EAAE,CAAC,oBAAoB,CAAC,CAAC,CAAA;IACjE,sBAAsB,CAAC,mBAAmB,EAAE,CAAC,sBAAsB,CAAC,CAAC,CAAA;AACvE,CAAC","sourcesContent":["import { registerEditor, registerRenderer, registerFilterRenderer } from '@operato/data-grist'\n\nimport { FilterResourceCode } from '@operato/app/filters-form/filter-resource-code.js'\nimport { FilterResourceObject } from '@operato/app/filters-form/filter-resource-object.js'\nimport { FilterDepartmentObject } from './filters-form/filter-department-object.js'\n\nimport { GristRendererDepartmentObject } from './grist-editor/grist-renderer-department-object'\nimport { GristEditorDepartmentObject } from './grist-editor/grist-editor-department-object'\nimport { GristEditorAssignees } from './grist-editor/grist-editor-assignees'\nimport { GristRendererAssignees } from './grist-editor/grist-renderer-assignees'\nimport { GristEditorRecipients } from './grist-editor/grist-editor-recipients'\nimport { GristRendererRecipients } from './grist-editor/grist-renderer-recipients'\nimport { GristEditorApprovalLine } from './grist-editor/grist-editor-approval-line'\nimport { GristRendererApprovalLine } from './grist-editor/grist-renderer-approval-line'\nimport { registerDepartmentKind } from './entity360/department-360.js'\nimport { registerPersonMembershipSection } from './entity360/person-membership-section.js'\nimport { loadMyPicture } from './my-picture.js'\n\nexport default function bootstrap() {\n registerDepartmentKind()\n registerPersonMembershipSection()\n\n /* The header's avatar shows the person's own picture (the avatar is apptool-ui's, the face is the roster's). */\n loadMyPicture()\n\n /* register grist renderer/editor for id */\n registerEditor('department-object', GristEditorDepartmentObject)\n registerEditor('approval-line', GristEditorApprovalLine)\n registerEditor('assignees', GristEditorAssignees)\n registerEditor('recipients', GristEditorRecipients)\n\n registerRenderer('department-object', GristRendererDepartmentObject)\n registerRenderer('approval-line', GristRendererApprovalLine)\n registerRenderer('assignees', GristRendererAssignees)\n registerRenderer('recipients', GristRendererRecipients)\n\n registerFilterRenderer('code', [FilterResourceCode])\n registerFilterRenderer('object', [FilterResourceObject])\n registerFilterRenderer('resource-object', [FilterResourceObject])\n registerFilterRenderer('department-object', [FilterDepartmentObject])\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which picture is the signed-in person's - kept apart from the query so a test can reach it.
|
|
3
|
+
*
|
|
4
|
+
* A person may hold more than one employee record in a domain (`myEmployees` says why), and a record
|
|
5
|
+
* has a picture only through its contact. The first record that has one is the face; none means the
|
|
6
|
+
* header draws a monogram.
|
|
7
|
+
*/
|
|
8
|
+
export type Pfp = {
|
|
9
|
+
picture?: string;
|
|
10
|
+
left?: number;
|
|
11
|
+
top?: number;
|
|
12
|
+
zoom?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function pictureOf(employees: readonly {
|
|
15
|
+
profile?: Pfp | null;
|
|
16
|
+
}[] | null | undefined): Pfp | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function pictureOf(employees) {
|
|
2
|
+
const profile = (employees || []).find(employee => employee?.profile?.picture)?.profile;
|
|
3
|
+
return profile ? { picture: profile.picture, left: profile.left, top: profile.top, zoom: profile.zoom } : null;
|
|
4
|
+
}
|
|
5
|
+
//# sourceMappingURL=my-picture-model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-picture-model.js","sourceRoot":"","sources":["../client/my-picture-model.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,SAAS,CAAC,SAAiE;IACzF,MAAM,OAAO,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAA;IAEvF,OAAO,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAChH,CAAC","sourcesContent":["/**\n * Which picture is the signed-in person's - kept apart from the query so a test can reach it.\n *\n * A person may hold more than one employee record in a domain (`myEmployees` says why), and a record\n * has a picture only through its contact. The first record that has one is the face; none means the\n * header draws a monogram.\n */\nexport type Pfp = { picture?: string; left?: number; top?: number; zoom?: number }\n\nexport function pictureOf(employees: readonly { profile?: Pfp | null }[] | null | undefined): Pfp | null {\n const profile = (employees || []).find(employee => employee?.profile?.picture)?.profile\n\n return profile ? { picture: profile.picture, left: profile.left, top: profile.top, zoom: profile.zoom } : null\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The signed-in person's face, for the avatar at the right end of the header.
|
|
3
|
+
*
|
|
4
|
+
* The roster knows it: an employee's picture is its contact's pfp. Read through `myEmployees`, which
|
|
5
|
+
* asks no privilege - who one is is not a fact to hide from oneself. Asked again on each profile,
|
|
6
|
+
* so a domain switch shows that domain's record.
|
|
7
|
+
*/
|
|
8
|
+
export declare function loadMyPicture(): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import gql from 'graphql-tag';
|
|
2
|
+
import { client } from '@operato/graphql';
|
|
3
|
+
import { store } from '@operato/shell';
|
|
4
|
+
import { auth } from '@things-factory/auth-base/dist-client/auth.js';
|
|
5
|
+
import { SET_PICTURE } from '@things-factory/auth-base/dist-client/actions/auth.js';
|
|
6
|
+
import { pictureOf } from './my-picture-model.js';
|
|
7
|
+
/**
|
|
8
|
+
* The signed-in person's face, for the avatar at the right end of the header.
|
|
9
|
+
*
|
|
10
|
+
* The roster knows it: an employee's picture is its contact's pfp. Read through `myEmployees`, which
|
|
11
|
+
* asks no privilege - who one is is not a fact to hide from oneself. Asked again on each profile,
|
|
12
|
+
* so a domain switch shows that domain's record.
|
|
13
|
+
*/
|
|
14
|
+
export function loadMyPicture() {
|
|
15
|
+
auth.on('profile', async () => {
|
|
16
|
+
try {
|
|
17
|
+
const response = await client.query({
|
|
18
|
+
query: gql `
|
|
19
|
+
query {
|
|
20
|
+
myEmployees {
|
|
21
|
+
profile {
|
|
22
|
+
picture
|
|
23
|
+
left
|
|
24
|
+
top
|
|
25
|
+
zoom
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
`
|
|
30
|
+
});
|
|
31
|
+
store.dispatch({ type: SET_PICTURE, picture: pictureOf(response.data?.myEmployees) });
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
/* No picture is a monogram, not an error - the header still works without one. */
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=my-picture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-picture.js","sourceRoot":"","sources":["../client/my-picture.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,aAAa,CAAA;AAE7B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,+CAA+C,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,uDAAuD,CAAA;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEjD;;;;;;GAMG;AACH,MAAM,UAAU,aAAa;IAC3B,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;QAC5B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC;gBAClC,KAAK,EAAE,GAAG,CAAA;;;;;;;;;;;SAWT;aACF,CAAC,CAAA;YAEF,KAAK,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,CAAC,CAAA;QACvF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,kFAAkF;QACpF,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import gql from 'graphql-tag'\n\nimport { client } from '@operato/graphql'\nimport { store } from '@operato/shell'\n\nimport { auth } from '@things-factory/auth-base/dist-client/auth.js'\nimport { SET_PICTURE } from '@things-factory/auth-base/dist-client/actions/auth.js'\n\nimport { pictureOf } from './my-picture-model.js'\n\n/**\n * The signed-in person's face, for the avatar at the right end of the header.\n *\n * The roster knows it: an employee's picture is its contact's pfp. Read through `myEmployees`, which\n * asks no privilege - who one is is not a fact to hide from oneself. Asked again on each profile,\n * so a domain switch shows that domain's record.\n */\nexport function loadMyPicture() {\n auth.on('profile', async () => {\n try {\n const response = await client.query({\n query: gql`\n query {\n myEmployees {\n profile {\n picture\n left\n top\n zoom\n }\n }\n }\n `\n })\n\n store.dispatch({ type: SET_PICTURE, picture: pictureOf(response.data?.myEmployees) })\n } catch (e) {\n /* No picture is a monogram, not an error - the header still works without one. */\n }\n })\n}\n"]}
|