Skip to content

Commit 08ebf7a

Browse files
committed
use shared 2
1 parent e8666c1 commit 08ebf7a

File tree

11 files changed

+28
-24
lines changed

11 files changed

+28
-24
lines changed

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@acm-uiuc:registry=https://registry.npmjs.org

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"test:e2e-ui": "playwright test --ui"
2929
},
3030
"dependencies": {
31-
"@acm-uiuc/js-shared": "^1.0.1"
31+
"@acm-uiuc/js-shared": "^2.0.1"
3232
},
3333
"devDependencies": {
3434
"@eslint/compat": "^1.2.8",

src/api/routes/events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import "zod-openapi/extend";
22
import { FastifyPluginAsync, FastifyRequest } from "fastify";
33
import { AppRoles } from "../../common/roles.js";
44
import { z } from "zod";
5-
import { OrganizationList } from "@acm-uiuc/js-shared";
5+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
66
import {
77
DeleteItemCommand,
88
GetItemCommand,
@@ -111,7 +111,7 @@ const baseSchema = z.object({
111111
description: "Google Maps link for easy navigation to the event location.",
112112
example: "https://maps.app.goo.gl/dwbBBBkfjkgj8gvA8",
113113
}),
114-
host: z.enum(OrganizationList as [string, ...string[]]),
114+
host: z.enum(AllOrganizationList as [string, ...string[]]),
115115
featured: z.boolean().default(false).openapi({
116116
description:
117117
"Whether or not the event should be shown on the ACM @ UIUC website home page (and added to Discord, as available).",
@@ -165,7 +165,7 @@ const eventsPlugin: FastifyPluginAsyncZodOpenApi = async (
165165
"If true, only get events which are marked as featured.",
166166
}),
167167
host: z
168-
.enum(OrganizationList as [string, ...string[]])
168+
.enum(AllOrganizationList as [string, ...string[]])
169169
.optional()
170170
.openapi({
171171
description: "Retrieve events only for a specific host.",

src/api/routes/ics.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import ical, {
1414
} from "ical-generator";
1515
import moment from "moment";
1616
import { getVtimezoneComponent } from "@touch4it/ical-timezones";
17-
import { OrganizationList } from "@acm-uiuc/js-shared";
17+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
1818
import { CLIENT_HTTP_CACHE_POLICY, EventRepeatOptions } from "./events.js";
1919
import rateLimiter from "api/plugins/rateLimiter.js";
2020
import { getCacheCounter } from "api/functions/cache.js";
@@ -43,7 +43,7 @@ function generateHostName(host: string) {
4343

4444
const icalPlugin: FastifyPluginAsync = async (fastify, _options) => {
4545
fastify.register(rateLimiter, {
46-
limit: OrganizationList.length,
46+
limit: AllOrganizationList.length,
4747
duration: 30,
4848
rateLimitIdentifier: "ical",
4949
});
@@ -53,7 +53,7 @@ const icalPlugin: FastifyPluginAsync = async (fastify, _options) => {
5353
schema: withTags(["iCalendar Integration"], {
5454
params: z.object({
5555
host: z
56-
.optional(z.enum(OrganizationList as [string, ...string[]]))
56+
.optional(z.enum(AllOrganizationList as [string, ...string[]]))
5757
.openapi({ description: "Host to get calendar for." }),
5858
}),
5959
summary:
@@ -87,7 +87,7 @@ const icalPlugin: FastifyPluginAsync = async (fastify, _options) => {
8787
reply.header("etag", etag);
8888
}
8989
if (host) {
90-
if (!OrganizationList.includes(host)) {
90+
if (!AllOrganizationList.includes(host)) {
9191
throw new ValidationError({
9292
message: `Invalid host parameter "${host}" in path.`,
9393
});

src/api/routes/organizations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FastifyPluginAsync } from "fastify";
2-
import { OrganizationList } from "@acm-uiuc/js-shared";
2+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
33
import fastifyCaching from "@fastify/caching";
44
import rateLimiter from "api/plugins/rateLimiter.js";
55
import { withTags } from "api/components/index.js";
@@ -23,7 +23,7 @@ const organizationsPlugin: FastifyPluginAsync = async (fastify, _options) => {
2323
}),
2424
},
2525
async (_request, reply) => {
26-
reply.send(OrganizationList);
26+
reply.send(AllOrganizationList);
2727
},
2828
);
2929
};

src/common/policies/events.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { z } from "zod";
1+
import { string, z } from "zod";
22
import { createPolicy } from "./evaluator.js";
3-
import { OrganizationList } from "@acm-uiuc/js-shared";
3+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
44
import { FastifyRequest } from "fastify";
55

66
export const hostRestrictionPolicy = createPolicy(
77
"EventsHostRestrictionPolicy",
8-
z.object({ host: z.array(z.enum(OrganizationList)) }),
8+
z.object({ host: z.array(z.enum(AllOrganizationList)) }),
99
(request: FastifyRequest & { username?: string }, params) => {
1010
if (request.method === "GET") {
1111
return {

src/common/types/roomRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from "zod";
2-
import { OrganizationList } from "@acm-uiuc/js-shared";
2+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
33

44
export const eventThemeOptions = [
55
"Arts & Music",
@@ -146,7 +146,7 @@ export const roomRequestPostResponse = z.object({
146146
});
147147

148148
export const roomRequestBaseSchema = z.object({
149-
host: z.enum(OrganizationList),
149+
host: z.enum(AllOrganizationList),
150150
title: z.string().min(2, "Title must have at least 2 characters"),
151151
semester: z
152152
.string()

src/ui/pages/events/ManageEvent.page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { useNavigate, useParams } from "react-router-dom";
2020
import { z } from "zod";
2121
import { AuthGuard } from "@ui/components/AuthGuard";
2222
import { useApi } from "@ui/util/api";
23-
import { OrganizationList as orgList } from "@acm-uiuc/js-shared";
23+
import { AllOrganizationList as orgList } from "@acm-uiuc/js-shared";
2424
import { AppRoles } from "@common/roles";
2525
import { EVENT_CACHED_DURATION } from "@common/config";
2626
import { IconPlus, IconTrash } from "@tabler/icons-react";

src/ui/pages/roomRequest/NewRoomRequest.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from "@mantine/core";
1919
import { useForm, zodResolver } from "@mantine/form";
2020
import { DateInput, DateTimePicker } from "@mantine/dates";
21-
import { OrganizationList } from "@acm-uiuc/js-shared";
21+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
2222
import {
2323
eventThemeOptions,
2424
spaceTypeOptions,
@@ -401,7 +401,10 @@ const NewRoomRequest: React.FC<NewRoomRequestProps> = ({
401401
placeholder="Select host organization"
402402
withAsterisk
403403
searchable
404-
data={OrganizationList.map((org) => ({ value: org, label: org }))}
404+
data={AllOrganizationList.map((org) => ({
405+
value: org,
406+
label: org,
407+
}))}
405408
{...form.getInputProps("host")}
406409
/>
407410
<TextInput

tests/live/ical.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { expect, test } from "vitest";
2-
import { OrganizationList } from "@acm-uiuc/js-shared";
2+
import { AllOrganizationList } from "@acm-uiuc/js-shared";
33
import ical from "node-ical";
44
const baseEndpoint = `https://core.aws.qa.acmuiuc.org`;
55

@@ -27,7 +27,7 @@ const fetchWithRateLimit = async (url: string) => {
2727
};
2828

2929
test("Get calendars with rate limit handling", { timeout: 45000 }, async () => {
30-
for (const org of OrganizationList) {
30+
for (const org of AllOrganizationList) {
3131
const response = await fetchWithRateLimit(
3232
`${baseEndpoint}/api/v1/ical/${org}`,
3333
);

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
# yarn lockfile v1
33

44

5-
"@acm-uiuc/js-shared@^1.0.1":
6-
version "1.0.1"
7-
resolved "https://npm.pkg.github.com/download/@acm-uiuc/js-shared/1.0.1/61e681d8120236760d506245a367c751bec4bc7d#61e681d8120236760d506245a367c751bec4bc7d"
8-
integrity sha512-BocoPsuLeTaUwA3HZjJ1zbIRAvRm7ekh9GcF0EYhqoau8JHoPCKjKEuy7N+dkkgX/S1EusYUwcqPA869fnuR0A==
5+
"@acm-uiuc/js-shared@^2.0.1":
6+
version "2.0.1"
7+
resolved "https://registry.yarnpkg.com/@acm-uiuc/js-shared/-/js-shared-2.0.1.tgz#2f7ee63651d1994fe84b7873d5cdcb1860e7861c"
8+
integrity sha512-mzmM6X6jRGhIHAz0iungt5hu3XKspnzmXo8itutz0FqEe515T/+49d9I5rR3HEsV17XkXHG++f6zyVL5g3wKlw==
99

1010
"@adobe/css-tools@^4.4.0":
1111
version "4.4.1"

0 commit comments

Comments
 (0)