placementt-core 1.400.1171 โ†’ 1.400.1174

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,26 @@ function updateVersion(version) {
23
27
  console.log(`โœ… Updated version to ${version}`);
24
28
  }
25
29
 
30
+ // npm processes publishes asynchronously, and a publish that lands while the
31
+ // previous one is still being processed can overwrite that one's dist-tag (the
32
+ // version itself survives). Wait for each publish to settle before the next โ€”
33
+ // the first publish of a run regularly takes 5+ minutes to become visible.
34
+ function publishAndWait(version, tag) {
35
+ run(`npm publish --tag ${tag}`);
36
+
37
+ for (let attempt = 0; attempt < 180; attempt++) {
38
+ const tags = JSON.parse(execSync('npm view placementt-core dist-tags --json --prefer-online', { encoding: 'utf8' }));
39
+ if (tags[tag] === version) {
40
+ console.log(`โœ… ${tag} โ†’ ${version}`);
41
+ return;
42
+ }
43
+ execSync('sleep 5');
44
+ }
45
+
46
+ console.error(`โŒ ${tag} still not pointing at ${version} after 15 minutes. Fix with: npm dist-tag add placementt-core@${version} ${tag}`);
47
+ process.exit(1);
48
+ }
49
+
26
50
  // ---- Keep original file contents for reset ----
27
51
  const firebaseConfigPath = 'src/firebase/firebaseConfig.tsx';
28
52
  // Every Algolia client reads the app id from this one module, so swapping it
@@ -45,20 +69,10 @@ function toDevAlgoliaConfig(source) {
45
69
  return swapped;
46
70
  }
47
71
 
48
- // -------------------------------
49
- // 1๏ธโƒฃ PROD VERSION
50
- // -------------------------------
51
72
  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
73
 
60
74
  // -------------------------------
61
- // 2๏ธโƒฃ DEV VERSION
75
+ // 1๏ธโƒฃ DEV VERSION
62
76
  // -------------------------------
63
77
  console.log("๐Ÿ›  Switching to DEV config...");
64
78
 
@@ -77,10 +91,10 @@ console.log("๐Ÿš€ Building (dev)...");
77
91
  run('yarn tsc');
78
92
 
79
93
  console.log(`๐Ÿ“ค Publishing ${devVersion}`);
80
- run('npm publish --tag dev');
94
+ publishAndWait(devVersion, 'dev');
81
95
 
82
96
  // -------------------------------
83
- // 3๏ธโƒฃ EMULATOR VERSION
97
+ // 2๏ธโƒฃ EMULATOR VERSION
84
98
  // -------------------------------
85
99
  console.log("๐Ÿ›  Switching to EMULATOR config...");
86
100
 
@@ -97,7 +111,7 @@ console.log("๐Ÿš€ Building (emulator)...");
97
111
  run('yarn tsc');
98
112
 
99
113
  console.log(`๐Ÿ“ค Publishing ${emulatorVersion}`);
100
- run('npm publish --tag emu');
114
+ publishAndWait(emulatorVersion, 'emu');
101
115
 
102
116
  // -------------------------------
103
117
  // RESET FILES
@@ -106,6 +120,17 @@ console.log("๐Ÿงน Resetting source files...");
106
120
  fs.writeFileSync(firebaseConfigPath, originalFirebaseConfig);
107
121
  fs.writeFileSync(algoliaConfigPath, originalAlgoliaConfig);
108
122
 
123
+ // -------------------------------
124
+ // PROD VERSION (last, so nothing publishes after it and clobbers its tag)
125
+ // -------------------------------
126
+ updateVersion(prodVersion);
127
+
128
+ console.log("๐Ÿš€ Building (prod)...");
129
+ run('yarn tsc');
130
+
131
+ console.log(`๐Ÿ“ค Publishing ${prodVersion}`);
132
+ publishAndWait(prodVersion, 'prod');
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,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,CAAC;YACd,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;YAChC,MAAM,EAAE,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.400.1171",
5
+ "version": "1.400.1174",
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"]),