@playcademy/sandbox 0.12.1 → 0.12.2-beta.2

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/dist/server.js CHANGED
@@ -697,7 +697,7 @@ var package_default;
697
697
  var init_package = __esm(() => {
698
698
  package_default = {
699
699
  name: "@playcademy/sandbox",
700
- version: "0.12.1",
700
+ version: "0.12.2-beta.2",
701
701
  description: "Local development server for Playcademy game development",
702
702
  type: "module",
703
703
  exports: {
@@ -5197,6 +5197,13 @@ var init_dashboard = __esm(() => {
5197
5197
  };
5198
5198
  });
5199
5199
 
5200
+ // ../constants/src/embed.ts
5201
+ var EMBED_PASS_TTL_MS, EMBED_LAUNCH_TTL_MS, EMBED_PAGE_PATH = "/embed", EMBED_PARENT_ORIGIN_PARAM = "parentOrigin";
5202
+ var init_embed = __esm(() => {
5203
+ EMBED_PASS_TTL_MS = 60 * 1000;
5204
+ EMBED_LAUNCH_TTL_MS = 12 * 60 * 60 * 1000;
5205
+ });
5206
+
5200
5207
  // ../constants/src/typescript.ts
5201
5208
  var init_typescript = () => {};
5202
5209
 
@@ -5340,6 +5347,7 @@ var init_cloudflare = __esm(() => {
5340
5347
  var init_src = __esm(() => {
5341
5348
  init_auth();
5342
5349
  init_dashboard();
5350
+ init_embed();
5343
5351
  init_typescript();
5344
5352
  init_domains();
5345
5353
  init_env_vars();
@@ -12946,6 +12954,7 @@ var init_schema = __esm(() => {
12946
12954
  assessmentArtifactBucket: stringType().optional(),
12947
12955
  cdnOrigin: stringType().url().startsWith("https://").optional(),
12948
12956
  queueIngressSecret: stringType().optional(),
12957
+ embedAdminToken: stringType().optional(),
12949
12958
  secretsManifestPepper: stringType().optional()
12950
12959
  }).superRefine((config, ctx) => {
12951
12960
  if (config.isLocal && !config.baseUrl) {
@@ -13112,6 +13121,17 @@ var init_table_utils = __esm(() => {
13112
13121
  });
13113
13122
 
13114
13123
  // ../../node_modules/.bun/drizzle-orm@0.45.3+c063d24bf874cbdc/node_modules/drizzle-orm/pg-core/foreign-keys.js
13124
+ function foreignKey(config) {
13125
+ function mappedConfig() {
13126
+ const { name: name2, columns, foreignColumns } = config;
13127
+ return {
13128
+ name: name2,
13129
+ columns,
13130
+ foreignColumns
13131
+ };
13132
+ }
13133
+ return new ForeignKeyBuilder(mappedConfig);
13134
+ }
13115
13135
  var ForeignKeyBuilder, ForeignKey;
13116
13136
  var init_foreign_keys = __esm(() => {
13117
13137
  init_entity();
@@ -15984,6 +16004,16 @@ function ilike(column, value) {
15984
16004
  function notIlike(column, value) {
15985
16005
  return sql`${column} not ilike ${value}`;
15986
16006
  }
16007
+ function arrayContains(column, values) {
16008
+ if (Array.isArray(values)) {
16009
+ if (values.length === 0) {
16010
+ throw new Error("arrayContains requires at least one value");
16011
+ }
16012
+ const array = sql`${bindIfParam(values, column)}`;
16013
+ return sql`${column} @> ${array}`;
16014
+ }
16015
+ return sql`${column} @> ${bindIfParam(values, column)}`;
16016
+ }
15987
16017
  var eq = (left, right) => {
15988
16018
  return sql`${left} = ${bindIfParam(right, left)}`;
15989
16019
  }, ne = (left, right) => {
@@ -18914,7 +18944,7 @@ var init_table6 = __esm(() => {
18914
18944
  });
18915
18945
 
18916
18946
  // ../data/src/domains/timeback/table.ts
18917
- var gameTimebackIntegrationStatusEnum, gameTimebackAssessmentPurposeEnum, gameTimebackAssessmentStatusEnum, gameTimebackIntegrations, gameTimebackAssessmentTests, gameTimebackMetricDiscrepancyVerifications, gameTimebackActivityCompletions;
18947
+ var gameTimebackIntegrationStatusEnum, gameTimebackIntegrationKindEnum, gameTimebackAssessmentPurposeEnum, gameTimebackAssessmentStatusEnum, gameTimebackIntegrations, gameTimebackAssessmentTests, gameTimebackMetricDiscrepancyVerifications, gameTimebackActivityCompletions;
18918
18948
  var init_table7 = __esm(() => {
18919
18949
  init_drizzle_orm();
18920
18950
  init_pg_core();
@@ -18925,6 +18955,10 @@ var init_table7 = __esm(() => {
18925
18955
  "active",
18926
18956
  "deactivated"
18927
18957
  ]);
18958
+ gameTimebackIntegrationKindEnum = pgEnum("game_timeback_integration_kind", [
18959
+ "base",
18960
+ "hole_filling"
18961
+ ]);
18928
18962
  gameTimebackAssessmentPurposeEnum = pgEnum("game_timeback_assessment_purpose", ASSESSMENT_PURPOSES);
18929
18963
  gameTimebackAssessmentStatusEnum = pgEnum("game_timeback_assessment_status", [
18930
18964
  "draft",
@@ -18938,6 +18972,8 @@ var init_table7 = __esm(() => {
18938
18972
  grade: integer("grade").notNull(),
18939
18973
  subject: text("subject").notNull(),
18940
18974
  status: gameTimebackIntegrationStatusEnum("status"),
18975
+ kind: gameTimebackIntegrationKindEnum("kind").notNull().default("base"),
18976
+ baseIntegrationId: uuid("base_integration_id"),
18941
18977
  totalXp: integer("total_xp"),
18942
18978
  lastVerifiedAt: timestamp("last_verified_at", { withTimezone: true }),
18943
18979
  deactivatedAt: timestamp("deactivated_at", { withTimezone: true }),
@@ -18945,7 +18981,19 @@ var init_table7 = __esm(() => {
18945
18981
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
18946
18982
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
18947
18983
  }, (table) => [
18948
- uniqueIndex("game_timeback_integrations_game_grade_subject_idx").on(table.gameId, table.grade, table.subject).where(sql`${table.status} IS DISTINCT FROM 'deactivated'`)
18984
+ uniqueIndex("game_timeback_integrations_game_grade_subject_idx").on(table.gameId, table.grade, table.subject).where(sql`${table.status} IS DISTINCT FROM 'deactivated' AND ${table.kind} = 'base'`),
18985
+ uniqueIndex("game_timeback_integrations_hole_filling_course_idx").on(table.gameId, table.courseId).where(sql`${table.kind} = 'hole_filling'`),
18986
+ index("game_timeback_integrations_base_integration_idx").on(table.baseIntegrationId),
18987
+ foreignKey({
18988
+ name: "game_timeback_integrations_base_integration_id_fk",
18989
+ columns: [table.baseIntegrationId],
18990
+ foreignColumns: [table.id]
18991
+ }),
18992
+ check("game_timeback_integrations_kind_base_check", sql`(
18993
+ (${table.kind}::text = 'base' AND ${table.baseIntegrationId} IS NULL)
18994
+ OR
18995
+ (${table.kind}::text = 'hole_filling' AND ${table.baseIntegrationId} IS NOT NULL)
18996
+ )`)
18949
18997
  ]);
18950
18998
  gameTimebackAssessmentTests = pgTable("game_timeback_assessment_tests", {
18951
18999
  id: uuid("id").primaryKey().defaultRandom(),
@@ -19026,6 +19074,56 @@ var init_table7 = __esm(() => {
19026
19074
  ]);
19027
19075
  });
19028
19076
 
19077
+ // ../data/src/domains/embed/table.ts
19078
+ var embedPartners, embedLaunches, embedLaunchesRelations;
19079
+ var init_table8 = __esm(() => {
19080
+ init_drizzle_orm();
19081
+ init_pg_core();
19082
+ init_table5();
19083
+ init_table3();
19084
+ embedPartners = pgTable("embed_partners", {
19085
+ id: uuid("id").primaryKey().defaultRandom(),
19086
+ name: text("name").notNull(),
19087
+ clientId: text("client_id").notNull().unique(),
19088
+ allowedOrigins: text("allowed_origins").array().notNull().default([]),
19089
+ enabled: boolean("enabled").notNull().default(true),
19090
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
19091
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
19092
+ });
19093
+ embedLaunches = pgTable("embed_launches", {
19094
+ id: uuid("id").primaryKey().defaultRandom(),
19095
+ partnerId: uuid("partner_id").notNull().references(() => embedPartners.id, { onDelete: "restrict" }),
19096
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
19097
+ gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
19098
+ parentOrigin: text("parent_origin").notNull(),
19099
+ timebackCourseId: text("timeback_course_id"),
19100
+ passHash: text("pass_hash").unique(),
19101
+ passExpiresAt: timestamp("pass_expires_at", { withTimezone: true }).notNull(),
19102
+ redeemedAt: timestamp("redeemed_at", { withTimezone: true }),
19103
+ endedAt: timestamp("ended_at", { withTimezone: true }),
19104
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
19105
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
19106
+ }, (table) => [
19107
+ index("embed_launches_partner_idx").on(table.partnerId),
19108
+ index("embed_launches_user_idx").on(table.userId),
19109
+ index("embed_launches_game_idx").on(table.gameId)
19110
+ ]);
19111
+ embedLaunchesRelations = relations(embedLaunches, ({ one }) => ({
19112
+ partner: one(embedPartners, {
19113
+ fields: [embedLaunches.partnerId],
19114
+ references: [embedPartners.id]
19115
+ }),
19116
+ user: one(users, {
19117
+ fields: [embedLaunches.userId],
19118
+ references: [users.id]
19119
+ }),
19120
+ game: one(games, {
19121
+ fields: [embedLaunches.gameId],
19122
+ references: [games.id]
19123
+ })
19124
+ }));
19125
+ });
19126
+
19029
19127
  // ../data/src/tables.index.ts
19030
19128
  var exports_tables_index = {};
19031
19129
  __export(exports_tables_index, {
@@ -19038,6 +19136,9 @@ __export(exports_tables_index, {
19038
19136
  deploymentProviderEnum: () => deploymentProviderEnum,
19039
19137
  deploymentTargetEnum: () => deploymentTargetEnum,
19040
19138
  developerStatusEnum: () => developerStatusEnum,
19139
+ embedLaunches: () => embedLaunches,
19140
+ embedLaunchesRelations: () => embedLaunchesRelations,
19141
+ embedPartners: () => embedPartners,
19041
19142
  gameCustomHostnames: () => gameCustomHostnames,
19042
19143
  gameDashboardUserRoleEnum: () => gameDashboardUserRoleEnum,
19043
19144
  gameDashboardUsers: () => gameDashboardUsers,
@@ -19056,6 +19157,7 @@ __export(exports_tables_index, {
19056
19157
  gameTimebackAssessmentPurposeEnum: () => gameTimebackAssessmentPurposeEnum,
19057
19158
  gameTimebackAssessmentStatusEnum: () => gameTimebackAssessmentStatusEnum,
19058
19159
  gameTimebackAssessmentTests: () => gameTimebackAssessmentTests,
19160
+ gameTimebackIntegrationKindEnum: () => gameTimebackIntegrationKindEnum,
19059
19161
  gameTimebackIntegrationStatusEnum: () => gameTimebackIntegrationStatusEnum,
19060
19162
  gameTimebackIntegrations: () => gameTimebackIntegrations,
19061
19163
  gameTimebackMetricDiscrepancyVerifications: () => gameTimebackMetricDiscrepancyVerifications,
@@ -19073,6 +19175,7 @@ var init_tables_index = __esm(() => {
19073
19175
  init_table5();
19074
19176
  init_table6();
19075
19177
  init_table7();
19178
+ init_table8();
19076
19179
  });
19077
19180
 
19078
19181
  // ../../node_modules/.bun/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/src/version.js
@@ -20962,10 +21065,16 @@ var init_helpers = __esm(() => {
20962
21065
  });
20963
21066
 
20964
21067
  // ../data/src/domains/timeback/helpers.ts
21068
+ function isBaseGameTimebackIntegration() {
21069
+ return sql`${gameTimebackIntegrations.kind} = ${BASE_GAME_TIMEBACK_INTEGRATION_KIND}`;
21070
+ }
20965
21071
  function isActiveGameTimebackIntegrationStatus(statusColumn = gameTimebackIntegrations.status) {
20966
21072
  return sql`${statusColumn} IS DISTINCT FROM ${DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS}`;
20967
21073
  }
20968
- var ACTIVE_GAME_TIMEBACK_INTEGRATION_STATUS = "active", DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS = "deactivated";
21074
+ function isActiveBaseGameTimebackIntegration() {
21075
+ return sql`(${isActiveGameTimebackIntegrationStatus()} AND ${isBaseGameTimebackIntegration()})`;
21076
+ }
21077
+ var ACTIVE_GAME_TIMEBACK_INTEGRATION_STATUS = "active", DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS = "deactivated", BASE_GAME_TIMEBACK_INTEGRATION_KIND = "base", HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND = "hole_filling";
20969
21078
  var init_helpers2 = __esm(() => {
20970
21079
  init_drizzle_orm();
20971
21080
  init_table7();
@@ -37542,12 +37651,12 @@ function resolveIntegrationSubject(patchSubject, liveSubject, storedSubject) {
37542
37651
  function filterEnrollmentsByGame(enrollments, gameId) {
37543
37652
  return enrollments.filter((enrollment) => enrollment.gameId === gameId).map(({ gameId: _, ...enrollment }) => enrollment);
37544
37653
  }
37545
- function mapEnrollmentsToUserEnrollments(enrollments, integrations) {
37654
+ function mapEnrollmentsToUserEnrollments(enrollments, integrations, baseCourseIdByIntegrationId = new Map) {
37546
37655
  const enrollmentByCourse = new Map(enrollments.map((enrollment) => [enrollment.courseId, enrollment]));
37547
37656
  const courseToSchool = new Map(enrollments.filter((enrollment) => enrollment.school?.id).map((enrollment) => [enrollment.courseId, enrollment.school.id]));
37548
37657
  return integrations.map((integration) => {
37549
37658
  const enrollment = enrollmentByCourse.get(integration.courseId);
37550
- return {
37659
+ const userEnrollment = {
37551
37660
  gameId: integration.gameId,
37552
37661
  grade: integration.grade,
37553
37662
  subject: integration.subject,
@@ -37555,6 +37664,17 @@ function mapEnrollmentsToUserEnrollments(enrollments, integrations) {
37555
37664
  orgId: courseToSchool.get(integration.courseId),
37556
37665
  ...enrollment ? { id: enrollment.sourcedId } : {}
37557
37666
  };
37667
+ if (integration.kind !== HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
37668
+ return userEnrollment;
37669
+ }
37670
+ const baseCourseId = integration.baseIntegrationId ? baseCourseIdByIntegrationId.get(integration.baseIntegrationId) : undefined;
37671
+ return {
37672
+ ...userEnrollment,
37673
+ kind: HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND,
37674
+ ...baseCourseId && { baseCourseId },
37675
+ ...enrollment?.beginDate !== undefined && { beginDate: enrollment.beginDate },
37676
+ ...enrollment?.metadata && { enrollmentMetadata: enrollment.metadata }
37677
+ };
37558
37678
  });
37559
37679
  }
37560
37680
  function buildGameTimebackSummaries(integrations) {
@@ -38037,7 +38157,7 @@ var init_game_service = __esm(() => {
38037
38157
  const db = this.deps.db;
38038
38158
  const integrations = await db.query.gameTimebackIntegrations.findMany({
38039
38159
  columns: { gameId: true, subject: true },
38040
- where: isActiveGameTimebackIntegrationStatus(),
38160
+ where: isActiveBaseGameTimebackIntegration(),
38041
38161
  orderBy: [asc(gameTimebackIntegrations.createdAt)]
38042
38162
  });
38043
38163
  const subjectMap = {};
@@ -38061,9 +38181,7 @@ var init_game_service = __esm(() => {
38061
38181
  }
38062
38182
  const integrations = await db.query.gameTimebackIntegrations.findMany({
38063
38183
  columns: { gameId: true, subject: true, status: true },
38064
- ...accessibleGameIds && {
38065
- where: inArray(gameTimebackIntegrations.gameId, [...accessibleGameIds])
38066
- },
38184
+ where: and(accessibleGameIds ? inArray(gameTimebackIntegrations.gameId, [...accessibleGameIds]) : undefined, isBaseGameTimebackIntegration()),
38067
38185
  orderBy: [asc(gameTimebackIntegrations.createdAt)]
38068
38186
  });
38069
38187
  return buildGameTimebackSummaries(integrations);
@@ -48494,7 +48612,7 @@ function rejectSystemManagedReview(input, context) {
48494
48612
  });
48495
48613
  }
48496
48614
  }
48497
- var TimebackGradeSchema, TimebackSubjectSchema, CourseGoalsSchema, UpdateGameTimebackIntegrationRequestSchema, CreateGameTimebackIntegrationRequestSchema, TimebackActivityDataSchema, EndActivityRequestSchema, GameRunMetricsSchema, GameCourseMetricsSchema, GameMetricsResponseSchema, AdvanceCourseRequestSchema, UnenrollCourseRequestSchema, HeartbeatRequestSchema, PopulateStudentRequestSchema, DerivedPlatformCourseConfigSchema, TimebackBaseConfigSchema, PlatformTimebackSetupRequestSchema, AdminTimebackMutationBaseSchema, AdminAttributionDateSchema, ADMIN_GRANT_XP_MIN = -1e5, ADMIN_GRANT_XP_MAX = 1e5, ADMIN_GRANT_XP_AMOUNT_RANGE_MESSAGE, GrantTimebackXpRequestSchema, AdjustTimebackTimeRequestSchema, AdjustTimebackMasteryRequestSchema, ReconcileMasteryForConfigChangeSchema, EnrollStudentRequestSchema, UnenrollStudentRequestSchema, ReactivateEnrollmentRequestSchema, VerifyTimebackMetricDiscrepancyRequestSchema, AssessmentPurposeSchema, AssessmentStatusSchema, AssessmentKeySchema, DiagnosticKeySchema, DiagnosticRoutingManifestSchema, DiagnosticAssessmentDefinitionInputSchema, AssessmentStandardRefSchema3, CreateAssessmentRequestSchema, UpdateAssessmentRequestSchema, CopyAssessmentRequestSchema, ReviseAssessmentRequestSchema, AssessmentAssociationImportEntrySchema, AttachExistingAssessmentsRequestSchema, ReorderQuestionsRequestSchema;
48615
+ var TimebackGradeSchema, TimebackSubjectSchema, CourseGoalsSchema, UpdateGameTimebackIntegrationRequestSchema, CreateGameTimebackIntegrationRequestSchema, RESERVED_TIMEBACK_COURSE_SOURCED_IDS, TimebackCourseSourcedIdSchema, CreateGameTimebackHoleFillingCourseRequestSchema, TimebackActivityDataSchema, EndActivityRequestSchema, GameRunMetricsSchema, GameCourseMetricsSchema, GameMetricsResponseSchema, AdvanceCourseRequestSchema, UnenrollCourseRequestSchema, HeartbeatRequestSchema, PopulateStudentRequestSchema, DerivedPlatformCourseConfigSchema, TimebackBaseConfigSchema, PlatformTimebackSetupRequestSchema, AdminTimebackMutationBaseSchema, AdminAttributionDateSchema, ADMIN_GRANT_XP_MIN = -1e5, ADMIN_GRANT_XP_MAX = 1e5, ADMIN_GRANT_XP_AMOUNT_RANGE_MESSAGE, GrantTimebackXpRequestSchema, AdjustTimebackTimeRequestSchema, AdjustTimebackMasteryRequestSchema, ReconcileMasteryForConfigChangeSchema, EnrollStudentRequestSchema, UnenrollStudentRequestSchema, ReactivateEnrollmentRequestSchema, VerifyTimebackMetricDiscrepancyRequestSchema, AssessmentPurposeSchema, AssessmentStatusSchema, AssessmentKeySchema, DiagnosticKeySchema, DiagnosticRoutingManifestSchema, DiagnosticAssessmentDefinitionInputSchema, AssessmentStandardRefSchema3, CreateAssessmentRequestSchema, UpdateAssessmentRequestSchema, CopyAssessmentRequestSchema, ReviseAssessmentRequestSchema, AssessmentAssociationImportEntrySchema, AttachExistingAssessmentsRequestSchema, ReorderQuestionsRequestSchema;
48498
48616
  var init_schemas4 = __esm(() => {
48499
48617
  init_esm();
48500
48618
  init_src();
@@ -48530,6 +48648,26 @@ var init_schemas4 = __esm(() => {
48530
48648
  masterableUnits: numberType().int().nonnegative(),
48531
48649
  level: stringType().trim().min(1).optional()
48532
48650
  });
48651
+ RESERVED_TIMEBACK_COURSE_SOURCED_IDS = new Set([
48652
+ "hole-filling",
48653
+ "removed",
48654
+ "components",
48655
+ "component-resources",
48656
+ "structure"
48657
+ ]);
48658
+ TimebackCourseSourcedIdSchema = stringType().trim().min(3).max(100).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, {
48659
+ message: "Use letters, numbers, dots, dashes, or underscores, starting with a letter or number"
48660
+ }).refine((value) => !RESERVED_TIMEBACK_COURSE_SOURCED_IDS.has(value.toLowerCase()), {
48661
+ message: "This course ID is reserved"
48662
+ });
48663
+ CreateGameTimebackHoleFillingCourseRequestSchema = objectType({
48664
+ baseCourseId: stringType().trim().min(1),
48665
+ title: stringType().trim().min(1),
48666
+ courseCode: stringType().trim().min(1),
48667
+ totalXp: numberType().int().positive(),
48668
+ masterableUnits: numberType().int().nonnegative(),
48669
+ courseId: TimebackCourseSourcedIdSchema.optional()
48670
+ });
48533
48671
  TimebackActivityDataSchema = objectType({
48534
48672
  activityId: stringType().min(1),
48535
48673
  activityName: stringType().optional(),
@@ -48845,12 +48983,55 @@ var init_schemas4 = __esm(() => {
48845
48983
  });
48846
48984
  });
48847
48985
 
48986
+ // ../data/src/domains/embed/schemas.ts
48987
+ function isLocalHostname(hostname) {
48988
+ return LOCAL_HOSTNAMES.has(hostname) || hostname.endsWith(".localhost");
48989
+ }
48990
+ function isCanonicalOrigin(value) {
48991
+ let url;
48992
+ try {
48993
+ url = new URL(value);
48994
+ } catch {
48995
+ return false;
48996
+ }
48997
+ if (url.origin !== value) {
48998
+ return false;
48999
+ }
49000
+ return url.protocol === "https:" || url.protocol === "http:" && isLocalHostname(url.hostname);
49001
+ }
49002
+ var LOCAL_HOSTNAMES, EmbedOriginSchema, EmbedPartnerClientIdSchema, EnsureEmbedPartnerSchema, AddEmbedPartnerOriginSchema, CreateEmbedLaunchSchema, RedeemEmbedPassSchema;
49003
+ var init_schemas5 = __esm(() => {
49004
+ init_esm();
49005
+ LOCAL_HOSTNAMES = new Set(["localhost", "127.0.0.1"]);
49006
+ EmbedOriginSchema = stringType().refine(isCanonicalOrigin, {
49007
+ message: "Origin must be a bare https origin like https://example.com, with no path or slash"
49008
+ });
49009
+ EmbedPartnerClientIdSchema = stringType().trim().min(1).max(200);
49010
+ EnsureEmbedPartnerSchema = objectType({
49011
+ name: stringType().trim().min(1).max(100)
49012
+ }).strict();
49013
+ AddEmbedPartnerOriginSchema = objectType({
49014
+ origin: EmbedOriginSchema
49015
+ }).strict();
49016
+ CreateEmbedLaunchSchema = objectType({
49017
+ timebackId: stringType().trim().min(1).max(200),
49018
+ gameSlug: stringType().trim().min(1).max(100),
49019
+ parentOrigin: EmbedOriginSchema,
49020
+ timebackCourseId: stringType().trim().min(1).max(200).optional()
49021
+ }).strict();
49022
+ RedeemEmbedPassSchema = objectType({
49023
+ pass: stringType().min(1).max(200),
49024
+ parentOrigin: EmbedOriginSchema
49025
+ }).strict();
49026
+ });
49027
+
48848
49028
  // ../data/src/schemas.index.ts
48849
49029
  var init_schemas_index = __esm(() => {
48850
49030
  init_schemas();
48851
49031
  init_schemas2();
48852
49032
  init_schemas3();
48853
49033
  init_schemas4();
49034
+ init_schemas5();
48854
49035
  });
48855
49036
 
48856
49037
  // ../../node_modules/.bun/@timeback+core@0.3.1+0ba747e64b820dcd/node_modules/@timeback/core/dist/chunk-3j7jywnx.js
@@ -51979,7 +52160,7 @@ function handleRefineResult(result, payload, input, inst) {
51979
52160
  }
51980
52161
  }
51981
52162
  var $ZodType, $ZodString, $ZodStringFormat, $ZodGUID, $ZodUUID, $ZodEmail, $ZodURL, $ZodEmoji, $ZodNanoID, $ZodCUID, $ZodCUID2, $ZodULID, $ZodXID, $ZodKSUID, $ZodISODateTime, $ZodISODate, $ZodISOTime, $ZodISODuration, $ZodIPv4, $ZodIPv6, $ZodCIDRv4, $ZodCIDRv6, $ZodBase64, $ZodBase64URL, $ZodE164, $ZodJWT, $ZodNumber, $ZodNumberFormat, $ZodBoolean, $ZodUnknown, $ZodNever, $ZodArray, $ZodObject, $ZodUnion, $ZodDiscriminatedUnion, $ZodIntersection, $ZodRecord, $ZodEnum, $ZodLiteral, $ZodTransform, $ZodOptional, $ZodNullable, $ZodDefault, $ZodPrefault, $ZodNonOptional, $ZodCatch, $ZodPipe, $ZodReadonly, $ZodCustom;
51982
- var init_schemas5 = __esm(() => {
52163
+ var init_schemas6 = __esm(() => {
51983
52164
  init_checks2();
51984
52165
  init_core2();
51985
52166
  init_parse();
@@ -53616,7 +53797,7 @@ var init_core3 = __esm(() => {
53616
53797
  init_core2();
53617
53798
  init_parse();
53618
53799
  init_errors4();
53619
- init_schemas5();
53800
+ init_schemas6();
53620
53801
  init_checks2();
53621
53802
  init_versions();
53622
53803
  init_registries();
@@ -53657,7 +53838,7 @@ function duration2(params) {
53657
53838
  var ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration;
53658
53839
  var init_iso = __esm(() => {
53659
53840
  init_core3();
53660
- init_schemas6();
53841
+ init_schemas7();
53661
53842
  ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
53662
53843
  $ZodISODateTime.init(inst, def);
53663
53844
  ZodStringFormat.init(inst, def);
@@ -53899,7 +54080,7 @@ function superRefine(fn, params) {
53899
54080
  return ch;
53900
54081
  }
53901
54082
  var ZodType2, _ZodString, ZodString2, ZodStringFormat, ZodEmail, ZodGUID, ZodUUID, ZodURL, ZodEmoji, ZodNanoID, ZodCUID, ZodCUID2, ZodULID, ZodXID, ZodKSUID, ZodIPv4, ZodIPv6, ZodCIDRv4, ZodCIDRv6, ZodBase64, ZodBase64URL, ZodE164, ZodJWT, ZodNumber2, ZodNumberFormat, ZodBoolean2, ZodUnknown2, ZodNever2, ZodArray2, ZodObject2, ZodUnion2, ZodDiscriminatedUnion2, ZodIntersection2, ZodRecord2, ZodEnum2, ZodLiteral2, ZodTransform, ZodOptional2, ZodNullable2, ZodDefault2, ZodPrefault, ZodNonOptional, ZodCatch2, ZodPipe, ZodReadonly2, ZodCustom;
53902
- var init_schemas6 = __esm(() => {
54083
+ var init_schemas7 = __esm(() => {
53903
54084
  init_core3();
53904
54085
  init_core3();
53905
54086
  init_checks3();
@@ -54352,7 +54533,7 @@ var init_external2 = __esm(() => {
54352
54533
  init_locales();
54353
54534
  init_iso();
54354
54535
  init_coerce();
54355
- init_schemas6();
54536
+ init_schemas7();
54356
54537
  init_checks3();
54357
54538
  init_errors5();
54358
54539
  init_parse2();
@@ -64028,7 +64209,7 @@ function handleRefineResult2(result, payload, input, inst) {
64028
64209
  }
64029
64210
  }
64030
64211
  var $ZodType2, $ZodString2, $ZodStringFormat2, $ZodGUID2, $ZodUUID2, $ZodEmail2, $ZodURL2, $ZodEmoji2, $ZodNanoID2, $ZodCUID3, $ZodCUID22, $ZodULID2, $ZodXID2, $ZodKSUID2, $ZodISODateTime2, $ZodISODate2, $ZodISOTime2, $ZodISODuration2, $ZodIPv42, $ZodIPv62, $ZodCIDRv42, $ZodCIDRv62, $ZodBase642, $ZodBase64URL2, $ZodE1642, $ZodJWT2, $ZodNumber2, $ZodNumberFormat2, $ZodBoolean2, $ZodUnknown2, $ZodNever2, $ZodArray2, $ZodObject2, $ZodObjectJIT, $ZodUnion2, $ZodDiscriminatedUnion2, $ZodIntersection2, $ZodRecord2, $ZodEnum2, $ZodLiteral2, $ZodTransform2, $ZodOptional2, $ZodExactOptional, $ZodNullable2, $ZodDefault2, $ZodPrefault2, $ZodNonOptional2, $ZodCatch2, $ZodPipe2, $ZodReadonly2, $ZodCustom2;
64031
- var init_schemas7 = __esm(() => {
64212
+ var init_schemas8 = __esm(() => {
64032
64213
  init_checks4();
64033
64214
  init_core4();
64034
64215
  init_parse3();
@@ -66505,7 +66686,7 @@ var init_core5 = __esm(() => {
66505
66686
  init_core4();
66506
66687
  init_parse3();
66507
66688
  init_errors6();
66508
- init_schemas7();
66689
+ init_schemas8();
66509
66690
  init_checks4();
66510
66691
  init_versions2();
66511
66692
  init_registries2();
@@ -66545,7 +66726,7 @@ function duration4(params) {
66545
66726
  var ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2;
66546
66727
  var init_iso2 = __esm(() => {
66547
66728
  init_core5();
66548
- init_schemas8();
66729
+ init_schemas9();
66549
66730
  ZodISODateTime2 = /* @__PURE__ */ $constructor2("ZodISODateTime", (inst, def) => {
66550
66731
  $ZodISODateTime2.init(inst, def);
66551
66732
  ZodStringFormat2.init(inst, def);
@@ -66823,7 +67004,7 @@ function superRefine2(fn, params) {
66823
67004
  return _superRefine(fn, params);
66824
67005
  }
66825
67006
  var _installedGroups, ZodType3, _ZodString2, ZodString3, ZodStringFormat2, ZodEmail2, ZodGUID2, ZodUUID2, ZodURL2, ZodEmoji2, ZodNanoID2, ZodCUID3, ZodCUID22, ZodULID2, ZodXID2, ZodKSUID2, ZodIPv42, ZodIPv62, ZodCIDRv42, ZodCIDRv62, ZodBase642, ZodBase64URL2, ZodE1642, ZodJWT2, ZodNumber3, ZodNumberFormat2, ZodBoolean3, ZodUnknown3, ZodNever3, ZodArray3, ZodObject3, ZodUnion3, ZodDiscriminatedUnion3, ZodIntersection3, ZodRecord3, ZodEnum3, ZodLiteral3, ZodTransform2, ZodOptional3, ZodExactOptional, ZodNullable3, ZodDefault3, ZodPrefault2, ZodNonOptional2, ZodCatch3, ZodPipe2, ZodReadonly3, ZodCustom2;
66826
- var init_schemas8 = __esm(() => {
67007
+ var init_schemas9 = __esm(() => {
66827
67008
  init_core5();
66828
67009
  init_core5();
66829
67010
  init_json_schema_processors();
@@ -67480,7 +67661,7 @@ var init_external3 = __esm(() => {
67480
67661
  init_locales2();
67481
67662
  init_iso2();
67482
67663
  init_coerce2();
67483
- init_schemas8();
67664
+ init_schemas9();
67484
67665
  init_checks5();
67485
67666
  init_errors7();
67486
67667
  init_parse4();
@@ -75989,6 +76170,7 @@ class CourseAssessments {
75989
76170
  }
75990
76171
  function buildCoursePayload(config) {
75991
76172
  return {
76173
+ ...config.course.sourcedId && { sourcedId: config.course.sourcedId },
75992
76174
  status: "active",
75993
76175
  title: config.course.title,
75994
76176
  courseCode: config.course.courseCode,
@@ -76035,6 +76217,16 @@ function buildComponentResourcePayload(config, sourcedIds) {
76035
76217
  lessonType: config.componentResource.lessonType
76036
76218
  };
76037
76219
  }
76220
+ async function findOrUndefined(request) {
76221
+ try {
76222
+ return await request;
76223
+ } catch (error) {
76224
+ if (isApiError(error) && error.statusCode === 404) {
76225
+ return;
76226
+ }
76227
+ throw error;
76228
+ }
76229
+ }
76038
76230
 
76039
76231
  class CourseIntegration {
76040
76232
  core;
@@ -76073,6 +76265,32 @@ class CourseIntegration {
76073
76265
  ...verboseData && { verboseData }
76074
76266
  };
76075
76267
  }
76268
+ async findCourse(courseId) {
76269
+ return findOrUndefined(this.core.api.oneroster.courses.get(courseId));
76270
+ }
76271
+ async resumeSetup(courseId, config) {
76272
+ const oneroster = this.core.api.oneroster;
76273
+ const sourcedIds = deriveSourcedIds(courseId);
76274
+ if (!await findOrUndefined(oneroster.courses.getComponent(sourcedIds.component))) {
76275
+ await oneroster.courses.createComponent(buildComponentPayload(config, sourcedIds));
76276
+ addEvent("timeback.component_created", {
76277
+ "app.timeback.component_id": sourcedIds.component
76278
+ });
76279
+ }
76280
+ if (!await findOrUndefined(oneroster.resources.get(sourcedIds.resource))) {
76281
+ await oneroster.resources.create(buildResourcePayload(config, sourcedIds.resource));
76282
+ addEvent("timeback.resource_created", {
76283
+ "app.timeback.resource_id": sourcedIds.resource
76284
+ });
76285
+ }
76286
+ if (!await findOrUndefined(oneroster.courses.getComponentResource(sourcedIds.componentResource))) {
76287
+ await oneroster.courses.createComponentResource(buildComponentResourcePayload(config, sourcedIds));
76288
+ addEvent("timeback.component_resource_link_created", {
76289
+ "app.timeback.component_resource_id": sourcedIds.componentResource
76290
+ });
76291
+ }
76292
+ await this.update(courseId, config);
76293
+ }
76076
76294
  async update(courseId, config) {
76077
76295
  const oneroster = this.core.api.oneroster;
76078
76296
  const sourcedIds = deriveSourcedIds(courseId);
@@ -76212,6 +76430,8 @@ function createCourseNamespace(core) {
76212
76430
  update: (courseId, config) => integration.update(courseId, config),
76213
76431
  verify: (courseId) => integration.verify(courseId),
76214
76432
  getConfig: (courseId) => integration.getConfig(courseId),
76433
+ findCourse: (courseId) => integration.findCourse(courseId),
76434
+ resumeSetup: (courseId, config) => integration.resumeSetup(courseId, config),
76215
76435
  cleanup: (courseId) => integration.cleanup(courseId),
76216
76436
  deactivateCourse: (courseId) => integration.updateCourseStatus(courseId, "tobedeleted"),
76217
76437
  reactivateCourse: (courseId) => integration.updateCourseStatus(courseId, "active"),
@@ -76296,7 +76516,9 @@ class RosterEnrollments {
76296
76516
  status: "active",
76297
76517
  grades,
76298
76518
  subjects,
76299
- school: enrollment.school
76519
+ school: enrollment.school,
76520
+ beginDate: enrollment.beginDate,
76521
+ ...enrollment.metadata && { metadata: enrollment.metadata }
76300
76522
  };
76301
76523
  });
76302
76524
  this.core.caches.enrollments.set(studentId, enrollments);
@@ -80391,11 +80613,8 @@ function normalizeText2(value) {
80391
80613
  function normalizeTestType(value) {
80392
80614
  return normalizeText2(value).replaceAll("-", " ");
80393
80615
  }
80394
- function isUuidLike(value) {
80395
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
80396
- }
80397
80616
  function hasReadableStandardLabel(standard) {
80398
- return Boolean(standard.name || standard.identifier || !isUuidLike(standard.id));
80617
+ return Boolean(standard.name || standard.identifier || !isValidUUID(standard.id));
80399
80618
  }
80400
80619
  function isAllowedGradeLevelTestType(value) {
80401
80620
  const normalizedType = normalizeTestType(value);
@@ -80708,6 +80927,7 @@ var GRADE_LEVEL_TEST_TYPES, naturalTitleSort;
80708
80927
  var init_timeback_grade_level_results_util = __esm(() => {
80709
80928
  init_constants2();
80710
80929
  init_qti();
80930
+ init_src9();
80711
80931
  GRADE_LEVEL_TEST_TYPES = [
80712
80932
  "placement",
80713
80933
  "test out",
@@ -81166,7 +81386,8 @@ class TimebackAdminService {
81166
81386
  const entries = await Promise.all(courseIds.map(async (courseId) => {
81167
81387
  const roster = await client.roster.getCourseRoster(courseId, {
81168
81388
  includeInactive: options?.includeInactive,
81169
- includeUsers: false
81389
+ includeUsers: false,
81390
+ userSourcedId: studentId
81170
81391
  });
81171
81392
  const matches = roster.filter((entry) => entry.enrollment.user.sourcedId === studentId).toSorted((a, b) => {
81172
81393
  const aActive = a.enrollment.status === "active";
@@ -87101,7 +87322,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
87101
87322
  }) {
87102
87323
  await this.deps.validateDeveloperAccess(user, gameId);
87103
87324
  const integrations = await this.deps.db.query.gameTimebackIntegrations.findMany({
87104
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
87325
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
87105
87326
  });
87106
87327
  const matchingIntegrations = new Map;
87107
87328
  for (const integration of integrations) {
@@ -87490,7 +87711,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
87490
87711
  }) {
87491
87712
  await this.deps.validateDeveloperAccess(user, gameId);
87492
87713
  const integrations = await this.deps.db.query.gameTimebackIntegrations.findMany({
87493
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
87714
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
87494
87715
  });
87495
87716
  const orderedIntegrations = integrations.toSorted((left, right) => {
87496
87717
  const subjectDifference = left.subject.localeCompare(right.subject);
@@ -87569,7 +87790,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
87569
87790
  async candidateIntegrations(gameId, studentId, input, db = this.deps.db) {
87570
87791
  const filters = [
87571
87792
  eq(gameTimebackIntegrations.gameId, gameId),
87572
- isActiveGameTimebackIntegrationStatus()
87793
+ isActiveBaseGameTimebackIntegration()
87573
87794
  ];
87574
87795
  if (input.subject) {
87575
87796
  filters.push(eq(gameTimebackIntegrations.subject, input.subject));
@@ -90511,6 +90732,50 @@ function timebackConfigMatchesCreateIntegrationRequest(config, request) {
90511
90732
  const requestedLevel = request.level ?? deriveTimebackCourseLevelFromGrade(request.grade);
90512
90733
  return subject === request.subject && grade === request.grade && config.course.title === request.title && config.course.courseCode === request.courseCode && config.course.level === requestedLevel && (getTotalXpFromTimebackConfig(config) ?? null) === request.totalXp && (getMasterableUnitsFromTimebackConfig(config) ?? null) === request.masterableUnits;
90513
90734
  }
90735
+ function buildHoleFillingCourseConfig(baseConfig, request) {
90736
+ const baseCourseMetadata = isRecord4(baseConfig.course.metadata) ? baseConfig.course.metadata : {};
90737
+ const baseMetrics = isRecord4(baseCourseMetadata.metrics) ? baseCourseMetadata.metrics : {};
90738
+ const baseResourceMetadata = isRecord4(baseConfig.resource.metadata) ? baseConfig.resource.metadata : {};
90739
+ const basePlaycademy = isPlaycademyResourceMetadata(baseResourceMetadata.playcademy) ? baseResourceMetadata.playcademy : undefined;
90740
+ return {
90741
+ organization: baseConfig.organization,
90742
+ course: {
90743
+ ...baseConfig.course,
90744
+ ...request.courseId && { sourcedId: request.courseId },
90745
+ title: request.title,
90746
+ courseCode: request.courseCode,
90747
+ metadata: {
90748
+ ...baseCourseMetadata,
90749
+ courseType: HOLE_FILLING_COURSE_TYPE,
90750
+ baseCourseSourcedId: request.baseCourseId,
90751
+ metrics: {
90752
+ ...baseMetrics,
90753
+ totalXp: request.totalXp,
90754
+ totalLessons: request.masterableUnits,
90755
+ totalGrades: 1
90756
+ }
90757
+ }
90758
+ },
90759
+ component: { ...baseConfig.component, title: `${request.title} Activities` },
90760
+ resource: {
90761
+ ...baseConfig.resource,
90762
+ title: `${request.title} Game`,
90763
+ metadata: {
90764
+ ...baseResourceMetadata,
90765
+ xp: request.totalXp,
90766
+ playcademy: {
90767
+ ...basePlaycademy,
90768
+ mastery: {
90769
+ ...basePlaycademy?.mastery,
90770
+ masterableUnits: request.masterableUnits
90771
+ }
90772
+ }
90773
+ }
90774
+ },
90775
+ componentResource: { ...baseConfig.componentResource, title: `${request.title} Lesson` }
90776
+ };
90777
+ }
90778
+ var HOLE_FILLING_COURSE_TYPE = "hole-filling";
90514
90779
  var init_timeback_create_integration_util = __esm(() => {
90515
90780
  init_constants2();
90516
90781
  init_types2();
@@ -90526,7 +90791,7 @@ async function promoteCompletedCourse({
90526
90791
  enrollments: prefetchedEnrollments
90527
90792
  }) {
90528
90793
  const subjectIntegrations = await db.query.gameTimebackIntegrations.findMany({
90529
- where: and(eq(gameTimebackIntegrations.gameId, currentIntegration.gameId), eq(gameTimebackIntegrations.subject, currentIntegration.subject), isActiveGameTimebackIntegrationStatus())
90794
+ where: and(eq(gameTimebackIntegrations.gameId, currentIntegration.gameId), eq(gameTimebackIntegrations.subject, currentIntegration.subject), isActiveBaseGameTimebackIntegration())
90530
90795
  });
90531
90796
  const nextIntegration = subjectIntegrations.filter((integration) => integration.grade > currentIntegration.grade).toSorted((left, right) => left.grade - right.grade)[0];
90532
90797
  if (!nextIntegration) {
@@ -90593,6 +90858,8 @@ function toGameTimebackIntegration(integration) {
90593
90858
  courseId: integration.courseId,
90594
90859
  grade: integration.grade,
90595
90860
  subject: integration.subject,
90861
+ kind: integration.kind,
90862
+ baseIntegrationId: integration.baseIntegrationId,
90596
90863
  totalXp: integration.totalXp ?? null,
90597
90864
  status: integration.status ?? ACTIVE_GAME_TIMEBACK_INTEGRATION_STATUS,
90598
90865
  deactivatedAt: integration.deactivatedAt ?? null,
@@ -90630,6 +90897,9 @@ var init_timeback_removed_integration_util = __esm(() => {
90630
90897
 
90631
90898
  // ../api-core/src/services/timeback.service.ts
90632
90899
  import { createHash as createHash3 } from "node:crypto";
90900
+ function isUnregisteredHoleFillingOf(course, base) {
90901
+ return course.metadata?.courseType === HOLE_FILLING_COURSE_TYPE && course.metadata.baseCourseSourcedId === base.courseId;
90902
+ }
90633
90903
  async function findGameTimebackIntegrationForUpdate(db, condition) {
90634
90904
  const [integration] = await db.select().from(gameTimebackIntegrations).where(condition).limit(1).for("update");
90635
90905
  return integration;
@@ -91036,13 +91306,29 @@ var init_timeback_service = __esm(async () => {
91036
91306
  const integrations = await db.query.gameTimebackIntegrations.findMany({
91037
91307
  where: and(inArray(gameTimebackIntegrations.courseId, courseIds), isActiveGameTimebackIntegrationStatus())
91038
91308
  });
91039
- return mapEnrollmentsToUserEnrollments(enrollments, integrations);
91309
+ return mapEnrollmentsToUserEnrollments(enrollments, integrations, await this.loadBaseCourseIds(integrations));
91040
91310
  } catch (error) {
91041
91311
  setAttribute("app.timeback.enrollment_fetch", "failed");
91042
91312
  setAttribute("app.timeback.enrollment_fetch_error", errorMessage(error));
91043
91313
  return [];
91044
91314
  }
91045
91315
  }
91316
+ async loadBaseCourseIds(integrations) {
91317
+ const courseIdById = new Map(integrations.map((row) => [row.id, row.courseId]));
91318
+ const missingBaseIds = [
91319
+ ...new Set(integrations.map((row) => row.baseIntegrationId).filter((id) => id !== null && !courseIdById.has(id)))
91320
+ ];
91321
+ if (missingBaseIds.length > 0) {
91322
+ const baseRows = await this.deps.db.query.gameTimebackIntegrations.findMany({
91323
+ columns: { id: true, courseId: true },
91324
+ where: inArray(gameTimebackIntegrations.id, missingBaseIds)
91325
+ });
91326
+ for (const row of baseRows) {
91327
+ courseIdById.set(row.id, row.courseId);
91328
+ }
91329
+ }
91330
+ return courseIdById;
91331
+ }
91046
91332
  async setupIntegration(gameId, request, user) {
91047
91333
  return this.withClientTelemetry(async () => {
91048
91334
  const client = this.requireClient();
@@ -91053,7 +91339,7 @@ var init_timeback_service = __esm(async () => {
91053
91339
  "app.timeback.course_count": courses.length
91054
91340
  });
91055
91341
  const existing = await db.query.gameTimebackIntegrations.findMany({
91056
- where: eq(gameTimebackIntegrations.gameId, gameId)
91342
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isBaseGameTimebackIntegration())
91057
91343
  });
91058
91344
  const integrations = [];
91059
91345
  const verboseData = [];
@@ -91201,13 +91487,13 @@ var init_timeback_service = __esm(async () => {
91201
91487
  "app.timeback.subject": request.subject
91202
91488
  });
91203
91489
  const activeConflict = await db.query.gameTimebackIntegrations.findFirst({
91204
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), isActiveGameTimebackIntegrationStatus())
91490
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), isActiveBaseGameTimebackIntegration())
91205
91491
  });
91206
91492
  if (activeConflict) {
91207
91493
  throw new ConflictError(`A TimeBack integration already exists for ${request.subject} Grade ${request.grade}`);
91208
91494
  }
91209
91495
  const removedCandidates = await db.query.gameTimebackIntegrations.findMany({
91210
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS))
91496
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS), isBaseGameTimebackIntegration())
91211
91497
  });
91212
91498
  for (const candidate of removedCandidates) {
91213
91499
  const config = await client.course.getConfig(candidate.courseId).catch((error) => {
@@ -91245,10 +91531,10 @@ var init_timeback_service = __esm(async () => {
91245
91531
  }
91246
91532
  }
91247
91533
  const reference = await db.query.gameTimebackIntegrations.findFirst({
91248
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus()),
91534
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration()),
91249
91535
  orderBy: (table, { asc }) => [asc(table.createdAt)]
91250
91536
  }) ?? await db.query.gameTimebackIntegrations.findFirst({
91251
- where: eq(gameTimebackIntegrations.gameId, gameId),
91537
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isBaseGameTimebackIntegration()),
91252
91538
  orderBy: (table, { asc }) => [asc(table.createdAt)]
91253
91539
  });
91254
91540
  if (!reference) {
@@ -91278,10 +91564,77 @@ var init_timeback_service = __esm(async () => {
91278
91564
  return integration;
91279
91565
  });
91280
91566
  }
91567
+ async createHoleFillingCourse(gameId, user, request) {
91568
+ return this.withClientTelemetry(async () => {
91569
+ const client = this.requireClient();
91570
+ const db = this.deps.db;
91571
+ await this.deps.validateDeveloperAccess(user, gameId);
91572
+ TimebackService.recordIntegrationOperation("create_hole_filling_course", {
91573
+ "app.timeback.base_course_id": request.baseCourseId,
91574
+ "app.timeback.custom_course_id": Boolean(request.courseId)
91575
+ });
91576
+ const integration = await db.transaction(async (tx) => {
91577
+ const database = tx;
91578
+ const base = await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, request.baseCourseId), isActiveBaseGameTimebackIntegration()));
91579
+ if (!base) {
91580
+ throw new NotFoundError("Active base course", `${gameId}:${request.baseCourseId}`);
91581
+ }
91582
+ const config = buildHoleFillingCourseConfig(await client.course.getConfig(base.courseId), request);
91583
+ let courseId = request.courseId;
91584
+ if (courseId) {
91585
+ const takenLocally = await database.query.gameTimebackIntegrations.findFirst({
91586
+ columns: { id: true },
91587
+ where: eq(gameTimebackIntegrations.courseId, courseId)
91588
+ });
91589
+ const remote = takenLocally ? undefined : await client.course.findCourse(courseId);
91590
+ if (takenLocally || remote && !isUnregisteredHoleFillingOf(remote, base)) {
91591
+ throw new ConflictError(`A Timeback course with ID "${courseId}" already exists`);
91592
+ }
91593
+ if (remote) {
91594
+ setAttribute("app.timeback.course_create_mode", "resumed");
91595
+ await client.course.resumeSetup(courseId, config);
91596
+ } else {
91597
+ courseId = undefined;
91598
+ }
91599
+ }
91600
+ if (!courseId) {
91601
+ const created = await client.course.setup(config);
91602
+ courseId = created.courseId;
91603
+ }
91604
+ setAttribute("app.timeback.course_id", courseId);
91605
+ const [inserted] = await database.insert(gameTimebackIntegrations).values({
91606
+ gameId,
91607
+ courseId,
91608
+ grade: base.grade,
91609
+ subject: base.subject,
91610
+ totalXp: request.totalXp,
91611
+ kind: HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND,
91612
+ baseIntegrationId: base.id
91613
+ }).returning();
91614
+ return inserted;
91615
+ });
91616
+ if (!integration) {
91617
+ throw new InternalError("Hole-filling course creation did not return an integration");
91618
+ }
91619
+ return toGameTimebackIntegration(integration);
91620
+ });
91621
+ }
91622
+ async getHoleFillingCourses(gameId, user) {
91623
+ await this.deps.validateGameManagementAccess(user, gameId);
91624
+ const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
91625
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.kind, HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND), isActiveGameTimebackIntegrationStatus()),
91626
+ orderBy: (table, { asc }) => [
91627
+ asc(table.subject),
91628
+ asc(table.grade),
91629
+ asc(table.createdAt)
91630
+ ]
91631
+ });
91632
+ return rows.map((row) => toGameTimebackIntegration(row));
91633
+ }
91281
91634
  async getIntegrations(gameId, user) {
91282
91635
  await this.deps.validateGameManagementAccess(user, gameId);
91283
91636
  const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
91284
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
91637
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
91285
91638
  });
91286
91639
  return rows.map((row) => toGameTimebackIntegration(row));
91287
91640
  }
@@ -91290,7 +91643,7 @@ var init_timeback_service = __esm(async () => {
91290
91643
  const client = this.requireClient();
91291
91644
  await this.deps.validateGameManagementAccess(user, gameId);
91292
91645
  const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
91293
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS)),
91646
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS), isBaseGameTimebackIntegration()),
91294
91647
  orderBy: (table, { asc }) => [asc(table.subject), asc(table.grade)]
91295
91648
  });
91296
91649
  setAttribute("app.timeback.removed_integration_count", rows.length);
@@ -91321,6 +91674,17 @@ var init_timeback_service = __esm(async () => {
91321
91674
  if (!integration) {
91322
91675
  throw new NotFoundError("Timeback course", `${gameId}:${courseId}`);
91323
91676
  }
91677
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
91678
+ throw new ConflictError("This is a hole-filling course and may be referenced by Timeback, so it can't be removed.");
91679
+ }
91680
+ const activeHoleFilling = await database.query.gameTimebackIntegrations.findFirst({
91681
+ columns: { id: true },
91682
+ where: and(eq(gameTimebackIntegrations.baseIntegrationId, integration.id), isActiveGameTimebackIntegrationStatus())
91683
+ });
91684
+ if (activeHoleFilling) {
91685
+ setAttribute("app.timeback.removal_blocked", "hole_filling_courses");
91686
+ throw new ConflictError("This course has hole-filling courses that may be referenced by Timeback, so it can't be removed.");
91687
+ }
91324
91688
  const activeEnrollments = await client.roster.getCourseRoster(courseId, {
91325
91689
  role: "student",
91326
91690
  includeUsers: false
@@ -91358,11 +91722,18 @@ var init_timeback_service = __esm(async () => {
91358
91722
  if (!integration) {
91359
91723
  throw new NotFoundError("Removed Timeback course", `${gameId}:${courseId}`);
91360
91724
  }
91361
- const activeConflict = await database.query.gameTimebackIntegrations.findFirst({
91362
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, integration.subject), isActiveGameTimebackIntegrationStatus())
91363
- });
91364
- if (activeConflict) {
91365
- throw new ConflictError(`An active TimeBack course already exists for ${integration.subject} Grade ${integration.grade}`);
91725
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
91726
+ const base = integration.baseIntegrationId ? await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.id, integration.baseIntegrationId), isActiveBaseGameTimebackIntegration())) : undefined;
91727
+ if (!base) {
91728
+ throw new ConflictError("Restore the base course first: a hole-filling course can only be active beside its base course.");
91729
+ }
91730
+ } else {
91731
+ const activeConflict = await database.query.gameTimebackIntegrations.findFirst({
91732
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, integration.subject), isActiveBaseGameTimebackIntegration())
91733
+ });
91734
+ if (activeConflict) {
91735
+ throw new ConflictError(`An active TimeBack course already exists for ${integration.subject} Grade ${integration.grade}`);
91736
+ }
91366
91737
  }
91367
91738
  const now = new Date;
91368
91739
  const [updatedIntegration] = await database.update(gameTimebackIntegrations).set({
@@ -91401,52 +91772,66 @@ var init_timeback_service = __esm(async () => {
91401
91772
  TimebackService.recordIntegrationOperation("update_integration", {
91402
91773
  "app.timeback.course_id": courseId
91403
91774
  });
91404
- const integration = await this.deps.db.query.gameTimebackIntegrations.findFirst({
91405
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, courseId), isActiveGameTimebackIntegrationStatus())
91406
- });
91407
- if (!integration) {
91408
- throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
91409
- }
91410
- const timebackConfig = await client.course.getConfig(courseId);
91411
- const liveSubject = timebackConfig.course.subjects[0];
91412
- const subject = resolveIntegrationSubject(patch.subject, liveSubject, integration.subject);
91413
- if (!isTimebackSubject(subject)) {
91414
- throw new ValidationError(`Invalid subject "${subject}"`);
91415
- }
91416
- setAttributes({
91417
- "app.timeback.grade": integration.grade,
91418
- "app.timeback.previous_subject": integration.subject,
91419
- "app.timeback.next_subject": subject
91420
- });
91421
- if (subject !== integration.subject) {
91422
- const subjectConflict = await this.deps.db.query.gameTimebackIntegrations.findFirst({
91423
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, subject), isActiveGameTimebackIntegrationStatus())
91775
+ const updated = await this.deps.db.transaction(async (tx) => {
91776
+ const database = tx;
91777
+ const integration = await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, courseId), isActiveGameTimebackIntegrationStatus()));
91778
+ if (!integration) {
91779
+ throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
91780
+ }
91781
+ const timebackConfig = await client.course.getConfig(courseId);
91782
+ const liveSubject = timebackConfig.course.subjects[0];
91783
+ const subject = resolveIntegrationSubject(patch.subject, liveSubject, integration.subject);
91784
+ if (!isTimebackSubject(subject)) {
91785
+ throw new ValidationError(`Invalid subject "${subject}"`);
91786
+ }
91787
+ setAttributes({
91788
+ "app.timeback.grade": integration.grade,
91789
+ "app.timeback.previous_subject": integration.subject,
91790
+ "app.timeback.next_subject": subject
91424
91791
  });
91425
- if (subjectConflict && subjectConflict.id !== integration.id) {
91426
- throw new ValidationError(`A TimeBack integration already exists for ${subject} Grade ${integration.grade}`);
91792
+ if (subject !== integration.subject) {
91793
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
91794
+ throw new ValidationError("A hole-filling course must keep the subject of its base course");
91795
+ }
91796
+ const linkedHoleFilling = await database.query.gameTimebackIntegrations.findFirst({
91797
+ columns: { id: true },
91798
+ where: eq(gameTimebackIntegrations.baseIntegrationId, integration.id)
91799
+ });
91800
+ if (linkedHoleFilling) {
91801
+ throw new ValidationError("This course has hole-filling courses, so its subject cannot change");
91802
+ }
91427
91803
  }
91428
- }
91429
- const totalXp = "totalXp" in patch ? patch.totalXp ?? null : getTotalXpFromTimebackConfig(timebackConfig) ?? integration.totalXp ?? null;
91430
- const masterableUnits = "masterableUnits" in patch ? patch.masterableUnits ?? null : getMasterableUnitsFromTimebackConfig(timebackConfig);
91431
- setAttributes({
91432
- "app.timeback.total_xp": totalXp,
91433
- "app.timeback.masterable_units": masterableUnits
91804
+ if (subject !== integration.subject) {
91805
+ const subjectConflict = await database.query.gameTimebackIntegrations.findFirst({
91806
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, subject), isActiveBaseGameTimebackIntegration())
91807
+ });
91808
+ if (subjectConflict && subjectConflict.id !== integration.id) {
91809
+ throw new ValidationError(`A TimeBack integration already exists for ${subject} Grade ${integration.grade}`);
91810
+ }
91811
+ }
91812
+ const totalXp = "totalXp" in patch ? patch.totalXp ?? null : getTotalXpFromTimebackConfig(timebackConfig) ?? integration.totalXp ?? null;
91813
+ const masterableUnits = "masterableUnits" in patch ? patch.masterableUnits ?? null : getMasterableUnitsFromTimebackConfig(timebackConfig);
91814
+ setAttributes({
91815
+ "app.timeback.total_xp": totalXp,
91816
+ "app.timeback.masterable_units": masterableUnits
91817
+ });
91818
+ await client.course.update(courseId, TimebackService.patchTimebackConfig(timebackConfig, {
91819
+ ...patch,
91820
+ subject,
91821
+ totalXp,
91822
+ masterableUnits,
91823
+ grade: integration.grade
91824
+ }));
91825
+ const [row] = await database.update(gameTimebackIntegrations).set({
91826
+ subject,
91827
+ totalXp,
91828
+ updatedAt: new Date
91829
+ }).where(eq(gameTimebackIntegrations.id, integration.id)).returning();
91830
+ if (!row) {
91831
+ throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
91832
+ }
91833
+ return row;
91434
91834
  });
91435
- await client.course.update(courseId, TimebackService.patchTimebackConfig(timebackConfig, {
91436
- ...patch,
91437
- subject,
91438
- totalXp,
91439
- masterableUnits,
91440
- grade: integration.grade
91441
- }));
91442
- const [updated] = await this.deps.db.update(gameTimebackIntegrations).set({
91443
- subject,
91444
- totalXp,
91445
- updatedAt: new Date
91446
- }).where(eq(gameTimebackIntegrations.id, integration.id)).returning();
91447
- if (!updated) {
91448
- throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
91449
- }
91450
91835
  return toGameTimebackIntegration(updated);
91451
91836
  });
91452
91837
  }
@@ -91457,7 +91842,7 @@ var init_timeback_service = __esm(async () => {
91457
91842
  await this.deps.validateDeveloperAccess(user, gameId);
91458
91843
  TimebackService.recordIntegrationOperation("verify_integration");
91459
91844
  const integrations = await db.query.gameTimebackIntegrations.findMany({
91460
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
91845
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
91461
91846
  });
91462
91847
  if (integrations.length === 0) {
91463
91848
  throw new NotFoundError("Timeback integration", gameId);
@@ -91495,7 +91880,7 @@ var init_timeback_service = __esm(async () => {
91495
91880
  const client = this.requireClient();
91496
91881
  await this.deps.validateDeveloperAccess(user, gameId);
91497
91882
  const integration = await this.deps.db.query.gameTimebackIntegrations.findFirst({
91498
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
91883
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
91499
91884
  });
91500
91885
  if (!integration) {
91501
91886
  throw new NotFoundError("Timeback integration", gameId);
@@ -91509,17 +91894,24 @@ var init_timeback_service = __esm(async () => {
91509
91894
  const db = this.deps.db;
91510
91895
  await this.deps.validateDeveloperAccess(user, gameId);
91511
91896
  TimebackService.recordIntegrationOperation("delete_integrations");
91512
- const integrations = await db.query.gameTimebackIntegrations.findMany({
91513
- where: eq(gameTimebackIntegrations.gameId, gameId)
91897
+ await db.transaction(async (tx) => {
91898
+ const database = tx;
91899
+ await database.select({ id: gameTimebackIntegrations.id }).from(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId)).for("update");
91900
+ const integrations = await database.select().from(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
91901
+ if (integrations.length === 0) {
91902
+ throw new NotFoundError("Timeback integration", gameId);
91903
+ }
91904
+ setAttribute("app.timeback.integration_count", integrations.length);
91905
+ const holeFillingCount = integrations.filter((integration) => integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND).length;
91906
+ if (holeFillingCount > 0) {
91907
+ setAttribute("app.timeback.hole_filling_count", holeFillingCount);
91908
+ throw new ConflictError(`This game has ${holeFillingCount} hole-filling course(s) that may be referenced by Timeback, so its Timeback courses can't be removed automatically. Contact a Playcademy admin.`);
91909
+ }
91910
+ for (const integration of integrations) {
91911
+ await client.course.cleanup(integration.courseId);
91912
+ }
91913
+ await database.delete(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
91514
91914
  });
91515
- if (integrations.length === 0) {
91516
- throw new NotFoundError("Timeback integration", gameId);
91517
- }
91518
- setAttribute("app.timeback.integration_count", integrations.length);
91519
- for (const integration of integrations) {
91520
- await client.course.cleanup(integration.courseId);
91521
- }
91522
- await db.delete(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
91523
91915
  });
91524
91916
  }
91525
91917
  static patchCourseMetadata(metadata2, totalXp, options) {
@@ -91699,7 +92091,7 @@ var init_timeback_service = __esm(async () => {
91699
92091
  });
91700
92092
  await this.deps.validateDeveloperAccess(user, gameId);
91701
92093
  const integration = await db.query.gameTimebackIntegrations.findFirst({
91702
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveGameTimebackIntegrationStatus())
92094
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveBaseGameTimebackIntegration())
91703
92095
  });
91704
92096
  if (!integration) {
91705
92097
  throw new NotFoundError(`Timeback integration for game (grade ${activityData.grade}, subject ${activityData.subject})`);
@@ -91842,7 +92234,7 @@ var init_timeback_service = __esm(async () => {
91842
92234
  const client = this.requireClient();
91843
92235
  const db = this.deps.db;
91844
92236
  const integrations = await db.query.gameTimebackIntegrations.findMany({
91845
- where: subject ? and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.subject, subject), isActiveGameTimebackIntegrationStatus()) : and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
92237
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), subject ? eq(gameTimebackIntegrations.subject, subject) : undefined, isActiveBaseGameTimebackIntegration())
91846
92238
  });
91847
92239
  if (integrations.length === 0) {
91848
92240
  throw new NotFoundError(subject ? `Timeback integrations for game (subject ${subject})` : "Timeback integrations for game");
@@ -92031,7 +92423,7 @@ var init_timeback_service = __esm(async () => {
92031
92423
  }
92032
92424
  const pendingHeartbeat = (async () => {
92033
92425
  const integration = await db.query.gameTimebackIntegrations.findFirst({
92034
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveGameTimebackIntegrationStatus())
92426
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveBaseGameTimebackIntegration())
92035
92427
  });
92036
92428
  if (!integration) {
92037
92429
  throw new NotFoundError(`Timeback integration for game (grade ${activityData.grade}, subject ${activityData.subject})`);
@@ -92161,7 +92553,7 @@ var init_timeback_service = __esm(async () => {
92161
92553
  const db = this.deps.db;
92162
92554
  await this.deps.validateDeveloperAccess(user, options.gameId);
92163
92555
  const integration = await db.query.gameTimebackIntegrations.findFirst({
92164
- where: and(eq(gameTimebackIntegrations.gameId, options.gameId), eq(gameTimebackIntegrations.subject, options.subject), isActiveGameTimebackIntegrationStatus())
92556
+ where: and(eq(gameTimebackIntegrations.gameId, options.gameId), eq(gameTimebackIntegrations.subject, options.subject), isActiveBaseGameTimebackIntegration())
92165
92557
  });
92166
92558
  if (!integration) {
92167
92559
  throw new ValidationError(`Subject "${options.subject}" is not configured for game ${options.gameId}`);
@@ -92869,6 +93261,372 @@ var init_player = __esm(() => {
92869
93261
  init_leaderboard_service();
92870
93262
  });
92871
93263
 
93264
+ // ../api-core/src/utils/account.util.ts
93265
+ function resolveStudentAccount(byEmail, hasTimebackSignIn) {
93266
+ if (!byEmail) {
93267
+ return "create";
93268
+ }
93269
+ return byEmail.emailVerified && !byEmail.timebackId && !hasTimebackSignIn ? "link" : "conflict";
93270
+ }
93271
+
93272
+ // ../api-core/src/utils/lti.util.ts
93273
+ function generateUsername(email) {
93274
+ const baseUsername = (email.split("@")[0] || "user").toLowerCase();
93275
+ const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
93276
+ const randomSuffix = Math.random().toString(36).substring(2, 7);
93277
+ return `${cleanUsername}_${randomSuffix}`;
93278
+ }
93279
+ function extractRedirectPath(targetUri, currentHost) {
93280
+ try {
93281
+ const targetUrl = new URL(targetUri);
93282
+ if (targetUrl.hostname === currentHost) {
93283
+ return targetUrl.pathname + targetUrl.search;
93284
+ }
93285
+ } catch {}
93286
+ return "/";
93287
+ }
93288
+ function validateLtiClaims(claims) {
93289
+ const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
93290
+ const version = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
93291
+ if (messageType !== "LtiResourceLinkRequest") {
93292
+ return `Invalid LTI message type: ${messageType}`;
93293
+ }
93294
+ if (version !== "1.3.0") {
93295
+ return `Unsupported LTI version: ${version}`;
93296
+ }
93297
+ return null;
93298
+ }
93299
+ var init_lti_util = () => {};
93300
+
93301
+ // ../api-core/src/services/account.service.ts
93302
+ import * as crypto4 from "node:crypto";
93303
+
93304
+ class AccountService {
93305
+ deps;
93306
+ constructor(deps) {
93307
+ this.deps = deps;
93308
+ }
93309
+ async resolveTimebackStudent(timebackId) {
93310
+ const byTimebackId = await this.findByTimebackId(timebackId);
93311
+ if (byTimebackId) {
93312
+ setAttributes({ "app.account.student_resolution": "existing" });
93313
+ return byTimebackId;
93314
+ }
93315
+ const profile = await this.fetchOneRosterProfile(timebackId);
93316
+ const byEmailMatches = await this.deps.db.query.users.findMany({
93317
+ where: sql`lower(${users.email}) = lower(${profile.email})`,
93318
+ limit: 2
93319
+ });
93320
+ const byEmail = byEmailMatches.length === 1 ? byEmailMatches[0] : undefined;
93321
+ if (byEmail?.timebackId === timebackId) {
93322
+ return byEmail;
93323
+ }
93324
+ const resolution = byEmailMatches.length > 1 ? "conflict" : resolveStudentAccount(byEmail, await this.hasTimebackSignIn(byEmail));
93325
+ setAttributes({ "app.account.student_resolution": resolution });
93326
+ if (resolution === "conflict") {
93327
+ throw new ConflictError("This student's email belongs to another account");
93328
+ }
93329
+ if (byEmail && resolution === "link") {
93330
+ return this.link(byEmail, timebackId);
93331
+ }
93332
+ return this.create(profile, timebackId);
93333
+ }
93334
+ async hasTimebackSignIn(user) {
93335
+ if (!user) {
93336
+ return false;
93337
+ }
93338
+ const signIn = await this.deps.db.query.accounts.findFirst({
93339
+ columns: { id: true },
93340
+ where: and(eq(accounts.userId, user.id), inArray(accounts.providerId, [
93341
+ AUTH_PROVIDER_IDS.TIMEBACK,
93342
+ AUTH_PROVIDER_IDS.TIMEBACK_LTI,
93343
+ AUTH_PROVIDER_IDS.PLAYCADEMY
93344
+ ]))
93345
+ });
93346
+ setAttributes({ "app.account.has_timeback_sign_in": signIn !== undefined });
93347
+ return signIn !== undefined;
93348
+ }
93349
+ findByTimebackId(timebackId) {
93350
+ return this.deps.db.query.users.findFirst({ where: eq(users.timebackId, timebackId) });
93351
+ }
93352
+ async concurrentWinner(timebackId) {
93353
+ const winner = await this.findByTimebackId(timebackId);
93354
+ if (!winner) {
93355
+ throw new ConflictError("This student's email belongs to another account");
93356
+ }
93357
+ return winner;
93358
+ }
93359
+ async link(account, timebackId) {
93360
+ const [linked] = await this.deps.db.update(users).set({ timebackId, updatedAt: new Date }).where(and(eq(users.id, account.id), isNull(users.timebackId))).returning();
93361
+ return linked ?? this.concurrentWinner(timebackId);
93362
+ }
93363
+ async create(profile, timebackId) {
93364
+ const now = new Date;
93365
+ let created;
93366
+ try {
93367
+ [created] = await this.deps.db.insert(users).values({
93368
+ id: crypto4.randomUUID(),
93369
+ email: profile.email.toLowerCase(),
93370
+ emailVerified: true,
93371
+ username: generateUsername(profile.email),
93372
+ name: profile.name,
93373
+ timebackId,
93374
+ createdAt: now,
93375
+ updatedAt: now
93376
+ }).returning();
93377
+ } catch (error) {
93378
+ if (isUniqueViolation(error)) {
93379
+ return this.concurrentWinner(timebackId);
93380
+ }
93381
+ throw error;
93382
+ }
93383
+ if (!created) {
93384
+ throw new InternalError("Failed to create user");
93385
+ }
93386
+ return created;
93387
+ }
93388
+ async fetchOneRosterProfile(timebackId) {
93389
+ if (!this.deps.timeback) {
93390
+ throw new ServiceUnavailableError("Timeback is not available in this environment");
93391
+ }
93392
+ const record = await this.deps.timeback.api.oneroster.users.get(timebackId).catch((error) => {
93393
+ if (isApiError(error) && error.statusCode === 404) {
93394
+ return null;
93395
+ }
93396
+ setAttributes({
93397
+ "app.account.student_resolution": "timeback_unavailable",
93398
+ "app.timeback.status_code": isApiError(error) ? error.statusCode : undefined
93399
+ });
93400
+ throw new ServiceUnavailableError("Timeback is unavailable; retry shortly");
93401
+ });
93402
+ if (!record) {
93403
+ throw new NotFoundError("Timeback student", timebackId);
93404
+ }
93405
+ if (!record.email) {
93406
+ throw new NotFoundError("Email for Timeback student", timebackId);
93407
+ }
93408
+ const fullName = [record.givenName, record.familyName].filter(Boolean).join(" ");
93409
+ return {
93410
+ email: record.email,
93411
+ name: fullName || record.email.split("@")[0] || "Timeback User"
93412
+ };
93413
+ }
93414
+ }
93415
+ var init_account_service = __esm(async () => {
93416
+ init_drizzle_orm();
93417
+ init_src();
93418
+ init_tables_index();
93419
+ init_spans();
93420
+ init_errors2();
93421
+ init_lti_util();
93422
+ await init_errors8();
93423
+ });
93424
+
93425
+ // ../api-core/src/services/embed-partner.service.ts
93426
+ class EmbedPartnerService {
93427
+ deps;
93428
+ constructor(deps) {
93429
+ this.deps = deps;
93430
+ }
93431
+ async ensurePartner(clientId, name2) {
93432
+ const [partner] = await this.deps.db.insert(embedPartners).values({ clientId, name: name2 }).onConflictDoUpdate({
93433
+ target: embedPartners.clientId,
93434
+ set: { name: name2, updatedAt: new Date }
93435
+ }).returning();
93436
+ if (!partner) {
93437
+ throw new InternalError("Failed to ensure embed partner");
93438
+ }
93439
+ return partner;
93440
+ }
93441
+ addOrigin(clientId, origin) {
93442
+ return this.setOrigins(clientId, sql`CASE WHEN ${origin} = ANY(${embedPartners.allowedOrigins})
93443
+ THEN ${embedPartners.allowedOrigins}
93444
+ ELSE array_append(${embedPartners.allowedOrigins}, ${origin}) END`);
93445
+ }
93446
+ removeOrigin(clientId, origin) {
93447
+ return this.setOrigins(clientId, sql`array_remove(${embedPartners.allowedOrigins}, ${origin})`);
93448
+ }
93449
+ async setOrigins(clientId, origins) {
93450
+ const [partner] = await this.deps.db.update(embedPartners).set({ allowedOrigins: origins, updatedAt: new Date }).where(eq(embedPartners.clientId, clientId)).returning();
93451
+ if (!partner) {
93452
+ throw new NotFoundError("Embed partner", clientId);
93453
+ }
93454
+ return partner;
93455
+ }
93456
+ }
93457
+ var init_embed_partner_service = __esm(() => {
93458
+ init_drizzle_orm();
93459
+ init_tables_index();
93460
+ init_errors2();
93461
+ });
93462
+
93463
+ // ../api-core/src/utils/embed.util.ts
93464
+ function canPartnerLaunch(partner, origin) {
93465
+ return partner.enabled && partner.allowedOrigins.includes(origin);
93466
+ }
93467
+ function embedPageUrl(hubOrigin, slug, parentOrigin) {
93468
+ const url = new URL(`${EMBED_PAGE_PATH}/${encodeURIComponent(slug)}`, hubOrigin);
93469
+ url.searchParams.set(EMBED_PARENT_ORIGIN_PARAM, parentOrigin);
93470
+ return url.toString();
93471
+ }
93472
+ var init_embed_util = __esm(() => {
93473
+ init_src();
93474
+ });
93475
+
93476
+ // ../api-core/src/services/embed.service.ts
93477
+ class EmbedService {
93478
+ deps;
93479
+ constructor(deps) {
93480
+ this.deps = deps;
93481
+ }
93482
+ async getPartnerByClientId(clientId) {
93483
+ const partner = await this.deps.db.query.embedPartners.findFirst({
93484
+ where: eq(embedPartners.clientId, clientId)
93485
+ });
93486
+ if (!partner?.enabled) {
93487
+ throw new AccessDeniedError("This client is not an approved embed partner");
93488
+ }
93489
+ setAttributes({ "app.embed.partner_id": partner.id });
93490
+ return partner;
93491
+ }
93492
+ async isFrameOriginAllowed(origin, slug) {
93493
+ const game = this.deps.db.select({ id: games.id }).from(games).where(eq(games.slug, slug));
93494
+ const [partner] = await this.deps.db.select({ id: embedPartners.id }).from(embedPartners).where(and(eq(embedPartners.enabled, true), arrayContains(embedPartners.allowedOrigins, [origin]), exists(game))).limit(1);
93495
+ return partner !== undefined;
93496
+ }
93497
+ async createLaunch(partner, input) {
93498
+ const game = await this.deps.db.query.games.findFirst({
93499
+ where: eq(games.slug, input.gameSlug),
93500
+ columns: { id: true, slug: true }
93501
+ });
93502
+ if (!game) {
93503
+ throw new NotFoundError("Game", input.gameSlug);
93504
+ }
93505
+ setAttributes({ "app.game.id": game.id, "app.game.slug": game.slug });
93506
+ if (!canPartnerLaunch(partner, input.parentOrigin)) {
93507
+ throw new AccessDeniedError("This partner may not launch into that origin");
93508
+ }
93509
+ setAttributes({ "app.user.timeback_id": input.timebackId });
93510
+ const user = await this.deps.resolveTimebackStudent(input.timebackId);
93511
+ const pass = await generateSecureRandomString(PASS_LENGTH);
93512
+ const now = Date.now();
93513
+ const passExpiresAt = new Date(now + EMBED_PASS_TTL_MS);
93514
+ const [launch] = await this.deps.db.insert(embedLaunches).values({
93515
+ partnerId: partner.id,
93516
+ userId: user.id,
93517
+ gameId: game.id,
93518
+ parentOrigin: input.parentOrigin,
93519
+ timebackCourseId: input.timebackCourseId ?? null,
93520
+ passHash: await sha256Hex(pass),
93521
+ passExpiresAt,
93522
+ expiresAt: new Date(now + EMBED_LAUNCH_TTL_MS)
93523
+ }).returning({ id: embedLaunches.id });
93524
+ if (!launch) {
93525
+ throw new InternalError("Failed to create embed launch");
93526
+ }
93527
+ setAttributes({ "app.launch.id": launch.id, "app.user.id": user.id });
93528
+ return { launchId: launch.id, pass, passExpiresAt, gameSlug: game.slug };
93529
+ }
93530
+ async redeemLaunch(input, timeZone) {
93531
+ const launch = await this.consumePass(input);
93532
+ try {
93533
+ const user = await this.deps.db.query.users.findFirst({
93534
+ where: eq(users.id, launch.userId)
93535
+ });
93536
+ if (!user) {
93537
+ throw new NotFoundError("User", launch.userId);
93538
+ }
93539
+ const [game, profile, token] = await Promise.all([
93540
+ this.deps.getGameForStudent(launch.gameId, user),
93541
+ this.deps.getGameProfile(user, launch.gameId, timeZone),
93542
+ this.deps.mintGameToken(launch.gameId, user.id)
93543
+ ]);
93544
+ await this.deps.db.update(embedLaunches).set({ redeemedAt: new Date }).where(eq(embedLaunches.id, launch.id));
93545
+ return {
93546
+ launchId: launch.id,
93547
+ token,
93548
+ user,
93549
+ game,
93550
+ profile,
93551
+ timebackCourseId: launch.timebackCourseId
93552
+ };
93553
+ } catch (error) {
93554
+ setAttributes({ "app.embed.outcome": "prepare_failed" });
93555
+ await this.endLaunch(launch.id);
93556
+ throw error;
93557
+ }
93558
+ }
93559
+ async renewToken(partner, launchId) {
93560
+ setAttributes({ "app.launch.id": launchId });
93561
+ const launch = await this.deps.db.query.embedLaunches.findFirst({
93562
+ where: and(eq(embedLaunches.id, launchId), eq(embedLaunches.partnerId, partner.id))
93563
+ });
93564
+ if (!launch) {
93565
+ setAttributes({ "app.embed.outcome": "not_found" });
93566
+ throw new NotFoundError("Embed launch", launchId);
93567
+ }
93568
+ setAttributes({ "app.game.id": launch.gameId, "app.user.id": launch.userId });
93569
+ const outcome = renewalRefusal(launch, () => canPartnerLaunch(partner, launch.parentOrigin));
93570
+ setAttributes({ "app.embed.outcome": outcome ?? "renewed" });
93571
+ if (outcome) {
93572
+ throw new AccessDeniedError("This launch has ended");
93573
+ }
93574
+ return this.deps.mintGameToken(launch.gameId, launch.userId);
93575
+ }
93576
+ async endLaunch(launchId) {
93577
+ await this.deps.db.update(embedLaunches).set({ endedAt: sql`coalesce(${embedLaunches.endedAt}, now())`, passHash: null }).where(eq(embedLaunches.id, launchId));
93578
+ }
93579
+ async consumePass(input) {
93580
+ const now = new Date;
93581
+ const [launch] = await this.deps.db.update(embedLaunches).set({ passHash: null }).where(and(eq(embedLaunches.passHash, await sha256Hex(input.pass)), gt(embedLaunches.passExpiresAt, now), isNull(embedLaunches.endedAt))).returning();
93582
+ if (!launch) {
93583
+ setAttributes({ "app.embed.outcome": "pass_rejected" });
93584
+ throw new UnauthorizedError("This launch pass is not valid");
93585
+ }
93586
+ setAttributes({
93587
+ "app.launch.id": launch.id,
93588
+ "app.game.id": launch.gameId,
93589
+ "app.embed.partner_id": launch.partnerId,
93590
+ "app.user.id": launch.userId
93591
+ });
93592
+ const partner = await this.deps.db.query.embedPartners.findFirst({
93593
+ where: eq(embedPartners.id, launch.partnerId),
93594
+ columns: { enabled: true, allowedOrigins: true }
93595
+ });
93596
+ const originMatches = launch.parentOrigin === input.parentOrigin;
93597
+ const stillAllowed = partner !== undefined && canPartnerLaunch(partner, launch.parentOrigin);
93598
+ if (!originMatches || !stillAllowed) {
93599
+ await this.endLaunch(launch.id);
93600
+ setAttributes({
93601
+ "app.embed.outcome": originMatches ? "partner_disallowed" : "origin_mismatch"
93602
+ });
93603
+ throw new UnauthorizedError("This launch pass is not valid");
93604
+ }
93605
+ return launch;
93606
+ }
93607
+ }
93608
+ function renewalRefusal(launch, isAllowed) {
93609
+ if (!launch.redeemedAt) {
93610
+ return "not_started";
93611
+ }
93612
+ if (launch.endedAt) {
93613
+ return "ended";
93614
+ }
93615
+ if (launch.expiresAt <= new Date) {
93616
+ return "expired";
93617
+ }
93618
+ return isAllowed() ? undefined : "partner_disallowed";
93619
+ }
93620
+ var PASS_LENGTH = 43;
93621
+ var init_embed_service = __esm(() => {
93622
+ init_drizzle_orm();
93623
+ init_src();
93624
+ init_tables_index();
93625
+ init_spans();
93626
+ init_errors2();
93627
+ init_embed_util();
93628
+ });
93629
+
92872
93630
  // ../api-core/src/services/lti.service.ts
92873
93631
  class LtiService {
92874
93632
  deps;
@@ -92934,7 +93692,7 @@ class SessionService {
92934
93692
  }
92935
93693
  async resolveGame(gameIdOrSlug) {
92936
93694
  const db = this.deps.db;
92937
- const isUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(gameIdOrSlug);
93695
+ const isUuid = isValidUUID(gameIdOrSlug);
92938
93696
  const game = isUuid ? await db.query.games.findFirst({
92939
93697
  where: eq(games.id, gameIdOrSlug),
92940
93698
  columns: { id: true, slug: true }
@@ -92957,6 +93715,7 @@ var init_session_service = __esm(() => {
92957
93715
  init_drizzle_orm();
92958
93716
  init_tables_index();
92959
93717
  init_spans();
93718
+ init_src9();
92960
93719
  init_errors2();
92961
93720
  });
92962
93721
 
@@ -93232,21 +93991,43 @@ var init_verify_service = __esm(() => {
93232
93991
 
93233
93992
  // ../api-core/src/services/factory/standalone.ts
93234
93993
  function createStandaloneServices(deps) {
93235
- const { db, auth, timeback } = deps;
93994
+ const { db, auth, timeback, getGameForStudent, getTimebackData } = deps;
93236
93995
  const lti = new LtiService({ db });
93237
93996
  const session = new SessionService({ db, mintGameToken: auth.mintGameToken.bind(auth) });
93997
+ const account = new AccountService({ db, timeback });
93238
93998
  const user = new UserService({ db, timeback });
93999
+ const embed = new EmbedService({
94000
+ db,
94001
+ mintGameToken: auth.mintGameToken.bind(auth),
94002
+ resolveTimebackStudent: (timebackId) => account.resolveTimebackStudent(timebackId),
94003
+ getGameForStudent,
94004
+ getGameProfile: async (student, gameId, timeZone) => {
94005
+ const [profile, timebackData] = await Promise.all([
94006
+ user.getMe(student, gameId, timeZone),
94007
+ student.timebackId ? getTimebackData(student.id, gameId).catch(() => {
94008
+ setAttributes({ "app.embed.timeback_context": "unavailable" });
94009
+ return;
94010
+ }) : undefined
94011
+ ]);
94012
+ return { ...profile, timeback: timebackData };
94013
+ }
94014
+ });
94015
+ const embedPartner = new EmbedPartnerService({ db });
93239
94016
  const verify = new VerifyService({
93240
94017
  db,
93241
94018
  validateGameToken: auth.validateGameToken.bind(auth)
93242
94019
  });
93243
- return { lti, session, user, verify };
94020
+ return { account, embed, embedPartner, lti, session, user, verify };
93244
94021
  }
93245
- var init_standalone = __esm(() => {
94022
+ var init_standalone = __esm(async () => {
94023
+ init_spans();
94024
+ init_embed_partner_service();
94025
+ init_embed_service();
93246
94026
  init_lti_service();
93247
94027
  init_session_service();
93248
94028
  init_user_service();
93249
94029
  init_verify_service();
94030
+ await init_account_service();
93250
94031
  });
93251
94032
 
93252
94033
  // ../api-core/src/services/factory/index.ts
@@ -93289,7 +94070,13 @@ function createServices(ctx) {
93289
94070
  verifyAssessmentToken: auth.verifyAssessmentToken.bind(auth),
93290
94071
  ...gaming.validators
93291
94072
  });
93292
- const standalone = createStandaloneServices({ db, auth, timeback });
94073
+ const standalone = createStandaloneServices({
94074
+ db,
94075
+ auth,
94076
+ timeback,
94077
+ getGameForStudent: (gameId, student) => gaming.services.game.getById(gameId, student),
94078
+ getTimebackData: (userId, gameId) => platform.timeback.getUserData(userId, gameId)
94079
+ });
93293
94080
  return {
93294
94081
  ...infra,
93295
94082
  ...player,
@@ -93302,8 +94089,10 @@ var init_factory = __esm(async () => {
93302
94089
  init_game3();
93303
94090
  init_infra2();
93304
94091
  init_player();
93305
- init_standalone();
93306
- await init_platform2();
94092
+ await __promiseAll([
94093
+ init_platform2(),
94094
+ init_standalone()
94095
+ ]);
93307
94096
  });
93308
94097
 
93309
94098
  // ../api-core/src/types/context.type.ts
@@ -93437,6 +94226,17 @@ function defineControllerNames(namespace, handlers) {
93437
94226
  return handlers;
93438
94227
  }
93439
94228
 
94229
+ // ../api-core/src/utils/game-token.util.ts
94230
+ async function withTunnelUrl(ctx, token) {
94231
+ const baseUrl = ctx.config.isLocal ? await getTunnelUrl(ctx.config.baseUrl).catch(() => {
94232
+ return;
94233
+ }) : undefined;
94234
+ return { ...token, baseUrl };
94235
+ }
94236
+ var init_game_token_util = __esm(() => {
94237
+ init_tunnel();
94238
+ });
94239
+
93440
94240
  // ../api-core/src/utils/assessment-artifact-backfill.util.ts
93441
94241
  var init_assessment_artifact_backfill_util = __esm(() => {
93442
94242
  init_tables_index();
@@ -93446,37 +94246,8 @@ var init_assessment_artifact_backfill_util = __esm(() => {
93446
94246
  init_timeback_review_mapping_util();
93447
94247
  });
93448
94248
 
93449
- // ../api-core/src/utils/lti.util.ts
93450
- function generateUsername(email) {
93451
- const baseUsername = (email.split("@")[0] || "user").toLowerCase();
93452
- const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
93453
- const randomSuffix = Math.random().toString(36).substring(2, 7);
93454
- return `${cleanUsername}_${randomSuffix}`;
93455
- }
93456
- function extractRedirectPath(targetUri, currentHost) {
93457
- try {
93458
- const targetUrl = new URL(targetUri);
93459
- if (targetUrl.hostname === currentHost) {
93460
- return targetUrl.pathname + targetUrl.search;
93461
- }
93462
- } catch {}
93463
- return "/";
93464
- }
93465
- function validateLtiClaims(claims) {
93466
- const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
93467
- const version = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
93468
- if (messageType !== "LtiResourceLinkRequest") {
93469
- return `Invalid LTI message type: ${messageType}`;
93470
- }
93471
- if (version !== "1.3.0") {
93472
- return `Unsupported LTI version: ${version}`;
93473
- }
93474
- return null;
93475
- }
93476
- var init_lti_util = () => {};
93477
-
93478
94249
  // ../api-core/src/utils/lti-provisioning.ts
93479
- import * as crypto4 from "node:crypto";
94250
+ import * as crypto5 from "node:crypto";
93480
94251
  async function provisionLtiUser(db, claims) {
93481
94252
  const database = db;
93482
94253
  const email = claims.email;
@@ -93507,7 +94278,7 @@ async function provisionLtiUser(db, claims) {
93507
94278
  });
93508
94279
  if (!existingLtiAccount) {
93509
94280
  const [account] = await tx.insert(accounts).values({
93510
- id: crypto4.randomUUID(),
94281
+ id: crypto5.randomUUID(),
93511
94282
  userId: existingUser.id,
93512
94283
  accountId: ltiTimebackId,
93513
94284
  providerId,
@@ -93526,7 +94297,7 @@ async function provisionLtiUser(db, claims) {
93526
94297
  setAttribute("app.lti.provision", "linked_account");
93527
94298
  return existingUser;
93528
94299
  }
93529
- const newUserId = crypto4.randomUUID();
94300
+ const newUserId = crypto5.randomUUID();
93530
94301
  const createdUser = await database.transaction(async (tx) => {
93531
94302
  const [insertedUser] = await tx.insert(users).values({
93532
94303
  id: newUserId,
@@ -93541,7 +94312,7 @@ async function provisionLtiUser(db, claims) {
93541
94312
  throw new InternalError("Failed to create user");
93542
94313
  }
93543
94314
  await tx.insert(accounts).values({
93544
- id: crypto4.randomUUID(),
94315
+ id: crypto5.randomUUID(),
93545
94316
  userId: newUserId,
93546
94317
  accountId: ltiTimebackId,
93547
94318
  providerId,
@@ -93651,6 +94422,7 @@ var init_validation_util = __esm(() => {
93651
94422
  // ../api-core/src/utils/index.ts
93652
94423
  var init_utils7 = __esm(() => {
93653
94424
  init_auth_util();
94425
+ init_game_token_util();
93654
94426
  init_assessment_runtime_lock_util();
93655
94427
  init_assessment_artifact_envelope_util();
93656
94428
  init_assessment_artifact_backfill_util();
@@ -93924,6 +94696,9 @@ function createSandboxAuthProvider() {
93924
94696
  return null;
93925
94697
  }
93926
94698
  },
94699
+ async verifyEmbedPartnerToken() {
94700
+ return null;
94701
+ },
93927
94702
  async mintPlatformServiceToken(gameId, studentId) {
93928
94703
  return mintSandboxServiceToken("playcademy-game-metrics", { gameId, studentId });
93929
94704
  },
@@ -108319,7 +109094,7 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
108319
109094
  import process22 from "process";
108320
109095
  import os2 from "os";
108321
109096
  import tty from "tty";
108322
- import { randomUUID as randomUUID2 } from "crypto";
109097
+ import { randomUUID as randomUUID3 } from "crypto";
108323
109098
  function assembleStyles() {
108324
109099
  const codes = /* @__PURE__ */ new Map;
108325
109100
  for (const [groupName, group] of Object.entries(styles2)) {
@@ -109691,7 +110466,7 @@ function ilike2(column6, value) {
109691
110466
  function notIlike2(column6, value) {
109692
110467
  return sql4`${column6} not ilike ${value}`;
109693
110468
  }
109694
- function arrayContains(column6, values) {
110469
+ function arrayContains2(column6, values) {
109695
110470
  if (Array.isArray(values)) {
109696
110471
  if (values.length === 0) {
109697
110472
  throw new Error("arrayContains requires at least one value");
@@ -110986,7 +111761,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
110986
111761
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
110987
111762
  }
110988
111763
  return to;
110989
- }, __toESM5 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles2, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default, init_ansi_styles, env, flagForceColor, supportsColor, supports_color_default, init_supports_color, init_utilities, stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles22, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default, init_source, require_old, require_fs, require_path, require_balanced_match, require_brace_expansion, require_minimatch, require_inherits_browser2, require_inherits2, require_common3, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src3, require_utils4, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType2, init_util5, ZodIssueCode4, ZodError4, init_ZodError2, errorMap2, en_default4, init_en4, overrideErrorMap2, init_errors9, makeIssue2, ParseStatus2, INVALID3, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType4, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString4, ZodNumber4, ZodBigInt2, ZodBoolean4, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown4, ZodNever4, ZodVoid2, ZodArray4, ZodObject4, ZodUnion4, getDiscriminator2, ZodDiscriminatedUnion4, ZodIntersection4, ZodTuple2, ZodRecord4, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral4, ZodEnum4, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional4, ZodNullable4, ZodDefault4, ZodCatch4, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly4, late2, ZodFirstPartyTypeKind3, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, coerce2, init_types6, init_external4, init_v32, init_esm2, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table8, schemaHash, kitInternals, gelSchemaExternal, gelSchemaInternal, tableSquashed, gelSchemaSquashed, gelSchema, dryGel, init_gelSchema, index22, fk2, column22, tableV3, compositePK2, uniqueConstraint2, checkConstraint2, tableV4, table22, viewMeta, view22, kitInternals2, dialect2, schemaHash2, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed2, viewSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql, init_mysqlSchema, indexV2, columnV2, tableV2, enumSchemaV12, enumSchema2, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn2, index3, indexV4, indexV5, indexV6, fk3, sequenceSchema2, roleSchema2, sequenceSquashed2, columnV7, column3, checkConstraint3, columnSquashed2, tableV32, compositePK3, uniqueConstraint3, policy2, policySquashed2, viewWithOption2, matViewWithOption2, mergedViewWithOption2, view3, tableV42, tableV5, tableV6, tableV7, table32, schemaHash3, kitInternals3, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed3, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg, init_pgSchema, index4, column4, compositePK4, uniqueConstraint4, table42, viewMeta2, kitInternals4, dialect22, schemaHash4, schemaInternal2, schema22, tableSquashed4, schemaSquashed2, SingleStoreSquasher, squashSingleStoreScheme, singlestoreSchema, singlestoreSchemaSquashed, backwardCompatibleSingleStoreSchema, drySingleStore, init_singlestoreSchema, index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstraint4, table52, view4, dialect3, schemaHash5, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals5, latestVersion, schemaInternal3, schemaV32, schemaV42, schemaV52, schema3, tableSquashed5, schemaSquashed3, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema, init_sqliteSchema, copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, init_utils8, import_hanji, warning, error3, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner2, ProgressView, init_views, glob, init_serializer, fillPgSnapshot, init_migrationPreparator, require_heap, require_heap2, require_difflib, require_difflib2, require_util2, require_styles, require_has_flag2, require_supports_colors, require_trap, require_zalgo, require_america, require_zebra, require_rainbow, require_random, require_colors, require_safe, require_colorize, require_lib5, import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn, init_jsonDiffer, parseType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SingleStoreCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, SingleStoreAlterTableAddUniqueConstraintConvertor, SingleStoreAlterTableDropUniqueConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SingleStoreDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, SingleStoreRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SingleStoreAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SingleStoreAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SingleStoreAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, SingleStoreAlterTableAlterColumnAlterrGeneratedConvertor, SingleStoreAlterTableAddPk, SingleStoreAlterTableDropPk, SingleStoreModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSingleStoreIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SingleStoreDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, SingleStoreRecreateTableConvertor, convertors, init_sqlgenerator, _moveDataStatements, getOldTableName, getNewTableName, logSuggestionsAndReturn, init_sqlitePushUtils, preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSingleStoreCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView, init_jsonStatements, prepareLibSQLRecreateTable, prepareSQLiteRecreateTable, libSQLCombineStatements, sqliteCombineStatements, prepareSingleStoreRecreateTable, singleStoreCombineStatements, init_statementCombiner, snapshotsDiffer_exports, makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema, alteredColumnSchema, enumSchema3, changedEnumSchema, tableScheme, alteredTableScheme, alteredViewCommon, alteredPgViewSchema, alteredMySqlViewSchema, diffResultScheme, diffResultSchemeMysql, diffResultSchemeSingleStore, diffResultSchemeSQLite, schemaChangeFor, nameChangeFor, nameSchemaChangeFor, columnChangeFor, applyPgSnapshotsDiff, applyMysqlSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff, applyLibSQLSnapshotsDiff, init_snapshotsDiffer, init_words, dialects, dialect4, commonSquashedSchema, commonSchema, init_schemaValidator, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver2, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, init_common2, withStyle, init_outputs, import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, init_migrate, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, init_brace_expressions, escape, init_escape, unescape, init_unescape, import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep3, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match2, globUnescape, globMagic, regExpEscape, Minimatch, init_mjs, entityKind2, hasOwnEntityKind2, init_entity2, _a3, Column2, init_column2, _a22, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a32, ForeignKeyBuilder2, _a4, ForeignKey2, init_foreign_keys2, init_tracing_utils2, _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint, init_unique_constraint2, init_array2, _a8, _b, PgColumnBuilder2, _a9, _b2, PgColumn2, _a10, _b3, ExtraConfigColumn2, _a11, IndexedColumn2, _a12, _b4, PgArrayBuilder2, _a13, _b5, _PgArray, PgArray2, init_common22, _a14, _b6, PgEnumObjectColumnBuilder2, _a15, _b7, PgEnumObjectColumn2, isPgEnumSym2, _a16, _b8, PgEnumColumnBuilder2, _a17, _b9, PgEnumColumn2, init_enum2, _a18, Subquery2, _a19, _b10, WithSubquery2, init_subquery2, version4, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e3, _f, _g, _h, _i, _j, Table2, init_table8, _a21, FakePrimitiveParam, _a222, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql5, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError2, _a322, _b14, TransactionRollbackError2, init_errors22, _a33, ConsoleLogWriter2, _a34, DefaultLogger2, _a35, NoopLogger2, init_logger3, init_operations, _a36, _b15, QueryPromise2, init_query_promise2, textDecoder2, init_utils22, _a37, _b16, PgIntColumnBaseBuilder2, init_int_common2, _a38, _b17, PgBigInt53Builder2, _a39, _b18, PgBigInt532, _a40, _b19, PgBigInt64Builder2, _a41, _b20, PgBigInt642, init_bigint2, _a42, _b21, PgBigSerial53Builder2, _a43, _b22, PgBigSerial532, _a44, _b23, PgBigSerial64Builder2, _a45, _b24, PgBigSerial642, init_bigserial2, _a46, _b25, PgBooleanBuilder2, _a47, _b26, PgBoolean2, init_boolean2, _a48, _b27, PgCharBuilder2, _a49, _b28, PgChar2, init_char2, _a50, _b29, PgCidrBuilder2, _a51, _b30, PgCidr2, init_cidr2, _a52, _b31, PgCustomColumnBuilder2, _a53, _b32, PgCustomColumn2, init_custom2, _a54, _b33, PgDateColumnBaseBuilder2, init_date_common2, _a55, _b34, PgDateBuilder2, _a56, _b35, PgDate2, _a57, _b36, PgDateStringBuilder2, _a58, _b37, PgDateString2, init_date2, _a59, _b38, PgDoublePrecisionBuilder2, _a60, _b39, PgDoublePrecision2, init_double_precision2, _a61, _b40, PgInetBuilder2, _a62, _b41, PgInet2, init_inet2, _a63, _b42, PgIntegerBuilder2, _a64, _b43, PgInteger2, init_integer2, _a65, _b44, PgIntervalBuilder2, _a66, _b45, PgInterval2, init_interval2, _a67, _b46, PgJsonBuilder2, _a68, _b47, PgJson2, init_json2, _a69, _b48, PgJsonbBuilder2, _a70, _b49, PgJsonb2, init_jsonb2, _a71, _b50, PgLineBuilder2, _a72, _b51, PgLineTuple2, _a73, _b52, PgLineABCBuilder2, _a74, _b53, PgLineABC2, init_line2, _a75, _b54, PgMacaddrBuilder2, _a76, _b55, PgMacaddr2, init_macaddr2, _a77, _b56, PgMacaddr8Builder2, _a78, _b57, PgMacaddr82, init_macaddr82, _a79, _b58, PgNumericBuilder2, _a80, _b59, PgNumeric2, _a81, _b60, PgNumericNumberBuilder2, _a82, _b61, PgNumericNumber2, _a83, _b62, PgNumericBigIntBuilder2, _a84, _b63, PgNumericBigInt2, init_numeric2, _a85, _b64, PgPointTupleBuilder2, _a86, _b65, PgPointTuple2, _a87, _b66, PgPointObjectBuilder2, _a88, _b67, PgPointObject2, init_point2, init_utils32, _a89, _b68, PgGeometryBuilder2, _a90, _b69, PgGeometry2, _a91, _b70, PgGeometryObjectBuilder2, _a92, _b71, PgGeometryObject2, init_geometry2, _a93, _b72, PgRealBuilder2, _a94, _b73, PgReal2, init_real2, _a95, _b74, PgSerialBuilder2, _a96, _b75, PgSerial2, init_serial2, _a97, _b76, PgSmallIntBuilder2, _a98, _b77, PgSmallInt2, init_smallint2, _a99, _b78, PgSmallSerialBuilder2, _a100, _b79, PgSmallSerial2, init_smallserial2, _a101, _b80, PgTextBuilder2, _a102, _b81, PgText2, init_text2, _a103, _b82, PgTimeBuilder2, _a104, _b83, PgTime2, init_time2, _a105, _b84, PgTimestampBuilder2, _a106, _b85, PgTimestamp2, _a107, _b86, PgTimestampStringBuilder2, _a108, _b87, PgTimestampString2, init_timestamp2, _a109, _b88, PgUUIDBuilder2, _a110, _b89, PgUUID2, init_uuid3, _a111, _b90, PgVarcharBuilder2, _a112, _b91, PgVarchar2, init_varchar2, _a113, _b92, PgBinaryVectorBuilder2, _a114, _b93, PgBinaryVector2, init_bit2, _a115, _b94, PgHalfVectorBuilder2, _a116, _b95, PgHalfVector2, init_halfvec2, _a117, _b96, PgSparseVectorBuilder2, _a118, _b97, PgSparseVector2, init_sparsevec2, _a119, _b98, PgVectorBuilder2, _a120, _b99, PgVector2, init_vector3, init_all2, InlineForeignKeys2, EnableRLS2, _a121, _b100, _c3, _d2, _e22, _f2, PgTable2, pgTable2, init_table22, _a122, PrimaryKeyBuilder2, _a123, PrimaryKey2, init_primary_keys2, eq2, ne4, gt3, gte2, lt4, lte2, init_conditions2, init_select3, init_expressions2, _a124, Relation2, _a125, Relations2, _a126, _b101, _One, One2, _a127, _b102, _Many, Many2, init_relations2, init_aggregate2, init_vector22, init_functions2, init_sql22, dist_exports, init_dist9, init_alias22, _a128, CheckBuilder2, _a129, Check2, init_checks6, init_columns2, _a130, _SelectionProxyHandler, SelectionProxyHandler2, init_selection_proxy2, _a131, IndexBuilderOn2, _a132, IndexBuilder2, _a133, Index2, init_indexes2, _a134, PgPolicy, init_policies2, PgViewConfig2, init_view_common22, _a135, CasingCache2, init_casing2, _a136, _b103, PgViewBase2, init_view_base2, _a137, PgDialect2, init_dialect2, _a138, TypedQueryBuilder2, init_query_builder3, _a139, PgSelectBuilder2, _a140, _b104, PgSelectQueryBuilderBase2, _a141, _b105, PgSelectBase2, getPgSetOperators2, union22, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema4, _a165, Cache2, _a166, _b119, NoopCache2, init_cache2, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils62, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder22, _a171, Check22, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e32, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils72, _a213, _b152, SQLiteDeleteBase, init_delete22, _a214, _b153, SQLiteViewBase, init_view_base22, _a215, SQLiteDialect, _a216, _b154, SQLiteSyncDialect, _a217, _b155, SQLiteAsyncDialect, init_dialect22, _a218, SQLiteSelectBuilder, _a219, _b156, SQLiteSelectQueryBuilderBase, _a220, _b157, SQLiteSelectBase, getSQLiteSetOperators, union32, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a2222, SQLiteInsertBuilder, _a223, _b158, SQLiteInsertBase, init_insert22, init_select_types2, _a224, SQLiteUpdateBuilder, _a225, _b159, SQLiteUpdateBase, init_update22, init_query_builders22, _a226, _b160, _c8, _SQLiteCountBuilder, SQLiteCountBuilder, init_count22, _a227, RelationalQueryBuilder22, _a228, _b161, SQLiteRelationalQuery, _a229, _b162, SQLiteSyncRelationalQuery, init_query22, _a230, _b163, SQLiteRaw, init_raw22, _a231, BaseSQLiteDatabase, init_db22, _a232, _b164, ExecuteResultSync, _a233, SQLitePreparedQuery, _a234, SQLiteSession, _a235, _b165, SQLiteTransaction, init_session22, init_subquery3, _a236, ViewBuilderCore, _a237, _b166, ViewBuilder2, _a238, _b167, ManualViewBuilder2, _a239, _b168, SQLiteView2, init_view22, init_sqlite_core, generateSqliteSnapshot, fromDatabase2, init_sqliteSerializer, getTablesFilterByExtensions, init_getTablesFilterByExtensions, init_alias4, _a240, CheckBuilder3, _a241, Check3, init_checks32, _a242, ForeignKeyBuilder3, _a243, ForeignKey3, init_foreign_keys3, _a244, UniqueConstraintBuilder3, _a245, UniqueOnConstraintBuilder3, _a246, UniqueConstraint3, init_unique_constraint3, _a247, _b169, MySqlColumnBuilder, _a248, _b170, MySqlColumn, _a249, _b171, MySqlColumnBuilderWithAutoIncrement, _a250, _b172, MySqlColumnWithAutoIncrement, init_common4, _a251, _b173, MySqlBigInt53Builder, _a252, _b174, MySqlBigInt53, _a253, _b175, MySqlBigInt64Builder, _a254, _b176, MySqlBigInt64, init_bigint22, _a255, _b177, MySqlBinaryBuilder, _a256, _b178, MySqlBinary, init_binary, _a257, _b179, MySqlBooleanBuilder, _a258, _b180, MySqlBoolean, init_boolean22, _a259, _b181, MySqlCharBuilder, _a260, _b182, MySqlChar, init_char22, _a261, _b183, MySqlCustomColumnBuilder, _a262, _b184, MySqlCustomColumn, init_custom3, _a263, _b185, MySqlDateBuilder, _a264, _b186, MySqlDate, _a265, _b187, MySqlDateStringBuilder, _a266, _b188, MySqlDateString, init_date22, _a267, _b189, MySqlDateTimeBuilder, _a268, _b190, MySqlDateTime, _a269, _b191, MySqlDateTimeStringBuilder, _a270, _b192, MySqlDateTimeString, init_datetime, _a271, _b193, MySqlDecimalBuilder, _a272, _b194, MySqlDecimal, _a273, _b195, MySqlDecimalNumberBuilder, _a274, _b196, MySqlDecimalNumber, _a275, _b197, MySqlDecimalBigIntBuilder, _a276, _b198, MySqlDecimalBigInt, init_decimal, _a277, _b199, MySqlDoubleBuilder, _a278, _b200, MySqlDouble, init_double, _a279, _b201, MySqlEnumColumnBuilder, _a280, _b202, MySqlEnumColumn, _a281, _b203, MySqlEnumObjectColumnBuilder, _a282, _b204, MySqlEnumObjectColumn, init_enum22, _a283, _b205, MySqlFloatBuilder, _a284, _b206, MySqlFloat, init_float, _a285, _b207, MySqlIntBuilder, _a286, _b208, MySqlInt, init_int, _a287, _b209, MySqlJsonBuilder, _a288, _b210, MySqlJson, init_json22, _a289, _b211, MySqlMediumIntBuilder, _a290, _b212, MySqlMediumInt, init_mediumint, _a291, _b213, MySqlRealBuilder, _a292, _b214, MySqlReal, init_real3, _a293, _b215, MySqlSerialBuilder, _a294, _b216, MySqlSerial, init_serial22, _a295, _b217, MySqlSmallIntBuilder, _a296, _b218, MySqlSmallInt, init_smallint22, _a297, _b219, MySqlTextBuilder, _a298, _b220, MySqlText, init_text3, _a299, _b221, MySqlTimeBuilder, _a300, _b222, MySqlTime, init_time22, _a301, _b223, MySqlDateColumnBaseBuilder, _a302, _b224, MySqlDateBaseColumn, init_date_common22, _a303, _b225, MySqlTimestampBuilder, _a304, _b226, MySqlTimestamp, _a305, _b227, MySqlTimestampStringBuilder, _a306, _b228, MySqlTimestampString, init_timestamp22, _a307, _b229, MySqlTinyIntBuilder, _a308, _b230, MySqlTinyInt, init_tinyint, _a309, _b231, MySqlVarBinaryBuilder, _a310, _b232, MySqlVarBinary, init_varbinary, _a311, _b233, MySqlVarCharBuilder, _a312, _b234, MySqlVarChar, init_varchar22, _a313, _b235, MySqlYearBuilder, _a314, _b236, MySqlYear, init_year, init_columns3, _a315, _b237, _c9, _MySqlCountBuilder, MySqlCountBuilder, init_count3, _a316, IndexBuilderOn3, _a317, IndexBuilder3, _a318, Index5, init_indexes3, init_all3, InlineForeignKeys3, _a319, _b238, _c10, _d4, _e4, MySqlTable, mysqlTable, init_table42, _a320, PrimaryKeyBuilder3, _a321, PrimaryKey3, init_primary_keys3, MySqlViewConfig, init_view_common32, init_utils82, _a3222, _b239, MySqlDeleteBase, init_delete3, _a323, _b240, MySqlViewBase, init_view_base3, _a324, MySqlDialect, init_dialect3, _a325, MySqlSelectBuilder, _a326, _b241, MySqlSelectQueryBuilderBase, _a327, _b242, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll22, except3, exceptAll22, init_select4, _a328, QueryBuilder3, init_query_builder4, _a329, MySqlInsertBuilder, _a330, _b243, MySqlInsertBase, init_insert3, init_select_types3, _a331, MySqlUpdateBuilder, _a332, _b244, MySqlUpdateBase, init_update3, init_query_builders3, _a333, RelationalQueryBuilder3, _a334, _b245, MySqlRelationalQuery, init_query3, _a335, MySqlDatabase, init_db3, _a336, ViewBuilderCore2, _a337, _b246, ViewBuilder3, _a338, _b247, ManualViewBuilder3, _a339, _b248, _c11, MySqlView2, init_view3, _a340, MySqlSchema5, init_schema22, _a341, MySqlPreparedQuery, _a342, MySqlSession, _a343, _b249, MySqlTransaction, init_session32, init_subquery4, init_mysql_core, handleEnumType, generateMySqlSnapshot, fromDatabase3, init_mysqlSerializer, cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck, init_cli, gelCredentials, init_gel, libSQLCredentials, init_libsql, mysqlCredentials, init_mysql, postgresCredentials, init_postgres, singlestoreCredentials, init_singlestore, sqliteCredentials, init_sqlite, credentials, studioCliParams, studioConfig, init_studio, es5_exports, _3, es5_default, init_es5, import_hanji7, assertES5, safeRegister, migrateConfig, init_utils9, prepareFromExports, init_pgImports, init_alias5, _a344, UniqueConstraintBuilder4, _a345, UniqueOnConstraintBuilder4, _a346, UniqueConstraint4, init_unique_constraint4, _a347, _b250, SingleStoreColumnBuilder, _a348, _b251, SingleStoreColumn, _a349, _b252, SingleStoreColumnBuilderWithAutoIncrement, _a350, _b253, SingleStoreColumnWithAutoIncrement, init_common5, _a351, _b254, SingleStoreBigInt53Builder, _a352, _b255, SingleStoreBigInt53, _a353, _b256, SingleStoreBigInt64Builder, _a354, _b257, SingleStoreBigInt64, init_bigint3, _a355, _b258, SingleStoreBinaryBuilder, _a356, _b259, SingleStoreBinary, init_binary2, _a357, _b260, SingleStoreBooleanBuilder, _a358, _b261, SingleStoreBoolean, init_boolean3, _a359, _b262, SingleStoreCharBuilder, _a360, _b263, SingleStoreChar, init_char3, _a361, _b264, SingleStoreCustomColumnBuilder, _a362, _b265, SingleStoreCustomColumn, init_custom4, _a363, _b266, SingleStoreDateBuilder, _a364, _b267, SingleStoreDate, _a365, _b268, SingleStoreDateStringBuilder, _a366, _b269, SingleStoreDateString, init_date3, _a367, _b270, SingleStoreDateTimeBuilder, _a368, _b271, SingleStoreDateTime, _a369, _b272, SingleStoreDateTimeStringBuilder, _a370, _b273, SingleStoreDateTimeString, init_datetime2, _a371, _b274, SingleStoreDecimalBuilder, _a372, _b275, SingleStoreDecimal, _a373, _b276, SingleStoreDecimalNumberBuilder, _a374, _b277, SingleStoreDecimalNumber, _a375, _b278, SingleStoreDecimalBigIntBuilder, _a376, _b279, SingleStoreDecimalBigInt, init_decimal2, _a377, _b280, SingleStoreDoubleBuilder, _a378, _b281, SingleStoreDouble, init_double2, _a379, _b282, SingleStoreEnumColumnBuilder, _a380, _b283, SingleStoreEnumColumn, init_enum3, _a381, _b284, SingleStoreFloatBuilder, _a382, _b285, SingleStoreFloat, init_float2, _a383, _b286, SingleStoreIntBuilder, _a384, _b287, SingleStoreInt, init_int2, _a385, _b288, SingleStoreJsonBuilder, _a386, _b289, SingleStoreJson, init_json3, _a387, _b290, SingleStoreMediumIntBuilder, _a388, _b291, SingleStoreMediumInt, init_mediumint2, _a389, _b292, SingleStoreRealBuilder, _a390, _b293, SingleStoreReal, init_real4, _a391, _b294, SingleStoreSerialBuilder, _a392, _b295, SingleStoreSerial, init_serial3, _a393, _b296, SingleStoreSmallIntBuilder, _a394, _b297, SingleStoreSmallInt, init_smallint3, _a395, _b298, SingleStoreTextBuilder, _a396, _b299, SingleStoreText, init_text4, _a397, _b300, SingleStoreTimeBuilder, _a398, _b301, SingleStoreTime, init_time3, _a399, _b302, SingleStoreDateColumnBaseBuilder, _a400, _b303, SingleStoreDateBaseColumn, init_date_common3, _a401, _b304, SingleStoreTimestampBuilder, _a402, _b305, SingleStoreTimestamp, _a403, _b306, SingleStoreTimestampStringBuilder, _a404, _b307, SingleStoreTimestampString, init_timestamp3, _a405, _b308, SingleStoreTinyIntBuilder, _a406, _b309, SingleStoreTinyInt, init_tinyint2, _a407, _b310, SingleStoreVarBinaryBuilder, _a408, _b311, SingleStoreVarBinary, init_varbinary2, _a409, _b312, SingleStoreVarCharBuilder, _a410, _b313, SingleStoreVarChar, init_varchar3, _a411, _b314, SingleStoreVectorBuilder, _a412, _b315, SingleStoreVector, init_vector4, _a413, _b316, SingleStoreYearBuilder, _a414, _b317, SingleStoreYear, init_year2, init_columns4, _a415, _b318, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder, init_count4, _a416, IndexBuilderOn4, _a417, IndexBuilder4, _a418, Index6, init_indexes4, init_all4, _a419, _b319, _c13, _d5, SingleStoreTable, init_table52, _a420, PrimaryKeyBuilder4, _a421, PrimaryKey4, init_primary_keys4, init_utils10, _a422, _b320, SingleStoreDeleteBase, init_delete4, _a423, SingleStoreInsertBuilder, _a424, _b321, SingleStoreInsertBase, init_insert4, _a425, SingleStoreDialect, init_dialect4, _a426, SingleStoreSelectBuilder, _a427, _b322, SingleStoreSelectQueryBuilderBase, _a428, _b323, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus, init_select5, _a429, QueryBuilder4, init_query_builder5, init_select_types4, _a430, SingleStoreUpdateBuilder, _a431, _b324, SingleStoreUpdateBase, init_update4, init_query_builders4, _a432, SingleStoreDatabase, init_db4, _a433, SingleStoreSchema5, init_schema32, _a434, SingleStorePreparedQuery, _a435, SingleStoreSession, _a436, _b325, SingleStoreTransaction, init_session4, init_subquery5, init_singlestore_core, dialect5, generateSingleStoreSnapshot, fromDatabase4, init_singlestoreSerializer, sqliteImports_exports, prepareFromExports2, prepareFromSqliteImports, init_sqliteImports, mysqlImports_exports, prepareFromExports3, prepareFromMySqlImports, init_mysqlImports, mysqlPushUtils_exports, import_hanji8, filterStatements, logSuggestionsAndReturn2, init_mysqlPushUtils, mysqlIntrospect_exports, import_hanji9, mysqlPushIntrospect, init_mysqlIntrospect, singlestoreImports_exports, prepareFromExports4, prepareFromSingleStoreImports, init_singlestoreImports, singlestorePushUtils_exports, import_hanji10, filterStatements2, logSuggestionsAndReturn3, init_singlestorePushUtils, singlestoreIntrospect_exports, import_hanji11, singlestorePushIntrospect, init_singlestoreIntrospect, import_hanji3, import_hanji5, import_hanji6, UPPERCASE, LOWERCASE, LEADING_CAPITAL, IDENTIFIER, SEPARATORS, LEADING_SEPARATORS, SEPARATORS_AND_IDENTIFIER, NUMBERS_AND_IDENTIFIER, preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
111764
+ }, __toESM5 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod)), __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value), ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles2, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default, init_ansi_styles, env, flagForceColor, supportsColor, supports_color_default, init_supports_color, init_utilities, stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles22, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default, init_source, require_old, require_fs, require_path, require_balanced_match, require_brace_expansion, require_minimatch, require_inherits_browser2, require_inherits2, require_common3, require_sync, require_wrappy, require_once, require_inflight, require_glob, require_readline, require_src3, require_utils4, require_lodash, require_hanji, originUUID, snapshotVersion, mapValues, mapKeys, mapEntries, customMapEntries, init_global2, util3, objectUtil2, ZodParsedType2, getParsedType2, init_util5, ZodIssueCode4, ZodError4, init_ZodError2, errorMap2, en_default4, init_en4, overrideErrorMap2, init_errors9, makeIssue2, ParseStatus2, INVALID3, DIRTY2, OK2, isAborted2, isDirty2, isValid2, isAsync2, init_parseUtil2, init_typeAliases2, errorUtil2, init_errorUtil2, ParseInputLazyPath2, handleResult2, ZodType4, cuidRegex2, cuid2Regex2, ulidRegex2, uuidRegex2, nanoidRegex2, jwtRegex2, durationRegex2, emailRegex2, _emojiRegex2, emojiRegex2, ipv4Regex2, ipv4CidrRegex2, ipv6Regex2, ipv6CidrRegex2, base64Regex2, base64urlRegex2, dateRegexSource2, dateRegex2, ZodString4, ZodNumber4, ZodBigInt2, ZodBoolean4, ZodDate2, ZodSymbol2, ZodUndefined2, ZodNull2, ZodAny2, ZodUnknown4, ZodNever4, ZodVoid2, ZodArray4, ZodObject4, ZodUnion4, getDiscriminator2, ZodDiscriminatedUnion4, ZodIntersection4, ZodTuple2, ZodRecord4, ZodMap2, ZodSet2, ZodFunction2, ZodLazy2, ZodLiteral4, ZodEnum4, ZodNativeEnum2, ZodPromise2, ZodEffects2, ZodOptional4, ZodNullable4, ZodDefault4, ZodCatch4, ZodNaN2, BRAND2, ZodBranded2, ZodPipeline2, ZodReadonly4, late2, ZodFirstPartyTypeKind3, stringType2, numberType2, nanType2, bigIntType2, booleanType2, dateType2, symbolType2, undefinedType2, nullType2, anyType2, unknownType2, neverType2, voidType2, arrayType2, objectType2, strictObjectType2, unionType2, discriminatedUnionType2, intersectionType2, tupleType2, recordType2, mapType2, setType2, functionType2, lazyType2, literalType2, enumType2, nativeEnumType2, promiseType2, effectsType2, optionalType2, nullableType2, preprocessType2, pipelineType2, coerce2, init_types6, init_external4, init_v32, init_esm2, enumSchema, enumSchemaV1, indexColumn, index2, fk, sequenceSchema, roleSchema, sequenceSquashed, column2, checkConstraint, columnSquashed, compositePK, uniqueConstraint, policy, policySquashed, viewWithOption, matViewWithOption, mergedViewWithOption, view2, table9, schemaHash, kitInternals, gelSchemaExternal, gelSchemaInternal, tableSquashed, gelSchemaSquashed, gelSchema, dryGel, init_gelSchema, index22, fk2, column22, tableV3, compositePK2, uniqueConstraint2, checkConstraint2, tableV4, table22, viewMeta, view22, kitInternals2, dialect2, schemaHash2, schemaInternalV3, schemaInternalV4, schemaInternalV5, schemaInternal, schemaV3, schemaV4, schemaV5, schema2, tableSquashedV4, tableSquashed2, viewSquashed, schemaSquashed, schemaSquashedV4, MySqlSquasher, squashMysqlScheme, mysqlSchema, mysqlSchemaV5, mysqlSchemaSquashed, backwardCompatibleMysqlSchema, dryMySql, init_mysqlSchema, indexV2, columnV2, tableV2, enumSchemaV12, enumSchema2, pgSchemaV2, references, columnV1, tableV1, pgSchemaV1, indexColumn2, index3, indexV4, indexV5, indexV6, fk3, sequenceSchema2, roleSchema2, sequenceSquashed2, columnV7, column3, checkConstraint3, columnSquashed2, tableV32, compositePK3, uniqueConstraint3, policy2, policySquashed2, viewWithOption2, matViewWithOption2, mergedViewWithOption2, view3, tableV42, tableV5, tableV6, tableV7, table32, schemaHash3, kitInternals3, pgSchemaInternalV3, pgSchemaInternalV4, pgSchemaInternalV5, pgSchemaInternalV6, pgSchemaExternal, pgSchemaInternalV7, pgSchemaInternal, tableSquashed3, tableSquashedV42, pgSchemaSquashedV4, pgSchemaSquashedV6, pgSchemaSquashed, pgSchemaV3, pgSchemaV4, pgSchemaV5, pgSchemaV6, pgSchemaV7, pgSchema, backwardCompatiblePgSchema, PgSquasher, squashPgScheme, dryPg, init_pgSchema, index4, column4, compositePK4, uniqueConstraint4, table42, viewMeta2, kitInternals4, dialect22, schemaHash4, schemaInternal2, schema22, tableSquashed4, schemaSquashed2, SingleStoreSquasher, squashSingleStoreScheme, singlestoreSchema, singlestoreSchemaSquashed, backwardCompatibleSingleStoreSchema, drySingleStore, init_singlestoreSchema, index5, fk4, compositePK5, column5, tableV33, uniqueConstraint5, checkConstraint4, table52, view4, dialect3, schemaHash5, schemaInternalV32, schemaInternalV42, schemaInternalV52, kitInternals5, latestVersion, schemaInternal3, schemaV32, schemaV42, schemaV52, schema3, tableSquashed5, schemaSquashed3, SQLiteSquasher, squashSqliteScheme, drySQLite, sqliteSchemaV5, sqliteSchema, SQLiteSchemaSquashed, backwardCompatibleSqliteSchema, init_sqliteSchema, copy, prepareMigrationMeta, schemaRenameKey, tableRenameKey, columnRenameKey, init_utils8, import_hanji, warning, error3, isRenamePromptItem, ResolveColumnSelect, tableKey, ResolveSelectNamed, ResolveSelect, ResolveSchemasSelect, Spinner2, ProgressView, init_views, glob, init_serializer, fillPgSnapshot, init_migrationPreparator, require_heap, require_heap2, require_difflib, require_difflib2, require_util2, require_styles, require_has_flag2, require_supports_colors, require_trap, require_zalgo, require_america, require_zebra, require_rainbow, require_random, require_colors, require_safe, require_colorize, require_lib5, import_json_diff, mapArraysDiff, findAlternationsInTable, alternationsInColumn, init_jsonDiffer, parseType, Convertor, PgCreateRoleConvertor, PgDropRoleConvertor, PgRenameRoleConvertor, PgAlterRoleConvertor, PgCreatePolicyConvertor, PgDropPolicyConvertor, PgRenamePolicyConvertor, PgAlterPolicyConvertor, PgCreateIndPolicyConvertor, PgDropIndPolicyConvertor, PgRenameIndPolicyConvertor, PgAlterIndPolicyConvertor, PgEnableRlsConvertor, PgDisableRlsConvertor, PgCreateTableConvertor, MySqlCreateTableConvertor, SingleStoreCreateTableConvertor, SQLiteCreateTableConvertor, PgCreateViewConvertor, MySqlCreateViewConvertor, SqliteCreateViewConvertor, PgDropViewConvertor, MySqlDropViewConvertor, SqliteDropViewConvertor, MySqlAlterViewConvertor, PgRenameViewConvertor, MySqlRenameViewConvertor, PgAlterViewSchemaConvertor, PgAlterViewAddWithOptionConvertor, PgAlterViewDropWithOptionConvertor, PgAlterViewAlterTablespaceConvertor, PgAlterViewAlterUsingConvertor, PgAlterTableAlterColumnSetGenerated, PgAlterTableAlterColumnDropGenerated, PgAlterTableAlterColumnAlterGenerated, PgAlterTableAddUniqueConstraintConvertor, PgAlterTableDropUniqueConstraintConvertor, PgAlterTableAddCheckConstraintConvertor, PgAlterTableDeleteCheckConstraintConvertor, MySQLAlterTableAddUniqueConstraintConvertor, MySQLAlterTableDropUniqueConstraintConvertor, MySqlAlterTableAddCheckConstraintConvertor, SingleStoreAlterTableAddUniqueConstraintConvertor, SingleStoreAlterTableDropUniqueConstraintConvertor, MySqlAlterTableDeleteCheckConstraintConvertor, CreatePgSequenceConvertor, DropPgSequenceConvertor, RenamePgSequenceConvertor, MovePgSequenceConvertor, AlterPgSequenceConvertor, CreateTypeEnumConvertor, DropTypeEnumConvertor, AlterTypeAddValueConvertor, AlterTypeSetSchemaConvertor, AlterRenameTypeConvertor, AlterTypeDropValueConvertor, PgDropTableConvertor, MySQLDropTableConvertor, SingleStoreDropTableConvertor, SQLiteDropTableConvertor, PgRenameTableConvertor, SqliteRenameTableConvertor, MySqlRenameTableConvertor, SingleStoreRenameTableConvertor, PgAlterTableRenameColumnConvertor, MySqlAlterTableRenameColumnConvertor, SingleStoreAlterTableRenameColumnConvertor, SQLiteAlterTableRenameColumnConvertor, PgAlterTableDropColumnConvertor, MySqlAlterTableDropColumnConvertor, SingleStoreAlterTableDropColumnConvertor, SQLiteAlterTableDropColumnConvertor, PgAlterTableAddColumnConvertor, MySqlAlterTableAddColumnConvertor, SingleStoreAlterTableAddColumnConvertor, SQLiteAlterTableAddColumnConvertor, PgAlterTableAlterColumnSetTypeConvertor, PgAlterTableAlterColumnSetDefaultConvertor, PgAlterTableAlterColumnDropDefaultConvertor, PgAlterTableAlterColumnDropGeneratedConvertor, PgAlterTableAlterColumnSetExpressionConvertor, PgAlterTableAlterColumnAlterrGeneratedConvertor, SqliteAlterTableAlterColumnDropGeneratedConvertor, SqliteAlterTableAlterColumnSetExpressionConvertor, SqliteAlterTableAlterColumnAlterGeneratedConvertor, MySqlAlterTableAlterColumnAlterrGeneratedConvertor, MySqlAlterTableAddPk, MySqlAlterTableDropPk, LibSQLModifyColumn, MySqlModifyColumn, SingleStoreAlterTableAlterColumnAlterrGeneratedConvertor, SingleStoreAlterTableAddPk, SingleStoreAlterTableDropPk, SingleStoreModifyColumn, PgAlterTableCreateCompositePrimaryKeyConvertor, PgAlterTableDeleteCompositePrimaryKeyConvertor, PgAlterTableAlterCompositePrimaryKeyConvertor, MySqlAlterTableCreateCompositePrimaryKeyConvertor, MySqlAlterTableDeleteCompositePrimaryKeyConvertor, MySqlAlterTableAlterCompositePrimaryKeyConvertor, PgAlterTableAlterColumnSetPrimaryKeyConvertor, PgAlterTableAlterColumnDropPrimaryKeyConvertor, PgAlterTableAlterColumnSetNotNullConvertor, PgAlterTableAlterColumnDropNotNullConvertor, PgCreateForeignKeyConvertor, LibSQLCreateForeignKeyConvertor, MySqlCreateForeignKeyConvertor, PgAlterForeignKeyConvertor, PgDeleteForeignKeyConvertor, MySqlDeleteForeignKeyConvertor, CreatePgIndexConvertor, CreateMySqlIndexConvertor, CreateSingleStoreIndexConvertor, CreateSqliteIndexConvertor, PgDropIndexConvertor, PgCreateSchemaConvertor, PgRenameSchemaConvertor, PgDropSchemaConvertor, PgAlterTableSetSchemaConvertor, PgAlterTableSetNewSchemaConvertor, PgAlterTableRemoveFromSchemaConvertor, SqliteDropIndexConvertor, MySqlDropIndexConvertor, SingleStoreDropIndexConvertor, SQLiteRecreateTableConvertor, LibSQLRecreateTableConvertor, SingleStoreRecreateTableConvertor, convertors, init_sqlgenerator, _moveDataStatements, getOldTableName, getNewTableName, logSuggestionsAndReturn, init_sqlitePushUtils, preparePgCreateTableJson, prepareMySqlCreateTableJson, prepareSingleStoreCreateTableJson, prepareSQLiteCreateTable, prepareDropTableJson, prepareRenameTableJson, prepareCreateEnumJson, prepareAddValuesToEnumJson, prepareDropEnumValues, prepareDropEnumJson, prepareMoveEnumJson, prepareRenameEnumJson, prepareCreateSequenceJson, prepareAlterSequenceJson, prepareDropSequenceJson, prepareMoveSequenceJson, prepareRenameSequenceJson, prepareCreateRoleJson, prepareAlterRoleJson, prepareDropRoleJson, prepareRenameRoleJson, prepareCreateSchemasJson, prepareRenameSchemasJson, prepareDeleteSchemasJson, prepareRenameColumns, _prepareDropColumns, _prepareAddColumns, _prepareSqliteAddColumns, prepareAlterColumnsMysql, preparePgAlterColumns, prepareSqliteAlterColumns, prepareRenamePolicyJsons, prepareRenameIndPolicyJsons, prepareCreatePolicyJsons, prepareCreateIndPolicyJsons, prepareDropPolicyJsons, prepareDropIndPolicyJsons, prepareAlterPolicyJson, prepareAlterIndPolicyJson, preparePgCreateIndexesJson, prepareCreateIndexesJson, prepareCreateReferencesJson, prepareLibSQLCreateReferencesJson, prepareDropReferencesJson, prepareLibSQLDropReferencesJson, prepareAlterReferencesJson, prepareDropIndexesJson, prepareAddCompositePrimaryKeySqlite, prepareDeleteCompositePrimaryKeySqlite, prepareAlterCompositePrimaryKeySqlite, prepareAddCompositePrimaryKeyPg, prepareDeleteCompositePrimaryKeyPg, prepareAlterCompositePrimaryKeyPg, prepareAddUniqueConstraintPg, prepareDeleteUniqueConstraintPg, prepareAddCheckConstraint, prepareDeleteCheckConstraint, prepareAddCompositePrimaryKeyMySql, prepareDeleteCompositePrimaryKeyMySql, prepareAlterCompositePrimaryKeyMySql, preparePgCreateViewJson, prepareMySqlCreateViewJson, prepareSqliteCreateViewJson, prepareDropViewJson, prepareRenameViewJson, preparePgAlterViewAlterSchemaJson, preparePgAlterViewAddWithOptionJson, preparePgAlterViewDropWithOptionJson, preparePgAlterViewAlterTablespaceJson, preparePgAlterViewAlterUsingJson, prepareMySqlAlterView, init_jsonStatements, prepareLibSQLRecreateTable, prepareSQLiteRecreateTable, libSQLCombineStatements, sqliteCombineStatements, prepareSingleStoreRecreateTable, singleStoreCombineStatements, init_statementCombiner, snapshotsDiffer_exports, makeChanged, makeSelfOrChanged, makePatched, makeSelfOrPatched, columnSchema, alteredColumnSchema, enumSchema3, changedEnumSchema, tableScheme, alteredTableScheme, alteredViewCommon, alteredPgViewSchema, alteredMySqlViewSchema, diffResultScheme, diffResultSchemeMysql, diffResultSchemeSingleStore, diffResultSchemeSQLite, schemaChangeFor, nameChangeFor, nameSchemaChangeFor, columnChangeFor, applyPgSnapshotsDiff, applyMysqlSnapshotsDiff, applySingleStoreSnapshotsDiff, applySqliteSnapshotsDiff, applyLibSQLSnapshotsDiff, init_snapshotsDiffer, init_words, dialects, dialect4, commonSquashedSchema, commonSchema, init_schemaValidator, sqliteDriversLiterals, postgresqlDriversLiterals, prefixes, prefix, casingTypes, casingType, sqliteDriver, postgresDriver, driver2, configMigrations, configCommonSchema, casing, introspectParams, configIntrospectCliSchema, configGenerateSchema, configPushSchema, init_common2, withStyle, init_outputs, import_hanji2, schemasResolver, tablesResolver, viewsResolver, mySqlViewsResolver, sqliteViewsResolver, sequencesResolver, roleResolver, policyResolver, indPolicyResolver, enumsResolver, columnsResolver, promptColumnsConflicts, promptNamedConflict, promptNamedWithSchemasConflict, promptSchemasConflict, BREAKPOINT, init_migrate, posixClasses, braceEscape, regexpEscape, rangesToString, parseClass, init_brace_expressions, escape, init_escape, unescape, init_unescape, import_brace_expansion, minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep3, GLOBSTAR, plTypes, qmark, star, twoStarDot, twoStarNoDot, charSet, reSpecials, addPatternStartSet, filter, ext, defaults, braceExpand, MAX_PATTERN_LENGTH, assertValidPattern, makeRe, match2, globUnescape, globMagic, regExpEscape, Minimatch, init_mjs, entityKind2, hasOwnEntityKind2, init_entity2, _a3, Column2, init_column2, _a22, ColumnBuilder2, init_column_builder2, TableName2, init_table_utils2, _a32, ForeignKeyBuilder2, _a4, ForeignKey2, init_foreign_keys2, init_tracing_utils2, _a5, UniqueConstraintBuilder, _a6, UniqueOnConstraintBuilder, _a7, UniqueConstraint, init_unique_constraint2, init_array2, _a8, _b, PgColumnBuilder2, _a9, _b2, PgColumn2, _a10, _b3, ExtraConfigColumn2, _a11, IndexedColumn2, _a12, _b4, PgArrayBuilder2, _a13, _b5, _PgArray, PgArray2, init_common22, _a14, _b6, PgEnumObjectColumnBuilder2, _a15, _b7, PgEnumObjectColumn2, isPgEnumSym2, _a16, _b8, PgEnumColumnBuilder2, _a17, _b9, PgEnumColumn2, init_enum2, _a18, Subquery2, _a19, _b10, WithSubquery2, init_subquery2, version4, init_version2, otel2, rawTracer2, tracer2, init_tracing2, ViewBaseConfig2, init_view_common3, Schema2, Columns2, ExtraConfigColumns2, OriginalName2, BaseName2, IsAlias2, ExtraConfigBuilder2, IsDrizzleTable2, _a20, _b11, _c, _d, _e3, _f, _g, _h, _i, _j, Table2, init_table9, _a21, FakePrimitiveParam, _a222, StringChunk2, _a23, _SQL, SQL2, _a24, Name2, noopDecoder2, noopEncoder2, noopMapper2, _a25, Param2, _a26, Placeholder2, IsDrizzleView2, _a27, _b12, _c2, View3, init_sql5, _a28, ColumnAliasProxyHandler2, _a29, TableAliasProxyHandler2, _a30, RelationTableAliasProxyHandler, init_alias3, _a31, _b13, DrizzleError2, DrizzleQueryError2, _a322, _b14, TransactionRollbackError2, init_errors22, _a33, ConsoleLogWriter2, _a34, DefaultLogger2, _a35, NoopLogger2, init_logger3, init_operations, _a36, _b15, QueryPromise2, init_query_promise2, textDecoder2, init_utils22, _a37, _b16, PgIntColumnBaseBuilder2, init_int_common2, _a38, _b17, PgBigInt53Builder2, _a39, _b18, PgBigInt532, _a40, _b19, PgBigInt64Builder2, _a41, _b20, PgBigInt642, init_bigint2, _a42, _b21, PgBigSerial53Builder2, _a43, _b22, PgBigSerial532, _a44, _b23, PgBigSerial64Builder2, _a45, _b24, PgBigSerial642, init_bigserial2, _a46, _b25, PgBooleanBuilder2, _a47, _b26, PgBoolean2, init_boolean2, _a48, _b27, PgCharBuilder2, _a49, _b28, PgChar2, init_char2, _a50, _b29, PgCidrBuilder2, _a51, _b30, PgCidr2, init_cidr2, _a52, _b31, PgCustomColumnBuilder2, _a53, _b32, PgCustomColumn2, init_custom2, _a54, _b33, PgDateColumnBaseBuilder2, init_date_common2, _a55, _b34, PgDateBuilder2, _a56, _b35, PgDate2, _a57, _b36, PgDateStringBuilder2, _a58, _b37, PgDateString2, init_date2, _a59, _b38, PgDoublePrecisionBuilder2, _a60, _b39, PgDoublePrecision2, init_double_precision2, _a61, _b40, PgInetBuilder2, _a62, _b41, PgInet2, init_inet2, _a63, _b42, PgIntegerBuilder2, _a64, _b43, PgInteger2, init_integer2, _a65, _b44, PgIntervalBuilder2, _a66, _b45, PgInterval2, init_interval2, _a67, _b46, PgJsonBuilder2, _a68, _b47, PgJson2, init_json2, _a69, _b48, PgJsonbBuilder2, _a70, _b49, PgJsonb2, init_jsonb2, _a71, _b50, PgLineBuilder2, _a72, _b51, PgLineTuple2, _a73, _b52, PgLineABCBuilder2, _a74, _b53, PgLineABC2, init_line2, _a75, _b54, PgMacaddrBuilder2, _a76, _b55, PgMacaddr2, init_macaddr2, _a77, _b56, PgMacaddr8Builder2, _a78, _b57, PgMacaddr82, init_macaddr82, _a79, _b58, PgNumericBuilder2, _a80, _b59, PgNumeric2, _a81, _b60, PgNumericNumberBuilder2, _a82, _b61, PgNumericNumber2, _a83, _b62, PgNumericBigIntBuilder2, _a84, _b63, PgNumericBigInt2, init_numeric2, _a85, _b64, PgPointTupleBuilder2, _a86, _b65, PgPointTuple2, _a87, _b66, PgPointObjectBuilder2, _a88, _b67, PgPointObject2, init_point2, init_utils32, _a89, _b68, PgGeometryBuilder2, _a90, _b69, PgGeometry2, _a91, _b70, PgGeometryObjectBuilder2, _a92, _b71, PgGeometryObject2, init_geometry2, _a93, _b72, PgRealBuilder2, _a94, _b73, PgReal2, init_real2, _a95, _b74, PgSerialBuilder2, _a96, _b75, PgSerial2, init_serial2, _a97, _b76, PgSmallIntBuilder2, _a98, _b77, PgSmallInt2, init_smallint2, _a99, _b78, PgSmallSerialBuilder2, _a100, _b79, PgSmallSerial2, init_smallserial2, _a101, _b80, PgTextBuilder2, _a102, _b81, PgText2, init_text2, _a103, _b82, PgTimeBuilder2, _a104, _b83, PgTime2, init_time2, _a105, _b84, PgTimestampBuilder2, _a106, _b85, PgTimestamp2, _a107, _b86, PgTimestampStringBuilder2, _a108, _b87, PgTimestampString2, init_timestamp2, _a109, _b88, PgUUIDBuilder2, _a110, _b89, PgUUID2, init_uuid3, _a111, _b90, PgVarcharBuilder2, _a112, _b91, PgVarchar2, init_varchar2, _a113, _b92, PgBinaryVectorBuilder2, _a114, _b93, PgBinaryVector2, init_bit2, _a115, _b94, PgHalfVectorBuilder2, _a116, _b95, PgHalfVector2, init_halfvec2, _a117, _b96, PgSparseVectorBuilder2, _a118, _b97, PgSparseVector2, init_sparsevec2, _a119, _b98, PgVectorBuilder2, _a120, _b99, PgVector2, init_vector3, init_all2, InlineForeignKeys2, EnableRLS2, _a121, _b100, _c3, _d2, _e22, _f2, PgTable2, pgTable2, init_table22, _a122, PrimaryKeyBuilder2, _a123, PrimaryKey2, init_primary_keys2, eq2, ne4, gt3, gte2, lt4, lte2, init_conditions2, init_select3, init_expressions2, _a124, Relation2, _a125, Relations2, _a126, _b101, _One, One2, _a127, _b102, _Many, Many2, init_relations2, init_aggregate2, init_vector22, init_functions2, init_sql22, dist_exports, init_dist9, init_alias22, _a128, CheckBuilder2, _a129, Check2, init_checks6, init_columns2, _a130, _SelectionProxyHandler, SelectionProxyHandler2, init_selection_proxy2, _a131, IndexBuilderOn2, _a132, IndexBuilder2, _a133, Index2, init_indexes2, _a134, PgPolicy, init_policies2, PgViewConfig2, init_view_common22, _a135, CasingCache2, init_casing2, _a136, _b103, PgViewBase2, init_view_base2, _a137, PgDialect2, init_dialect2, _a138, TypedQueryBuilder2, init_query_builder3, _a139, PgSelectBuilder2, _a140, _b104, PgSelectQueryBuilderBase2, _a141, _b105, PgSelectBase2, getPgSetOperators2, union22, unionAll2, intersect2, intersectAll2, except2, exceptAll2, init_select22, _a142, QueryBuilder2, init_query_builder22, _a143, DefaultViewBuilderCore, _a144, _b106, ViewBuilder, _a145, _b107, ManualViewBuilder, _a146, MaterializedViewBuilderCore, _a147, _b108, MaterializedViewBuilder, _a148, _b109, ManualMaterializedViewBuilder, _a149, _b110, _c4, PgView2, PgMaterializedViewConfig2, _a150, _b111, _c5, PgMaterializedView, init_view2, init_utils42, _a151, _b112, PgDeleteBase2, init_delete2, _a152, PgInsertBuilder2, _a153, _b113, PgInsertBase2, init_insert2, _a154, _b114, PgRefreshMaterializedView2, init_refresh_materialized_view2, init_select_types, _a155, PgUpdateBuilder2, _a156, _b115, PgUpdateBase2, init_update2, init_query_builders2, _a157, _b116, _c6, _PgCountBuilder, PgCountBuilder2, init_count2, _a158, RelationalQueryBuilder2, _a159, _b117, PgRelationalQuery2, init_query2, _a160, _b118, PgRaw2, init_raw2, _a161, PgDatabase2, init_db2, _a162, PgRole, init_roles2, _a163, PgSequence, init_sequence2, _a164, PgSchema5, init_schema4, _a165, Cache2, _a166, _b119, NoopCache2, init_cache2, _a167, PgPreparedQuery2, _a168, PgSession2, _a169, _b120, PgTransaction2, init_session3, init_subquery22, init_utils52, init_pg_core2, vectorOps, init_vector32, sqlToStr, init_utils62, indexName, generatePgSnapshot, trimChar, fromDatabase, defaultForColumn, getColumnsInfoQuery, init_pgSerializer, import_hanji4, Select, init_selector_ui, init_alias32, _a170, CheckBuilder22, _a171, Check22, init_checks22, _a172, ForeignKeyBuilder22, _a173, ForeignKey22, init_foreign_keys22, _a174, UniqueConstraintBuilder2, _a175, UniqueOnConstraintBuilder2, _a176, UniqueConstraint2, init_unique_constraint22, _a177, _b121, SQLiteColumnBuilder, _a178, _b122, SQLiteColumn, init_common3, _a179, _b123, SQLiteBigIntBuilder, _a180, _b124, SQLiteBigInt, _a181, _b125, SQLiteBlobJsonBuilder, _a182, _b126, SQLiteBlobJson, _a183, _b127, SQLiteBlobBufferBuilder, _a184, _b128, SQLiteBlobBuffer, init_blob, _a185, _b129, SQLiteCustomColumnBuilder, _a186, _b130, SQLiteCustomColumn, init_custom22, _a187, _b131, SQLiteBaseIntegerBuilder, _a188, _b132, SQLiteBaseInteger, _a189, _b133, SQLiteIntegerBuilder, _a190, _b134, SQLiteInteger, _a191, _b135, SQLiteTimestampBuilder, _a192, _b136, SQLiteTimestamp, _a193, _b137, SQLiteBooleanBuilder, _a194, _b138, SQLiteBoolean, init_integer22, _a195, _b139, SQLiteNumericBuilder, _a196, _b140, SQLiteNumeric, _a197, _b141, SQLiteNumericNumberBuilder, _a198, _b142, SQLiteNumericNumber, _a199, _b143, SQLiteNumericBigIntBuilder, _a200, _b144, SQLiteNumericBigInt, init_numeric22, _a201, _b145, SQLiteRealBuilder, _a202, _b146, SQLiteReal, init_real22, _a203, _b147, SQLiteTextBuilder, _a204, _b148, SQLiteText, _a205, _b149, SQLiteTextJsonBuilder, _a206, _b150, SQLiteTextJson, init_text22, init_columns22, init_all22, InlineForeignKeys22, _a207, _b151, _c7, _d3, _e32, SQLiteTable, sqliteTable, init_table32, _a208, IndexBuilderOn22, _a209, IndexBuilder22, _a210, Index4, init_indexes22, _a211, PrimaryKeyBuilder22, _a212, PrimaryKey22, init_primary_keys22, init_utils72, _a213, _b152, SQLiteDeleteBase, init_delete22, _a214, _b153, SQLiteViewBase, init_view_base22, _a215, SQLiteDialect, _a216, _b154, SQLiteSyncDialect, _a217, _b155, SQLiteAsyncDialect, init_dialect22, _a218, SQLiteSelectBuilder, _a219, _b156, SQLiteSelectQueryBuilderBase, _a220, _b157, SQLiteSelectBase, getSQLiteSetOperators, union32, unionAll22, intersect22, except22, init_select32, _a221, QueryBuilder22, init_query_builder32, _a2222, SQLiteInsertBuilder, _a223, _b158, SQLiteInsertBase, init_insert22, init_select_types2, _a224, SQLiteUpdateBuilder, _a225, _b159, SQLiteUpdateBase, init_update22, init_query_builders22, _a226, _b160, _c8, _SQLiteCountBuilder, SQLiteCountBuilder, init_count22, _a227, RelationalQueryBuilder22, _a228, _b161, SQLiteRelationalQuery, _a229, _b162, SQLiteSyncRelationalQuery, init_query22, _a230, _b163, SQLiteRaw, init_raw22, _a231, BaseSQLiteDatabase, init_db22, _a232, _b164, ExecuteResultSync, _a233, SQLitePreparedQuery, _a234, SQLiteSession, _a235, _b165, SQLiteTransaction, init_session22, init_subquery3, _a236, ViewBuilderCore, _a237, _b166, ViewBuilder2, _a238, _b167, ManualViewBuilder2, _a239, _b168, SQLiteView2, init_view22, init_sqlite_core, generateSqliteSnapshot, fromDatabase2, init_sqliteSerializer, getTablesFilterByExtensions, init_getTablesFilterByExtensions, init_alias4, _a240, CheckBuilder3, _a241, Check3, init_checks32, _a242, ForeignKeyBuilder3, _a243, ForeignKey3, init_foreign_keys3, _a244, UniqueConstraintBuilder3, _a245, UniqueOnConstraintBuilder3, _a246, UniqueConstraint3, init_unique_constraint3, _a247, _b169, MySqlColumnBuilder, _a248, _b170, MySqlColumn, _a249, _b171, MySqlColumnBuilderWithAutoIncrement, _a250, _b172, MySqlColumnWithAutoIncrement, init_common4, _a251, _b173, MySqlBigInt53Builder, _a252, _b174, MySqlBigInt53, _a253, _b175, MySqlBigInt64Builder, _a254, _b176, MySqlBigInt64, init_bigint22, _a255, _b177, MySqlBinaryBuilder, _a256, _b178, MySqlBinary, init_binary, _a257, _b179, MySqlBooleanBuilder, _a258, _b180, MySqlBoolean, init_boolean22, _a259, _b181, MySqlCharBuilder, _a260, _b182, MySqlChar, init_char22, _a261, _b183, MySqlCustomColumnBuilder, _a262, _b184, MySqlCustomColumn, init_custom3, _a263, _b185, MySqlDateBuilder, _a264, _b186, MySqlDate, _a265, _b187, MySqlDateStringBuilder, _a266, _b188, MySqlDateString, init_date22, _a267, _b189, MySqlDateTimeBuilder, _a268, _b190, MySqlDateTime, _a269, _b191, MySqlDateTimeStringBuilder, _a270, _b192, MySqlDateTimeString, init_datetime, _a271, _b193, MySqlDecimalBuilder, _a272, _b194, MySqlDecimal, _a273, _b195, MySqlDecimalNumberBuilder, _a274, _b196, MySqlDecimalNumber, _a275, _b197, MySqlDecimalBigIntBuilder, _a276, _b198, MySqlDecimalBigInt, init_decimal, _a277, _b199, MySqlDoubleBuilder, _a278, _b200, MySqlDouble, init_double, _a279, _b201, MySqlEnumColumnBuilder, _a280, _b202, MySqlEnumColumn, _a281, _b203, MySqlEnumObjectColumnBuilder, _a282, _b204, MySqlEnumObjectColumn, init_enum22, _a283, _b205, MySqlFloatBuilder, _a284, _b206, MySqlFloat, init_float, _a285, _b207, MySqlIntBuilder, _a286, _b208, MySqlInt, init_int, _a287, _b209, MySqlJsonBuilder, _a288, _b210, MySqlJson, init_json22, _a289, _b211, MySqlMediumIntBuilder, _a290, _b212, MySqlMediumInt, init_mediumint, _a291, _b213, MySqlRealBuilder, _a292, _b214, MySqlReal, init_real3, _a293, _b215, MySqlSerialBuilder, _a294, _b216, MySqlSerial, init_serial22, _a295, _b217, MySqlSmallIntBuilder, _a296, _b218, MySqlSmallInt, init_smallint22, _a297, _b219, MySqlTextBuilder, _a298, _b220, MySqlText, init_text3, _a299, _b221, MySqlTimeBuilder, _a300, _b222, MySqlTime, init_time22, _a301, _b223, MySqlDateColumnBaseBuilder, _a302, _b224, MySqlDateBaseColumn, init_date_common22, _a303, _b225, MySqlTimestampBuilder, _a304, _b226, MySqlTimestamp, _a305, _b227, MySqlTimestampStringBuilder, _a306, _b228, MySqlTimestampString, init_timestamp22, _a307, _b229, MySqlTinyIntBuilder, _a308, _b230, MySqlTinyInt, init_tinyint, _a309, _b231, MySqlVarBinaryBuilder, _a310, _b232, MySqlVarBinary, init_varbinary, _a311, _b233, MySqlVarCharBuilder, _a312, _b234, MySqlVarChar, init_varchar22, _a313, _b235, MySqlYearBuilder, _a314, _b236, MySqlYear, init_year, init_columns3, _a315, _b237, _c9, _MySqlCountBuilder, MySqlCountBuilder, init_count3, _a316, IndexBuilderOn3, _a317, IndexBuilder3, _a318, Index5, init_indexes3, init_all3, InlineForeignKeys3, _a319, _b238, _c10, _d4, _e4, MySqlTable, mysqlTable, init_table42, _a320, PrimaryKeyBuilder3, _a321, PrimaryKey3, init_primary_keys3, MySqlViewConfig, init_view_common32, init_utils82, _a3222, _b239, MySqlDeleteBase, init_delete3, _a323, _b240, MySqlViewBase, init_view_base3, _a324, MySqlDialect, init_dialect3, _a325, MySqlSelectBuilder, _a326, _b241, MySqlSelectQueryBuilderBase, _a327, _b242, MySqlSelectBase, getMySqlSetOperators, union4, unionAll3, intersect3, intersectAll22, except3, exceptAll22, init_select4, _a328, QueryBuilder3, init_query_builder4, _a329, MySqlInsertBuilder, _a330, _b243, MySqlInsertBase, init_insert3, init_select_types3, _a331, MySqlUpdateBuilder, _a332, _b244, MySqlUpdateBase, init_update3, init_query_builders3, _a333, RelationalQueryBuilder3, _a334, _b245, MySqlRelationalQuery, init_query3, _a335, MySqlDatabase, init_db3, _a336, ViewBuilderCore2, _a337, _b246, ViewBuilder3, _a338, _b247, ManualViewBuilder3, _a339, _b248, _c11, MySqlView2, init_view3, _a340, MySqlSchema5, init_schema22, _a341, MySqlPreparedQuery, _a342, MySqlSession, _a343, _b249, MySqlTransaction, init_session32, init_subquery4, init_mysql_core, handleEnumType, generateMySqlSnapshot, fromDatabase3, init_mysqlSerializer, cliConfigGenerate, pushParams, pullParams, configCheck, cliConfigCheck, init_cli, gelCredentials, init_gel, libSQLCredentials, init_libsql, mysqlCredentials, init_mysql, postgresCredentials, init_postgres, singlestoreCredentials, init_singlestore, sqliteCredentials, init_sqlite, credentials, studioCliParams, studioConfig, init_studio, es5_exports, _3, es5_default, init_es5, import_hanji7, assertES5, safeRegister, migrateConfig, init_utils9, prepareFromExports, init_pgImports, init_alias5, _a344, UniqueConstraintBuilder4, _a345, UniqueOnConstraintBuilder4, _a346, UniqueConstraint4, init_unique_constraint4, _a347, _b250, SingleStoreColumnBuilder, _a348, _b251, SingleStoreColumn, _a349, _b252, SingleStoreColumnBuilderWithAutoIncrement, _a350, _b253, SingleStoreColumnWithAutoIncrement, init_common5, _a351, _b254, SingleStoreBigInt53Builder, _a352, _b255, SingleStoreBigInt53, _a353, _b256, SingleStoreBigInt64Builder, _a354, _b257, SingleStoreBigInt64, init_bigint3, _a355, _b258, SingleStoreBinaryBuilder, _a356, _b259, SingleStoreBinary, init_binary2, _a357, _b260, SingleStoreBooleanBuilder, _a358, _b261, SingleStoreBoolean, init_boolean3, _a359, _b262, SingleStoreCharBuilder, _a360, _b263, SingleStoreChar, init_char3, _a361, _b264, SingleStoreCustomColumnBuilder, _a362, _b265, SingleStoreCustomColumn, init_custom4, _a363, _b266, SingleStoreDateBuilder, _a364, _b267, SingleStoreDate, _a365, _b268, SingleStoreDateStringBuilder, _a366, _b269, SingleStoreDateString, init_date3, _a367, _b270, SingleStoreDateTimeBuilder, _a368, _b271, SingleStoreDateTime, _a369, _b272, SingleStoreDateTimeStringBuilder, _a370, _b273, SingleStoreDateTimeString, init_datetime2, _a371, _b274, SingleStoreDecimalBuilder, _a372, _b275, SingleStoreDecimal, _a373, _b276, SingleStoreDecimalNumberBuilder, _a374, _b277, SingleStoreDecimalNumber, _a375, _b278, SingleStoreDecimalBigIntBuilder, _a376, _b279, SingleStoreDecimalBigInt, init_decimal2, _a377, _b280, SingleStoreDoubleBuilder, _a378, _b281, SingleStoreDouble, init_double2, _a379, _b282, SingleStoreEnumColumnBuilder, _a380, _b283, SingleStoreEnumColumn, init_enum3, _a381, _b284, SingleStoreFloatBuilder, _a382, _b285, SingleStoreFloat, init_float2, _a383, _b286, SingleStoreIntBuilder, _a384, _b287, SingleStoreInt, init_int2, _a385, _b288, SingleStoreJsonBuilder, _a386, _b289, SingleStoreJson, init_json3, _a387, _b290, SingleStoreMediumIntBuilder, _a388, _b291, SingleStoreMediumInt, init_mediumint2, _a389, _b292, SingleStoreRealBuilder, _a390, _b293, SingleStoreReal, init_real4, _a391, _b294, SingleStoreSerialBuilder, _a392, _b295, SingleStoreSerial, init_serial3, _a393, _b296, SingleStoreSmallIntBuilder, _a394, _b297, SingleStoreSmallInt, init_smallint3, _a395, _b298, SingleStoreTextBuilder, _a396, _b299, SingleStoreText, init_text4, _a397, _b300, SingleStoreTimeBuilder, _a398, _b301, SingleStoreTime, init_time3, _a399, _b302, SingleStoreDateColumnBaseBuilder, _a400, _b303, SingleStoreDateBaseColumn, init_date_common3, _a401, _b304, SingleStoreTimestampBuilder, _a402, _b305, SingleStoreTimestamp, _a403, _b306, SingleStoreTimestampStringBuilder, _a404, _b307, SingleStoreTimestampString, init_timestamp3, _a405, _b308, SingleStoreTinyIntBuilder, _a406, _b309, SingleStoreTinyInt, init_tinyint2, _a407, _b310, SingleStoreVarBinaryBuilder, _a408, _b311, SingleStoreVarBinary, init_varbinary2, _a409, _b312, SingleStoreVarCharBuilder, _a410, _b313, SingleStoreVarChar, init_varchar3, _a411, _b314, SingleStoreVectorBuilder, _a412, _b315, SingleStoreVector, init_vector4, _a413, _b316, SingleStoreYearBuilder, _a414, _b317, SingleStoreYear, init_year2, init_columns4, _a415, _b318, _c12, _SingleStoreCountBuilder, SingleStoreCountBuilder, init_count4, _a416, IndexBuilderOn4, _a417, IndexBuilder4, _a418, Index6, init_indexes4, init_all4, _a419, _b319, _c13, _d5, SingleStoreTable, init_table52, _a420, PrimaryKeyBuilder4, _a421, PrimaryKey4, init_primary_keys4, init_utils10, _a422, _b320, SingleStoreDeleteBase, init_delete4, _a423, SingleStoreInsertBuilder, _a424, _b321, SingleStoreInsertBase, init_insert4, _a425, SingleStoreDialect, init_dialect4, _a426, SingleStoreSelectBuilder, _a427, _b322, SingleStoreSelectQueryBuilderBase, _a428, _b323, SingleStoreSelectBase, getSingleStoreSetOperators, union5, unionAll4, intersect4, except4, minus, init_select5, _a429, QueryBuilder4, init_query_builder5, init_select_types4, _a430, SingleStoreUpdateBuilder, _a431, _b324, SingleStoreUpdateBase, init_update4, init_query_builders4, _a432, SingleStoreDatabase, init_db4, _a433, SingleStoreSchema5, init_schema32, _a434, SingleStorePreparedQuery, _a435, SingleStoreSession, _a436, _b325, SingleStoreTransaction, init_session4, init_subquery5, init_singlestore_core, dialect5, generateSingleStoreSnapshot, fromDatabase4, init_singlestoreSerializer, sqliteImports_exports, prepareFromExports2, prepareFromSqliteImports, init_sqliteImports, mysqlImports_exports, prepareFromExports3, prepareFromMySqlImports, init_mysqlImports, mysqlPushUtils_exports, import_hanji8, filterStatements, logSuggestionsAndReturn2, init_mysqlPushUtils, mysqlIntrospect_exports, import_hanji9, mysqlPushIntrospect, init_mysqlIntrospect, singlestoreImports_exports, prepareFromExports4, prepareFromSingleStoreImports, init_singlestoreImports, singlestorePushUtils_exports, import_hanji10, filterStatements2, logSuggestionsAndReturn3, init_singlestorePushUtils, singlestoreIntrospect_exports, import_hanji11, singlestorePushIntrospect, init_singlestoreIntrospect, import_hanji3, import_hanji5, import_hanji6, UPPERCASE, LOWERCASE, LEADING_CAPITAL, IDENTIFIER, SEPARATORS, LEADING_SEPARATORS, SEPARATORS_AND_IDENTIFIER, NUMBERS_AND_IDENTIFIER, preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase2) => {
110990
111765
  let isLastCharLower = false;
110991
111766
  let isLastCharUpper = false;
110992
111767
  let isLastLastCharUpper = false;
@@ -111021,7 +111796,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
111021
111796
  return input.replace(SEPARATORS_AND_IDENTIFIER, (_2, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
111022
111797
  }, generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
111023
111798
  const prepared = prepareFromExports(imports);
111024
- const id = randomUUID2();
111799
+ const id = randomUUID3();
111025
111800
  const snapshot = generatePgSnapshot(prepared.tables, prepared.enums, prepared.schemas, prepared.sequences, prepared.roles, prepared.policies, prepared.views, prepared.matViews, casing2, schemaFilters);
111026
111801
  return fillPgSnapshot({
111027
111802
  serialized: snapshot,
@@ -117934,7 +118709,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
117934
118709
  using: stringType2().optional(),
117935
118710
  tablespace: stringType2().optional()
117936
118711
  }).strict();
117937
- table8 = objectType2({
118712
+ table9 = objectType2({
117938
118713
  name: stringType2(),
117939
118714
  schema: stringType2(),
117940
118715
  columns: recordType2(stringType2(), column2),
@@ -117963,7 +118738,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
117963
118738
  gelSchemaExternal = objectType2({
117964
118739
  version: literalType2("1"),
117965
118740
  dialect: literalType2("gel"),
117966
- tables: arrayType2(table8),
118741
+ tables: arrayType2(table9),
117967
118742
  enums: arrayType2(enumSchemaV1),
117968
118743
  schemas: arrayType2(objectType2({ name: stringType2() })),
117969
118744
  _meta: objectType2({
@@ -117975,7 +118750,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
117975
118750
  gelSchemaInternal = objectType2({
117976
118751
  version: literalType2("1"),
117977
118752
  dialect: literalType2("gel"),
117978
- tables: recordType2(stringType2(), table8),
118753
+ tables: recordType2(stringType2(), table9),
117979
118754
  enums: recordType2(stringType2(), enumSchema),
117980
118755
  schemas: recordType2(stringType2(), stringType2()),
117981
118756
  views: recordType2(stringType2(), view2).default({}),
@@ -130970,7 +131745,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
130970
131745
  ViewBaseConfig2 = Symbol.for("drizzle:ViewBaseConfig");
130971
131746
  }
130972
131747
  });
130973
- init_table8 = __esm2({
131748
+ init_table9 = __esm2({
130974
131749
  "../drizzle-orm/dist/table.js"() {
130975
131750
  init_entity2();
130976
131751
  init_table_utils2();
@@ -131020,7 +131795,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
131020
131795
  init_tracing2();
131021
131796
  init_view_common3();
131022
131797
  init_column2();
131023
- init_table8();
131798
+ init_table9();
131024
131799
  _a21 = entityKind2;
131025
131800
  FakePrimitiveParam = class {
131026
131801
  };
@@ -131366,7 +132141,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
131366
132141
  init_column2();
131367
132142
  init_entity2();
131368
132143
  init_sql5();
131369
- init_table8();
132144
+ init_table9();
131370
132145
  init_view_common3();
131371
132146
  _a28 = entityKind2;
131372
132147
  ColumnAliasProxyHandler2 = class {
@@ -131541,7 +132316,7 @@ params: ${params}`);
131541
132316
  init_entity2();
131542
132317
  init_sql5();
131543
132318
  init_subquery2();
131544
- init_table8();
132319
+ init_table9();
131545
132320
  init_view_common3();
131546
132321
  textDecoder2 = typeof TextDecoder === "undefined" ? null : new TextDecoder;
131547
132322
  }
@@ -132793,7 +133568,7 @@ params: ${params}`);
132793
133568
  init_table22 = __esm2({
132794
133569
  "../drizzle-orm/dist/pg-core/table.js"() {
132795
133570
  init_entity2();
132796
- init_table8();
133571
+ init_table9();
132797
133572
  init_all2();
132798
133573
  InlineForeignKeys2 = Symbol.for("drizzle:PgInlineForeignKeys");
132799
133574
  EnableRLS2 = Symbol.for("drizzle:EnableRLS");
@@ -132853,7 +133628,7 @@ params: ${params}`);
132853
133628
  "../drizzle-orm/dist/sql/expressions/conditions.js"() {
132854
133629
  init_column2();
132855
133630
  init_entity2();
132856
- init_table8();
133631
+ init_table9();
132857
133632
  init_sql5();
132858
133633
  eq2 = (left, right) => {
132859
133634
  return sql4`${left} = ${bindIfParam2(right, left)}`;
@@ -132888,7 +133663,7 @@ params: ${params}`);
132888
133663
  });
132889
133664
  init_relations2 = __esm2({
132890
133665
  "../drizzle-orm/dist/relations.js"() {
132891
- init_table8();
133666
+ init_table9();
132892
133667
  init_column2();
132893
133668
  init_entity2();
132894
133669
  init_primary_keys2();
@@ -133010,7 +133785,7 @@ params: ${params}`);
133010
133785
  and: () => and2,
133011
133786
  applyMixins: () => applyMixins2,
133012
133787
  arrayContained: () => arrayContained,
133013
- arrayContains: () => arrayContains,
133788
+ arrayContains: () => arrayContains2,
133014
133789
  arrayOverlaps: () => arrayOverlaps,
133015
133790
  asc: () => asc2,
133016
133791
  avg: () => avg,
@@ -133102,7 +133877,7 @@ params: ${params}`);
133102
133877
  init_relations2();
133103
133878
  init_sql22();
133104
133879
  init_subquery2();
133105
- init_table8();
133880
+ init_table9();
133106
133881
  init_utils22();
133107
133882
  init_view_common3();
133108
133883
  }
@@ -133361,7 +134136,7 @@ params: ${params}`);
133361
134136
  init_casing2 = __esm2({
133362
134137
  "../drizzle-orm/dist/casing.js"() {
133363
134138
  init_entity2();
133364
- init_table8();
134139
+ init_table9();
133365
134140
  _a135 = entityKind2;
133366
134141
  CasingCache2 = class {
133367
134142
  constructor(casing2) {
@@ -133423,7 +134198,7 @@ params: ${params}`);
133423
134198
  init_sql22();
133424
134199
  init_sql5();
133425
134200
  init_subquery2();
133426
- init_table8();
134201
+ init_table9();
133427
134202
  init_utils22();
133428
134203
  init_view_common3();
133429
134204
  init_view_base2();
@@ -134007,7 +134782,7 @@ params: ${params}`);
134007
134782
  init_selection_proxy2();
134008
134783
  init_sql5();
134009
134784
  init_subquery2();
134010
- init_table8();
134785
+ init_table9();
134011
134786
  init_tracing2();
134012
134787
  init_utils22();
134013
134788
  init_utils22();
@@ -134628,7 +135403,7 @@ params: ${params}`);
134628
135403
  init_table22();
134629
135404
  init_sql5();
134630
135405
  init_subquery2();
134631
- init_table8();
135406
+ init_table9();
134632
135407
  init_view_common3();
134633
135408
  init_checks6();
134634
135409
  init_foreign_keys2();
@@ -134645,7 +135420,7 @@ params: ${params}`);
134645
135420
  init_entity2();
134646
135421
  init_query_promise2();
134647
135422
  init_selection_proxy2();
134648
- init_table8();
135423
+ init_table9();
134649
135424
  init_tracing2();
134650
135425
  init_utils22();
134651
135426
  init_utils42();
@@ -134715,7 +135490,7 @@ params: ${params}`);
134715
135490
  init_query_promise2();
134716
135491
  init_selection_proxy2();
134717
135492
  init_sql5();
134718
- init_table8();
135493
+ init_table9();
134719
135494
  init_tracing2();
134720
135495
  init_utils22();
134721
135496
  init_utils42();
@@ -134910,7 +135685,7 @@ params: ${params}`);
134910
135685
  init_selection_proxy2();
134911
135686
  init_sql5();
134912
135687
  init_subquery2();
134913
- init_table8();
135688
+ init_table9();
134914
135689
  init_utils22();
134915
135690
  init_view_common3();
134916
135691
  init_utils42();
@@ -137712,7 +138487,7 @@ ORDER BY
137712
138487
  init_table32 = __esm2({
137713
138488
  "../drizzle-orm/dist/sqlite-core/table.js"() {
137714
138489
  init_entity2();
137715
- init_table8();
138490
+ init_table9();
137716
138491
  init_all22();
137717
138492
  InlineForeignKeys22 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
137718
138493
  SQLiteTable = class extends (_e32 = Table2, _d3 = entityKind2, _c7 = Table2.Symbol.Columns, _b151 = InlineForeignKeys22, _a207 = Table2.Symbol.ExtraConfigBuilder, _e32) {
@@ -137814,7 +138589,7 @@ ORDER BY
137814
138589
  init_entity2();
137815
138590
  init_sql5();
137816
138591
  init_subquery2();
137817
- init_table8();
138592
+ init_table9();
137818
138593
  init_view_common3();
137819
138594
  init_checks22();
137820
138595
  init_foreign_keys22();
@@ -137830,7 +138605,7 @@ ORDER BY
137830
138605
  init_query_promise2();
137831
138606
  init_selection_proxy2();
137832
138607
  init_table32();
137833
- init_table8();
138608
+ init_table9();
137834
138609
  init_utils22();
137835
138610
  init_utils72();
137836
138611
  SQLiteDeleteBase = class extends (_b152 = QueryPromise2, _a213 = entityKind2, _b152) {
@@ -137925,7 +138700,7 @@ ORDER BY
137925
138700
  init_columns22();
137926
138701
  init_table32();
137927
138702
  init_subquery2();
137928
- init_table8();
138703
+ init_table9();
137929
138704
  init_utils22();
137930
138705
  init_view_common3();
137931
138706
  init_view_base22();
@@ -138503,7 +139278,7 @@ ORDER BY
138503
139278
  init_selection_proxy2();
138504
139279
  init_sql5();
138505
139280
  init_subquery2();
138506
- init_table8();
139281
+ init_table9();
138507
139282
  init_utils22();
138508
139283
  init_view_common3();
138509
139284
  init_utils72();
@@ -138866,7 +139641,7 @@ ORDER BY
138866
139641
  init_query_promise2();
138867
139642
  init_sql5();
138868
139643
  init_table32();
138869
- init_table8();
139644
+ init_table9();
138870
139645
  init_utils22();
138871
139646
  init_utils72();
138872
139647
  init_query_builder32();
@@ -138989,7 +139764,7 @@ ORDER BY
138989
139764
  init_selection_proxy2();
138990
139765
  init_table32();
138991
139766
  init_subquery2();
138992
- init_table8();
139767
+ init_table9();
138993
139768
  init_utils22();
138994
139769
  init_view_common3();
138995
139770
  init_utils72();
@@ -141597,7 +142372,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
141597
142372
  init_table42 = __esm2({
141598
142373
  "../drizzle-orm/dist/mysql-core/table.js"() {
141599
142374
  init_entity2();
141600
- init_table8();
142375
+ init_table9();
141601
142376
  init_all3();
141602
142377
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
141603
142378
  MySqlTable = class extends (_e4 = Table2, _d4 = entityKind2, _c10 = Table2.Symbol.Columns, _b238 = InlineForeignKeys3, _a319 = Table2.Symbol.ExtraConfigBuilder, _e4) {
@@ -141660,7 +142435,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
141660
142435
  init_entity2();
141661
142436
  init_dist9();
141662
142437
  init_subquery2();
141663
- init_table8();
142438
+ init_table9();
141664
142439
  init_view_common3();
141665
142440
  init_checks32();
141666
142441
  init_foreign_keys3();
@@ -141676,7 +142451,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
141676
142451
  init_entity2();
141677
142452
  init_query_promise2();
141678
142453
  init_selection_proxy2();
141679
- init_table8();
142454
+ init_table9();
141680
142455
  init_utils82();
141681
142456
  MySqlDeleteBase = class extends (_b239 = QueryPromise2, _a3222 = entityKind2, _b239) {
141682
142457
  constructor(table6, session, dialect6, withList) {
@@ -141756,7 +142531,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
141756
142531
  init_expressions2();
141757
142532
  init_sql5();
141758
142533
  init_subquery2();
141759
- init_table8();
142534
+ init_table9();
141760
142535
  init_utils22();
141761
142536
  init_view_common3();
141762
142537
  init_common4();
@@ -142522,7 +143297,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
142522
143297
  init_selection_proxy2();
142523
143298
  init_sql5();
142524
143299
  init_subquery2();
142525
- init_table8();
143300
+ init_table9();
142526
143301
  init_utils22();
142527
143302
  init_view_common3();
142528
143303
  init_utils82();
@@ -142922,7 +143697,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
142922
143697
  init_entity2();
142923
143698
  init_query_promise2();
142924
143699
  init_sql5();
142925
- init_table8();
143700
+ init_table9();
142926
143701
  init_utils22();
142927
143702
  init_utils82();
142928
143703
  init_query_builder4();
@@ -143026,7 +143801,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
143026
143801
  init_entity2();
143027
143802
  init_query_promise2();
143028
143803
  init_selection_proxy2();
143029
- init_table8();
143804
+ init_table9();
143030
143805
  init_utils22();
143031
143806
  init_utils82();
143032
143807
  _a331 = entityKind2;
@@ -145834,7 +146609,7 @@ AND
145834
146609
  init_table52 = __esm2({
145835
146610
  "../drizzle-orm/dist/singlestore-core/table.js"() {
145836
146611
  init_entity2();
145837
- init_table8();
146612
+ init_table9();
145838
146613
  init_all4();
145839
146614
  SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind2, _b319 = Table2.Symbol.Columns, _a419 = Table2.Symbol.ExtraConfigBuilder, _d5) {
145840
146615
  constructor() {
@@ -145885,7 +146660,7 @@ AND
145885
146660
  init_entity2();
145886
146661
  init_sql5();
145887
146662
  init_subquery2();
145888
- init_table8();
146663
+ init_table9();
145889
146664
  init_indexes4();
145890
146665
  init_primary_keys4();
145891
146666
  init_table52();
@@ -145897,7 +146672,7 @@ AND
145897
146672
  init_entity2();
145898
146673
  init_query_promise2();
145899
146674
  init_selection_proxy2();
145900
- init_table8();
146675
+ init_table9();
145901
146676
  init_utils10();
145902
146677
  SingleStoreDeleteBase = class extends (_b320 = QueryPromise2, _a422 = entityKind2, _b320) {
145903
146678
  constructor(table6, session, dialect6, withList) {
@@ -145962,7 +146737,7 @@ AND
145962
146737
  init_entity2();
145963
146738
  init_query_promise2();
145964
146739
  init_sql5();
145965
- init_table8();
146740
+ init_table9();
145966
146741
  init_utils22();
145967
146742
  init_utils10();
145968
146743
  _a423 = entityKind2;
@@ -146060,7 +146835,7 @@ AND
146060
146835
  init_expressions2();
146061
146836
  init_sql5();
146062
146837
  init_subquery2();
146063
- init_table8();
146838
+ init_table9();
146064
146839
  init_utils22();
146065
146840
  init_view_common3();
146066
146841
  init_common5();
@@ -146591,7 +147366,7 @@ AND
146591
147366
  init_selection_proxy2();
146592
147367
  init_sql5();
146593
147368
  init_subquery2();
146594
- init_table8();
147369
+ init_table9();
146595
147370
  init_utils22();
146596
147371
  init_utils10();
146597
147372
  _a426 = entityKind2;
@@ -146960,7 +147735,7 @@ AND
146960
147735
  init_entity2();
146961
147736
  init_query_promise2();
146962
147737
  init_selection_proxy2();
146963
- init_table8();
147738
+ init_table9();
146964
147739
  init_utils22();
146965
147740
  init_utils10();
146966
147741
  _a430 = entityKind2;
@@ -149570,6 +150345,114 @@ var init_domain_controller = __esm(() => {
149570
150345
  });
149571
150346
  });
149572
150347
 
150348
+ // ../api-core/src/controllers/embed.controller.ts
150349
+ function requireUuidParam(value, name2) {
150350
+ if (!value) {
150351
+ throw ApiError.badRequest(`Missing ${name2}`);
150352
+ }
150353
+ if (!isValidUUID(value)) {
150354
+ throw ApiError.unprocessableEntity(`${name2} must be a valid UUID format`);
150355
+ }
150356
+ return value;
150357
+ }
150358
+ function bearerToken(request) {
150359
+ const header = request.headers.get("Authorization");
150360
+ return header?.startsWith("Bearer ") ? header.slice("Bearer ".length) : "";
150361
+ }
150362
+ async function requirePartner(ctx) {
150363
+ const token = bearerToken(ctx.request);
150364
+ const verified = token ? await ctx.providers.auth.verifyEmbedPartnerToken(token) : null;
150365
+ if (!verified) {
150366
+ throw ApiError.unauthorized("A valid embed partner access token is required");
150367
+ }
150368
+ return ctx.services.embed.getPartnerByClientId(verified.clientId);
150369
+ }
150370
+ async function requireEmbedAdmin(ctx) {
150371
+ const expected = ctx.config.embedAdminToken;
150372
+ if (!expected) {
150373
+ throw ApiError.serviceUnavailable("Embed partner management is not configured");
150374
+ }
150375
+ const token = bearerToken(ctx.request);
150376
+ const [given, wanted] = token ? await Promise.all([sha256Hex(token), sha256Hex(expected)]) : [];
150377
+ if (!given || given !== wanted) {
150378
+ throw ApiError.unauthorized("A valid embed admin token is required");
150379
+ }
150380
+ }
150381
+ function requireClientIdParam(ctx) {
150382
+ const clientId = EmbedPartnerClientIdSchema.safeParse(ctx.params.clientId);
150383
+ if (!clientId.success) {
150384
+ throw ApiError.badRequest("Missing or invalid clientId");
150385
+ }
150386
+ return clientId.data;
150387
+ }
150388
+ async function createLaunch(ctx) {
150389
+ const partner = await requirePartner(ctx);
150390
+ const body2 = await parseRequestBody(ctx.request, CreateEmbedLaunchSchema);
150391
+ const launch = await ctx.services.embed.createLaunch(partner, body2);
150392
+ return {
150393
+ launchId: launch.launchId,
150394
+ pass: launch.pass,
150395
+ passExpiresAt: launch.passExpiresAt.toISOString(),
150396
+ embedUrl: embedPageUrl(ctx.url.origin, launch.gameSlug, body2.parentOrigin)
150397
+ };
150398
+ }
150399
+ async function renewToken(ctx) {
150400
+ const partner = await requirePartner(ctx);
150401
+ const launchId = requireUuidParam(ctx.params.launchId, "launchId");
150402
+ return withTunnelUrl(ctx, await ctx.services.embed.renewToken(partner, launchId));
150403
+ }
150404
+ async function redeemPass(ctx) {
150405
+ const body2 = await parseRequestBody(ctx.request, RedeemEmbedPassSchema);
150406
+ const launch = await ctx.services.embed.redeemLaunch(body2, ctx.request.headers.get(PLAYCADEMY_BROWSER_TIME_ZONE_HEADER));
150407
+ return {
150408
+ launchId: launch.launchId,
150409
+ token: await withTunnelUrl(ctx, launch.token),
150410
+ userId: launch.user.id,
150411
+ game: launch.game,
150412
+ timebackCourseId: launch.timebackCourseId,
150413
+ localDay: launch.profile.localDay,
150414
+ timeback: launch.profile.timeback
150415
+ };
150416
+ }
150417
+ async function ensurePartner(ctx) {
150418
+ await requireEmbedAdmin(ctx);
150419
+ const clientId = requireClientIdParam(ctx);
150420
+ const body2 = await parseRequestBody(ctx.request, EnsureEmbedPartnerSchema);
150421
+ return ctx.services.embedPartner.ensurePartner(clientId, body2.name);
150422
+ }
150423
+ async function addPartnerOrigin(ctx) {
150424
+ await requireEmbedAdmin(ctx);
150425
+ const clientId = requireClientIdParam(ctx);
150426
+ const body2 = await parseRequestBody(ctx.request, AddEmbedPartnerOriginSchema);
150427
+ return ctx.services.embedPartner.addOrigin(clientId, body2.origin);
150428
+ }
150429
+ async function removePartnerOrigin(ctx) {
150430
+ await requireEmbedAdmin(ctx);
150431
+ const clientId = requireClientIdParam(ctx);
150432
+ const origin = EmbedOriginSchema.safeParse(ctx.url.searchParams.get("origin"));
150433
+ if (!origin.success) {
150434
+ throw ApiError.badRequest("Missing or invalid origin");
150435
+ }
150436
+ return ctx.services.embedPartner.removeOrigin(clientId, origin.data);
150437
+ }
150438
+ var embed2;
150439
+ var init_embed_controller = __esm(() => {
150440
+ init_src();
150441
+ init_schemas_index();
150442
+ init_src9();
150443
+ init_errors2();
150444
+ init_utils7();
150445
+ init_embed_util();
150446
+ embed2 = defineControllerNames("embed", {
150447
+ addPartnerOrigin,
150448
+ createLaunch,
150449
+ ensurePartner,
150450
+ redeemPass,
150451
+ removePartnerOrigin,
150452
+ renewToken
150453
+ });
150454
+ });
150455
+
149573
150456
  // ../api-core/src/controllers/game-member.controller.ts
149574
150457
  function requireUserId2(userId) {
149575
150458
  if (!userId) {
@@ -150099,7 +150982,6 @@ var MintTokenBody, mintToken, sessions2;
150099
150982
  var init_session_controller = __esm(() => {
150100
150983
  init_esm();
150101
150984
  init_spans();
150102
- init_tunnel();
150103
150985
  init_errors2();
150104
150986
  init_utils7();
150105
150987
  MintTokenBody = objectType({
@@ -150115,14 +150997,7 @@ var init_session_controller = __esm(() => {
150115
150997
  reason = MintTokenBody.parse(await ctx.request.clone().json()).reason;
150116
150998
  } catch {}
150117
150999
  setAttribute("app.token.reason", reason ?? "initial");
150118
- const { token, exp } = await ctx.services.session.mintToken(gameIdOrSlug, ctx.user.id);
150119
- let baseUrl;
150120
- if (ctx.config.isLocal) {
150121
- try {
150122
- baseUrl = await getTunnelUrl(ctx.config.baseUrl);
150123
- } catch {}
150124
- }
150125
- return { token, exp, baseUrl };
151000
+ return withTunnelUrl(ctx, await ctx.services.session.mintToken(gameIdOrSlug, ctx.user.id));
150126
151001
  });
150127
151002
  sessions2 = defineControllerNames("sessions", {
150128
151003
  mintToken
@@ -150180,7 +151055,7 @@ function parseQtiLibraryParams(searchParams) {
150180
151055
  limit
150181
151056
  };
150182
151057
  }
150183
- var populateStudent, getUser, getUserEnrollments, getUserById, setupIntegration, getIntegrations, getRemovedIntegrations, createIntegration, updateIntegration, deactivateCourse, reactivateCourse, getIntegrationConfig, verifyIntegration, getConfig, deleteIntegrations, endActivity, heartbeat, advanceCourse, unenrollCourse, prepareRuntimeAssessment, startRuntimeAssessment, getRuntimeAssessment, getLatestRuntimeAssessment, resumeRuntimeAssessment, saveRuntimeAssessment, recordRuntimeAssessmentProgress, submitRuntimeAssessmentItem, submitRuntimeAssessment, finalizeRuntimeAssessment, exportRuntimeAssessmentFixture, getStudentXp, getStudentMastery, getStudentHighestGradeMastered, getRoster, getStudentOverview, getGameMetrics, getStudentActivity, getGradeLevelTestResults, getGradeLevelTestReview, getActivityDetail, listMetricDiscrepancies, verifyMetricDiscrepancy, grantXp, adjustTime, adjustMastery, reconcileMasteryForConfigChange, searchStudents, enrollStudent, unenrollStudent, reactivateEnrollment, listAssessments, createAssessment, attachExistingAssessments, updateAssessment, reviseAssessment, synchronizeReviewBank, reorderQuestions, removeAssessment, listQuestions, listQuestionLibrary, listTestLibrary, copyAssessment, createQuestion, updateQuestion, removeQuestion, timeback2;
151058
+ var populateStudent, getUser, getUserEnrollments, getUserById, setupIntegration, getIntegrations, getRemovedIntegrations, createIntegration, getHoleFillingCourses, createHoleFillingCourse, updateIntegration, deactivateCourse, reactivateCourse, getIntegrationConfig, verifyIntegration, getConfig, deleteIntegrations, endActivity, heartbeat, advanceCourse, unenrollCourse, prepareRuntimeAssessment, startRuntimeAssessment, getRuntimeAssessment, getLatestRuntimeAssessment, resumeRuntimeAssessment, saveRuntimeAssessment, recordRuntimeAssessmentProgress, submitRuntimeAssessmentItem, submitRuntimeAssessment, finalizeRuntimeAssessment, exportRuntimeAssessmentFixture, getStudentXp, getStudentMastery, getStudentHighestGradeMastered, getRoster, getStudentOverview, getGameMetrics, getStudentActivity, getGradeLevelTestResults, getGradeLevelTestReview, getActivityDetail, listMetricDiscrepancies, verifyMetricDiscrepancy, grantXp, adjustTime, adjustMastery, reconcileMasteryForConfigChange, searchStudents, enrollStudent, unenrollStudent, reactivateEnrollment, listAssessments, createAssessment, attachExistingAssessments, updateAssessment, reviseAssessment, synchronizeReviewBank, reorderQuestions, removeAssessment, listQuestions, listQuestionLibrary, listTestLibrary, copyAssessment, createQuestion, updateQuestion, removeQuestion, timeback2;
150184
151059
  var init_timeback_controller = __esm(() => {
150185
151060
  init_esm();
150186
151061
  init_src();
@@ -150259,6 +151134,27 @@ var init_timeback_controller = __esm(() => {
150259
151134
  const body2 = await parseRequestBody(ctx.request, CreateGameTimebackIntegrationRequestSchema);
150260
151135
  return ctx.services.timeback.createIntegration(gameId, ctx.user, body2);
150261
151136
  });
151137
+ getHoleFillingCourses = requireGameManagementAccess(async (ctx) => {
151138
+ const gameId = ctx.params.gameId;
151139
+ if (!gameId) {
151140
+ throw ApiError.badRequest("Missing gameId");
151141
+ }
151142
+ if (!isValidUUID(gameId)) {
151143
+ throw ApiError.unprocessableEntity("Invalid gameId format");
151144
+ }
151145
+ return ctx.services.timeback.getHoleFillingCourses(gameId, ctx.user);
151146
+ });
151147
+ createHoleFillingCourse = requireDeveloper(async (ctx) => {
151148
+ const gameId = ctx.params.gameId;
151149
+ if (!gameId) {
151150
+ throw ApiError.badRequest("Missing gameId");
151151
+ }
151152
+ if (!isValidUUID(gameId)) {
151153
+ throw ApiError.unprocessableEntity("Invalid gameId format");
151154
+ }
151155
+ const body2 = await parseRequestBody(ctx.request, CreateGameTimebackHoleFillingCourseRequestSchema);
151156
+ return ctx.services.timeback.createHoleFillingCourse(gameId, ctx.user, body2);
151157
+ });
150262
151158
  updateIntegration = requireDeveloper(async (ctx) => {
150263
151159
  const { gameId, courseId } = ctx.params;
150264
151160
  if (!gameId || !courseId) {
@@ -151043,6 +151939,8 @@ var init_timeback_controller = __esm(() => {
151043
151939
  getIntegrations,
151044
151940
  getRemovedIntegrations,
151045
151941
  createIntegration,
151942
+ getHoleFillingCourses,
151943
+ createHoleFillingCourse,
151046
151944
  updateIntegration,
151047
151945
  deactivateCourse,
151048
151946
  reactivateCourse,
@@ -151186,6 +152084,7 @@ var init_controllers = __esm(() => {
151186
152084
  init_deployment_state_controller();
151187
152085
  init_developer_controller();
151188
152086
  init_domain_controller();
152087
+ init_embed_controller();
151189
152088
  init_game_member_controller();
151190
152089
  init_game_controller();
151191
152090
  init_kv_controller();
@@ -151430,7 +152329,7 @@ var init_crud = __esm(async () => {
151430
152329
  });
151431
152330
 
151432
152331
  // src/routes/platform/games/uploads.ts
151433
- import { randomUUID as randomUUID3 } from "node:crypto";
152332
+ import { randomUUID as randomUUID4 } from "node:crypto";
151434
152333
  async function initiateHandler(c) {
151435
152334
  const user = c.get("user");
151436
152335
  if (!user) {
@@ -151450,7 +152349,7 @@ async function initiateHandler(c) {
151450
152349
  }
151451
152350
  }, 422);
151452
152351
  }
151453
- const uploadToken = `sandbox-upload-${randomUUID3()}`;
152352
+ const uploadToken = `sandbox-upload-${randomUUID4()}`;
151454
152353
  const version = `v${Date.now()}`;
151455
152354
  pendingUploads.set(uploadToken, {
151456
152355
  gameId: body2.gameId,