@voyant-travel/mice 0.1.0

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.
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ const isoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD");
3
+ export const sessionTypeSchema = z.enum([
4
+ "keynote",
5
+ "breakout",
6
+ "meal",
7
+ "networking",
8
+ "gala",
9
+ "excursion",
10
+ "free",
11
+ ]);
12
+ export const sessionInclusionKindSchema = z.enum(["fnb", "av", "materials", "signage", "other"]);
13
+ export const createSessionSchema = z.object({
14
+ programId: z.string().min(1),
15
+ title: z.string().min(1),
16
+ sessionType: sessionTypeSchema.default("breakout"),
17
+ functionSpaceId: z.string().min(1).optional(),
18
+ dayDate: isoDate.optional(),
19
+ startsAt: z.string().datetime().optional(),
20
+ endsAt: z.string().datetime().optional(),
21
+ track: z.string().optional(),
22
+ capacity: z.number().int().min(0).optional(),
23
+ requiresRegistration: z.boolean().optional(),
24
+ notes: z.string().optional(),
25
+ });
26
+ export const updateSessionSchema = createSessionSchema.partial().omit({ programId: true });
27
+ export const sessionListQuerySchema = z.object({
28
+ programId: z.string().min(1),
29
+ sessionType: sessionTypeSchema.optional(),
30
+ limit: z.coerce.number().int().min(1).max(200).default(50),
31
+ offset: z.coerce.number().int().min(0).default(0),
32
+ });
33
+ export const setSessionInclusionsSchema = z.object({
34
+ inclusions: z.array(z.object({
35
+ kind: sessionInclusionKindSchema,
36
+ description: z.string().optional(),
37
+ quantity: z.number().int().min(1).default(1),
38
+ costAmountCents: z.number().int().min(0).optional(),
39
+ currency: z.string().optional(),
40
+ })),
41
+ });
@@ -0,0 +1,98 @@
1
+ import { z } from "zod";
2
+ export declare const programTypeSchema: z.ZodEnum<{
3
+ meeting: "meeting";
4
+ incentive: "incentive";
5
+ conference: "conference";
6
+ exhibition: "exhibition";
7
+ other: "other";
8
+ }>;
9
+ export declare const programStatusSchema: z.ZodEnum<{
10
+ lead: "lead";
11
+ planning: "planning";
12
+ contracted: "contracted";
13
+ operating: "operating";
14
+ completed: "completed";
15
+ cancelled: "cancelled";
16
+ }>;
17
+ export declare const createProgramSchema: z.ZodObject<{
18
+ name: z.ZodString;
19
+ organizationId: z.ZodOptional<z.ZodString>;
20
+ primaryContactPersonId: z.ZodOptional<z.ZodString>;
21
+ accountManagerId: z.ZodOptional<z.ZodString>;
22
+ code: z.ZodOptional<z.ZodString>;
23
+ type: z.ZodDefault<z.ZodEnum<{
24
+ meeting: "meeting";
25
+ incentive: "incentive";
26
+ conference: "conference";
27
+ exhibition: "exhibition";
28
+ other: "other";
29
+ }>>;
30
+ status: z.ZodDefault<z.ZodEnum<{
31
+ lead: "lead";
32
+ planning: "planning";
33
+ contracted: "contracted";
34
+ operating: "operating";
35
+ completed: "completed";
36
+ cancelled: "cancelled";
37
+ }>>;
38
+ destination: z.ZodOptional<z.ZodString>;
39
+ startDate: z.ZodOptional<z.ZodString>;
40
+ endDate: z.ZodOptional<z.ZodString>;
41
+ estimatedPax: z.ZodOptional<z.ZodNumber>;
42
+ confirmedPax: z.ZodOptional<z.ZodNumber>;
43
+ currency: z.ZodOptional<z.ZodString>;
44
+ budgetAmountCents: z.ZodOptional<z.ZodNumber>;
45
+ }, z.core.$strip>;
46
+ export declare const updateProgramSchema: z.ZodObject<{
47
+ name: z.ZodOptional<z.ZodString>;
48
+ organizationId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
49
+ primaryContactPersonId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
50
+ accountManagerId: z.ZodOptional<z.ZodOptional<z.ZodString>>;
51
+ code: z.ZodOptional<z.ZodOptional<z.ZodString>>;
52
+ type: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
53
+ meeting: "meeting";
54
+ incentive: "incentive";
55
+ conference: "conference";
56
+ exhibition: "exhibition";
57
+ other: "other";
58
+ }>>>;
59
+ status: z.ZodOptional<z.ZodDefault<z.ZodEnum<{
60
+ lead: "lead";
61
+ planning: "planning";
62
+ contracted: "contracted";
63
+ operating: "operating";
64
+ completed: "completed";
65
+ cancelled: "cancelled";
66
+ }>>>;
67
+ destination: z.ZodOptional<z.ZodOptional<z.ZodString>>;
68
+ startDate: z.ZodOptional<z.ZodOptional<z.ZodString>>;
69
+ endDate: z.ZodOptional<z.ZodOptional<z.ZodString>>;
70
+ estimatedPax: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
71
+ confirmedPax: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
72
+ currency: z.ZodOptional<z.ZodOptional<z.ZodString>>;
73
+ budgetAmountCents: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
74
+ }, z.core.$strip>;
75
+ export declare const programListQuerySchema: z.ZodObject<{
76
+ status: z.ZodOptional<z.ZodEnum<{
77
+ lead: "lead";
78
+ planning: "planning";
79
+ contracted: "contracted";
80
+ operating: "operating";
81
+ completed: "completed";
82
+ cancelled: "cancelled";
83
+ }>>;
84
+ type: z.ZodOptional<z.ZodEnum<{
85
+ meeting: "meeting";
86
+ incentive: "incentive";
87
+ conference: "conference";
88
+ exhibition: "exhibition";
89
+ other: "other";
90
+ }>>;
91
+ organizationId: z.ZodOptional<z.ZodString>;
92
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
93
+ offset: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
94
+ }, z.core.$strip>;
95
+ export type CreateProgramBody = z.infer<typeof createProgramSchema>;
96
+ export type UpdateProgramBody = z.infer<typeof updateProgramSchema>;
97
+ export type ProgramListQuery = z.infer<typeof programListQuerySchema>;
98
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAIvB,eAAO,MAAM,iBAAiB;;;;;;EAM5B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;EAO9B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAe9B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgC,CAAA;AAEhE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;iBAMjC,CAAA;AAEF,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AACnE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AACnE,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { z } from "zod";
2
+ const isoDate = z.string().regex(/^\d{4}-\d{2}-\d{2}$/, "expected YYYY-MM-DD");
3
+ export const programTypeSchema = z.enum([
4
+ "meeting",
5
+ "incentive",
6
+ "conference",
7
+ "exhibition",
8
+ "other",
9
+ ]);
10
+ export const programStatusSchema = z.enum([
11
+ "lead",
12
+ "planning",
13
+ "contracted",
14
+ "operating",
15
+ "completed",
16
+ "cancelled",
17
+ ]);
18
+ export const createProgramSchema = z.object({
19
+ name: z.string().min(1),
20
+ organizationId: z.string().min(1).optional(),
21
+ primaryContactPersonId: z.string().min(1).optional(),
22
+ accountManagerId: z.string().min(1).optional(),
23
+ code: z.string().optional(),
24
+ type: programTypeSchema.default("conference"),
25
+ status: programStatusSchema.default("lead"),
26
+ destination: z.string().optional(),
27
+ startDate: isoDate.optional(),
28
+ endDate: isoDate.optional(),
29
+ estimatedPax: z.number().int().min(0).optional(),
30
+ confirmedPax: z.number().int().min(0).optional(),
31
+ currency: z.string().optional(),
32
+ budgetAmountCents: z.number().int().min(0).optional(),
33
+ });
34
+ export const updateProgramSchema = createProgramSchema.partial();
35
+ export const programListQuerySchema = z.object({
36
+ status: programStatusSchema.optional(),
37
+ type: programTypeSchema.optional(),
38
+ organizationId: z.string().min(1).optional(),
39
+ limit: z.coerce.number().int().min(1).max(200).default(50),
40
+ offset: z.coerce.number().int().min(0).default(0),
41
+ });
@@ -0,0 +1,32 @@
1
+ DO $$ BEGIN
2
+ CREATE TYPE "public"."mice_program_status" AS ENUM('lead', 'planning', 'contracted', 'operating', 'completed', 'cancelled');
3
+ EXCEPTION WHEN duplicate_object THEN null;
4
+ END $$;--> statement-breakpoint
5
+ DO $$ BEGIN
6
+ CREATE TYPE "public"."mice_program_type" AS ENUM('meeting', 'incentive', 'conference', 'exhibition', 'other');
7
+ EXCEPTION WHEN duplicate_object THEN null;
8
+ END $$;--> statement-breakpoint
9
+ CREATE TABLE "mice_programs" (
10
+ "id" text PRIMARY KEY NOT NULL,
11
+ "organization_id" text,
12
+ "primary_contact_person_id" text,
13
+ "account_manager_id" text,
14
+ "name" text NOT NULL,
15
+ "code" text,
16
+ "type" "mice_program_type" DEFAULT 'conference' NOT NULL,
17
+ "status" "mice_program_status" DEFAULT 'lead' NOT NULL,
18
+ "destination" text,
19
+ "start_date" date,
20
+ "end_date" date,
21
+ "estimated_pax" integer,
22
+ "confirmed_pax" integer,
23
+ "currency" text,
24
+ "budget_amount_cents" integer,
25
+ "metadata" jsonb,
26
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
27
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
28
+ );
29
+ --> statement-breakpoint
30
+ CREATE INDEX "idx_mice_programs_org" ON "mice_programs" USING btree ("organization_id");--> statement-breakpoint
31
+ CREATE INDEX "idx_mice_programs_status" ON "mice_programs" USING btree ("status");--> statement-breakpoint
32
+ CREATE INDEX "idx_mice_programs_dates" ON "mice_programs" USING btree ("start_date","end_date");
@@ -0,0 +1,45 @@
1
+ DO $$ BEGIN
2
+ CREATE TYPE "public"."mice_session_inclusion_kind" AS ENUM('fnb', 'av', 'materials', 'signage', 'other');
3
+ EXCEPTION WHEN duplicate_object THEN null;
4
+ END $$;--> statement-breakpoint
5
+ DO $$ BEGIN
6
+ CREATE TYPE "public"."mice_session_type" AS ENUM('keynote', 'breakout', 'meal', 'networking', 'gala', 'excursion', 'free');
7
+ EXCEPTION WHEN duplicate_object THEN null;
8
+ END $$;--> statement-breakpoint
9
+ CREATE TABLE "mice_program_sessions" (
10
+ "id" text PRIMARY KEY NOT NULL,
11
+ "program_id" text NOT NULL,
12
+ "function_space_id" text,
13
+ "title" text NOT NULL,
14
+ "session_type" "mice_session_type" DEFAULT 'breakout' NOT NULL,
15
+ "day_date" date,
16
+ "starts_at" timestamp with time zone,
17
+ "ends_at" timestamp with time zone,
18
+ "track" text,
19
+ "capacity" integer,
20
+ "requires_registration" boolean DEFAULT false NOT NULL,
21
+ "notes" text,
22
+ "metadata" jsonb,
23
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
24
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
25
+ );
26
+ --> statement-breakpoint
27
+ CREATE TABLE "mice_session_inclusions" (
28
+ "id" text PRIMARY KEY NOT NULL,
29
+ "session_id" text NOT NULL,
30
+ "kind" "mice_session_inclusion_kind" NOT NULL,
31
+ "description" text,
32
+ "quantity" integer DEFAULT 1 NOT NULL,
33
+ "cost_amount_cents" integer,
34
+ "currency" text,
35
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
36
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL
37
+ );
38
+ --> statement-breakpoint
39
+ ALTER TABLE "mice_program_sessions" ADD CONSTRAINT "mice_program_sessions_program_id_mice_programs_id_fk" FOREIGN KEY ("program_id") REFERENCES "public"."mice_programs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
40
+ ALTER TABLE "mice_session_inclusions" ADD CONSTRAINT "mice_session_inclusions_session_id_mice_program_sessions_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."mice_program_sessions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
41
+ CREATE INDEX "idx_mice_program_sessions_program" ON "mice_program_sessions" USING btree ("program_id");--> statement-breakpoint
42
+ CREATE INDEX "idx_mice_program_sessions_program_day" ON "mice_program_sessions" USING btree ("program_id","day_date");--> statement-breakpoint
43
+ CREATE INDEX "idx_mice_program_sessions_function_space" ON "mice_program_sessions" USING btree ("function_space_id");--> statement-breakpoint
44
+ CREATE INDEX "idx_mice_program_sessions_starts_at" ON "mice_program_sessions" USING btree ("starts_at");--> statement-breakpoint
45
+ CREATE INDEX "idx_mice_session_inclusions_session" ON "mice_session_inclusions" USING btree ("session_id");
@@ -0,0 +1,20 @@
1
+ {
2
+ "version": "7",
3
+ "dialect": "postgresql",
4
+ "entries": [
5
+ {
6
+ "idx": 0,
7
+ "version": "7",
8
+ "when": 1782147436181,
9
+ "tag": "0000_mice_baseline",
10
+ "breakpoints": true
11
+ },
12
+ {
13
+ "idx": 1,
14
+ "version": "7",
15
+ "when": 1782153566121,
16
+ "tag": "0001_mice_baseline",
17
+ "breakpoints": true
18
+ }
19
+ ]
20
+ }
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@voyant-travel/mice",
3
+ "version": "0.1.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./schema": "./src/schema.ts",
9
+ "./validation": "./src/validation.ts",
10
+ "./routes": "./src/routes.ts"
11
+ },
12
+ "scripts": {
13
+ "typecheck": "tsc --noEmit",
14
+ "lint": "biome check src/",
15
+ "test": "vitest run",
16
+ "build": "tsc -p tsconfig.json",
17
+ "clean": "rm -rf dist tsconfig.tsbuildinfo",
18
+ "prepack": "pnpm run build",
19
+ "db:generate": "drizzle-kit generate --config=drizzle.migrations.config.ts --name=mice_baseline && node ../../scripts/migrations/guard-create-type.mjs ./migrations && node ../../scripts/migrations/ensure-extensions.mjs ./migrations"
20
+ },
21
+ "dependencies": {
22
+ "@voyant-travel/core": "workspace:^",
23
+ "@voyant-travel/db": "workspace:^",
24
+ "@voyant-travel/hono": "workspace:^",
25
+ "drizzle-orm": "^0.45.2",
26
+ "hono": "^4.12.10",
27
+ "zod": "^4.3.6"
28
+ },
29
+ "devDependencies": {
30
+ "@voyant-travel/voyant-typescript-config": "workspace:^",
31
+ "drizzle-kit": "^0.31.10",
32
+ "typescript": "^6.0.2",
33
+ "vitest": "^4.1.2"
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "migrations/*.sql",
38
+ "migrations/meta/_journal.json"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "import": "./dist/index.js",
46
+ "default": "./dist/index.js"
47
+ },
48
+ "./schema": {
49
+ "types": "./dist/schema.d.ts",
50
+ "import": "./dist/schema.js",
51
+ "default": "./dist/schema.js"
52
+ },
53
+ "./validation": {
54
+ "types": "./dist/validation.d.ts",
55
+ "import": "./dist/validation.js",
56
+ "default": "./dist/validation.js"
57
+ },
58
+ "./routes": {
59
+ "types": "./dist/routes.d.ts",
60
+ "import": "./dist/routes.js",
61
+ "default": "./dist/routes.js"
62
+ }
63
+ },
64
+ "main": "./dist/index.js",
65
+ "types": "./dist/index.d.ts"
66
+ },
67
+ "repository": {
68
+ "type": "git",
69
+ "url": "https://github.com/voyant-travel/voyant.git",
70
+ "directory": "packages/mice"
71
+ },
72
+ "voyant": {
73
+ "schema": "./schema"
74
+ }
75
+ }