placementt-core 1.400.1271 → 1.400.1273
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/.claude/settings.local.json +12 -0
- package/.github/workflows/deploy-dev.yaml +39 -0
- package/README.md +1 -1
- package/deploy-all.js +34 -10
- package/lib/callables/index.d.ts +1 -0
- package/lib/callables/index.js +1 -0
- package/lib/callables/index.js.map +1 -1
- package/lib/callables/registration.d.ts +211 -0
- package/lib/callables/registration.js +76 -0
- package/lib/callables/registration.js.map +1 -0
- package/lib/callables/registry.d.ts +526 -0
- package/lib/callables/registry.js +3 -0
- package/lib/callables/registry.js.map +1 -1
- package/lib/callables/userManagement.d.ts +45 -0
- package/lib/callables/userManagement.js +15 -0
- package/lib/callables/userManagement.js.map +1 -1
- 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/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -1
- package/lib/onboardingV2.d.ts +129 -0
- package/lib/onboardingV2.js +217 -0
- package/lib/onboardingV2.js.map +1 -0
- package/lib/onboardingV2.steps.d.ts +13 -0
- package/lib/onboardingV2.steps.js +17 -0
- package/lib/onboardingV2.steps.js.map +1 -0
- package/lib/onboardingV2.test.d.ts +1 -0
- package/lib/onboardingV2.test.js +109 -0
- package/lib/onboardingV2.test.js.map +1 -0
- package/lib/productFeatures.d.ts +8 -3
- package/lib/productFeatures.js +10 -2
- package/lib/productFeatures.js.map +1 -1
- package/lib/productFeatures.test.d.ts +1 -0
- package/lib/productFeatures.test.js +31 -0
- package/lib/productFeatures.test.js.map +1 -0
- package/lib/studentUpload.d.ts +114 -0
- package/lib/studentUpload.js +189 -0
- package/lib/studentUpload.js.map +1 -0
- package/lib/studentUpload.test.d.ts +1 -0
- package/lib/studentUpload.test.js +83 -0
- package/lib/studentUpload.test.js.map +1 -0
- package/lib/surveys/schedule.d.ts +27 -0
- package/lib/surveys/schedule.js +43 -1
- package/lib/surveys/schedule.js.map +1 -1
- package/lib/surveys/schedule.test.js +92 -59
- package/lib/surveys/schedule.test.js.map +1 -1
- package/lib/typeDefinitions.d.ts +26 -0
- package/lib/typeDefinitions.js.map +1 -1
- package/package.json +2 -1
- package/src/callables/index.ts +1 -0
- package/src/callables/registration.ts +75 -0
- package/src/callables/registry.ts +3 -0
- package/src/callables/userManagement.ts +15 -0
- package/src/callables/wonde.ts +19 -0
- package/src/index.ts +3 -0
- package/src/onboardingV2.steps.ts +16 -0
- package/src/onboardingV2.test.ts +129 -0
- package/src/onboardingV2.ts +263 -0
- package/src/productFeatures.test.ts +31 -0
- package/src/productFeatures.ts +12 -4
- package/src/studentUpload.test.ts +97 -0
- package/src/studentUpload.ts +218 -0
- package/src/surveys/schedule.test.ts +40 -0
- package/src/surveys/schedule.ts +41 -0
- package/src/typeDefinitions.ts +16 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(grep -n \"completedAllDocs\\\\|insuranceRequired\\\\|raRequired\\\\|dbsRequired\\\\|requiredForms\\\\|forms\" /Users/thomasbarton/Documents/GitHub/placementt-backend/functions/src/util.ts | head -50)",
|
|
5
|
+
"Read(//Users/thomasbarton/Documents/GitHub/Placementt-Backend/functions/src/**)",
|
|
6
|
+
"Bash(grep -rn \"file_\\\\$\\\\|\\\\`file_\" /Users/thomasbarton/Documents/GitHub/Placementt-Core/src/ /Users/thomasbarton/Documents/GitHub/placementt-backend/functions/src/)",
|
|
7
|
+
"Bash(awk '/^export type StudentPlacementData/,/^};/' /Users/thomasbarton/Documents/GitHub/Placementt-Core/src/typeDefinitions.ts)",
|
|
8
|
+
"Bash(cd /Users/thomasbarton/Documents/GitHub && grep -rn \"StudentToolKey\\\\|StudentToolLaunchConfig\\\\|studentTools\\\\b\\\\|activityLogging\\\\b\\\\|\\\\.activityLogging\\\\|StudentAudienceMap\\\\|studentAudiences\\\\|StudentAudience\\\\b\\\\|audienceId\\\\|audiences\" --include=*.ts --include=*.tsx -l placementt-core/src placementt-web/src placementt-backend/functions/src placementt-app/src 2>/dev/null | sort)",
|
|
9
|
+
"Bash(grep -v \"activityLogging\\\\.ts\\\\|activityLogging\\\\.test\\\\|callables/activityLogging\\\\|from \\\\\"\\\\./activityLogging\\\\\"\\\\|from '\\\\./activityLogging'\\\\|activityLogging\\\\\"$\")"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
name: Deploy dev
|
|
2
|
+
|
|
3
|
+
# Publishes the emulator (1.300.x) and dev (1.400.x) builds from any branch, so a
|
|
4
|
+
# feature branch can be tried in the dev web app and backend before it is merged.
|
|
5
|
+
# Prod is not touched and nothing is committed. Run it from the Actions tab,
|
|
6
|
+
# choosing the branch, or with: gh workflow run deploy-dev.yaml --ref <branch>
|
|
7
|
+
on:
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
# Shares the publish queue with the main deploy, so the two never publish at once.
|
|
11
|
+
concurrency:
|
|
12
|
+
group: npm-publish
|
|
13
|
+
cancel-in-progress: false
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
id-token: write # npm trusted publisher
|
|
17
|
+
jobs:
|
|
18
|
+
publish-dev:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
|
|
23
|
+
- name: Setup Node
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: 22
|
|
27
|
+
registry-url: https://registry.npmjs.org
|
|
28
|
+
|
|
29
|
+
- name: Install NPM
|
|
30
|
+
run: npm install -g npm@latest
|
|
31
|
+
|
|
32
|
+
- name: Install dependencies
|
|
33
|
+
run: yarn install --frozen-lockfile
|
|
34
|
+
|
|
35
|
+
- name: Build
|
|
36
|
+
run: yarn tsc
|
|
37
|
+
|
|
38
|
+
- name: Deploy dev and emulator only
|
|
39
|
+
run: node deploy-all.js --dev-only
|
package/README.md
CHANGED
|
@@ -118,4 +118,4 @@ yarn test-local dev
|
|
|
118
118
|
yarn core dev --restart
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
-
Repeat step 1 + step 3 as you iterate. Once you're happy with the change, commit it here, bump the version, and publish for real (`yarn deploy` / `yarn deploy-all`) — then re-run `yarn core dev` (or `prod`) in the consuming repos without `--restart` to drop back to the real published version instead of the local link.
|
|
121
|
+
Repeat step 1 + step 3 as you iterate. Once you're happy with the change, commit it here, bump the version, and publish for real (`yarn deploy` / `yarn deploy-all`; `yarn deploy-dev` publishes only the `dev` and `emu` tags from the current branch, leaves `prod` alone and commits nothing; publishing needs npm credentials, which only the GitHub trusted publisher has, so run it as the "Deploy dev" workflow from the Actions tab on your branch, or `gh workflow run deploy-dev.yaml --ref <branch>`) — then re-run `yarn core dev` (or `prod`) in the consuming repos without `--restart` to drop back to the real published version instead of the local link.
|
package/deploy-all.js
CHANGED
|
@@ -5,11 +5,24 @@ function run(cmd) {
|
|
|
5
5
|
execSync(cmd, { stdio: 'inherit' });
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
// `yarn deploy-dev` runs this with --dev-only: the emulator and dev builds are
|
|
9
|
+
// published from whatever branch is checked out, prod is not touched, and
|
|
10
|
+
// nothing is committed or pushed, so a feature branch can be tried in the dev
|
|
11
|
+
// web app and backend before it is merged.
|
|
12
|
+
const devOnly = process.argv.includes('--dev-only');
|
|
13
|
+
|
|
14
|
+
// Run through `yarn deploy-*`, npm inherits yarn's registry (registry.yarnpkg.com),
|
|
15
|
+
// which has no login and refuses to publish. Always publish to npm itself.
|
|
16
|
+
process.env.npm_config_registry = 'https://registry.npmjs.org/';
|
|
17
|
+
|
|
18
|
+
console.log(devOnly ?
|
|
19
|
+
"📦 Publishing dev and emulator builds only (prod untouched, nothing committed)..." :
|
|
20
|
+
"📦 Starting automated deploy-all process...");
|
|
9
21
|
|
|
10
22
|
// ---- Read & bump version ----
|
|
11
23
|
const packageJsonPath = 'package.json';
|
|
12
|
-
const
|
|
24
|
+
const originalPackageJson = fs.readFileSync(packageJsonPath, 'utf8');
|
|
25
|
+
const packageJson = JSON.parse(originalPackageJson);
|
|
13
26
|
|
|
14
27
|
// package.json can lag the registry (a bump commit that failed to push, or a
|
|
15
28
|
// manual edit), so take the highest patch from either source.
|
|
@@ -76,16 +89,18 @@ function toDevAlgoliaConfig(source) {
|
|
|
76
89
|
|
|
77
90
|
const prodVersion = `1.1.${nextPatch}`;
|
|
78
91
|
|
|
79
|
-
|
|
80
|
-
//
|
|
81
|
-
//
|
|
82
|
-
|
|
92
|
+
if (!devOnly) {
|
|
93
|
+
// -------------------------------
|
|
94
|
+
// 1️⃣ PROD VERSION (first, so a failing build or publish stops before dev/emu go out)
|
|
95
|
+
// -------------------------------
|
|
96
|
+
updateVersion(prodVersion);
|
|
83
97
|
|
|
84
|
-
console.log("🚀 Building (prod)...");
|
|
85
|
-
run('yarn tsc');
|
|
98
|
+
console.log("🚀 Building (prod)...");
|
|
99
|
+
run('yarn tsc');
|
|
86
100
|
|
|
87
|
-
console.log(`📤 Publishing ${prodVersion}`);
|
|
88
|
-
publishWithTag(prodVersion, 'prod');
|
|
101
|
+
console.log(`📤 Publishing ${prodVersion}`);
|
|
102
|
+
publishWithTag(prodVersion, 'prod');
|
|
103
|
+
}
|
|
89
104
|
|
|
90
105
|
const devFirebaseConfig = originalFirebaseConfig.replace(
|
|
91
106
|
/\(credentialsProd\)/g,
|
|
@@ -135,6 +150,9 @@ try {
|
|
|
135
150
|
console.log("🧹 Resetting source files...");
|
|
136
151
|
fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
|
|
137
152
|
fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
|
|
153
|
+
// A dev-only publish leaves the version as it was: the next full deploy reads
|
|
154
|
+
// the registry's tags and carries on from the patch this one used.
|
|
155
|
+
if (devOnly) fs.writeFileSync(packageJsonPath, originalPackageJson);
|
|
138
156
|
}
|
|
139
157
|
|
|
140
158
|
// Rebuild so lib/ matches the prod source again rather than the dev build.
|
|
@@ -144,6 +162,12 @@ run('yarn tsc');
|
|
|
144
162
|
// pinning re-points every tag at the version it was published with.
|
|
145
163
|
pinDistTags();
|
|
146
164
|
|
|
165
|
+
if (devOnly) {
|
|
166
|
+
console.log(`🎉 Published emu ${publishedVersions.emu} and dev ${publishedVersions.dev}. Prod is unchanged. Nothing was committed.`);
|
|
167
|
+
console.log(" In placementt-web or placementt-backend: yarn core dev (or yarn core em).");
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
|
|
147
171
|
console.log("🎉 Deployment complete!");
|
|
148
172
|
|
|
149
173
|
updateVersion(prodVersion);
|
package/lib/callables/index.d.ts
CHANGED
package/lib/callables/index.js
CHANGED
|
@@ -33,4 +33,5 @@ __exportStar(require("./outreach"), exports);
|
|
|
33
33
|
__exportStar(require("./formImport"), exports);
|
|
34
34
|
__exportStar(require("./activities"), exports);
|
|
35
35
|
__exportStar(require("./engagement"), exports);
|
|
36
|
+
__exportStar(require("./registration"), exports);
|
|
36
37
|
//# 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;AACrB,oDAAkC;AAClC,4CAA0B;AAC1B,oDAAkC;AAClC,wCAAsB;AACtB,0CAAwB;AACxB,4CAA0B;AAC1B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B"}
|
|
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,oDAAkC;AAClC,4CAA0B;AAC1B,oDAAkC;AAClC,wCAAsB;AACtB,0CAAwB;AACxB,4CAA0B;AAC1B,mDAAiC;AACjC,6CAA2B;AAC3B,+CAA6B;AAC7B,+CAA6B;AAC7B,+CAA6B;AAC7B,iDAA+B"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const registrationCallables: {
|
|
3
|
+
/**
|
|
4
|
+
* Creates a school, trust or hub account. Existing fields are untyped here on
|
|
5
|
+
* purpose: trust and hub invites send more than this and nothing about them is
|
|
6
|
+
* changing. The new, optional fields are checked.
|
|
7
|
+
*/
|
|
8
|
+
"registration-registerInstitute": {
|
|
9
|
+
request: z.ZodObject<{
|
|
10
|
+
email: z.ZodString;
|
|
11
|
+
password: z.ZodString;
|
|
12
|
+
instituteName: z.ZodString;
|
|
13
|
+
package: z.ZodString;
|
|
14
|
+
/** 2 for the self-serve journey. Only honoured for institutes-one with no trust or hub invite. */
|
|
15
|
+
onboardingVersion: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | undefined, number | null | undefined>;
|
|
16
|
+
/** The sub-modules ticked at sign-up. */
|
|
17
|
+
picks: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | undefined, string[] | null | undefined>;
|
|
18
|
+
/** The terms tick box, with the wording shown. */
|
|
19
|
+
termsAccepted: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
20
|
+
wording: z.ZodString;
|
|
21
|
+
at: z.ZodString;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
at: string;
|
|
24
|
+
wording: string;
|
|
25
|
+
}, {
|
|
26
|
+
at: string;
|
|
27
|
+
wording: string;
|
|
28
|
+
}>>>, {
|
|
29
|
+
at: string;
|
|
30
|
+
wording: string;
|
|
31
|
+
} | undefined, {
|
|
32
|
+
at: string;
|
|
33
|
+
wording: string;
|
|
34
|
+
} | null | undefined>;
|
|
35
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
36
|
+
email: z.ZodString;
|
|
37
|
+
password: z.ZodString;
|
|
38
|
+
instituteName: z.ZodString;
|
|
39
|
+
package: z.ZodString;
|
|
40
|
+
/** 2 for the self-serve journey. Only honoured for institutes-one with no trust or hub invite. */
|
|
41
|
+
onboardingVersion: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | undefined, number | null | undefined>;
|
|
42
|
+
/** The sub-modules ticked at sign-up. */
|
|
43
|
+
picks: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | undefined, string[] | null | undefined>;
|
|
44
|
+
/** The terms tick box, with the wording shown. */
|
|
45
|
+
termsAccepted: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
46
|
+
wording: z.ZodString;
|
|
47
|
+
at: z.ZodString;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
at: string;
|
|
50
|
+
wording: string;
|
|
51
|
+
}, {
|
|
52
|
+
at: string;
|
|
53
|
+
wording: string;
|
|
54
|
+
}>>>, {
|
|
55
|
+
at: string;
|
|
56
|
+
wording: string;
|
|
57
|
+
} | undefined, {
|
|
58
|
+
at: string;
|
|
59
|
+
wording: string;
|
|
60
|
+
} | null | undefined>;
|
|
61
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
62
|
+
email: z.ZodString;
|
|
63
|
+
password: z.ZodString;
|
|
64
|
+
instituteName: z.ZodString;
|
|
65
|
+
package: z.ZodString;
|
|
66
|
+
/** 2 for the self-serve journey. Only honoured for institutes-one with no trust or hub invite. */
|
|
67
|
+
onboardingVersion: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | undefined, number | null | undefined>;
|
|
68
|
+
/** The sub-modules ticked at sign-up. */
|
|
69
|
+
picks: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>, string[] | undefined, string[] | null | undefined>;
|
|
70
|
+
/** The terms tick box, with the wording shown. */
|
|
71
|
+
termsAccepted: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
72
|
+
wording: z.ZodString;
|
|
73
|
+
at: z.ZodString;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
at: string;
|
|
76
|
+
wording: string;
|
|
77
|
+
}, {
|
|
78
|
+
at: string;
|
|
79
|
+
wording: string;
|
|
80
|
+
}>>>, {
|
|
81
|
+
at: string;
|
|
82
|
+
wording: string;
|
|
83
|
+
} | undefined, {
|
|
84
|
+
at: string;
|
|
85
|
+
wording: string;
|
|
86
|
+
} | null | undefined>;
|
|
87
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
88
|
+
response: z.ZodObject<{
|
|
89
|
+
code: z.ZodNumber;
|
|
90
|
+
msg: z.ZodObject<{
|
|
91
|
+
uid: z.ZodString;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
uid: string;
|
|
94
|
+
}, {
|
|
95
|
+
uid: string;
|
|
96
|
+
}>;
|
|
97
|
+
}, "strip", z.ZodTypeAny, {
|
|
98
|
+
code: number;
|
|
99
|
+
msg: {
|
|
100
|
+
uid: string;
|
|
101
|
+
};
|
|
102
|
+
}, {
|
|
103
|
+
code: number;
|
|
104
|
+
msg: {
|
|
105
|
+
uid: string;
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
};
|
|
109
|
+
/** What the activation page shows before the code is typed. Signed out, so the email is masked. */
|
|
110
|
+
"registration-activationStatus": {
|
|
111
|
+
request: z.ZodObject<{
|
|
112
|
+
uid: z.ZodString;
|
|
113
|
+
}, "strip", z.ZodTypeAny, {
|
|
114
|
+
uid: string;
|
|
115
|
+
}, {
|
|
116
|
+
uid: string;
|
|
117
|
+
}>;
|
|
118
|
+
response: z.ZodObject<{
|
|
119
|
+
/** "j***@example.sch.uk" */
|
|
120
|
+
maskedEmail: z.ZodString;
|
|
121
|
+
/** Already active: the page should offer sign-in instead. */
|
|
122
|
+
active: z.ZodBoolean;
|
|
123
|
+
/** Whether the current code has expired. False for a code with no sent time. */
|
|
124
|
+
expired: z.ZodBoolean;
|
|
125
|
+
/** When the current code was sent, ISO, if known. */
|
|
126
|
+
sentAt: z.ZodOptional<z.ZodString>;
|
|
127
|
+
/** How long a code works for, in hours. */
|
|
128
|
+
validHours: z.ZodNumber;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
active: boolean;
|
|
131
|
+
expired: boolean;
|
|
132
|
+
maskedEmail: string;
|
|
133
|
+
validHours: number;
|
|
134
|
+
sentAt?: string | undefined;
|
|
135
|
+
}, {
|
|
136
|
+
active: boolean;
|
|
137
|
+
expired: boolean;
|
|
138
|
+
maskedEmail: string;
|
|
139
|
+
validHours: number;
|
|
140
|
+
sentAt?: string | undefined;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
/** Sends a new activation code. Rate limited to one a minute and ten in total. */
|
|
144
|
+
"registration-resendActivationCode": {
|
|
145
|
+
request: z.ZodObject<{
|
|
146
|
+
uid: z.ZodString;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
uid: string;
|
|
149
|
+
}, {
|
|
150
|
+
uid: string;
|
|
151
|
+
}>;
|
|
152
|
+
response: z.ZodObject<{
|
|
153
|
+
sent: z.ZodBoolean;
|
|
154
|
+
maskedEmail: z.ZodString;
|
|
155
|
+
}, "strip", z.ZodTypeAny, {
|
|
156
|
+
sent: boolean;
|
|
157
|
+
maskedEmail: string;
|
|
158
|
+
}, {
|
|
159
|
+
sent: boolean;
|
|
160
|
+
maskedEmail: string;
|
|
161
|
+
}>;
|
|
162
|
+
};
|
|
163
|
+
/** Search the schools we hold DfE records for, to fill the sign-up form. Public. */
|
|
164
|
+
"registration-lookupSchool": {
|
|
165
|
+
request: z.ZodObject<{
|
|
166
|
+
/** A school name, town or postcode. Two characters or more. */
|
|
167
|
+
query: z.ZodString;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
query: string;
|
|
170
|
+
}, {
|
|
171
|
+
query: string;
|
|
172
|
+
}>;
|
|
173
|
+
response: z.ZodObject<{
|
|
174
|
+
schools: z.ZodArray<z.ZodObject<{
|
|
175
|
+
urn: z.ZodNumber;
|
|
176
|
+
name: z.ZodString;
|
|
177
|
+
town: z.ZodString;
|
|
178
|
+
postcode: z.ZodString;
|
|
179
|
+
street: z.ZodString;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
name: string;
|
|
182
|
+
urn: number;
|
|
183
|
+
postcode: string;
|
|
184
|
+
town: string;
|
|
185
|
+
street: string;
|
|
186
|
+
}, {
|
|
187
|
+
name: string;
|
|
188
|
+
urn: number;
|
|
189
|
+
postcode: string;
|
|
190
|
+
town: string;
|
|
191
|
+
street: string;
|
|
192
|
+
}>, "many">;
|
|
193
|
+
}, "strip", z.ZodTypeAny, {
|
|
194
|
+
schools: {
|
|
195
|
+
name: string;
|
|
196
|
+
urn: number;
|
|
197
|
+
postcode: string;
|
|
198
|
+
town: string;
|
|
199
|
+
street: string;
|
|
200
|
+
}[];
|
|
201
|
+
}, {
|
|
202
|
+
schools: {
|
|
203
|
+
name: string;
|
|
204
|
+
urn: number;
|
|
205
|
+
postcode: string;
|
|
206
|
+
town: string;
|
|
207
|
+
street: string;
|
|
208
|
+
}[];
|
|
209
|
+
}>;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registrationCallables = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
/**
|
|
7
|
+
* Contracts for the registration callables (`Placementt-Backend/functions/src/registration.ts`)
|
|
8
|
+
* added or changed for the self-serve onboarding journey. The older registration
|
|
9
|
+
* callables keep their loose params; `registration-registerInstitute` gains a
|
|
10
|
+
* contract that checks only the new fields and passes the rest through.
|
|
11
|
+
*/
|
|
12
|
+
/** A pick a school can make at sign-up (onboardingV2.ts SIGNUP_PICK_KEYS). Unknown keys are ignored by the backend. */
|
|
13
|
+
const signupPick = zod_1.z.string().min(1).max(40);
|
|
14
|
+
exports.registrationCallables = {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a school, trust or hub account. Existing fields are untyped here on
|
|
17
|
+
* purpose: trust and hub invites send more than this and nothing about them is
|
|
18
|
+
* changing. The new, optional fields are checked.
|
|
19
|
+
*/
|
|
20
|
+
"registration-registerInstitute": {
|
|
21
|
+
request: zod_1.z.object({
|
|
22
|
+
email: zod_1.z.string().trim().email().max(254),
|
|
23
|
+
password: zod_1.z.string().min(8).max(200),
|
|
24
|
+
instituteName: zod_1.z.string().trim().min(1).max(200),
|
|
25
|
+
package: zod_1.z.string().min(1).max(40),
|
|
26
|
+
/** 2 for the self-serve journey. Only honoured for institutes-one with no trust or hub invite. */
|
|
27
|
+
onboardingVersion: (0, types_1.optionalField)(zod_1.z.number().int().min(2).max(2)),
|
|
28
|
+
/** The sub-modules ticked at sign-up. */
|
|
29
|
+
picks: (0, types_1.optionalField)(zod_1.z.array(signupPick).max(20)),
|
|
30
|
+
/** The terms tick box, with the wording shown. */
|
|
31
|
+
termsAccepted: (0, types_1.optionalField)(zod_1.z.object({
|
|
32
|
+
wording: zod_1.z.string().min(1).max(500),
|
|
33
|
+
at: zod_1.z.string().min(1).max(40),
|
|
34
|
+
})),
|
|
35
|
+
}).passthrough(),
|
|
36
|
+
response: zod_1.z.object({ code: zod_1.z.number(), msg: zod_1.z.object({ uid: zod_1.z.string() }) }),
|
|
37
|
+
},
|
|
38
|
+
/** What the activation page shows before the code is typed. Signed out, so the email is masked. */
|
|
39
|
+
"registration-activationStatus": {
|
|
40
|
+
request: zod_1.z.object({ uid: zod_1.z.string().min(1).max(128) }),
|
|
41
|
+
response: zod_1.z.object({
|
|
42
|
+
/** "j***@example.sch.uk" */
|
|
43
|
+
maskedEmail: zod_1.z.string(),
|
|
44
|
+
/** Already active: the page should offer sign-in instead. */
|
|
45
|
+
active: zod_1.z.boolean(),
|
|
46
|
+
/** Whether the current code has expired. False for a code with no sent time. */
|
|
47
|
+
expired: zod_1.z.boolean(),
|
|
48
|
+
/** When the current code was sent, ISO, if known. */
|
|
49
|
+
sentAt: zod_1.z.string().optional(),
|
|
50
|
+
/** How long a code works for, in hours. */
|
|
51
|
+
validHours: zod_1.z.number(),
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
/** Sends a new activation code. Rate limited to one a minute and ten in total. */
|
|
55
|
+
"registration-resendActivationCode": {
|
|
56
|
+
request: zod_1.z.object({ uid: zod_1.z.string().min(1).max(128) }),
|
|
57
|
+
response: zod_1.z.object({ sent: zod_1.z.boolean(), maskedEmail: zod_1.z.string() }),
|
|
58
|
+
},
|
|
59
|
+
/** Search the schools we hold DfE records for, to fill the sign-up form. Public. */
|
|
60
|
+
"registration-lookupSchool": {
|
|
61
|
+
request: zod_1.z.object({
|
|
62
|
+
/** A school name, town or postcode. Two characters or more. */
|
|
63
|
+
query: zod_1.z.string().trim().min(2).max(100),
|
|
64
|
+
}),
|
|
65
|
+
response: zod_1.z.object({
|
|
66
|
+
schools: zod_1.z.array(zod_1.z.object({
|
|
67
|
+
urn: zod_1.z.number(),
|
|
68
|
+
name: zod_1.z.string(),
|
|
69
|
+
town: zod_1.z.string(),
|
|
70
|
+
postcode: zod_1.z.string(),
|
|
71
|
+
street: zod_1.z.string(),
|
|
72
|
+
})),
|
|
73
|
+
}),
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=registration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registration.js","sourceRoot":"","sources":["../../src/callables/registration.ts"],"names":[],"mappings":"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"}
|