placementt-core 1.400.1079 → 1.400.1081

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.
@@ -0,0 +1,67 @@
1
+ import { ActivityLoggingConfig, InstituteData } from "./typeDefinitions";
2
+ /**
3
+ * Whether a student can log activities, and whether we may email them about it.
4
+ *
5
+ * Two different switches are easy to confuse here, so they are named apart:
6
+ *
7
+ * - `trackExtracurriculars` is the PRODUCT. Absent means on, which is right for
8
+ * staff: a school that has never touched the switch still gets the Activities
9
+ * area, its analytics and its Gatsby reporting.
10
+ * - `activityLogging` is the LAUNCH. It is what a school says to its students, and
11
+ * absent means nothing has been said. A feature that appears in a pupil's account
12
+ * unannounced gets used by nobody and asked about by everybody, so a year group
13
+ * sees activity logging only once the school has launched it to them.
14
+ *
15
+ * The launch is per year group and, unless the school says otherwise, per academic
16
+ * year: last year's Year 11 is not this year's Year 11, and a school introducing it
17
+ * to each new cohort in assembly should not find it already live.
18
+ */
19
+ /** Does the school have the Activities area at all? Absent means yes. */
20
+ export declare const activityLoggingProductOn: (institute?: Pick<InstituteData, "trackExtracurriculars">) => boolean;
21
+ /**
22
+ * Does the stored launch still count today?
23
+ *
24
+ * A launch is made for one academic year. With `rollOver` on it carries forward
25
+ * forever; without it, September spends it.
26
+ *
27
+ * @param {ActivityLoggingConfig} [config] the school's launch.
28
+ * @param {Date} [now] the date to judge it against.
29
+ * @return {boolean} whether the year groups below are live.
30
+ */
31
+ export declare const activityLaunchCurrent: (config?: ActivityLoggingConfig, now?: Date) => boolean;
32
+ /**
33
+ * The year groups activity logging is live for right now.
34
+ *
35
+ * @param {InstituteData} [institute] the school.
36
+ * @param {Date} [now] the date to judge the launch against.
37
+ * @return {string[]} the year group tags, empty when nothing is live.
38
+ */
39
+ export declare const activityLoggingLiveYearGroups: (institute?: InstituteData, now?: Date) => string[];
40
+ /**
41
+ * Can THIS student log activities, and may we email them about it?
42
+ *
43
+ * The one gate every student-facing surface asks. A student with no year group on
44
+ * their record is not in a launched year group, so the answer is no — which is the
45
+ * safe way round: they see nothing rather than being shown something their school
46
+ * hasn't announced.
47
+ *
48
+ * @param {InstituteData} [institute] their school.
49
+ * @param {string} [yearGroup] their year group tag, as their record holds it.
50
+ * @param {Date} [now] the date to judge the launch against.
51
+ * @return {boolean} whether activity logging is live for them.
52
+ */
53
+ export declare const activityLoggingLive: (institute?: InstituteData, yearGroup?: string, now?: Date) => boolean;
54
+ /** Where a school's activity logging stands, in the vocabulary the careers year
55
+ * setup uses for every other programme. */
56
+ export type ActivityLoggingState = "unconfigured" | "needsLaunch" | "live";
57
+ /**
58
+ * Has this school launched activity logging, and does the launch still stand?
59
+ *
60
+ * The three answers are the three different things to do about it: ask the setup
61
+ * questions, re-launch a year that has rolled over, or nothing.
62
+ *
63
+ * @param {InstituteData} [institute] the school.
64
+ * @param {Date} [now] the date to judge the launch against.
65
+ * @return {ActivityLoggingState} what is left to do.
66
+ */
67
+ export declare const activityLoggingState: (institute?: InstituteData, now?: Date) => ActivityLoggingState;
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityLoggingState = exports.activityLoggingLive = exports.activityLoggingLiveYearGroups = exports.activityLaunchCurrent = exports.activityLoggingProductOn = void 0;
4
+ const schedule_1 = require("./surveys/schedule");
5
+ /**
6
+ * Whether a student can log activities, and whether we may email them about it.
7
+ *
8
+ * Two different switches are easy to confuse here, so they are named apart:
9
+ *
10
+ * - `trackExtracurriculars` is the PRODUCT. Absent means on, which is right for
11
+ * staff: a school that has never touched the switch still gets the Activities
12
+ * area, its analytics and its Gatsby reporting.
13
+ * - `activityLogging` is the LAUNCH. It is what a school says to its students, and
14
+ * absent means nothing has been said. A feature that appears in a pupil's account
15
+ * unannounced gets used by nobody and asked about by everybody, so a year group
16
+ * sees activity logging only once the school has launched it to them.
17
+ *
18
+ * The launch is per year group and, unless the school says otherwise, per academic
19
+ * year: last year's Year 11 is not this year's Year 11, and a school introducing it
20
+ * to each new cohort in assembly should not find it already live.
21
+ */
22
+ /** Does the school have the Activities area at all? Absent means yes. */
23
+ const activityLoggingProductOn = (institute) => institute?.trackExtracurriculars !== false;
24
+ exports.activityLoggingProductOn = activityLoggingProductOn;
25
+ /**
26
+ * Does the stored launch still count today?
27
+ *
28
+ * A launch is made for one academic year. With `rollOver` on it carries forward
29
+ * forever; without it, September spends it.
30
+ *
31
+ * @param {ActivityLoggingConfig} [config] the school's launch.
32
+ * @param {Date} [now] the date to judge it against.
33
+ * @return {boolean} whether the year groups below are live.
34
+ */
35
+ const activityLaunchCurrent = (config, now = new Date()) => {
36
+ if (!config?.launchedYear)
37
+ return false;
38
+ return Boolean(config.rollOver) || config.launchedYear === (0, schedule_1.academicYearOf)(now);
39
+ };
40
+ exports.activityLaunchCurrent = activityLaunchCurrent;
41
+ /**
42
+ * The year groups activity logging is live for right now.
43
+ *
44
+ * @param {InstituteData} [institute] the school.
45
+ * @param {Date} [now] the date to judge the launch against.
46
+ * @return {string[]} the year group tags, empty when nothing is live.
47
+ */
48
+ const activityLoggingLiveYearGroups = (institute, now = new Date()) => {
49
+ if (!(0, exports.activityLoggingProductOn)(institute))
50
+ return [];
51
+ const config = institute?.activityLogging;
52
+ if (!(0, exports.activityLaunchCurrent)(config, now))
53
+ return [];
54
+ return Object.entries(config?.yearGroups || {}).filter(([, on]) => on).map(([yg]) => yg);
55
+ };
56
+ exports.activityLoggingLiveYearGroups = activityLoggingLiveYearGroups;
57
+ /**
58
+ * Can THIS student log activities, and may we email them about it?
59
+ *
60
+ * The one gate every student-facing surface asks. A student with no year group on
61
+ * their record is not in a launched year group, so the answer is no — which is the
62
+ * safe way round: they see nothing rather than being shown something their school
63
+ * hasn't announced.
64
+ *
65
+ * @param {InstituteData} [institute] their school.
66
+ * @param {string} [yearGroup] their year group tag, as their record holds it.
67
+ * @param {Date} [now] the date to judge the launch against.
68
+ * @return {boolean} whether activity logging is live for them.
69
+ */
70
+ const activityLoggingLive = (institute, yearGroup, now = new Date()) => {
71
+ if (!yearGroup)
72
+ return false;
73
+ if (!(0, exports.activityLoggingProductOn)(institute))
74
+ return false;
75
+ const config = institute?.activityLogging;
76
+ if (!(0, exports.activityLaunchCurrent)(config, now))
77
+ return false;
78
+ return config?.yearGroups?.[yearGroup] === true;
79
+ };
80
+ exports.activityLoggingLive = activityLoggingLive;
81
+ /**
82
+ * Has this school launched activity logging, and does the launch still stand?
83
+ *
84
+ * The three answers are the three different things to do about it: ask the setup
85
+ * questions, re-launch a year that has rolled over, or nothing.
86
+ *
87
+ * @param {InstituteData} [institute] the school.
88
+ * @param {Date} [now] the date to judge the launch against.
89
+ * @return {ActivityLoggingState} what is left to do.
90
+ */
91
+ const activityLoggingState = (institute, now = new Date()) => {
92
+ const config = institute?.activityLogging;
93
+ // Never answered, or answered and launched to nobody — both leave a school with
94
+ // the questions still to answer.
95
+ if (!config?.setupCompletedAt || !Object.values(config.yearGroups || {}).some(Boolean))
96
+ return "unconfigured";
97
+ if ((0, exports.activityLoggingLiveYearGroups)(institute, now).length)
98
+ return "live";
99
+ return "needsLaunch";
100
+ };
101
+ exports.activityLoggingState = activityLoggingState;
102
+ //# sourceMappingURL=activityLogging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activityLogging.js","sourceRoot":"","sources":["../src/activityLogging.ts"],"names":[],"mappings":";;;AACA,iDAAkD;AAElD;;;;;;;;;;;;;;;;GAgBG;AAEH,yEAAyE;AAClE,MAAM,wBAAwB,GAAG,CAAC,SAAwD,EAAW,EAAE,CAC1G,SAAS,EAAE,qBAAqB,KAAK,KAAK,CAAC;AADlC,QAAA,wBAAwB,4BACU;AAE/C;;;;;;;;;GASG;AACI,MAAM,qBAAqB,GAAG,CAAC,MAA8B,EAAE,GAAG,GAAG,IAAI,IAAI,EAAE,EAAW,EAAE;IAC/F,IAAI,CAAC,MAAM,EAAE,YAAY;QAAE,OAAO,KAAK,CAAC;IACxC,OAAO,OAAO,CAAC,MAAM,CAAC,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;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAAC,SAAyB,EAAE,GAAG,GAAG,IAAI,IAAI,EAAE,EAAwB,EAAE;IACtG,MAAM,MAAM,GAAG,SAAS,EAAE,eAAe,CAAC;IAC1C,gFAAgF;IAChF,iCAAiC;IACjC,IAAI,CAAC,MAAM,EAAE,gBAAgB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QAAE,OAAO,cAAc,CAAC;IAC9G,IAAI,IAAA,qCAA6B,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM;QAAE,OAAO,MAAM,CAAC;IACxE,OAAO,aAAa,CAAC;AACzB,CAAC,CAAC;AAPW,QAAA,oBAAoB,wBAO/B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const activityLogging_1 = require("./activityLogging");
4
+ // 1 September is the academic-year boundary the whole platform uses, so a launch
5
+ // made in one year is spent the moment the next one starts.
6
+ const IN_2026_27 = new Date("2026-10-01T09:00:00Z");
7
+ const IN_2027_28 = new Date("2027-10-01T09:00:00Z");
8
+ // The August before 2026-27 starts: still the 2025-26 academic year.
9
+ const AUGUST_2026 = new Date("2026-08-20T09:00:00Z");
10
+ const school = (overrides = {}) => ({
11
+ name: "Calder Park Academy",
12
+ ...overrides,
13
+ });
14
+ const launched = (yearGroups, extra = {}) => school({ activityLogging: {
15
+ setupCompletedAt: "2026-09-02T10:00:00Z",
16
+ launchedYear: "2026-27",
17
+ yearGroups,
18
+ ...extra,
19
+ } });
20
+ describe("activityLoggingProductOn", () => {
21
+ it("is on when the flag is absent, because staff have the area by default", () => {
22
+ expect((0, activityLogging_1.activityLoggingProductOn)(school())).toBe(true);
23
+ });
24
+ it("is on when explicitly true", () => {
25
+ expect((0, activityLogging_1.activityLoggingProductOn)(school({ trackExtracurriculars: true }))).toBe(true);
26
+ });
27
+ it("is off only when explicitly false", () => {
28
+ expect((0, activityLogging_1.activityLoggingProductOn)(school({ trackExtracurriculars: false }))).toBe(false);
29
+ });
30
+ });
31
+ describe("activityLaunchCurrent", () => {
32
+ it("is false with nothing launched", () => {
33
+ expect((0, activityLogging_1.activityLaunchCurrent)(undefined, IN_2026_27)).toBe(false);
34
+ expect((0, activityLogging_1.activityLaunchCurrent)({ yearGroups: { "Year 12": true } }, IN_2026_27)).toBe(false);
35
+ });
36
+ it("holds within the year it was launched for", () => {
37
+ expect((0, activityLogging_1.activityLaunchCurrent)({ launchedYear: "2026-27" }, IN_2026_27)).toBe(true);
38
+ });
39
+ it("is spent by the next academic year", () => {
40
+ expect((0, activityLogging_1.activityLaunchCurrent)({ launchedYear: "2026-27" }, IN_2027_28)).toBe(false);
41
+ });
42
+ it("carries forward when the school asked it to", () => {
43
+ expect((0, activityLogging_1.activityLaunchCurrent)({ launchedYear: "2026-27", rollOver: true }, IN_2027_28)).toBe(true);
44
+ });
45
+ it("counts August as the year that is ending, not the one about to start", () => {
46
+ expect((0, activityLogging_1.activityLaunchCurrent)({ launchedYear: "2025-26" }, AUGUST_2026)).toBe(true);
47
+ expect((0, activityLogging_1.activityLaunchCurrent)({ launchedYear: "2026-27" }, AUGUST_2026)).toBe(false);
48
+ });
49
+ });
50
+ describe("activityLoggingLive", () => {
51
+ it("is live for a launched year group", () => {
52
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": true }), "Year 12", IN_2026_27)).toBe(true);
53
+ });
54
+ it("is not live for a year group left out of the launch", () => {
55
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": true }), "Year 9", IN_2026_27)).toBe(false);
56
+ });
57
+ it("is not live for a year group switched off", () => {
58
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": false }), "Year 12", IN_2026_27)).toBe(false);
59
+ });
60
+ it("is not live for a student with no year group on their record", () => {
61
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": true }), undefined, IN_2026_27)).toBe(false);
62
+ });
63
+ it("stops at the new academic year unless the launch rolls over", () => {
64
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": true }), "Year 12", IN_2027_28)).toBe(false);
65
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Year 12": true }, { rollOver: true }), "Year 12", IN_2027_28)).toBe(true);
66
+ });
67
+ it("is never live when the product itself is off, whatever the launch says", () => {
68
+ const off = launched({ "Year 12": true });
69
+ off.trackExtracurriculars = false;
70
+ expect((0, activityLogging_1.activityLoggingLive)(off, "Year 12", IN_2026_27)).toBe(false);
71
+ });
72
+ it("matches the school's own year tag verbatim rather than normalising it", () => {
73
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Yr 12 (KS5)": true }), "Yr 12 (KS5)", IN_2026_27)).toBe(true);
74
+ expect((0, activityLogging_1.activityLoggingLive)(launched({ "Yr 12 (KS5)": true }), "Year 12", IN_2026_27)).toBe(false);
75
+ });
76
+ });
77
+ describe("activityLoggingLiveYearGroups", () => {
78
+ it("lists only the year groups switched on", () => {
79
+ expect((0, activityLogging_1.activityLoggingLiveYearGroups)(launched({ "Year 9": true, "Year 10": false, "Year 12": true }), IN_2026_27))
80
+ .toEqual(["Year 9", "Year 12"]);
81
+ });
82
+ it("is empty once the launch is spent", () => {
83
+ expect((0, activityLogging_1.activityLoggingLiveYearGroups)(launched({ "Year 9": true }), IN_2027_28)).toEqual([]);
84
+ });
85
+ });
86
+ describe("activityLoggingState", () => {
87
+ it("is unconfigured before the school has answered the setup", () => {
88
+ expect((0, activityLogging_1.activityLoggingState)(school(), IN_2026_27)).toBe("unconfigured");
89
+ });
90
+ it("is unconfigured when setup was answered but nobody was launched to", () => {
91
+ expect((0, activityLogging_1.activityLoggingState)(launched({ "Year 9": false }), IN_2026_27)).toBe("unconfigured");
92
+ });
93
+ it("is live while a launch stands", () => {
94
+ expect((0, activityLogging_1.activityLoggingState)(launched({ "Year 9": true }), IN_2026_27)).toBe("live");
95
+ });
96
+ it("asks for a new launch once the year has rolled over", () => {
97
+ expect((0, activityLogging_1.activityLoggingState)(launched({ "Year 9": true }), IN_2027_28)).toBe("needsLaunch");
98
+ });
99
+ it("stays live across years when the school said it should", () => {
100
+ expect((0, activityLogging_1.activityLoggingState)(launched({ "Year 9": true }, { rollOver: true }), IN_2027_28)).toBe("live");
101
+ });
102
+ });
103
+ //# sourceMappingURL=activityLogging.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activityLogging.test.js","sourceRoot":"","sources":["../src/activityLogging.test.ts"],"names":[],"mappings":";;AACA,uDAM2B;AAE3B,iFAAiF;AACjF,4DAA4D;AAC5D,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACpD,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACpD,qEAAqE;AACrE,MAAM,WAAW,GAAG,IAAI,IAAI,CAAC,sBAAsB,CAAC,CAAC;AAErD,MAAM,MAAM,GAAG,CAAC,YAAoC,EAAE,EAAiB,EAAE,CAAC,CAAC;IACvE,IAAI,EAAE,qBAAqB;IAC3B,GAAG,SAAS;CACG,CAAA,CAAC;AAEpB,MAAM,QAAQ,GAAG,CAAC,UAAmC,EAAE,QAAgE,EAAE,EAAE,EAAE,CACzH,MAAM,CAAC,EAAC,eAAe,EAAE;QACrB,gBAAgB,EAAE,sBAAsB;QACxC,YAAY,EAAE,SAAS;QACvB,UAAU;QACV,GAAG,KAAK;KACX,EAAC,CAAC,CAAC;AAER,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACtC,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAC7E,MAAM,CAAC,IAAA,0CAAwB,EAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;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AM,CAAC,IAAA,sCAAoB,EAAC,QAAQ,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,IAAA,sCAAoB,EAAC,QAAQ,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;QAC9D,MAAM,CAAC,IAAA,sCAAoB,EAAC,QAAQ,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE,EAAC,QAAQ,EAAE,IAAI,EAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxG,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Contract for launching activity logging to students
4
+ * (`Placementt-Backend/functions/src/activityLogging.ts`).
5
+ *
6
+ * Launching is a callable rather than a client write for one reason: it emails
7
+ * pupils. Which year groups a school has told about activity logging decides who
8
+ * gets that email, so the list and the send have to be the same act, checked in one
9
+ * place — a client that could write the year groups itself could mail a school's
10
+ * whole roll by editing one document.
11
+ */
12
+ export declare const activityLoggingCallables: {
13
+ "activityLogging-launchActivityLogging": {
14
+ request: z.ZodObject<{
15
+ oId: z.ZodString;
16
+ /** Every year group tag the school wants live, exactly as its MIS writes
17
+ * them. The stored map is replaced by this list, so a tag left out is a
18
+ * year group switched off. */
19
+ yearGroups: z.ZodArray<z.ZodString, "many">;
20
+ /** Whether the launch carries into each new academic year, or has to be
21
+ * made again every September. */
22
+ rollOver: z.ZodOptional<z.ZodBoolean>;
23
+ /** Skip the announcement email. For a school switching a year group off,
24
+ * correcting a tag, or turning rollOver on and off — none of which is
25
+ * news a pupil needs. Newly launched year groups are emailed otherwise. */
26
+ silent: z.ZodOptional<z.ZodBoolean>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ oId: string;
29
+ yearGroups: string[];
30
+ silent?: boolean | undefined;
31
+ rollOver?: boolean | undefined;
32
+ }, {
33
+ oId: string;
34
+ yearGroups: string[];
35
+ silent?: boolean | undefined;
36
+ rollOver?: boolean | undefined;
37
+ }>;
38
+ response: z.ZodObject<{
39
+ launched: z.ZodBoolean;
40
+ academicYear: z.ZodString;
41
+ /** Year groups live after this call. */
42
+ yearGroups: z.ZodArray<z.ZodString, "many">;
43
+ /** How many students were emailed. Zero on a silent launch, and on one
44
+ * that only switched year groups off. */
45
+ emailed: z.ZodNumber;
46
+ }, "strip", z.ZodTypeAny, {
47
+ yearGroups: string[];
48
+ academicYear: string;
49
+ launched: boolean;
50
+ emailed: number;
51
+ }, {
52
+ yearGroups: string[];
53
+ academicYear: string;
54
+ launched: boolean;
55
+ emailed: number;
56
+ }>;
57
+ };
58
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.activityLoggingCallables = void 0;
4
+ const zod_1 = require("zod");
5
+ /**
6
+ * Contract for launching activity logging to students
7
+ * (`Placementt-Backend/functions/src/activityLogging.ts`).
8
+ *
9
+ * Launching is a callable rather than a client write for one reason: it emails
10
+ * pupils. Which year groups a school has told about activity logging decides who
11
+ * gets that email, so the list and the send have to be the same act, checked in one
12
+ * place — a client that could write the year groups itself could mail a school's
13
+ * whole roll by editing one document.
14
+ */
15
+ exports.activityLoggingCallables = {
16
+ "activityLogging-launchActivityLogging": {
17
+ request: zod_1.z.object({
18
+ oId: zod_1.z.string(),
19
+ /** Every year group tag the school wants live, exactly as its MIS writes
20
+ * them. The stored map is replaced by this list, so a tag left out is a
21
+ * year group switched off. */
22
+ yearGroups: zod_1.z.array(zod_1.z.string()),
23
+ /** Whether the launch carries into each new academic year, or has to be
24
+ * made again every September. */
25
+ rollOver: zod_1.z.boolean().optional(),
26
+ /** Skip the announcement email. For a school switching a year group off,
27
+ * correcting a tag, or turning rollOver on and off — none of which is
28
+ * news a pupil needs. Newly launched year groups are emailed otherwise. */
29
+ silent: zod_1.z.boolean().optional(),
30
+ }),
31
+ response: zod_1.z.object({
32
+ launched: zod_1.z.boolean(),
33
+ academicYear: zod_1.z.string(),
34
+ /** Year groups live after this call. */
35
+ yearGroups: zod_1.z.array(zod_1.z.string()),
36
+ /** How many students were emailed. Zero on a silent launch, and on one
37
+ * that only switched year groups off. */
38
+ emailed: zod_1.z.number(),
39
+ }),
40
+ },
41
+ };
42
+ //# sourceMappingURL=activityLogging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activityLogging.js","sourceRoot":"","sources":["../../src/callables/activityLogging.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAGtB;;;;;;;;;GASG;AACU,QAAA,wBAAwB,GAAG;IACpC,uCAAuC,EAAE;QACrC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf;;0CAE8B;YAC9B,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;YAC/B;6CACiC;YACjC,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;YAChC;;uFAE2E;YAC3E,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;SACjC,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE;YACrB,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;YACxB,wCAAwC;YACxC,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC;YAC/B;qDACyC;YACzC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE;SACtB,CAAC;KACL;CACoB,CAAC"}
@@ -6,3 +6,5 @@ export * from "./events";
6
6
  export * from "./jobRoles";
7
7
  export * from "./apprenticeships";
8
8
  export * from "./he";
9
+ export * from "./nextSteps";
10
+ export * from "./activityLogging";
@@ -22,4 +22,6 @@ __exportStar(require("./events"), exports);
22
22
  __exportStar(require("./jobRoles"), exports);
23
23
  __exportStar(require("./apprenticeships"), exports);
24
24
  __exportStar(require("./he"), exports);
25
+ __exportStar(require("./nextSteps"), exports);
26
+ __exportStar(require("./activityLogging"), exports);
25
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/callables/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,uDAAqC;AACrC,8CAA4B;AAC5B,2CAAyB;AACzB,6CAA2B;AAC3B,oDAAkC;AAClC,uCAAqB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/callables/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,6CAA2B;AAC3B,uDAAqC;AACrC,8CAA4B;AAC5B,2CAAyB;AACzB,6CAA2B;AAC3B,oDAAkC;AAClC,uCAAqB;AACrB,8CAA4B;AAC5B,oDAAkC"}