placementt-core 1.400.1202 → 1.400.1204
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/deploy-all.js +46 -40
- package/lib/typeDefinitions.d.ts +6 -0
- package/lib/typeDefinitions.js.map +1 -1
- package/lib/workflows.d.ts +7 -0
- package/lib/workflows.js +13 -1
- package/lib/workflows.js.map +1 -1
- package/package.json +1 -1
- package/src/typeDefinitions.ts +6 -0
- package/src/workflows.ts +13 -0
package/deploy-all.js
CHANGED
|
@@ -77,65 +77,71 @@ function toDevAlgoliaConfig(source) {
|
|
|
77
77
|
const prodVersion = `1.1.${nextPatch}`;
|
|
78
78
|
|
|
79
79
|
// -------------------------------
|
|
80
|
-
// 1️⃣
|
|
80
|
+
// 1️⃣ PROD VERSION (first, so a failing build or publish stops before dev/emu go out)
|
|
81
81
|
// -------------------------------
|
|
82
|
-
|
|
82
|
+
updateVersion(prodVersion);
|
|
83
|
+
|
|
84
|
+
console.log("🚀 Building (prod)...");
|
|
85
|
+
run('yarn tsc');
|
|
83
86
|
|
|
84
|
-
|
|
87
|
+
console.log(`📤 Publishing ${prodVersion}`);
|
|
88
|
+
publishWithTag(prodVersion, 'prod');
|
|
89
|
+
|
|
90
|
+
const devFirebaseConfig = originalFirebaseConfig.replace(
|
|
85
91
|
/\(credentialsProd\)/g,
|
|
86
92
|
'(credentialsDev)'
|
|
87
93
|
);
|
|
88
|
-
fs.writeFileSync(firebaseConfigPath, firebaseConfig);
|
|
89
|
-
|
|
90
|
-
fs.writeFileSync(algoliaConfigPath, toDevAlgoliaConfig(originalAlgoliaConfig));
|
|
91
94
|
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
try {
|
|
96
|
+
// -------------------------------
|
|
97
|
+
// 2️⃣ EMULATOR VERSION
|
|
98
|
+
// -------------------------------
|
|
99
|
+
console.log("🛠 Switching to EMULATOR config...");
|
|
94
100
|
|
|
95
|
-
|
|
96
|
-
|
|
101
|
+
fs.writeFileSync(firebaseConfigPath, devFirebaseConfig
|
|
102
|
+
.replace(/getFunctions}/g, 'connectFunctionsEmulator, getFunctions}')
|
|
103
|
+
.replace(/\/\/ con/g, 'con'));
|
|
97
104
|
|
|
98
|
-
|
|
99
|
-
publishWithTag(devVersion, 'dev');
|
|
105
|
+
fs.writeFileSync(algoliaConfigPath, toDevAlgoliaConfig(originalAlgoliaConfig));
|
|
100
106
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// -------------------------------
|
|
104
|
-
console.log("🛠 Switching to EMULATOR config...");
|
|
107
|
+
const emulatorVersion = `1.300.${nextPatch}`;
|
|
108
|
+
updateVersion(emulatorVersion);
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
.replace(/\/\/ con/g, 'con');
|
|
110
|
+
console.log("🚀 Building (emulator)...");
|
|
111
|
+
run('yarn tsc');
|
|
109
112
|
|
|
110
|
-
|
|
113
|
+
console.log(`📤 Publishing ${emulatorVersion}`);
|
|
114
|
+
publishWithTag(emulatorVersion, 'emu');
|
|
111
115
|
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
// -------------------------------
|
|
117
|
+
// 3️⃣ DEV VERSION
|
|
118
|
+
// -------------------------------
|
|
119
|
+
console.log("🛠 Switching to DEV config...");
|
|
114
120
|
|
|
115
|
-
|
|
116
|
-
run('yarn tsc');
|
|
121
|
+
fs.writeFileSync(firebaseConfigPath, devFirebaseConfig);
|
|
117
122
|
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
const devVersion = `1.400.${nextPatch}`;
|
|
124
|
+
updateVersion(devVersion);
|
|
120
125
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// -------------------------------
|
|
124
|
-
console.log("🧹 Resetting source files...");
|
|
125
|
-
fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
|
|
126
|
-
fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
|
|
126
|
+
console.log("🚀 Building (dev)...");
|
|
127
|
+
run('yarn tsc');
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
console.log(`📤 Publishing ${devVersion}`);
|
|
130
|
+
publishWithTag(devVersion, 'dev');
|
|
131
|
+
} finally {
|
|
132
|
+
// -------------------------------
|
|
133
|
+
// RESET FILES
|
|
134
|
+
// -------------------------------
|
|
135
|
+
console.log("🧹 Resetting source files...");
|
|
136
|
+
fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
|
|
137
|
+
fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
|
|
138
|
+
}
|
|
132
139
|
|
|
133
|
-
|
|
140
|
+
// Rebuild so lib/ matches the prod source again rather than the dev build.
|
|
134
141
|
run('yarn tsc');
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
// Prod no longer publishes last, so a later publish may have clobbered its tag;
|
|
144
|
+
// pinning re-points every tag at the version it was published with.
|
|
139
145
|
pinDistTags();
|
|
140
146
|
|
|
141
147
|
console.log("🎉 Deployment complete!");
|
package/lib/typeDefinitions.d.ts
CHANGED
|
@@ -1000,6 +1000,12 @@ export type WorkflowConfig = {
|
|
|
1000
1000
|
/** Flattened forms/files used across the stages, mirroring CohortData.forms/files. */
|
|
1001
1001
|
forms?: string[];
|
|
1002
1002
|
files?: string[];
|
|
1003
|
+
/** The template each workflow email uses, by emailTemplates key. Copied onto every
|
|
1004
|
+
* cohort on this workflow (CohortData.emailTemplates), which the backend reads when
|
|
1005
|
+
* sending. Absent means the cohorts keep their own. */
|
|
1006
|
+
emailTemplates?: CohortData["emailTemplates"];
|
|
1007
|
+
/** Workflow emails switched off, copied onto every cohort on this workflow the same way. */
|
|
1008
|
+
disabledEmails?: string[];
|
|
1003
1009
|
/** Authored by a trust (institutes-two) for the schools beneath it. A trust
|
|
1004
1010
|
* requires a workflow by putting it on a mandatory cohort template
|
|
1005
1011
|
* (InstituteData.cohortConfig), not by marking the workflow itself. */
|
|
@@ -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":";;;AA2uIA,sDASC;AAeD,oDAKC;AAaD,0CAEC;AA/pED;;;;;kFAKkF;AACrE,QAAA,qBAAqB,GAAG,SAAS,CAAC;AAClC,QAAA,iBAAiB,GAAG,OAAO,CAAC;AA2kEzC;yEACyE;AAC5D,QAAA,0BAA0B,GAA2C;IAC9E,gBAAgB,EAAE,2BAA2B;IAC7C,mBAAmB,EAAE,sBAAsB;IAC3C,cAAc,EAAE,iBAAiB;IACjC,kBAAkB,EAAE,qBAAqB;IACzC,UAAU,EAAE,oCAAoC;IAChD,aAAa,EAAE,yBAAyB;IACxC,aAAa,EAAE,wBAAwB;IACvC,KAAK,EAAE,OAAO;CACjB,CAAC;AAEW,QAAA,0BAA0B,GAA+C;IAClF,QAAQ,EAAE,WAAW;IACrB,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,OAAO;CACjB,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB,CAAC,SAAsC;IACxE,QAAQ,SAAS,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,OAAO,OAAO,CAAC;QAC5B,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC;QAC7B,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC;QACb,KAAK,OAAO,CAAC;QACb,OAAO,CAAC,CAAC,OAAO,UAAU,CAAC;IAC3B,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,oBAAoB,CAChC,IAAwC,EACxC,MAA6C;IAE7C,OAAO,IAAI,EAAE,WAAW,IAAI,MAAM,EAAE,YAAY,IAAI,KAAK,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;GAUG;AACH,SAAgB,eAAe,CAAC,KAA6D;IACzF,OAAO,GAAG,KAAK,CAAC,cAAc,IAAI,EAAE,IAAI,KAAK,CAAC,aAAa,IAAI,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC;AAC/E,CAAC"}
|
package/lib/workflows.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export declare function flattenWorkflowFormsAndFiles(workflow: WorkflowStage[]):
|
|
|
35
35
|
forms: string[];
|
|
36
36
|
files: string[];
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* The email settings a workflow hands the cohorts on it, with only the fields it sets.
|
|
40
|
+
* A workflow saved before emails moved onto it sets neither, so its cohorts keep their own.
|
|
41
|
+
*/
|
|
42
|
+
export declare const workflowEmailSettings: (config?: Pick<WorkflowConfig, "emailTemplates" | "disabledEmails">) => Pick<CohortData, "emailTemplates" | "disabledEmails">;
|
|
43
|
+
/** Whether a workflow's emails are its trust's to set, so the school running it can't change them. */
|
|
44
|
+
export declare const workflowEmailsLockedFor: (config: Pick<WorkflowConfig, "trust" | "oId"> | undefined, oId: string) => boolean;
|
|
38
45
|
/**
|
|
39
46
|
* The workflow a cohort actually runs on: its referenced workflow doc with the cohort's
|
|
40
47
|
* own overrides applied. Pass the workflows already loaded in context/memory.
|
package/lib/workflows.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.cohortWorkflowConfigured = exports.workflowEditPolicy = exports.trustWorkflows = exports.approvedTrustId = void 0;
|
|
6
|
+
exports.cohortWorkflowConfigured = exports.workflowEmailsLockedFor = exports.workflowEmailSettings = exports.workflowEditPolicy = exports.trustWorkflows = exports.approvedTrustId = void 0;
|
|
7
7
|
exports.applyWorkflowOverrides = applyWorkflowOverrides;
|
|
8
8
|
exports.diffWorkflowOverrides = diffWorkflowOverrides;
|
|
9
9
|
exports.enforceEditPolicy = enforceEditPolicy;
|
|
@@ -89,6 +89,18 @@ function flattenWorkflowFormsAndFiles(workflow) {
|
|
|
89
89
|
});
|
|
90
90
|
return { forms: [...forms], files: [...files] };
|
|
91
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The email settings a workflow hands the cohorts on it, with only the fields it sets.
|
|
94
|
+
* A workflow saved before emails moved onto it sets neither, so its cohorts keep their own.
|
|
95
|
+
*/
|
|
96
|
+
const workflowEmailSettings = (config) => ({
|
|
97
|
+
...(config?.emailTemplates ? { emailTemplates: config.emailTemplates } : {}),
|
|
98
|
+
...(config?.disabledEmails ? { disabledEmails: config.disabledEmails } : {}),
|
|
99
|
+
});
|
|
100
|
+
exports.workflowEmailSettings = workflowEmailSettings;
|
|
101
|
+
/** Whether a workflow's emails are its trust's to set, so the school running it can't change them. */
|
|
102
|
+
const workflowEmailsLockedFor = (config, oId) => Boolean(config?.trust && config.oId !== oId);
|
|
103
|
+
exports.workflowEmailsLockedFor = workflowEmailsLockedFor;
|
|
92
104
|
/**
|
|
93
105
|
* The workflow a cohort actually runs on: its referenced workflow doc with the cohort's
|
|
94
106
|
* own overrides applied. Pass the workflows already loaded in context/memory.
|
package/lib/workflows.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":";;;;;;AA2BA,wDAWC;AAGD,sDAgBC;AASD,8CAMC;AAGD,oEAQC;
|
|
1
|
+
{"version":3,"file":"workflows.js","sourceRoot":"","sources":["../src/workflows.ts"],"names":[],"mappings":";;;;;;AA2BA,wDAWC;AAGD,sDAgBC;AASD,8CAMC;AAGD,oEAQC;AAmBD,sDAQC;AAID,kDAQC;AA1HD,6EAAqD;AAGrD;;;;;;;;;;GAUG;AAEH,6CAA6C;AACtC,MAAM,eAAe,GAAG,CAAC,SAA6C,EAAE,EAAE,CAC7E,MAAM,CAAC,OAAO,CAAC,SA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E,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,CAAC,QAAQ,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;AAC7E,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"}
|
package/package.json
CHANGED
package/src/typeDefinitions.ts
CHANGED
|
@@ -1015,6 +1015,12 @@ export type WorkflowConfig = {
|
|
|
1015
1015
|
/** Flattened forms/files used across the stages, mirroring CohortData.forms/files. */
|
|
1016
1016
|
forms?: string[],
|
|
1017
1017
|
files?: string[],
|
|
1018
|
+
/** The template each workflow email uses, by emailTemplates key. Copied onto every
|
|
1019
|
+
* cohort on this workflow (CohortData.emailTemplates), which the backend reads when
|
|
1020
|
+
* sending. Absent means the cohorts keep their own. */
|
|
1021
|
+
emailTemplates?: CohortData["emailTemplates"],
|
|
1022
|
+
/** Workflow emails switched off, copied onto every cohort on this workflow the same way. */
|
|
1023
|
+
disabledEmails?: string[],
|
|
1018
1024
|
// --- Trust-authored workflows only ---
|
|
1019
1025
|
/** Authored by a trust (institutes-two) for the schools beneath it. A trust
|
|
1020
1026
|
* requires a workflow by putting it on a mandatory cohort template
|
package/src/workflows.ts
CHANGED
|
@@ -83,6 +83,19 @@ export function flattenWorkflowFormsAndFiles(workflow: WorkflowStage[]) {
|
|
|
83
83
|
return {forms: [...forms], files: [...files]};
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* The email settings a workflow hands the cohorts on it, with only the fields it sets.
|
|
88
|
+
* A workflow saved before emails moved onto it sets neither, so its cohorts keep their own.
|
|
89
|
+
*/
|
|
90
|
+
export const workflowEmailSettings = (config?: Pick<WorkflowConfig, "emailTemplates"|"disabledEmails">): Pick<CohortData, "emailTemplates"|"disabledEmails"> => ({
|
|
91
|
+
...(config?.emailTemplates ? {emailTemplates: config.emailTemplates} : {}),
|
|
92
|
+
...(config?.disabledEmails ? {disabledEmails: config.disabledEmails} : {}),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/** Whether a workflow's emails are its trust's to set, so the school running it can't change them. */
|
|
96
|
+
export const workflowEmailsLockedFor = (config: Pick<WorkflowConfig, "trust"|"oId">|undefined, oId: string) =>
|
|
97
|
+
Boolean(config?.trust && config.oId !== oId);
|
|
98
|
+
|
|
86
99
|
/**
|
|
87
100
|
* The workflow a cohort actually runs on: its referenced workflow doc with the cohort's
|
|
88
101
|
* own overrides applied. Pass the workflows already loaded in context/memory.
|