placementt-core 1.400.1270 → 1.400.1272
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/lib/callables/registry.d.ts +76 -0
- package/lib/callables/wonde.d.ts +45 -0
- package/lib/callables/wonde.js +19 -0
- package/lib/callables/wonde.js.map +1 -1
- package/lib/exportTransformers.js +1 -1
- package/lib/exportTransformers.js.map +1 -1
- package/lib/typeDefinitions.d.ts +8 -0
- package/lib/typeDefinitions.js.map +1 -1
- package/lib/workflows.d.ts +19 -3
- package/lib/workflows.js +24 -6
- package/lib/workflows.js.map +1 -1
- package/lib/workflows.test.d.ts +1 -0
- package/lib/workflows.test.js +36 -0
- package/lib/workflows.test.js.map +1 -0
- package/package.json +1 -1
- package/src/callables/wonde.ts +19 -0
- package/src/exportTransformers.ts +1 -1
- package/src/typeDefinitions.ts +2 -0
- package/src/workflows.test.ts +44 -0
- package/src/workflows.ts +28 -7
|
@@ -1858,6 +1858,44 @@ export declare const allCallables: {
|
|
|
1858
1858
|
}[];
|
|
1859
1859
|
}>;
|
|
1860
1860
|
};
|
|
1861
|
+
"wonde-transferStudent": {
|
|
1862
|
+
request: z.ZodObject<{
|
|
1863
|
+
uid: z.ZodString;
|
|
1864
|
+
toOId: z.ZodString;
|
|
1865
|
+
cohort: z.ZodOptional<z.ZodString>;
|
|
1866
|
+
}, "strip", z.ZodTypeAny, {
|
|
1867
|
+
uid: string;
|
|
1868
|
+
toOId: string;
|
|
1869
|
+
cohort?: string | undefined;
|
|
1870
|
+
}, {
|
|
1871
|
+
uid: string;
|
|
1872
|
+
toOId: string;
|
|
1873
|
+
cohort?: string | undefined;
|
|
1874
|
+
}>;
|
|
1875
|
+
response: z.ZodObject<{
|
|
1876
|
+
ok: z.ZodLiteral<true>;
|
|
1877
|
+
}, "strip", z.ZodTypeAny, {
|
|
1878
|
+
ok: true;
|
|
1879
|
+
}, {
|
|
1880
|
+
ok: true;
|
|
1881
|
+
}>;
|
|
1882
|
+
};
|
|
1883
|
+
"wonde-undoTransfer": {
|
|
1884
|
+
request: z.ZodObject<{
|
|
1885
|
+
uid: z.ZodString;
|
|
1886
|
+
}, "strip", z.ZodTypeAny, {
|
|
1887
|
+
uid: string;
|
|
1888
|
+
}, {
|
|
1889
|
+
uid: string;
|
|
1890
|
+
}>;
|
|
1891
|
+
response: z.ZodObject<{
|
|
1892
|
+
ok: z.ZodLiteral<true>;
|
|
1893
|
+
}, "strip", z.ZodTypeAny, {
|
|
1894
|
+
ok: true;
|
|
1895
|
+
}, {
|
|
1896
|
+
ok: true;
|
|
1897
|
+
}>;
|
|
1898
|
+
};
|
|
1861
1899
|
"e2e-redeemSignInLink": {
|
|
1862
1900
|
request: z.ZodObject<{
|
|
1863
1901
|
token: z.ZodString;
|
|
@@ -6123,6 +6161,44 @@ export declare const callableGroups: {
|
|
|
6123
6161
|
}[];
|
|
6124
6162
|
}>;
|
|
6125
6163
|
};
|
|
6164
|
+
"wonde-transferStudent": {
|
|
6165
|
+
request: z.ZodObject<{
|
|
6166
|
+
uid: z.ZodString;
|
|
6167
|
+
toOId: z.ZodString;
|
|
6168
|
+
cohort: z.ZodOptional<z.ZodString>;
|
|
6169
|
+
}, "strip", z.ZodTypeAny, {
|
|
6170
|
+
uid: string;
|
|
6171
|
+
toOId: string;
|
|
6172
|
+
cohort?: string | undefined;
|
|
6173
|
+
}, {
|
|
6174
|
+
uid: string;
|
|
6175
|
+
toOId: string;
|
|
6176
|
+
cohort?: string | undefined;
|
|
6177
|
+
}>;
|
|
6178
|
+
response: z.ZodObject<{
|
|
6179
|
+
ok: z.ZodLiteral<true>;
|
|
6180
|
+
}, "strip", z.ZodTypeAny, {
|
|
6181
|
+
ok: true;
|
|
6182
|
+
}, {
|
|
6183
|
+
ok: true;
|
|
6184
|
+
}>;
|
|
6185
|
+
};
|
|
6186
|
+
"wonde-undoTransfer": {
|
|
6187
|
+
request: z.ZodObject<{
|
|
6188
|
+
uid: z.ZodString;
|
|
6189
|
+
}, "strip", z.ZodTypeAny, {
|
|
6190
|
+
uid: string;
|
|
6191
|
+
}, {
|
|
6192
|
+
uid: string;
|
|
6193
|
+
}>;
|
|
6194
|
+
response: z.ZodObject<{
|
|
6195
|
+
ok: z.ZodLiteral<true>;
|
|
6196
|
+
}, "strip", z.ZodTypeAny, {
|
|
6197
|
+
ok: true;
|
|
6198
|
+
}, {
|
|
6199
|
+
ok: true;
|
|
6200
|
+
}>;
|
|
6201
|
+
};
|
|
6126
6202
|
};
|
|
6127
6203
|
misSyncCallables: {
|
|
6128
6204
|
"misSync-saveConfig": {
|
package/lib/callables/wonde.d.ts
CHANGED
|
@@ -294,4 +294,49 @@ export declare const wondeCallables: {
|
|
|
294
294
|
}[];
|
|
295
295
|
}>;
|
|
296
296
|
};
|
|
297
|
+
/**
|
|
298
|
+
* Admin only. Moves a student's account to another school in the same trust,
|
|
299
|
+
* so that school's Wonde sync picks them up. Only the user doc changes; the old
|
|
300
|
+
* oId and cohort are kept in `transferredFrom` for undo.
|
|
301
|
+
*/
|
|
302
|
+
"wonde-transferStudent": {
|
|
303
|
+
request: z.ZodObject<{
|
|
304
|
+
uid: z.ZodString;
|
|
305
|
+
toOId: z.ZodString;
|
|
306
|
+
/** A cohort at the new school, or none. */
|
|
307
|
+
cohort: z.ZodOptional<z.ZodString>;
|
|
308
|
+
}, "strip", z.ZodTypeAny, {
|
|
309
|
+
uid: string;
|
|
310
|
+
toOId: string;
|
|
311
|
+
cohort?: string | undefined;
|
|
312
|
+
}, {
|
|
313
|
+
uid: string;
|
|
314
|
+
toOId: string;
|
|
315
|
+
cohort?: string | undefined;
|
|
316
|
+
}>;
|
|
317
|
+
response: z.ZodObject<{
|
|
318
|
+
ok: z.ZodLiteral<true>;
|
|
319
|
+
}, "strip", z.ZodTypeAny, {
|
|
320
|
+
ok: true;
|
|
321
|
+
}, {
|
|
322
|
+
ok: true;
|
|
323
|
+
}>;
|
|
324
|
+
};
|
|
325
|
+
/** Admin only. Moves a transferred student back to the school in `transferredFrom`. */
|
|
326
|
+
"wonde-undoTransfer": {
|
|
327
|
+
request: z.ZodObject<{
|
|
328
|
+
uid: z.ZodString;
|
|
329
|
+
}, "strip", z.ZodTypeAny, {
|
|
330
|
+
uid: string;
|
|
331
|
+
}, {
|
|
332
|
+
uid: string;
|
|
333
|
+
}>;
|
|
334
|
+
response: z.ZodObject<{
|
|
335
|
+
ok: z.ZodLiteral<true>;
|
|
336
|
+
}, "strip", z.ZodTypeAny, {
|
|
337
|
+
ok: true;
|
|
338
|
+
}, {
|
|
339
|
+
ok: true;
|
|
340
|
+
}>;
|
|
341
|
+
};
|
|
297
342
|
};
|
package/lib/callables/wonde.js
CHANGED
|
@@ -87,5 +87,24 @@ exports.wondeCallables = {
|
|
|
87
87
|
})),
|
|
88
88
|
}),
|
|
89
89
|
},
|
|
90
|
+
/**
|
|
91
|
+
* Admin only. Moves a student's account to another school in the same trust,
|
|
92
|
+
* so that school's Wonde sync picks them up. Only the user doc changes; the old
|
|
93
|
+
* oId and cohort are kept in `transferredFrom` for undo.
|
|
94
|
+
*/
|
|
95
|
+
"wonde-transferStudent": {
|
|
96
|
+
request: zod_1.z.object({
|
|
97
|
+
uid: zod_1.z.string().min(1),
|
|
98
|
+
toOId: zod_1.z.string().min(1),
|
|
99
|
+
/** A cohort at the new school, or none. */
|
|
100
|
+
cohort: zod_1.z.string().min(1).optional(),
|
|
101
|
+
}),
|
|
102
|
+
response: zod_1.z.object({ ok: zod_1.z.literal(true) }),
|
|
103
|
+
},
|
|
104
|
+
/** Admin only. Moves a transferred student back to the school in `transferredFrom`. */
|
|
105
|
+
"wonde-undoTransfer": {
|
|
106
|
+
request: zod_1.z.object({ uid: zod_1.z.string().min(1) }),
|
|
107
|
+
response: zod_1.z.object({ ok: zod_1.z.literal(true) }),
|
|
108
|
+
},
|
|
90
109
|
};
|
|
91
110
|
//# sourceMappingURL=wonde.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wonde.js","sourceR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|
if (!cohort?.workflowId)
|
|
22
22
|
return value;
|
|
23
23
|
const workflowConfig = await fetcher.getDocData(["workflows", cohort.workflowId]).catch(() => null);
|
|
24
|
-
return (0, workflows_1.applyWorkflowOverrides)(workflowConfig
|
|
24
|
+
return (0, workflows_1.applyWorkflowOverrides)(workflowConfig ?? undefined, cohort.workflowOverrides).find(s => s.id === value)?.name ?? value;
|
|
25
25
|
},
|
|
26
26
|
resolveActivityTitles: async (fetcher, value, item, params) => {
|
|
27
27
|
const activityIds = value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exportTransformers.js","sourceRoot":"","sources":["../src/exportTransformers.ts"],"names":[],"mappings":";;;AAAA,6CAAsE;AAEtE,2CAAmD;AACnD,+CAAmE;AAStD,QAAA,kBAAkB,GAAwC;IACnE,iBAAiB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,IAAA,2BAAiB,EAAC,KAA6B,CAAC;IAE9F,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,CAAC,IAAA,uBAAa,EAAC,KAA6B,CAAC;IAEzF,iBAAiB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;QACxC,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,UAAU,CAAa,CAAC,SAAS,EAAE,KAAe,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QACpG,OAAO,MAAM,EAAE,IAAI,IAAI,KAAK,CAAC;IACjC,CAAC;IAED,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACrD,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAgB,CAAC;QACvC,IAAI,CAAC,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5B,MAAM,MAAM,GAAG,MAAM,OAAO,C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AAO,CAAC,GAAG,CAChC,WAAW,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACzB,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,UAAU,CAAmB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;YACrG,OAAO,GAAG,IAAI,IAAA,8BAAiB,EAAC,EAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAC,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC,CACL,CAAC;QACF,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzE,CAAC;CACJ,CAAC"}
|
package/lib/typeDefinitions.d.ts
CHANGED
|
@@ -621,6 +621,14 @@ export type UserData = {
|
|
|
621
621
|
activationCode: number;
|
|
622
622
|
cohort?: string;
|
|
623
623
|
schoolId?: string;
|
|
624
|
+
/** Set when an admin moved a dual registered pupil to another school in their trust. The old school-specific fields, for undo. */
|
|
625
|
+
transferredFrom?: {
|
|
626
|
+
oId: string;
|
|
627
|
+
cohort: string | null;
|
|
628
|
+
schoolId: string | null;
|
|
629
|
+
at: string;
|
|
630
|
+
by: string;
|
|
631
|
+
};
|
|
624
632
|
cohortData?: CohortData;
|
|
625
633
|
dismissedTasks?: string[];
|
|
626
634
|
dismissedTutorials?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeDefinitions.js","sourceRoot":"","sources":["../src/typeDefinitions.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"typeDefinitions.js","sourceRoot":"","sources":["../src/typeDefinitions.ts"],"names":[],"mappings":";;;AA01IA,sDASC;AAeD,oD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Id: (institute?: Pick<InstituteData, "trustLin
|
|
|
17
17
|
export declare const trustWorkflows: (workflows?: {
|
|
18
18
|
[id: string]: WorkflowConfig;
|
|
19
19
|
}, trustId?: string) => [string, WorkflowConfig][];
|
|
20
|
-
export declare const workflowEditPolicy: (workflow?: WorkflowConfig) => WorkflowEditPolicy;
|
|
21
|
-
/**
|
|
22
|
-
|
|
20
|
+
export declare const workflowEditPolicy: (workflow?: Pick<WorkflowConfig, "trust" | "editPolicy">) => WorkflowEditPolicy;
|
|
21
|
+
/**
|
|
22
|
+
* Layer a school's per-stage forms/files overrides onto the workflow they were made on.
|
|
23
|
+
*
|
|
24
|
+
* Takes the workflow DOC, not its stages, because the trust's edit policy decides how an
|
|
25
|
+
* override combines with the stage, and it is applied here - every time the workflow is
|
|
26
|
+
* read - rather than only when the school saved. An override holds a stage's whole
|
|
27
|
+
* forms/files list as it stood then, so applying it as-is would let it outlive the
|
|
28
|
+
* trust's later edits: a form the trust adds to an "add only" stage would never reach a
|
|
29
|
+
* school that had added one of its own, and switching to "locked" would leave the
|
|
30
|
+
* school's additions in place. Through enforceEditPolicy, "add" is the trust's current
|
|
31
|
+
* list plus the school's own, "locked" is the trust's list alone, and "open" (and any
|
|
32
|
+
* workflow that isn't a trust's) is the school's list as saved.
|
|
33
|
+
*
|
|
34
|
+
* @param {Pick<WorkflowConfig, "workflow"|"trust"|"editPolicy">|undefined} config the workflow doc the overrides sit on.
|
|
35
|
+
* @param {WorkflowOverrides} overrides the cohort's or group's per-stage overrides.
|
|
36
|
+
* @return {WorkflowStage[]} the stages the cohort runs on.
|
|
37
|
+
*/
|
|
38
|
+
export declare function applyWorkflowOverrides(config: Pick<WorkflowConfig, "workflow" | "trust" | "editPolicy"> | undefined, overrides?: WorkflowOverrides): WorkflowStage[];
|
|
23
39
|
/** Reduce an edited workflow back to just the stages whose forms/files differ from the base. */
|
|
24
40
|
export declare function diffWorkflowOverrides(base: WorkflowStage[], edited: WorkflowStage[]): WorkflowOverrides;
|
|
25
41
|
/**
|
package/lib/workflows.js
CHANGED
|
@@ -30,18 +30,36 @@ const trustWorkflows = (workflows, trustId) => Object.entries(workflows || {}).f
|
|
|
30
30
|
exports.trustWorkflows = trustWorkflows;
|
|
31
31
|
const workflowEditPolicy = (workflow) => (workflow?.trust ? workflow.editPolicy || "open" : "open");
|
|
32
32
|
exports.workflowEditPolicy = workflowEditPolicy;
|
|
33
|
-
/**
|
|
34
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Layer a school's per-stage forms/files overrides onto the workflow they were made on.
|
|
35
|
+
*
|
|
36
|
+
* Takes the workflow DOC, not its stages, because the trust's edit policy decides how an
|
|
37
|
+
* override combines with the stage, and it is applied here - every time the workflow is
|
|
38
|
+
* read - rather than only when the school saved. An override holds a stage's whole
|
|
39
|
+
* forms/files list as it stood then, so applying it as-is would let it outlive the
|
|
40
|
+
* trust's later edits: a form the trust adds to an "add only" stage would never reach a
|
|
41
|
+
* school that had added one of its own, and switching to "locked" would leave the
|
|
42
|
+
* school's additions in place. Through enforceEditPolicy, "add" is the trust's current
|
|
43
|
+
* list plus the school's own, "locked" is the trust's list alone, and "open" (and any
|
|
44
|
+
* workflow that isn't a trust's) is the school's list as saved.
|
|
45
|
+
*
|
|
46
|
+
* @param {Pick<WorkflowConfig, "workflow"|"trust"|"editPolicy">|undefined} config the workflow doc the overrides sit on.
|
|
47
|
+
* @param {WorkflowOverrides} overrides the cohort's or group's per-stage overrides.
|
|
48
|
+
* @return {WorkflowStage[]} the stages the cohort runs on.
|
|
49
|
+
*/
|
|
50
|
+
function applyWorkflowOverrides(config, overrides) {
|
|
51
|
+
const workflow = config?.workflow || [];
|
|
35
52
|
if (!overrides || !Object.keys(overrides).length)
|
|
36
53
|
return workflow;
|
|
54
|
+
const policy = (0, exports.workflowEditPolicy)(config);
|
|
37
55
|
return workflow.map((stage) => {
|
|
38
56
|
const override = overrides[String(stage.id)];
|
|
39
57
|
if (!override)
|
|
40
58
|
return stage;
|
|
41
59
|
return {
|
|
42
60
|
...stage,
|
|
43
|
-
...(override.forms ? { forms: override.forms } : {}),
|
|
44
|
-
...(override.files ? { files: override.files } : {}),
|
|
61
|
+
...(override.forms ? { forms: enforceEditPolicy(stage.forms, override.forms, policy) } : {}),
|
|
62
|
+
...(override.files ? { files: enforceEditPolicy(stage.files, override.files, policy) } : {}),
|
|
45
63
|
};
|
|
46
64
|
});
|
|
47
65
|
}
|
|
@@ -111,7 +129,7 @@ function resolveCohortWorkflow(cohort, workflows) {
|
|
|
111
129
|
const config = workflows?.[cohort.workflowId];
|
|
112
130
|
if (!config)
|
|
113
131
|
return [];
|
|
114
|
-
return applyWorkflowOverrides(config
|
|
132
|
+
return applyWorkflowOverrides(config, cohort.workflowOverrides);
|
|
115
133
|
}
|
|
116
134
|
/** Fetch-and-resolve version of resolveCohortWorkflow, for callers without the
|
|
117
135
|
* workflows collection already in memory. Returns [] when nothing is configured. */
|
|
@@ -121,7 +139,7 @@ async function fetchCohortWorkflow(cohort, firebaseQuery = new firebaseQuery_1.d
|
|
|
121
139
|
const config = await firebaseQuery.getDocData(["workflows", cohort.workflowId]).catch(() => undefined);
|
|
122
140
|
if (!config?.workflow?.length)
|
|
123
141
|
return [];
|
|
124
|
-
return applyWorkflowOverrides(config
|
|
142
|
+
return applyWorkflowOverrides(config, cohort.workflowOverrides);
|
|
125
143
|
}
|
|
126
144
|
/** Whether a cohort has a usable workflow configured. */
|
|
127
145
|
const cohortWorkflowConfigured = (cohort, workflows) => Boolean(cohort?.workflowId && workflows?.[cohort.workflowId]?.workflow?.length);
|
package/lib/workflows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":";;;;;;AA2CA,wDAgBC;AAGD,sDAgBC;AASD,8CAMC;AAGD,oEAQC;AAmBD,sDAQ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CAAC,MAAM,EAAE,UAAU;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC9C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACpE,CAAC;AAED;oFACoF;AAC7E,KAAK,UAAU,mBAAmB,CACrC,MAAoE,EACpE,aAAa,GAAG,IAAI,uBAAa,EAAE;IAEnC,IAAI,CAAC,MAAM,EAAE,UAAU;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAA6B,CAAC;IACnI,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM;QAAE,OAAO,EAAE,CAAC;IACzC,OAAO,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;AACpE,CAAC;AAED,yDAAyD;AAClD,MAAM,wBAAwB,GAAG,CACpC,MAAgD,EAChD,SAA0C,EAC5C,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAHxE,QAAA,wBAAwB,4BAGgD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
jest.mock("./firebase/firebaseQuery", () => ({ __esModule: true, default: jest.fn() }));
|
|
4
|
+
const workflows_1 = require("./workflows");
|
|
5
|
+
describe("applyWorkflowOverrides", () => {
|
|
6
|
+
const stages = (forms) => [
|
|
7
|
+
{ id: 1, name: "Staff review", userType: "Staff", forms },
|
|
8
|
+
{ id: 2, name: "Parent review", userType: "Parent", forms: ["trustParent"] },
|
|
9
|
+
];
|
|
10
|
+
const trustWorkflow = (editPolicy, forms = ["trustForm"]) => ({ trust: true, editPolicy, workflow: stages(forms) });
|
|
11
|
+
// Saved when the trust's stage held only trustForm, so it is the whole list as it stood then.
|
|
12
|
+
const overrides = { "1": { forms: ["trustForm", "schoolForm"] } };
|
|
13
|
+
it("keeps forms the trust adds after the school saved, under add only", () => {
|
|
14
|
+
const resolved = (0, workflows_1.applyWorkflowOverrides)(trustWorkflow("add", ["trustForm", "laterTrustForm"]), overrides);
|
|
15
|
+
expect(resolved[0].forms).toEqual(["trustForm", "laterTrustForm", "schoolForm"]);
|
|
16
|
+
expect(resolved[1].forms).toEqual(["trustParent"]);
|
|
17
|
+
});
|
|
18
|
+
it("keeps the trust's forms when the school's override dropped one, under add only", () => {
|
|
19
|
+
const resolved = (0, workflows_1.applyWorkflowOverrides)(trustWorkflow("add"), { "1": { forms: ["schoolForm"] } });
|
|
20
|
+
expect(resolved[0].forms).toEqual(["trustForm", "schoolForm"]);
|
|
21
|
+
});
|
|
22
|
+
it("ignores the school's additions once the trust locks the workflow", () => {
|
|
23
|
+
expect((0, workflows_1.applyWorkflowOverrides)(trustWorkflow("locked"), overrides)[0].forms).toEqual(["trustForm"]);
|
|
24
|
+
});
|
|
25
|
+
it("uses the school's list as saved under full editing", () => {
|
|
26
|
+
expect((0, workflows_1.applyWorkflowOverrides)(trustWorkflow("open"), { "1": { forms: ["schoolForm"] } })[0].forms).toEqual(["schoolForm"]);
|
|
27
|
+
});
|
|
28
|
+
it("uses the list as saved on a workflow that isn't a trust's", () => {
|
|
29
|
+
const own = { workflow: stages(["ownForm"]) };
|
|
30
|
+
expect((0, workflows_1.applyWorkflowOverrides)(own, { "1": { forms: ["other"] } })[0].forms).toEqual(["other"]);
|
|
31
|
+
});
|
|
32
|
+
it("returns no stages for a missing workflow", () => {
|
|
33
|
+
expect((0, workflows_1.applyWorkflowOverrides)(undefined, overrides)).toEqual([]);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=workflows.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflows.test.js","sourceRoot":"","sources":["../src/workflows.test.ts"],"names":[],"mappings":";;AAAA,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE,EAAC,CAAC,CAAC,CAAC;AAEtF,2CAAmD;AAGnD,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC,MAAM,MAAM,GAAG,CAAC,KAAe,EAAmB,EAAE,CAAC;QACjD,EAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAkB;QACxE,EAAC,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,aAAa,CAAC,EAAkB;KAC9F,CAAC;IACF,MAAM,aAAa,GAAG,CAAC,UAA8B,EAAE,KAAK,GAAG,CAAC,WAAW,CAAC,EAAE,EAAE,CAC5E,CAAC,EAAC,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,EAAC,CAA0D,CAAC;IAElH,8FAA8F;IAC9F,MAAM,SAAS,GAAG,EAAC,GAAG,EAAE,EAAC,KAAK,EAAE,CAAC,WAAW,EAAE,YAAY,CAAC,EAAC,EAAC,CAAC;IAE9D,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QACzE,MAAM,QAAQ,GAAG,IAAA,kCAAsB,EAAC,aAAa,CAAC,KAAK,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC,EAA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AG,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,SAAS,CAAC,CAAC,EAAqC,CAAC;QAChF,MAAM,CAAC,IAAA,kCAAsB,EAAC,GAAG,EAAE,EAAC,GAAG,EAAE,EAAC,KAAK,EAAE,CAAC,OAAO,CAAC,EAAC,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,IAAA,kCAAsB,EAAC,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/callables/wonde.ts
CHANGED
|
@@ -86,4 +86,23 @@ export const wondeCallables = {
|
|
|
86
86
|
})),
|
|
87
87
|
}),
|
|
88
88
|
},
|
|
89
|
+
/**
|
|
90
|
+
* Admin only. Moves a student's account to another school in the same trust,
|
|
91
|
+
* so that school's Wonde sync picks them up. Only the user doc changes; the old
|
|
92
|
+
* oId and cohort are kept in `transferredFrom` for undo.
|
|
93
|
+
*/
|
|
94
|
+
"wonde-transferStudent": {
|
|
95
|
+
request: z.object({
|
|
96
|
+
uid: z.string().min(1),
|
|
97
|
+
toOId: z.string().min(1),
|
|
98
|
+
/** A cohort at the new school, or none. */
|
|
99
|
+
cohort: z.string().min(1).optional(),
|
|
100
|
+
}),
|
|
101
|
+
response: z.object({ok: z.literal(true)}),
|
|
102
|
+
},
|
|
103
|
+
/** Admin only. Moves a transferred student back to the school in `transferredFrom`. */
|
|
104
|
+
"wonde-undoTransfer": {
|
|
105
|
+
request: z.object({uid: z.string().min(1)}),
|
|
106
|
+
response: z.object({ok: z.literal(true)}),
|
|
107
|
+
},
|
|
89
108
|
} satisfies CallableGroup;
|
|
@@ -27,7 +27,7 @@ export const exportTransformers: Record<string, ExportTransformerFn> = {
|
|
|
27
27
|
const cohort = await fetcher.getDocData<CohortData>(["cohorts", cohortId]).catch(() => null);
|
|
28
28
|
if (!cohort?.workflowId) return value;
|
|
29
29
|
const workflowConfig = await fetcher.getDocData<WorkflowConfig>(["workflows", cohort.workflowId]).catch(() => null);
|
|
30
|
-
return applyWorkflowOverrides(workflowConfig
|
|
30
|
+
return applyWorkflowOverrides(workflowConfig ?? undefined, cohort.workflowOverrides).find(s => s.id === value)?.name ?? value;
|
|
31
31
|
},
|
|
32
32
|
|
|
33
33
|
resolveActivityTitles: async (fetcher, value, item, params) => {
|
package/src/typeDefinitions.ts
CHANGED
|
@@ -658,6 +658,8 @@ export type UserData = {
|
|
|
658
658
|
activationCode: number,
|
|
659
659
|
cohort?: string,
|
|
660
660
|
schoolId?: string,
|
|
661
|
+
/** Set when an admin moved a dual registered pupil to another school in their trust. The old school-specific fields, for undo. */
|
|
662
|
+
transferredFrom?: {oId: string, cohort: string|null, schoolId: string|null, at: string, by: string},
|
|
661
663
|
cohortData?: CohortData,
|
|
662
664
|
dismissedTasks?: string[],
|
|
663
665
|
dismissedTutorials?: string[],
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
jest.mock("./firebase/firebaseQuery", () => ({__esModule: true, default: jest.fn()}));
|
|
2
|
+
|
|
3
|
+
import {applyWorkflowOverrides} from "./workflows";
|
|
4
|
+
import {WorkflowConfig, WorkflowEditPolicy, WorkflowStage} from "./typeDefinitions";
|
|
5
|
+
|
|
6
|
+
describe("applyWorkflowOverrides", () => {
|
|
7
|
+
const stages = (forms: string[]): WorkflowStage[] => [
|
|
8
|
+
{id: 1, name: "Staff review", userType: "Staff", forms} as WorkflowStage,
|
|
9
|
+
{id: 2, name: "Parent review", userType: "Parent", forms: ["trustParent"]} as WorkflowStage,
|
|
10
|
+
];
|
|
11
|
+
const trustWorkflow = (editPolicy: WorkflowEditPolicy, forms = ["trustForm"]) =>
|
|
12
|
+
({trust: true, editPolicy, workflow: stages(forms)}) as Pick<WorkflowConfig, "workflow"|"trust"|"editPolicy">;
|
|
13
|
+
|
|
14
|
+
// Saved when the trust's stage held only trustForm, so it is the whole list as it stood then.
|
|
15
|
+
const overrides = {"1": {forms: ["trustForm", "schoolForm"]}};
|
|
16
|
+
|
|
17
|
+
it("keeps forms the trust adds after the school saved, under add only", () => {
|
|
18
|
+
const resolved = applyWorkflowOverrides(trustWorkflow("add", ["trustForm", "laterTrustForm"]), overrides);
|
|
19
|
+
expect(resolved[0].forms).toEqual(["trustForm", "laterTrustForm", "schoolForm"]);
|
|
20
|
+
expect(resolved[1].forms).toEqual(["trustParent"]);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("keeps the trust's forms when the school's override dropped one, under add only", () => {
|
|
24
|
+
const resolved = applyWorkflowOverrides(trustWorkflow("add"), {"1": {forms: ["schoolForm"]}});
|
|
25
|
+
expect(resolved[0].forms).toEqual(["trustForm", "schoolForm"]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("ignores the school's additions once the trust locks the workflow", () => {
|
|
29
|
+
expect(applyWorkflowOverrides(trustWorkflow("locked"), overrides)[0].forms).toEqual(["trustForm"]);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("uses the school's list as saved under full editing", () => {
|
|
33
|
+
expect(applyWorkflowOverrides(trustWorkflow("open"), {"1": {forms: ["schoolForm"]}})[0].forms).toEqual(["schoolForm"]);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("uses the list as saved on a workflow that isn't a trust's", () => {
|
|
37
|
+
const own = {workflow: stages(["ownForm"])} as Pick<WorkflowConfig, "workflow">;
|
|
38
|
+
expect(applyWorkflowOverrides(own, {"1": {forms: ["other"]}})[0].forms).toEqual(["other"]);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("returns no stages for a missing workflow", () => {
|
|
42
|
+
expect(applyWorkflowOverrides(undefined, overrides)).toEqual([]);
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/workflows.ts
CHANGED
|
@@ -21,19 +21,40 @@ export const approvedTrustId = (institute?: Pick<InstituteData, "trustLinks">) =
|
|
|
21
21
|
export const trustWorkflows = (workflows?: {[id: string]: WorkflowConfig}, trustId?: string) =>
|
|
22
22
|
Object.entries(workflows || {}).filter(([, w]) => w.trust && (!trustId || w.oId === trustId));
|
|
23
23
|
|
|
24
|
-
export const workflowEditPolicy = (workflow?: WorkflowConfig): WorkflowEditPolicy =>
|
|
24
|
+
export const workflowEditPolicy = (workflow?: Pick<WorkflowConfig, "trust"|"editPolicy">): WorkflowEditPolicy =>
|
|
25
25
|
(workflow?.trust ? workflow.editPolicy || "open" : "open");
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Layer a school's per-stage forms/files overrides onto the workflow they were made on.
|
|
29
|
+
*
|
|
30
|
+
* Takes the workflow DOC, not its stages, because the trust's edit policy decides how an
|
|
31
|
+
* override combines with the stage, and it is applied here - every time the workflow is
|
|
32
|
+
* read - rather than only when the school saved. An override holds a stage's whole
|
|
33
|
+
* forms/files list as it stood then, so applying it as-is would let it outlive the
|
|
34
|
+
* trust's later edits: a form the trust adds to an "add only" stage would never reach a
|
|
35
|
+
* school that had added one of its own, and switching to "locked" would leave the
|
|
36
|
+
* school's additions in place. Through enforceEditPolicy, "add" is the trust's current
|
|
37
|
+
* list plus the school's own, "locked" is the trust's list alone, and "open" (and any
|
|
38
|
+
* workflow that isn't a trust's) is the school's list as saved.
|
|
39
|
+
*
|
|
40
|
+
* @param {Pick<WorkflowConfig, "workflow"|"trust"|"editPolicy">|undefined} config the workflow doc the overrides sit on.
|
|
41
|
+
* @param {WorkflowOverrides} overrides the cohort's or group's per-stage overrides.
|
|
42
|
+
* @return {WorkflowStage[]} the stages the cohort runs on.
|
|
43
|
+
*/
|
|
44
|
+
export function applyWorkflowOverrides(
|
|
45
|
+
config: Pick<WorkflowConfig, "workflow"|"trust"|"editPolicy">|undefined,
|
|
46
|
+
overrides?: WorkflowOverrides,
|
|
47
|
+
): WorkflowStage[] {
|
|
48
|
+
const workflow = config?.workflow || [];
|
|
29
49
|
if (!overrides || !Object.keys(overrides).length) return workflow;
|
|
50
|
+
const policy = workflowEditPolicy(config);
|
|
30
51
|
return workflow.map((stage) => {
|
|
31
52
|
const override = overrides[String(stage.id)];
|
|
32
53
|
if (!override) return stage;
|
|
33
54
|
return {
|
|
34
55
|
...stage,
|
|
35
|
-
...(override.forms ? {forms: override.forms} : {}),
|
|
36
|
-
...(override.files ? {files: override.files} : {}),
|
|
56
|
+
...(override.forms ? {forms: enforceEditPolicy(stage.forms, override.forms, policy)} : {}),
|
|
57
|
+
...(override.files ? {files: enforceEditPolicy(stage.files, override.files, policy)} : {}),
|
|
37
58
|
};
|
|
38
59
|
});
|
|
39
60
|
}
|
|
@@ -107,7 +128,7 @@ export function resolveCohortWorkflow(
|
|
|
107
128
|
if (!cohort?.workflowId) return [];
|
|
108
129
|
const config = workflows?.[cohort.workflowId];
|
|
109
130
|
if (!config) return [];
|
|
110
|
-
return applyWorkflowOverrides(config
|
|
131
|
+
return applyWorkflowOverrides(config, cohort.workflowOverrides);
|
|
111
132
|
}
|
|
112
133
|
|
|
113
134
|
/** Fetch-and-resolve version of resolveCohortWorkflow, for callers without the
|
|
@@ -119,7 +140,7 @@ export async function fetchCohortWorkflow(
|
|
|
119
140
|
if (!cohort?.workflowId) return [];
|
|
120
141
|
const config = await firebaseQuery.getDocData(["workflows", cohort.workflowId]).catch(() => undefined) as WorkflowConfig|undefined;
|
|
121
142
|
if (!config?.workflow?.length) return [];
|
|
122
|
-
return applyWorkflowOverrides(config
|
|
143
|
+
return applyWorkflowOverrides(config, cohort.workflowOverrides);
|
|
123
144
|
}
|
|
124
145
|
|
|
125
146
|
/** Whether a cohort has a usable workflow configured. */
|