placementt-core 1.300.1171 โ†’ 1.300.1176

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.
@@ -4,7 +4,12 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- permissions:
7
+ # Every publish rewrites the same npm package document, so two runs publishing at
8
+ # once clobber each other's versions and dist-tags. Queue runs instead.
9
+ concurrency:
10
+ group: npm-publish
11
+ cancel-in-progress: false
12
+ permissions:
8
13
  contents: write # default for repo checkout
9
14
  id-token: write # <-- required for npm provenance
10
15
  jobs:
@@ -12,6 +17,10 @@ jobs:
12
17
  runs-on: ubuntu-latest
13
18
  steps:
14
19
  - uses: actions/checkout@v4
20
+ with:
21
+ # A queued run must build the tip of main (including the previous run's
22
+ # version bump), not the commit that originally triggered it.
23
+ ref: main
15
24
 
16
25
  - name: Setup Node
17
26
  uses: actions/setup-node@v4
package/deploy-all.js CHANGED
@@ -11,7 +11,11 @@ console.log("๐Ÿ“ฆ Starting automated deploy-all process...");
11
11
  const packageJsonPath = 'package.json';
12
12
  const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
13
13
 
14
- const [major, minor, patch] = packageJson.version.split('.').map(Number);
14
+ // package.json can lag the registry (a bump commit that failed to push, or a
15
+ // manual edit), so take the highest patch from either source.
16
+ const publishedTags = JSON.parse(execSync('npm view placementt-core dist-tags --json', { encoding: 'utf8' }));
17
+ const patchOf = (version) => Number(version.split('.')[2]);
18
+ const patch = Math.max(patchOf(packageJson.version), ...['prod', 'dev', 'emu'].filter((tag) => publishedTags[tag]).map((tag) => patchOf(publishedTags[tag])));
15
19
  const nextPatch = patch + 1;
16
20
 
17
21
  console.log(`๐Ÿ” Current version: ${packageJson.version}`);
@@ -23,6 +27,24 @@ function updateVersion(version) {
23
27
  console.log(`โœ… Updated version to ${version}`);
24
28
  }
25
29
 
30
+ // A publish that lands while the previous one is still being processed can
31
+ // overwrite that one's dist-tag (the version itself survives). Polling `npm view`
32
+ // to wait it out reads the CDN-cached packument, which lags by many minutes, so
33
+ // instead re-point every tag directly once all three are published.
34
+ const publishedVersions = {};
35
+
36
+ function publishWithTag(version, tag) {
37
+ run(`npm publish --tag ${tag}`);
38
+ publishedVersions[tag] = version;
39
+ }
40
+
41
+ function pinDistTags() {
42
+ for (const [tag, version] of Object.entries(publishedVersions)) {
43
+ run(`npm dist-tag add placementt-core@${version} ${tag}`);
44
+ console.log(`โœ… ${tag} โ†’ ${version}`);
45
+ }
46
+ }
47
+
26
48
  // ---- Keep original file contents for reset ----
27
49
  const firebaseConfigPath = 'src/firebase/firebaseConfig.tsx';
28
50
  // Every Algolia client reads the app id from this one module, so swapping it
@@ -45,20 +67,10 @@ function toDevAlgoliaConfig(source) {
45
67
  return swapped;
46
68
  }
47
69
 
48
- // -------------------------------
49
- // 1๏ธโƒฃ PROD VERSION
50
- // -------------------------------
51
70
  const prodVersion = `1.1.${nextPatch}`;
52
- updateVersion(prodVersion);
53
-
54
- console.log("๐Ÿš€ Building (prod)...");
55
- run('yarn tsc');
56
-
57
- console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
58
- run('npm publish --tag prod');
59
71
 
60
72
  // -------------------------------
61
- // 2๏ธโƒฃ DEV VERSION
73
+ // 1๏ธโƒฃ DEV VERSION
62
74
  // -------------------------------
63
75
  console.log("๐Ÿ›  Switching to DEV config...");
64
76
 
@@ -77,10 +89,10 @@ console.log("๐Ÿš€ Building (dev)...");
77
89
  run('yarn tsc');
78
90
 
79
91
  console.log(`๐Ÿ“ค Publishing ${devVersion}`);
80
- run('npm publish --tag dev');
92
+ publishWithTag(devVersion, 'dev');
81
93
 
82
94
  // -------------------------------
83
- // 3๏ธโƒฃ EMULATOR VERSION
95
+ // 2๏ธโƒฃ EMULATOR VERSION
84
96
  // -------------------------------
85
97
  console.log("๐Ÿ›  Switching to EMULATOR config...");
86
98
 
@@ -97,7 +109,7 @@ console.log("๐Ÿš€ Building (emulator)...");
97
109
  run('yarn tsc');
98
110
 
99
111
  console.log(`๐Ÿ“ค Publishing ${emulatorVersion}`);
100
- run('npm publish --tag emu');
112
+ publishWithTag(emulatorVersion, 'emu');
101
113
 
102
114
  // -------------------------------
103
115
  // RESET FILES
@@ -106,6 +118,19 @@ console.log("๐Ÿงน Resetting source files...");
106
118
  fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
107
119
  fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
108
120
 
121
+ // -------------------------------
122
+ // PROD VERSION (last, so nothing publishes after it and clobbers its tag)
123
+ // -------------------------------
124
+ updateVersion(prodVersion);
125
+
126
+ console.log("๐Ÿš€ Building (prod)...");
127
+ run('yarn tsc');
128
+
129
+ console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
130
+ publishWithTag(prodVersion, 'prod');
131
+
132
+ pinDistTags();
133
+
109
134
  console.log("๐ŸŽ‰ Deployment complete!");
110
135
 
111
136
  updateVersion(prodVersion);
@@ -114,6 +139,8 @@ execSync('git config user.email "github-actions@github.com"', { stdio: 'inherit'
114
139
 
115
140
  execSync('git add package.json', { stdio: 'inherit' });
116
141
  execSync('git commit -m "chore: bump version"', { stdio: 'inherit' });
142
+ // main may have moved while this run was building; rebase so the bump still lands.
143
+ execSync('git pull --rebase origin main', { stdio: 'inherit' });
117
144
  execSync('git push origin main', { stdio: 'inherit' });
118
145
 
119
146
  console.log("๐ŸŽ‰ Deployment complete!");
@@ -71,14 +71,17 @@ export declare const eventsCallables: {
71
71
  eventSchoolId: z.ZodString;
72
72
  slotIds: z.ZodArray<z.ZodString, "many">;
73
73
  students: z.ZodOptional<z.ZodNumber>;
74
+ studentsPerSlot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
74
75
  }, "strip", z.ZodTypeAny, {
75
76
  eventSchoolId: string;
76
77
  slotIds: string[];
77
78
  students?: number | undefined;
79
+ studentsPerSlot?: Record<string, number> | undefined;
78
80
  }, {
79
81
  eventSchoolId: string;
80
82
  slotIds: string[];
81
83
  students?: number | undefined;
84
+ studentsPerSlot?: Record<string, number> | undefined;
82
85
  }>;
83
86
  response: z.ZodObject<{
84
87
  code: z.ZodEnum<["booked"]>;
@@ -45,6 +45,8 @@ exports.eventsCallables = {
45
45
  eventSchoolId: zod_1.z.string().min(1),
46
46
  slotIds: zod_1.z.array(zod_1.z.string().min(1)).min(1),
47
47
  students: zod_1.z.number().int().min(1).optional(),
48
+ // Students per slot, when places are counted in students. Takes precedence over students.
49
+ studentsPerSlot: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().min(1)).optional(),
48
50
  }),
49
51
  response: zod_1.z.object({
50
52
  code: zod_1.z.enum(["booked"]),
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","sourceRoot":"","sources":["../../src/callables/events.ts"],"names":[],"mappings":";;;AAAA,6BAAsB;AAGtB;;;GAGG;AACU,QAAA,eAAe,GAAG;IAC3B,qBAAqB,EAAE;QACnB,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC;YACd,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE;YACf,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;SACpB,CAAC;QACF,qEAAqE;QACrE,QAAQ,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,CAAC;YACvB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;YACd,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC3B,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC9B,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACtC,eAAe,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YACtC,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAClC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC/B,OAAO,EAAE,OAAC,CAAC,MAAM,E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,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;SAC5B,CAAC;QACF,QAAQ,EAAE,OAAC,CAAC,MAAM,CAAC;YACf,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC;SAC5B,CAAC;KACL;CACoB,CAAC"}
@@ -2408,14 +2408,17 @@ export declare const allCallables: {
2408
2408
  eventSchoolId: z.ZodString;
2409
2409
  slotIds: z.ZodArray<z.ZodString, "many">;
2410
2410
  students: z.ZodOptional<z.ZodNumber>;
2411
+ studentsPerSlot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2411
2412
  }, "strip", z.ZodTypeAny, {
2412
2413
  eventSchoolId: string;
2413
2414
  slotIds: string[];
2414
2415
  students?: number | undefined;
2416
+ studentsPerSlot?: Record<string, number> | undefined;
2415
2417
  }, {
2416
2418
  eventSchoolId: string;
2417
2419
  slotIds: string[];
2418
2420
  students?: number | undefined;
2421
+ studentsPerSlot?: Record<string, number> | undefined;
2419
2422
  }>;
2420
2423
  response: z.ZodObject<{
2421
2424
  code: z.ZodEnum<["booked"]>;
@@ -2626,14 +2629,17 @@ export declare const callableGroups: {
2626
2629
  eventSchoolId: z.ZodString;
2627
2630
  slotIds: z.ZodArray<z.ZodString, "many">;
2628
2631
  students: z.ZodOptional<z.ZodNumber>;
2632
+ studentsPerSlot: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
2629
2633
  }, "strip", z.ZodTypeAny, {
2630
2634
  eventSchoolId: string;
2631
2635
  slotIds: string[];
2632
2636
  students?: number | undefined;
2637
+ studentsPerSlot?: Record<string, number> | undefined;
2633
2638
  }, {
2634
2639
  eventSchoolId: string;
2635
2640
  slotIds: string[];
2636
2641
  students?: number | undefined;
2642
+ studentsPerSlot?: Record<string, number> | undefined;
2637
2643
  }>;
2638
2644
  response: z.ZodObject<{
2639
2645
  code: z.ZodEnum<["booked"]>;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "private": false,
3
3
  "name": "placementt-core",
4
4
  "author": "Placementt",
5
- "version": "1.300.1171",
5
+ "version": "1.300.1176",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
8
8
  "scripts": {
@@ -44,6 +44,8 @@ export const eventsCallables = {
44
44
  eventSchoolId: z.string().min(1),
45
45
  slotIds: z.array(z.string().min(1)).min(1),
46
46
  students: z.number().int().min(1).optional(),
47
+ // Students per slot, when places are counted in students. Takes precedence over students.
48
+ studentsPerSlot: z.record(z.string(), z.number().int().min(1)).optional(),
47
49
  }),
48
50
  response: z.object({
49
51
  code: z.enum(["booked"]),