@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/cli.js CHANGED
@@ -2517,7 +2517,7 @@ var package_default;
2517
2517
  var init_package = __esm(() => {
2518
2518
  package_default = {
2519
2519
  name: "@playcademy/sandbox",
2520
- version: "0.12.1",
2520
+ version: "0.12.2-beta.2",
2521
2521
  description: "Local development server for Playcademy game development",
2522
2522
  type: "module",
2523
2523
  exports: {
@@ -7017,6 +7017,13 @@ var init_dashboard = __esm(() => {
7017
7017
  };
7018
7018
  });
7019
7019
 
7020
+ // ../constants/src/embed.ts
7021
+ var EMBED_PASS_TTL_MS, EMBED_LAUNCH_TTL_MS, EMBED_PAGE_PATH = "/embed", EMBED_PARENT_ORIGIN_PARAM = "parentOrigin";
7022
+ var init_embed = __esm(() => {
7023
+ EMBED_PASS_TTL_MS = 60 * 1000;
7024
+ EMBED_LAUNCH_TTL_MS = 12 * 60 * 60 * 1000;
7025
+ });
7026
+
7020
7027
  // ../constants/src/typescript.ts
7021
7028
  var init_typescript = () => {};
7022
7029
 
@@ -7160,6 +7167,7 @@ var init_cloudflare = __esm(() => {
7160
7167
  var init_src = __esm(() => {
7161
7168
  init_auth();
7162
7169
  init_dashboard();
7170
+ init_embed();
7163
7171
  init_typescript();
7164
7172
  init_domains();
7165
7173
  init_env_vars();
@@ -14766,6 +14774,7 @@ var init_schema = __esm(() => {
14766
14774
  assessmentArtifactBucket: stringType().optional(),
14767
14775
  cdnOrigin: stringType().url().startsWith("https://").optional(),
14768
14776
  queueIngressSecret: stringType().optional(),
14777
+ embedAdminToken: stringType().optional(),
14769
14778
  secretsManifestPepper: stringType().optional()
14770
14779
  }).superRefine((config, ctx) => {
14771
14780
  if (config.isLocal && !config.baseUrl) {
@@ -14932,6 +14941,17 @@ var init_table_utils = __esm(() => {
14932
14941
  });
14933
14942
 
14934
14943
  // ../../node_modules/.bun/drizzle-orm@0.45.3+c063d24bf874cbdc/node_modules/drizzle-orm/pg-core/foreign-keys.js
14944
+ function foreignKey(config) {
14945
+ function mappedConfig() {
14946
+ const { name: name2, columns, foreignColumns } = config;
14947
+ return {
14948
+ name: name2,
14949
+ columns,
14950
+ foreignColumns
14951
+ };
14952
+ }
14953
+ return new ForeignKeyBuilder(mappedConfig);
14954
+ }
14935
14955
  var ForeignKeyBuilder, ForeignKey;
14936
14956
  var init_foreign_keys = __esm(() => {
14937
14957
  init_entity();
@@ -17804,6 +17824,16 @@ function ilike(column, value) {
17804
17824
  function notIlike(column, value) {
17805
17825
  return sql`${column} not ilike ${value}`;
17806
17826
  }
17827
+ function arrayContains(column, values) {
17828
+ if (Array.isArray(values)) {
17829
+ if (values.length === 0) {
17830
+ throw new Error("arrayContains requires at least one value");
17831
+ }
17832
+ const array = sql`${bindIfParam(values, column)}`;
17833
+ return sql`${column} @> ${array}`;
17834
+ }
17835
+ return sql`${column} @> ${bindIfParam(values, column)}`;
17836
+ }
17807
17837
  var eq = (left, right) => {
17808
17838
  return sql`${left} = ${bindIfParam(right, left)}`;
17809
17839
  }, ne = (left, right) => {
@@ -20734,7 +20764,7 @@ var init_table6 = __esm(() => {
20734
20764
  });
20735
20765
 
20736
20766
  // ../data/src/domains/timeback/table.ts
20737
- var gameTimebackIntegrationStatusEnum, gameTimebackAssessmentPurposeEnum, gameTimebackAssessmentStatusEnum, gameTimebackIntegrations, gameTimebackAssessmentTests, gameTimebackMetricDiscrepancyVerifications, gameTimebackActivityCompletions;
20767
+ var gameTimebackIntegrationStatusEnum, gameTimebackIntegrationKindEnum, gameTimebackAssessmentPurposeEnum, gameTimebackAssessmentStatusEnum, gameTimebackIntegrations, gameTimebackAssessmentTests, gameTimebackMetricDiscrepancyVerifications, gameTimebackActivityCompletions;
20738
20768
  var init_table7 = __esm(() => {
20739
20769
  init_drizzle_orm();
20740
20770
  init_pg_core();
@@ -20745,6 +20775,10 @@ var init_table7 = __esm(() => {
20745
20775
  "active",
20746
20776
  "deactivated"
20747
20777
  ]);
20778
+ gameTimebackIntegrationKindEnum = pgEnum("game_timeback_integration_kind", [
20779
+ "base",
20780
+ "hole_filling"
20781
+ ]);
20748
20782
  gameTimebackAssessmentPurposeEnum = pgEnum("game_timeback_assessment_purpose", ASSESSMENT_PURPOSES);
20749
20783
  gameTimebackAssessmentStatusEnum = pgEnum("game_timeback_assessment_status", [
20750
20784
  "draft",
@@ -20758,6 +20792,8 @@ var init_table7 = __esm(() => {
20758
20792
  grade: integer("grade").notNull(),
20759
20793
  subject: text("subject").notNull(),
20760
20794
  status: gameTimebackIntegrationStatusEnum("status"),
20795
+ kind: gameTimebackIntegrationKindEnum("kind").notNull().default("base"),
20796
+ baseIntegrationId: uuid("base_integration_id"),
20761
20797
  totalXp: integer("total_xp"),
20762
20798
  lastVerifiedAt: timestamp("last_verified_at", { withTimezone: true }),
20763
20799
  deactivatedAt: timestamp("deactivated_at", { withTimezone: true }),
@@ -20765,7 +20801,19 @@ var init_table7 = __esm(() => {
20765
20801
  createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
20766
20802
  updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
20767
20803
  }, (table) => [
20768
- uniqueIndex("game_timeback_integrations_game_grade_subject_idx").on(table.gameId, table.grade, table.subject).where(sql`${table.status} IS DISTINCT FROM 'deactivated'`)
20804
+ 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'`),
20805
+ uniqueIndex("game_timeback_integrations_hole_filling_course_idx").on(table.gameId, table.courseId).where(sql`${table.kind} = 'hole_filling'`),
20806
+ index("game_timeback_integrations_base_integration_idx").on(table.baseIntegrationId),
20807
+ foreignKey({
20808
+ name: "game_timeback_integrations_base_integration_id_fk",
20809
+ columns: [table.baseIntegrationId],
20810
+ foreignColumns: [table.id]
20811
+ }),
20812
+ check("game_timeback_integrations_kind_base_check", sql`(
20813
+ (${table.kind}::text = 'base' AND ${table.baseIntegrationId} IS NULL)
20814
+ OR
20815
+ (${table.kind}::text = 'hole_filling' AND ${table.baseIntegrationId} IS NOT NULL)
20816
+ )`)
20769
20817
  ]);
20770
20818
  gameTimebackAssessmentTests = pgTable("game_timeback_assessment_tests", {
20771
20819
  id: uuid("id").primaryKey().defaultRandom(),
@@ -20846,6 +20894,56 @@ var init_table7 = __esm(() => {
20846
20894
  ]);
20847
20895
  });
20848
20896
 
20897
+ // ../data/src/domains/embed/table.ts
20898
+ var embedPartners, embedLaunches, embedLaunchesRelations;
20899
+ var init_table8 = __esm(() => {
20900
+ init_drizzle_orm();
20901
+ init_pg_core();
20902
+ init_table5();
20903
+ init_table3();
20904
+ embedPartners = pgTable("embed_partners", {
20905
+ id: uuid("id").primaryKey().defaultRandom(),
20906
+ name: text("name").notNull(),
20907
+ clientId: text("client_id").notNull().unique(),
20908
+ allowedOrigins: text("allowed_origins").array().notNull().default([]),
20909
+ enabled: boolean("enabled").notNull().default(true),
20910
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
20911
+ updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow()
20912
+ });
20913
+ embedLaunches = pgTable("embed_launches", {
20914
+ id: uuid("id").primaryKey().defaultRandom(),
20915
+ partnerId: uuid("partner_id").notNull().references(() => embedPartners.id, { onDelete: "restrict" }),
20916
+ userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
20917
+ gameId: uuid("game_id").notNull().references(() => games.id, { onDelete: "cascade" }),
20918
+ parentOrigin: text("parent_origin").notNull(),
20919
+ timebackCourseId: text("timeback_course_id"),
20920
+ passHash: text("pass_hash").unique(),
20921
+ passExpiresAt: timestamp("pass_expires_at", { withTimezone: true }).notNull(),
20922
+ redeemedAt: timestamp("redeemed_at", { withTimezone: true }),
20923
+ endedAt: timestamp("ended_at", { withTimezone: true }),
20924
+ expiresAt: timestamp("expires_at", { withTimezone: true }).notNull(),
20925
+ createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow()
20926
+ }, (table) => [
20927
+ index("embed_launches_partner_idx").on(table.partnerId),
20928
+ index("embed_launches_user_idx").on(table.userId),
20929
+ index("embed_launches_game_idx").on(table.gameId)
20930
+ ]);
20931
+ embedLaunchesRelations = relations(embedLaunches, ({ one }) => ({
20932
+ partner: one(embedPartners, {
20933
+ fields: [embedLaunches.partnerId],
20934
+ references: [embedPartners.id]
20935
+ }),
20936
+ user: one(users, {
20937
+ fields: [embedLaunches.userId],
20938
+ references: [users.id]
20939
+ }),
20940
+ game: one(games, {
20941
+ fields: [embedLaunches.gameId],
20942
+ references: [games.id]
20943
+ })
20944
+ }));
20945
+ });
20946
+
20849
20947
  // ../data/src/tables.index.ts
20850
20948
  var exports_tables_index = {};
20851
20949
  __export(exports_tables_index, {
@@ -20858,6 +20956,9 @@ __export(exports_tables_index, {
20858
20956
  deploymentProviderEnum: () => deploymentProviderEnum,
20859
20957
  deploymentTargetEnum: () => deploymentTargetEnum,
20860
20958
  developerStatusEnum: () => developerStatusEnum,
20959
+ embedLaunches: () => embedLaunches,
20960
+ embedLaunchesRelations: () => embedLaunchesRelations,
20961
+ embedPartners: () => embedPartners,
20861
20962
  gameCustomHostnames: () => gameCustomHostnames,
20862
20963
  gameDashboardUserRoleEnum: () => gameDashboardUserRoleEnum,
20863
20964
  gameDashboardUsers: () => gameDashboardUsers,
@@ -20876,6 +20977,7 @@ __export(exports_tables_index, {
20876
20977
  gameTimebackAssessmentPurposeEnum: () => gameTimebackAssessmentPurposeEnum,
20877
20978
  gameTimebackAssessmentStatusEnum: () => gameTimebackAssessmentStatusEnum,
20878
20979
  gameTimebackAssessmentTests: () => gameTimebackAssessmentTests,
20980
+ gameTimebackIntegrationKindEnum: () => gameTimebackIntegrationKindEnum,
20879
20981
  gameTimebackIntegrationStatusEnum: () => gameTimebackIntegrationStatusEnum,
20880
20982
  gameTimebackIntegrations: () => gameTimebackIntegrations,
20881
20983
  gameTimebackMetricDiscrepancyVerifications: () => gameTimebackMetricDiscrepancyVerifications,
@@ -20893,6 +20995,7 @@ var init_tables_index = __esm(() => {
20893
20995
  init_table5();
20894
20996
  init_table6();
20895
20997
  init_table7();
20998
+ init_table8();
20896
20999
  });
20897
21000
 
20898
21001
  // ../../node_modules/.bun/@opentelemetry+api@1.9.1/node_modules/@opentelemetry/api/build/src/version.js
@@ -22782,10 +22885,16 @@ var init_helpers = __esm(() => {
22782
22885
  });
22783
22886
 
22784
22887
  // ../data/src/domains/timeback/helpers.ts
22888
+ function isBaseGameTimebackIntegration() {
22889
+ return sql`${gameTimebackIntegrations.kind} = ${BASE_GAME_TIMEBACK_INTEGRATION_KIND}`;
22890
+ }
22785
22891
  function isActiveGameTimebackIntegrationStatus(statusColumn = gameTimebackIntegrations.status) {
22786
22892
  return sql`${statusColumn} IS DISTINCT FROM ${DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS}`;
22787
22893
  }
22788
- var ACTIVE_GAME_TIMEBACK_INTEGRATION_STATUS = "active", DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS = "deactivated";
22894
+ function isActiveBaseGameTimebackIntegration() {
22895
+ return sql`(${isActiveGameTimebackIntegrationStatus()} AND ${isBaseGameTimebackIntegration()})`;
22896
+ }
22897
+ 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";
22789
22898
  var init_helpers2 = __esm(() => {
22790
22899
  init_drizzle_orm();
22791
22900
  init_table7();
@@ -39362,12 +39471,12 @@ function resolveIntegrationSubject(patchSubject, liveSubject, storedSubject) {
39362
39471
  function filterEnrollmentsByGame(enrollments, gameId) {
39363
39472
  return enrollments.filter((enrollment) => enrollment.gameId === gameId).map(({ gameId: _, ...enrollment }) => enrollment);
39364
39473
  }
39365
- function mapEnrollmentsToUserEnrollments(enrollments, integrations) {
39474
+ function mapEnrollmentsToUserEnrollments(enrollments, integrations, baseCourseIdByIntegrationId = new Map) {
39366
39475
  const enrollmentByCourse = new Map(enrollments.map((enrollment) => [enrollment.courseId, enrollment]));
39367
39476
  const courseToSchool = new Map(enrollments.filter((enrollment) => enrollment.school?.id).map((enrollment) => [enrollment.courseId, enrollment.school.id]));
39368
39477
  return integrations.map((integration) => {
39369
39478
  const enrollment = enrollmentByCourse.get(integration.courseId);
39370
- return {
39479
+ const userEnrollment = {
39371
39480
  gameId: integration.gameId,
39372
39481
  grade: integration.grade,
39373
39482
  subject: integration.subject,
@@ -39375,6 +39484,17 @@ function mapEnrollmentsToUserEnrollments(enrollments, integrations) {
39375
39484
  orgId: courseToSchool.get(integration.courseId),
39376
39485
  ...enrollment ? { id: enrollment.sourcedId } : {}
39377
39486
  };
39487
+ if (integration.kind !== HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
39488
+ return userEnrollment;
39489
+ }
39490
+ const baseCourseId = integration.baseIntegrationId ? baseCourseIdByIntegrationId.get(integration.baseIntegrationId) : undefined;
39491
+ return {
39492
+ ...userEnrollment,
39493
+ kind: HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND,
39494
+ ...baseCourseId && { baseCourseId },
39495
+ ...enrollment?.beginDate !== undefined && { beginDate: enrollment.beginDate },
39496
+ ...enrollment?.metadata && { enrollmentMetadata: enrollment.metadata }
39497
+ };
39378
39498
  });
39379
39499
  }
39380
39500
  function buildGameTimebackSummaries(integrations) {
@@ -39857,7 +39977,7 @@ var init_game_service = __esm(() => {
39857
39977
  const db = this.deps.db;
39858
39978
  const integrations = await db.query.gameTimebackIntegrations.findMany({
39859
39979
  columns: { gameId: true, subject: true },
39860
- where: isActiveGameTimebackIntegrationStatus(),
39980
+ where: isActiveBaseGameTimebackIntegration(),
39861
39981
  orderBy: [asc(gameTimebackIntegrations.createdAt)]
39862
39982
  });
39863
39983
  const subjectMap = {};
@@ -39881,9 +40001,7 @@ var init_game_service = __esm(() => {
39881
40001
  }
39882
40002
  const integrations = await db.query.gameTimebackIntegrations.findMany({
39883
40003
  columns: { gameId: true, subject: true, status: true },
39884
- ...accessibleGameIds && {
39885
- where: inArray(gameTimebackIntegrations.gameId, [...accessibleGameIds])
39886
- },
40004
+ where: and(accessibleGameIds ? inArray(gameTimebackIntegrations.gameId, [...accessibleGameIds]) : undefined, isBaseGameTimebackIntegration()),
39887
40005
  orderBy: [asc(gameTimebackIntegrations.createdAt)]
39888
40006
  });
39889
40007
  return buildGameTimebackSummaries(integrations);
@@ -50314,7 +50432,7 @@ function rejectSystemManagedReview(input, context) {
50314
50432
  });
50315
50433
  }
50316
50434
  }
50317
- 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;
50435
+ 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;
50318
50436
  var init_schemas4 = __esm(() => {
50319
50437
  init_esm();
50320
50438
  init_src();
@@ -50350,6 +50468,26 @@ var init_schemas4 = __esm(() => {
50350
50468
  masterableUnits: numberType().int().nonnegative(),
50351
50469
  level: stringType().trim().min(1).optional()
50352
50470
  });
50471
+ RESERVED_TIMEBACK_COURSE_SOURCED_IDS = new Set([
50472
+ "hole-filling",
50473
+ "removed",
50474
+ "components",
50475
+ "component-resources",
50476
+ "structure"
50477
+ ]);
50478
+ TimebackCourseSourcedIdSchema = stringType().trim().min(3).max(100).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, {
50479
+ message: "Use letters, numbers, dots, dashes, or underscores, starting with a letter or number"
50480
+ }).refine((value) => !RESERVED_TIMEBACK_COURSE_SOURCED_IDS.has(value.toLowerCase()), {
50481
+ message: "This course ID is reserved"
50482
+ });
50483
+ CreateGameTimebackHoleFillingCourseRequestSchema = objectType({
50484
+ baseCourseId: stringType().trim().min(1),
50485
+ title: stringType().trim().min(1),
50486
+ courseCode: stringType().trim().min(1),
50487
+ totalXp: numberType().int().positive(),
50488
+ masterableUnits: numberType().int().nonnegative(),
50489
+ courseId: TimebackCourseSourcedIdSchema.optional()
50490
+ });
50353
50491
  TimebackActivityDataSchema = objectType({
50354
50492
  activityId: stringType().min(1),
50355
50493
  activityName: stringType().optional(),
@@ -50665,12 +50803,55 @@ var init_schemas4 = __esm(() => {
50665
50803
  });
50666
50804
  });
50667
50805
 
50806
+ // ../data/src/domains/embed/schemas.ts
50807
+ function isLocalHostname(hostname) {
50808
+ return LOCAL_HOSTNAMES.has(hostname) || hostname.endsWith(".localhost");
50809
+ }
50810
+ function isCanonicalOrigin(value) {
50811
+ let url;
50812
+ try {
50813
+ url = new URL(value);
50814
+ } catch {
50815
+ return false;
50816
+ }
50817
+ if (url.origin !== value) {
50818
+ return false;
50819
+ }
50820
+ return url.protocol === "https:" || url.protocol === "http:" && isLocalHostname(url.hostname);
50821
+ }
50822
+ var LOCAL_HOSTNAMES, EmbedOriginSchema, EmbedPartnerClientIdSchema, EnsureEmbedPartnerSchema, AddEmbedPartnerOriginSchema, CreateEmbedLaunchSchema, RedeemEmbedPassSchema;
50823
+ var init_schemas5 = __esm(() => {
50824
+ init_esm();
50825
+ LOCAL_HOSTNAMES = new Set(["localhost", "127.0.0.1"]);
50826
+ EmbedOriginSchema = stringType().refine(isCanonicalOrigin, {
50827
+ message: "Origin must be a bare https origin like https://example.com, with no path or slash"
50828
+ });
50829
+ EmbedPartnerClientIdSchema = stringType().trim().min(1).max(200);
50830
+ EnsureEmbedPartnerSchema = objectType({
50831
+ name: stringType().trim().min(1).max(100)
50832
+ }).strict();
50833
+ AddEmbedPartnerOriginSchema = objectType({
50834
+ origin: EmbedOriginSchema
50835
+ }).strict();
50836
+ CreateEmbedLaunchSchema = objectType({
50837
+ timebackId: stringType().trim().min(1).max(200),
50838
+ gameSlug: stringType().trim().min(1).max(100),
50839
+ parentOrigin: EmbedOriginSchema,
50840
+ timebackCourseId: stringType().trim().min(1).max(200).optional()
50841
+ }).strict();
50842
+ RedeemEmbedPassSchema = objectType({
50843
+ pass: stringType().min(1).max(200),
50844
+ parentOrigin: EmbedOriginSchema
50845
+ }).strict();
50846
+ });
50847
+
50668
50848
  // ../data/src/schemas.index.ts
50669
50849
  var init_schemas_index = __esm(() => {
50670
50850
  init_schemas();
50671
50851
  init_schemas2();
50672
50852
  init_schemas3();
50673
50853
  init_schemas4();
50854
+ init_schemas5();
50674
50855
  });
50675
50856
 
50676
50857
  // ../../node_modules/.bun/@timeback+core@0.3.1+0ba747e64b820dcd/node_modules/@timeback/core/dist/chunk-3j7jywnx.js
@@ -53799,7 +53980,7 @@ function handleRefineResult(result, payload, input, inst) {
53799
53980
  }
53800
53981
  }
53801
53982
  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;
53802
- var init_schemas5 = __esm(() => {
53983
+ var init_schemas6 = __esm(() => {
53803
53984
  init_checks2();
53804
53985
  init_core2();
53805
53986
  init_parse();
@@ -55436,7 +55617,7 @@ var init_core3 = __esm(() => {
55436
55617
  init_core2();
55437
55618
  init_parse();
55438
55619
  init_errors4();
55439
- init_schemas5();
55620
+ init_schemas6();
55440
55621
  init_checks2();
55441
55622
  init_versions();
55442
55623
  init_registries();
@@ -55477,7 +55658,7 @@ function duration2(params) {
55477
55658
  var ZodISODateTime, ZodISODate, ZodISOTime, ZodISODuration;
55478
55659
  var init_iso = __esm(() => {
55479
55660
  init_core3();
55480
- init_schemas6();
55661
+ init_schemas7();
55481
55662
  ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
55482
55663
  $ZodISODateTime.init(inst, def);
55483
55664
  ZodStringFormat.init(inst, def);
@@ -55719,7 +55900,7 @@ function superRefine(fn, params) {
55719
55900
  return ch;
55720
55901
  }
55721
55902
  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;
55722
- var init_schemas6 = __esm(() => {
55903
+ var init_schemas7 = __esm(() => {
55723
55904
  init_core3();
55724
55905
  init_core3();
55725
55906
  init_checks3();
@@ -56172,7 +56353,7 @@ var init_external2 = __esm(() => {
56172
56353
  init_locales();
56173
56354
  init_iso();
56174
56355
  init_coerce();
56175
- init_schemas6();
56356
+ init_schemas7();
56176
56357
  init_checks3();
56177
56358
  init_errors5();
56178
56359
  init_parse2();
@@ -65848,7 +66029,7 @@ function handleRefineResult2(result, payload, input, inst) {
65848
66029
  }
65849
66030
  }
65850
66031
  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;
65851
- var init_schemas7 = __esm(() => {
66032
+ var init_schemas8 = __esm(() => {
65852
66033
  init_checks4();
65853
66034
  init_core4();
65854
66035
  init_parse3();
@@ -68325,7 +68506,7 @@ var init_core5 = __esm(() => {
68325
68506
  init_core4();
68326
68507
  init_parse3();
68327
68508
  init_errors6();
68328
- init_schemas7();
68509
+ init_schemas8();
68329
68510
  init_checks4();
68330
68511
  init_versions2();
68331
68512
  init_registries2();
@@ -68365,7 +68546,7 @@ function duration4(params) {
68365
68546
  var ZodISODateTime2, ZodISODate2, ZodISOTime2, ZodISODuration2;
68366
68547
  var init_iso2 = __esm(() => {
68367
68548
  init_core5();
68368
- init_schemas8();
68549
+ init_schemas9();
68369
68550
  ZodISODateTime2 = /* @__PURE__ */ $constructor2("ZodISODateTime", (inst, def) => {
68370
68551
  $ZodISODateTime2.init(inst, def);
68371
68552
  ZodStringFormat2.init(inst, def);
@@ -68643,7 +68824,7 @@ function superRefine2(fn, params) {
68643
68824
  return _superRefine(fn, params);
68644
68825
  }
68645
68826
  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;
68646
- var init_schemas8 = __esm(() => {
68827
+ var init_schemas9 = __esm(() => {
68647
68828
  init_core5();
68648
68829
  init_core5();
68649
68830
  init_json_schema_processors();
@@ -69300,7 +69481,7 @@ var init_external3 = __esm(() => {
69300
69481
  init_locales2();
69301
69482
  init_iso2();
69302
69483
  init_coerce2();
69303
- init_schemas8();
69484
+ init_schemas9();
69304
69485
  init_checks5();
69305
69486
  init_errors7();
69306
69487
  init_parse4();
@@ -77809,6 +77990,7 @@ class CourseAssessments {
77809
77990
  }
77810
77991
  function buildCoursePayload(config) {
77811
77992
  return {
77993
+ ...config.course.sourcedId && { sourcedId: config.course.sourcedId },
77812
77994
  status: "active",
77813
77995
  title: config.course.title,
77814
77996
  courseCode: config.course.courseCode,
@@ -77855,6 +78037,16 @@ function buildComponentResourcePayload(config, sourcedIds) {
77855
78037
  lessonType: config.componentResource.lessonType
77856
78038
  };
77857
78039
  }
78040
+ async function findOrUndefined(request) {
78041
+ try {
78042
+ return await request;
78043
+ } catch (error) {
78044
+ if (isApiError(error) && error.statusCode === 404) {
78045
+ return;
78046
+ }
78047
+ throw error;
78048
+ }
78049
+ }
77858
78050
 
77859
78051
  class CourseIntegration {
77860
78052
  core;
@@ -77893,6 +78085,32 @@ class CourseIntegration {
77893
78085
  ...verboseData && { verboseData }
77894
78086
  };
77895
78087
  }
78088
+ async findCourse(courseId) {
78089
+ return findOrUndefined(this.core.api.oneroster.courses.get(courseId));
78090
+ }
78091
+ async resumeSetup(courseId, config) {
78092
+ const oneroster = this.core.api.oneroster;
78093
+ const sourcedIds = deriveSourcedIds(courseId);
78094
+ if (!await findOrUndefined(oneroster.courses.getComponent(sourcedIds.component))) {
78095
+ await oneroster.courses.createComponent(buildComponentPayload(config, sourcedIds));
78096
+ addEvent("timeback.component_created", {
78097
+ "app.timeback.component_id": sourcedIds.component
78098
+ });
78099
+ }
78100
+ if (!await findOrUndefined(oneroster.resources.get(sourcedIds.resource))) {
78101
+ await oneroster.resources.create(buildResourcePayload(config, sourcedIds.resource));
78102
+ addEvent("timeback.resource_created", {
78103
+ "app.timeback.resource_id": sourcedIds.resource
78104
+ });
78105
+ }
78106
+ if (!await findOrUndefined(oneroster.courses.getComponentResource(sourcedIds.componentResource))) {
78107
+ await oneroster.courses.createComponentResource(buildComponentResourcePayload(config, sourcedIds));
78108
+ addEvent("timeback.component_resource_link_created", {
78109
+ "app.timeback.component_resource_id": sourcedIds.componentResource
78110
+ });
78111
+ }
78112
+ await this.update(courseId, config);
78113
+ }
77896
78114
  async update(courseId, config) {
77897
78115
  const oneroster = this.core.api.oneroster;
77898
78116
  const sourcedIds = deriveSourcedIds(courseId);
@@ -78032,6 +78250,8 @@ function createCourseNamespace(core) {
78032
78250
  update: (courseId, config) => integration.update(courseId, config),
78033
78251
  verify: (courseId) => integration.verify(courseId),
78034
78252
  getConfig: (courseId) => integration.getConfig(courseId),
78253
+ findCourse: (courseId) => integration.findCourse(courseId),
78254
+ resumeSetup: (courseId, config) => integration.resumeSetup(courseId, config),
78035
78255
  cleanup: (courseId) => integration.cleanup(courseId),
78036
78256
  deactivateCourse: (courseId) => integration.updateCourseStatus(courseId, "tobedeleted"),
78037
78257
  reactivateCourse: (courseId) => integration.updateCourseStatus(courseId, "active"),
@@ -78116,7 +78336,9 @@ class RosterEnrollments {
78116
78336
  status: "active",
78117
78337
  grades,
78118
78338
  subjects,
78119
- school: enrollment.school
78339
+ school: enrollment.school,
78340
+ beginDate: enrollment.beginDate,
78341
+ ...enrollment.metadata && { metadata: enrollment.metadata }
78120
78342
  };
78121
78343
  });
78122
78344
  this.core.caches.enrollments.set(studentId, enrollments);
@@ -82211,11 +82433,8 @@ function normalizeText2(value) {
82211
82433
  function normalizeTestType(value) {
82212
82434
  return normalizeText2(value).replaceAll("-", " ");
82213
82435
  }
82214
- function isUuidLike(value) {
82215
- return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
82216
- }
82217
82436
  function hasReadableStandardLabel(standard) {
82218
- return Boolean(standard.name || standard.identifier || !isUuidLike(standard.id));
82437
+ return Boolean(standard.name || standard.identifier || !isValidUUID(standard.id));
82219
82438
  }
82220
82439
  function isAllowedGradeLevelTestType(value) {
82221
82440
  const normalizedType = normalizeTestType(value);
@@ -82528,6 +82747,7 @@ var GRADE_LEVEL_TEST_TYPES, naturalTitleSort;
82528
82747
  var init_timeback_grade_level_results_util = __esm(() => {
82529
82748
  init_constants2();
82530
82749
  init_qti();
82750
+ init_src9();
82531
82751
  GRADE_LEVEL_TEST_TYPES = [
82532
82752
  "placement",
82533
82753
  "test out",
@@ -82986,7 +83206,8 @@ class TimebackAdminService {
82986
83206
  const entries = await Promise.all(courseIds.map(async (courseId) => {
82987
83207
  const roster = await client.roster.getCourseRoster(courseId, {
82988
83208
  includeInactive: options?.includeInactive,
82989
- includeUsers: false
83209
+ includeUsers: false,
83210
+ userSourcedId: studentId
82990
83211
  });
82991
83212
  const matches = roster.filter((entry) => entry.enrollment.user.sourcedId === studentId).toSorted((a, b) => {
82992
83213
  const aActive = a.enrollment.status === "active";
@@ -88921,7 +89142,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
88921
89142
  }) {
88922
89143
  await this.deps.validateDeveloperAccess(user, gameId);
88923
89144
  const integrations = await this.deps.db.query.gameTimebackIntegrations.findMany({
88924
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
89145
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
88925
89146
  });
88926
89147
  const matchingIntegrations = new Map;
88927
89148
  for (const integration of integrations) {
@@ -89310,7 +89531,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
89310
89531
  }) {
89311
89532
  await this.deps.validateDeveloperAccess(user, gameId);
89312
89533
  const integrations = await this.deps.db.query.gameTimebackIntegrations.findMany({
89313
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
89534
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
89314
89535
  });
89315
89536
  const orderedIntegrations = integrations.toSorted((left, right) => {
89316
89537
  const subjectDifference = left.subject.localeCompare(right.subject);
@@ -89389,7 +89610,7 @@ var init_timeback_assessment_runtime_service = __esm(async () => {
89389
89610
  async candidateIntegrations(gameId, studentId, input, db = this.deps.db) {
89390
89611
  const filters = [
89391
89612
  eq(gameTimebackIntegrations.gameId, gameId),
89392
- isActiveGameTimebackIntegrationStatus()
89613
+ isActiveBaseGameTimebackIntegration()
89393
89614
  ];
89394
89615
  if (input.subject) {
89395
89616
  filters.push(eq(gameTimebackIntegrations.subject, input.subject));
@@ -92331,6 +92552,50 @@ function timebackConfigMatchesCreateIntegrationRequest(config, request) {
92331
92552
  const requestedLevel = request.level ?? deriveTimebackCourseLevelFromGrade(request.grade);
92332
92553
  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;
92333
92554
  }
92555
+ function buildHoleFillingCourseConfig(baseConfig, request) {
92556
+ const baseCourseMetadata = isRecord4(baseConfig.course.metadata) ? baseConfig.course.metadata : {};
92557
+ const baseMetrics = isRecord4(baseCourseMetadata.metrics) ? baseCourseMetadata.metrics : {};
92558
+ const baseResourceMetadata = isRecord4(baseConfig.resource.metadata) ? baseConfig.resource.metadata : {};
92559
+ const basePlaycademy = isPlaycademyResourceMetadata(baseResourceMetadata.playcademy) ? baseResourceMetadata.playcademy : undefined;
92560
+ return {
92561
+ organization: baseConfig.organization,
92562
+ course: {
92563
+ ...baseConfig.course,
92564
+ ...request.courseId && { sourcedId: request.courseId },
92565
+ title: request.title,
92566
+ courseCode: request.courseCode,
92567
+ metadata: {
92568
+ ...baseCourseMetadata,
92569
+ courseType: HOLE_FILLING_COURSE_TYPE,
92570
+ baseCourseSourcedId: request.baseCourseId,
92571
+ metrics: {
92572
+ ...baseMetrics,
92573
+ totalXp: request.totalXp,
92574
+ totalLessons: request.masterableUnits,
92575
+ totalGrades: 1
92576
+ }
92577
+ }
92578
+ },
92579
+ component: { ...baseConfig.component, title: `${request.title} Activities` },
92580
+ resource: {
92581
+ ...baseConfig.resource,
92582
+ title: `${request.title} Game`,
92583
+ metadata: {
92584
+ ...baseResourceMetadata,
92585
+ xp: request.totalXp,
92586
+ playcademy: {
92587
+ ...basePlaycademy,
92588
+ mastery: {
92589
+ ...basePlaycademy?.mastery,
92590
+ masterableUnits: request.masterableUnits
92591
+ }
92592
+ }
92593
+ }
92594
+ },
92595
+ componentResource: { ...baseConfig.componentResource, title: `${request.title} Lesson` }
92596
+ };
92597
+ }
92598
+ var HOLE_FILLING_COURSE_TYPE = "hole-filling";
92334
92599
  var init_timeback_create_integration_util = __esm(() => {
92335
92600
  init_constants2();
92336
92601
  init_types2();
@@ -92346,7 +92611,7 @@ async function promoteCompletedCourse({
92346
92611
  enrollments: prefetchedEnrollments
92347
92612
  }) {
92348
92613
  const subjectIntegrations = await db.query.gameTimebackIntegrations.findMany({
92349
- where: and(eq(gameTimebackIntegrations.gameId, currentIntegration.gameId), eq(gameTimebackIntegrations.subject, currentIntegration.subject), isActiveGameTimebackIntegrationStatus())
92614
+ where: and(eq(gameTimebackIntegrations.gameId, currentIntegration.gameId), eq(gameTimebackIntegrations.subject, currentIntegration.subject), isActiveBaseGameTimebackIntegration())
92350
92615
  });
92351
92616
  const nextIntegration = subjectIntegrations.filter((integration) => integration.grade > currentIntegration.grade).toSorted((left, right) => left.grade - right.grade)[0];
92352
92617
  if (!nextIntegration) {
@@ -92413,6 +92678,8 @@ function toGameTimebackIntegration(integration) {
92413
92678
  courseId: integration.courseId,
92414
92679
  grade: integration.grade,
92415
92680
  subject: integration.subject,
92681
+ kind: integration.kind,
92682
+ baseIntegrationId: integration.baseIntegrationId,
92416
92683
  totalXp: integration.totalXp ?? null,
92417
92684
  status: integration.status ?? ACTIVE_GAME_TIMEBACK_INTEGRATION_STATUS,
92418
92685
  deactivatedAt: integration.deactivatedAt ?? null,
@@ -92450,6 +92717,9 @@ var init_timeback_removed_integration_util = __esm(() => {
92450
92717
 
92451
92718
  // ../api-core/src/services/timeback.service.ts
92452
92719
  import { createHash as createHash3 } from "node:crypto";
92720
+ function isUnregisteredHoleFillingOf(course, base) {
92721
+ return course.metadata?.courseType === HOLE_FILLING_COURSE_TYPE && course.metadata.baseCourseSourcedId === base.courseId;
92722
+ }
92453
92723
  async function findGameTimebackIntegrationForUpdate(db, condition) {
92454
92724
  const [integration] = await db.select().from(gameTimebackIntegrations).where(condition).limit(1).for("update");
92455
92725
  return integration;
@@ -92856,13 +93126,29 @@ var init_timeback_service = __esm(async () => {
92856
93126
  const integrations = await db.query.gameTimebackIntegrations.findMany({
92857
93127
  where: and(inArray(gameTimebackIntegrations.courseId, courseIds), isActiveGameTimebackIntegrationStatus())
92858
93128
  });
92859
- return mapEnrollmentsToUserEnrollments(enrollments, integrations);
93129
+ return mapEnrollmentsToUserEnrollments(enrollments, integrations, await this.loadBaseCourseIds(integrations));
92860
93130
  } catch (error) {
92861
93131
  setAttribute("app.timeback.enrollment_fetch", "failed");
92862
93132
  setAttribute("app.timeback.enrollment_fetch_error", errorMessage(error));
92863
93133
  return [];
92864
93134
  }
92865
93135
  }
93136
+ async loadBaseCourseIds(integrations) {
93137
+ const courseIdById = new Map(integrations.map((row) => [row.id, row.courseId]));
93138
+ const missingBaseIds = [
93139
+ ...new Set(integrations.map((row) => row.baseIntegrationId).filter((id) => id !== null && !courseIdById.has(id)))
93140
+ ];
93141
+ if (missingBaseIds.length > 0) {
93142
+ const baseRows = await this.deps.db.query.gameTimebackIntegrations.findMany({
93143
+ columns: { id: true, courseId: true },
93144
+ where: inArray(gameTimebackIntegrations.id, missingBaseIds)
93145
+ });
93146
+ for (const row of baseRows) {
93147
+ courseIdById.set(row.id, row.courseId);
93148
+ }
93149
+ }
93150
+ return courseIdById;
93151
+ }
92866
93152
  async setupIntegration(gameId, request, user) {
92867
93153
  return this.withClientTelemetry(async () => {
92868
93154
  const client = this.requireClient();
@@ -92873,7 +93159,7 @@ var init_timeback_service = __esm(async () => {
92873
93159
  "app.timeback.course_count": courses.length
92874
93160
  });
92875
93161
  const existing = await db.query.gameTimebackIntegrations.findMany({
92876
- where: eq(gameTimebackIntegrations.gameId, gameId)
93162
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isBaseGameTimebackIntegration())
92877
93163
  });
92878
93164
  const integrations = [];
92879
93165
  const verboseData = [];
@@ -93021,13 +93307,13 @@ var init_timeback_service = __esm(async () => {
93021
93307
  "app.timeback.subject": request.subject
93022
93308
  });
93023
93309
  const activeConflict = await db.query.gameTimebackIntegrations.findFirst({
93024
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), isActiveGameTimebackIntegrationStatus())
93310
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), isActiveBaseGameTimebackIntegration())
93025
93311
  });
93026
93312
  if (activeConflict) {
93027
93313
  throw new ConflictError(`A TimeBack integration already exists for ${request.subject} Grade ${request.grade}`);
93028
93314
  }
93029
93315
  const removedCandidates = await db.query.gameTimebackIntegrations.findMany({
93030
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, request.grade), eq(gameTimebackIntegrations.subject, request.subject), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS))
93316
+ 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())
93031
93317
  });
93032
93318
  for (const candidate of removedCandidates) {
93033
93319
  const config = await client.course.getConfig(candidate.courseId).catch((error) => {
@@ -93065,10 +93351,10 @@ var init_timeback_service = __esm(async () => {
93065
93351
  }
93066
93352
  }
93067
93353
  const reference = await db.query.gameTimebackIntegrations.findFirst({
93068
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus()),
93354
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration()),
93069
93355
  orderBy: (table, { asc }) => [asc(table.createdAt)]
93070
93356
  }) ?? await db.query.gameTimebackIntegrations.findFirst({
93071
- where: eq(gameTimebackIntegrations.gameId, gameId),
93357
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isBaseGameTimebackIntegration()),
93072
93358
  orderBy: (table, { asc }) => [asc(table.createdAt)]
93073
93359
  });
93074
93360
  if (!reference) {
@@ -93098,10 +93384,77 @@ var init_timeback_service = __esm(async () => {
93098
93384
  return integration;
93099
93385
  });
93100
93386
  }
93387
+ async createHoleFillingCourse(gameId, user, request) {
93388
+ return this.withClientTelemetry(async () => {
93389
+ const client = this.requireClient();
93390
+ const db = this.deps.db;
93391
+ await this.deps.validateDeveloperAccess(user, gameId);
93392
+ TimebackService.recordIntegrationOperation("create_hole_filling_course", {
93393
+ "app.timeback.base_course_id": request.baseCourseId,
93394
+ "app.timeback.custom_course_id": Boolean(request.courseId)
93395
+ });
93396
+ const integration = await db.transaction(async (tx) => {
93397
+ const database = tx;
93398
+ const base = await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, request.baseCourseId), isActiveBaseGameTimebackIntegration()));
93399
+ if (!base) {
93400
+ throw new NotFoundError("Active base course", `${gameId}:${request.baseCourseId}`);
93401
+ }
93402
+ const config = buildHoleFillingCourseConfig(await client.course.getConfig(base.courseId), request);
93403
+ let courseId = request.courseId;
93404
+ if (courseId) {
93405
+ const takenLocally = await database.query.gameTimebackIntegrations.findFirst({
93406
+ columns: { id: true },
93407
+ where: eq(gameTimebackIntegrations.courseId, courseId)
93408
+ });
93409
+ const remote = takenLocally ? undefined : await client.course.findCourse(courseId);
93410
+ if (takenLocally || remote && !isUnregisteredHoleFillingOf(remote, base)) {
93411
+ throw new ConflictError(`A Timeback course with ID "${courseId}" already exists`);
93412
+ }
93413
+ if (remote) {
93414
+ setAttribute("app.timeback.course_create_mode", "resumed");
93415
+ await client.course.resumeSetup(courseId, config);
93416
+ } else {
93417
+ courseId = undefined;
93418
+ }
93419
+ }
93420
+ if (!courseId) {
93421
+ const created = await client.course.setup(config);
93422
+ courseId = created.courseId;
93423
+ }
93424
+ setAttribute("app.timeback.course_id", courseId);
93425
+ const [inserted] = await database.insert(gameTimebackIntegrations).values({
93426
+ gameId,
93427
+ courseId,
93428
+ grade: base.grade,
93429
+ subject: base.subject,
93430
+ totalXp: request.totalXp,
93431
+ kind: HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND,
93432
+ baseIntegrationId: base.id
93433
+ }).returning();
93434
+ return inserted;
93435
+ });
93436
+ if (!integration) {
93437
+ throw new InternalError("Hole-filling course creation did not return an integration");
93438
+ }
93439
+ return toGameTimebackIntegration(integration);
93440
+ });
93441
+ }
93442
+ async getHoleFillingCourses(gameId, user) {
93443
+ await this.deps.validateGameManagementAccess(user, gameId);
93444
+ const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
93445
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.kind, HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND), isActiveGameTimebackIntegrationStatus()),
93446
+ orderBy: (table, { asc }) => [
93447
+ asc(table.subject),
93448
+ asc(table.grade),
93449
+ asc(table.createdAt)
93450
+ ]
93451
+ });
93452
+ return rows.map((row) => toGameTimebackIntegration(row));
93453
+ }
93101
93454
  async getIntegrations(gameId, user) {
93102
93455
  await this.deps.validateGameManagementAccess(user, gameId);
93103
93456
  const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
93104
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
93457
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
93105
93458
  });
93106
93459
  return rows.map((row) => toGameTimebackIntegration(row));
93107
93460
  }
@@ -93110,7 +93463,7 @@ var init_timeback_service = __esm(async () => {
93110
93463
  const client = this.requireClient();
93111
93464
  await this.deps.validateGameManagementAccess(user, gameId);
93112
93465
  const rows = await this.deps.db.query.gameTimebackIntegrations.findMany({
93113
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS)),
93466
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.status, DEACTIVATED_GAME_TIMEBACK_INTEGRATION_STATUS), isBaseGameTimebackIntegration()),
93114
93467
  orderBy: (table, { asc }) => [asc(table.subject), asc(table.grade)]
93115
93468
  });
93116
93469
  setAttribute("app.timeback.removed_integration_count", rows.length);
@@ -93141,6 +93494,17 @@ var init_timeback_service = __esm(async () => {
93141
93494
  if (!integration) {
93142
93495
  throw new NotFoundError("Timeback course", `${gameId}:${courseId}`);
93143
93496
  }
93497
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
93498
+ throw new ConflictError("This is a hole-filling course and may be referenced by Timeback, so it can't be removed.");
93499
+ }
93500
+ const activeHoleFilling = await database.query.gameTimebackIntegrations.findFirst({
93501
+ columns: { id: true },
93502
+ where: and(eq(gameTimebackIntegrations.baseIntegrationId, integration.id), isActiveGameTimebackIntegrationStatus())
93503
+ });
93504
+ if (activeHoleFilling) {
93505
+ setAttribute("app.timeback.removal_blocked", "hole_filling_courses");
93506
+ throw new ConflictError("This course has hole-filling courses that may be referenced by Timeback, so it can't be removed.");
93507
+ }
93144
93508
  const activeEnrollments = await client.roster.getCourseRoster(courseId, {
93145
93509
  role: "student",
93146
93510
  includeUsers: false
@@ -93178,11 +93542,18 @@ var init_timeback_service = __esm(async () => {
93178
93542
  if (!integration) {
93179
93543
  throw new NotFoundError("Removed Timeback course", `${gameId}:${courseId}`);
93180
93544
  }
93181
- const activeConflict = await database.query.gameTimebackIntegrations.findFirst({
93182
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, integration.subject), isActiveGameTimebackIntegrationStatus())
93183
- });
93184
- if (activeConflict) {
93185
- throw new ConflictError(`An active TimeBack course already exists for ${integration.subject} Grade ${integration.grade}`);
93545
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
93546
+ const base = integration.baseIntegrationId ? await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.id, integration.baseIntegrationId), isActiveBaseGameTimebackIntegration())) : undefined;
93547
+ if (!base) {
93548
+ throw new ConflictError("Restore the base course first: a hole-filling course can only be active beside its base course.");
93549
+ }
93550
+ } else {
93551
+ const activeConflict = await database.query.gameTimebackIntegrations.findFirst({
93552
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, integration.subject), isActiveBaseGameTimebackIntegration())
93553
+ });
93554
+ if (activeConflict) {
93555
+ throw new ConflictError(`An active TimeBack course already exists for ${integration.subject} Grade ${integration.grade}`);
93556
+ }
93186
93557
  }
93187
93558
  const now = new Date;
93188
93559
  const [updatedIntegration] = await database.update(gameTimebackIntegrations).set({
@@ -93221,52 +93592,66 @@ var init_timeback_service = __esm(async () => {
93221
93592
  TimebackService.recordIntegrationOperation("update_integration", {
93222
93593
  "app.timeback.course_id": courseId
93223
93594
  });
93224
- const integration = await this.deps.db.query.gameTimebackIntegrations.findFirst({
93225
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, courseId), isActiveGameTimebackIntegrationStatus())
93226
- });
93227
- if (!integration) {
93228
- throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
93229
- }
93230
- const timebackConfig = await client.course.getConfig(courseId);
93231
- const liveSubject = timebackConfig.course.subjects[0];
93232
- const subject = resolveIntegrationSubject(patch.subject, liveSubject, integration.subject);
93233
- if (!isTimebackSubject(subject)) {
93234
- throw new ValidationError(`Invalid subject "${subject}"`);
93235
- }
93236
- setAttributes({
93237
- "app.timeback.grade": integration.grade,
93238
- "app.timeback.previous_subject": integration.subject,
93239
- "app.timeback.next_subject": subject
93240
- });
93241
- if (subject !== integration.subject) {
93242
- const subjectConflict = await this.deps.db.query.gameTimebackIntegrations.findFirst({
93243
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, subject), isActiveGameTimebackIntegrationStatus())
93595
+ const updated = await this.deps.db.transaction(async (tx) => {
93596
+ const database = tx;
93597
+ const integration = await findGameTimebackIntegrationForUpdate(database, and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.courseId, courseId), isActiveGameTimebackIntegrationStatus()));
93598
+ if (!integration) {
93599
+ throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
93600
+ }
93601
+ const timebackConfig = await client.course.getConfig(courseId);
93602
+ const liveSubject = timebackConfig.course.subjects[0];
93603
+ const subject = resolveIntegrationSubject(patch.subject, liveSubject, integration.subject);
93604
+ if (!isTimebackSubject(subject)) {
93605
+ throw new ValidationError(`Invalid subject "${subject}"`);
93606
+ }
93607
+ setAttributes({
93608
+ "app.timeback.grade": integration.grade,
93609
+ "app.timeback.previous_subject": integration.subject,
93610
+ "app.timeback.next_subject": subject
93244
93611
  });
93245
- if (subjectConflict && subjectConflict.id !== integration.id) {
93246
- throw new ValidationError(`A TimeBack integration already exists for ${subject} Grade ${integration.grade}`);
93612
+ if (subject !== integration.subject) {
93613
+ if (integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND) {
93614
+ throw new ValidationError("A hole-filling course must keep the subject of its base course");
93615
+ }
93616
+ const linkedHoleFilling = await database.query.gameTimebackIntegrations.findFirst({
93617
+ columns: { id: true },
93618
+ where: eq(gameTimebackIntegrations.baseIntegrationId, integration.id)
93619
+ });
93620
+ if (linkedHoleFilling) {
93621
+ throw new ValidationError("This course has hole-filling courses, so its subject cannot change");
93622
+ }
93247
93623
  }
93248
- }
93249
- const totalXp = "totalXp" in patch ? patch.totalXp ?? null : getTotalXpFromTimebackConfig(timebackConfig) ?? integration.totalXp ?? null;
93250
- const masterableUnits = "masterableUnits" in patch ? patch.masterableUnits ?? null : getMasterableUnitsFromTimebackConfig(timebackConfig);
93251
- setAttributes({
93252
- "app.timeback.total_xp": totalXp,
93253
- "app.timeback.masterable_units": masterableUnits
93624
+ if (subject !== integration.subject) {
93625
+ const subjectConflict = await database.query.gameTimebackIntegrations.findFirst({
93626
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, integration.grade), eq(gameTimebackIntegrations.subject, subject), isActiveBaseGameTimebackIntegration())
93627
+ });
93628
+ if (subjectConflict && subjectConflict.id !== integration.id) {
93629
+ throw new ValidationError(`A TimeBack integration already exists for ${subject} Grade ${integration.grade}`);
93630
+ }
93631
+ }
93632
+ const totalXp = "totalXp" in patch ? patch.totalXp ?? null : getTotalXpFromTimebackConfig(timebackConfig) ?? integration.totalXp ?? null;
93633
+ const masterableUnits = "masterableUnits" in patch ? patch.masterableUnits ?? null : getMasterableUnitsFromTimebackConfig(timebackConfig);
93634
+ setAttributes({
93635
+ "app.timeback.total_xp": totalXp,
93636
+ "app.timeback.masterable_units": masterableUnits
93637
+ });
93638
+ await client.course.update(courseId, TimebackService.patchTimebackConfig(timebackConfig, {
93639
+ ...patch,
93640
+ subject,
93641
+ totalXp,
93642
+ masterableUnits,
93643
+ grade: integration.grade
93644
+ }));
93645
+ const [row] = await database.update(gameTimebackIntegrations).set({
93646
+ subject,
93647
+ totalXp,
93648
+ updatedAt: new Date
93649
+ }).where(eq(gameTimebackIntegrations.id, integration.id)).returning();
93650
+ if (!row) {
93651
+ throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
93652
+ }
93653
+ return row;
93254
93654
  });
93255
- await client.course.update(courseId, TimebackService.patchTimebackConfig(timebackConfig, {
93256
- ...patch,
93257
- subject,
93258
- totalXp,
93259
- masterableUnits,
93260
- grade: integration.grade
93261
- }));
93262
- const [updated] = await this.deps.db.update(gameTimebackIntegrations).set({
93263
- subject,
93264
- totalXp,
93265
- updatedAt: new Date
93266
- }).where(eq(gameTimebackIntegrations.id, integration.id)).returning();
93267
- if (!updated) {
93268
- throw new NotFoundError("Timeback integration", `${gameId}:${courseId}`);
93269
- }
93270
93655
  return toGameTimebackIntegration(updated);
93271
93656
  });
93272
93657
  }
@@ -93277,7 +93662,7 @@ var init_timeback_service = __esm(async () => {
93277
93662
  await this.deps.validateDeveloperAccess(user, gameId);
93278
93663
  TimebackService.recordIntegrationOperation("verify_integration");
93279
93664
  const integrations = await db.query.gameTimebackIntegrations.findMany({
93280
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
93665
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
93281
93666
  });
93282
93667
  if (integrations.length === 0) {
93283
93668
  throw new NotFoundError("Timeback integration", gameId);
@@ -93315,7 +93700,7 @@ var init_timeback_service = __esm(async () => {
93315
93700
  const client = this.requireClient();
93316
93701
  await this.deps.validateDeveloperAccess(user, gameId);
93317
93702
  const integration = await this.deps.db.query.gameTimebackIntegrations.findFirst({
93318
- where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
93703
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), isActiveBaseGameTimebackIntegration())
93319
93704
  });
93320
93705
  if (!integration) {
93321
93706
  throw new NotFoundError("Timeback integration", gameId);
@@ -93329,17 +93714,24 @@ var init_timeback_service = __esm(async () => {
93329
93714
  const db = this.deps.db;
93330
93715
  await this.deps.validateDeveloperAccess(user, gameId);
93331
93716
  TimebackService.recordIntegrationOperation("delete_integrations");
93332
- const integrations = await db.query.gameTimebackIntegrations.findMany({
93333
- where: eq(gameTimebackIntegrations.gameId, gameId)
93717
+ await db.transaction(async (tx) => {
93718
+ const database = tx;
93719
+ await database.select({ id: gameTimebackIntegrations.id }).from(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId)).for("update");
93720
+ const integrations = await database.select().from(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
93721
+ if (integrations.length === 0) {
93722
+ throw new NotFoundError("Timeback integration", gameId);
93723
+ }
93724
+ setAttribute("app.timeback.integration_count", integrations.length);
93725
+ const holeFillingCount = integrations.filter((integration) => integration.kind === HOLE_FILLING_GAME_TIMEBACK_INTEGRATION_KIND).length;
93726
+ if (holeFillingCount > 0) {
93727
+ setAttribute("app.timeback.hole_filling_count", holeFillingCount);
93728
+ 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.`);
93729
+ }
93730
+ for (const integration of integrations) {
93731
+ await client.course.cleanup(integration.courseId);
93732
+ }
93733
+ await database.delete(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
93334
93734
  });
93335
- if (integrations.length === 0) {
93336
- throw new NotFoundError("Timeback integration", gameId);
93337
- }
93338
- setAttribute("app.timeback.integration_count", integrations.length);
93339
- for (const integration of integrations) {
93340
- await client.course.cleanup(integration.courseId);
93341
- }
93342
- await db.delete(gameTimebackIntegrations).where(eq(gameTimebackIntegrations.gameId, gameId));
93343
93735
  });
93344
93736
  }
93345
93737
  static patchCourseMetadata(metadata2, totalXp, options) {
@@ -93519,7 +93911,7 @@ var init_timeback_service = __esm(async () => {
93519
93911
  });
93520
93912
  await this.deps.validateDeveloperAccess(user, gameId);
93521
93913
  const integration = await db.query.gameTimebackIntegrations.findFirst({
93522
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveGameTimebackIntegrationStatus())
93914
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveBaseGameTimebackIntegration())
93523
93915
  });
93524
93916
  if (!integration) {
93525
93917
  throw new NotFoundError(`Timeback integration for game (grade ${activityData.grade}, subject ${activityData.subject})`);
@@ -93662,7 +94054,7 @@ var init_timeback_service = __esm(async () => {
93662
94054
  const client = this.requireClient();
93663
94055
  const db = this.deps.db;
93664
94056
  const integrations = await db.query.gameTimebackIntegrations.findMany({
93665
- where: subject ? and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.subject, subject), isActiveGameTimebackIntegrationStatus()) : and(eq(gameTimebackIntegrations.gameId, gameId), isActiveGameTimebackIntegrationStatus())
94057
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), subject ? eq(gameTimebackIntegrations.subject, subject) : undefined, isActiveBaseGameTimebackIntegration())
93666
94058
  });
93667
94059
  if (integrations.length === 0) {
93668
94060
  throw new NotFoundError(subject ? `Timeback integrations for game (subject ${subject})` : "Timeback integrations for game");
@@ -93851,7 +94243,7 @@ var init_timeback_service = __esm(async () => {
93851
94243
  }
93852
94244
  const pendingHeartbeat = (async () => {
93853
94245
  const integration = await db.query.gameTimebackIntegrations.findFirst({
93854
- where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveGameTimebackIntegrationStatus())
94246
+ where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject), isActiveBaseGameTimebackIntegration())
93855
94247
  });
93856
94248
  if (!integration) {
93857
94249
  throw new NotFoundError(`Timeback integration for game (grade ${activityData.grade}, subject ${activityData.subject})`);
@@ -93981,7 +94373,7 @@ var init_timeback_service = __esm(async () => {
93981
94373
  const db = this.deps.db;
93982
94374
  await this.deps.validateDeveloperAccess(user, options.gameId);
93983
94375
  const integration = await db.query.gameTimebackIntegrations.findFirst({
93984
- where: and(eq(gameTimebackIntegrations.gameId, options.gameId), eq(gameTimebackIntegrations.subject, options.subject), isActiveGameTimebackIntegrationStatus())
94376
+ where: and(eq(gameTimebackIntegrations.gameId, options.gameId), eq(gameTimebackIntegrations.subject, options.subject), isActiveBaseGameTimebackIntegration())
93985
94377
  });
93986
94378
  if (!integration) {
93987
94379
  throw new ValidationError(`Subject "${options.subject}" is not configured for game ${options.gameId}`);
@@ -94689,6 +95081,372 @@ var init_player = __esm(() => {
94689
95081
  init_leaderboard_service();
94690
95082
  });
94691
95083
 
95084
+ // ../api-core/src/utils/account.util.ts
95085
+ function resolveStudentAccount(byEmail, hasTimebackSignIn) {
95086
+ if (!byEmail) {
95087
+ return "create";
95088
+ }
95089
+ return byEmail.emailVerified && !byEmail.timebackId && !hasTimebackSignIn ? "link" : "conflict";
95090
+ }
95091
+
95092
+ // ../api-core/src/utils/lti.util.ts
95093
+ function generateUsername(email) {
95094
+ const baseUsername = (email.split("@")[0] || "user").toLowerCase();
95095
+ const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
95096
+ const randomSuffix = Math.random().toString(36).substring(2, 7);
95097
+ return `${cleanUsername}_${randomSuffix}`;
95098
+ }
95099
+ function extractRedirectPath(targetUri, currentHost) {
95100
+ try {
95101
+ const targetUrl = new URL(targetUri);
95102
+ if (targetUrl.hostname === currentHost) {
95103
+ return targetUrl.pathname + targetUrl.search;
95104
+ }
95105
+ } catch {}
95106
+ return "/";
95107
+ }
95108
+ function validateLtiClaims(claims) {
95109
+ const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
95110
+ const version = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
95111
+ if (messageType !== "LtiResourceLinkRequest") {
95112
+ return `Invalid LTI message type: ${messageType}`;
95113
+ }
95114
+ if (version !== "1.3.0") {
95115
+ return `Unsupported LTI version: ${version}`;
95116
+ }
95117
+ return null;
95118
+ }
95119
+ var init_lti_util = () => {};
95120
+
95121
+ // ../api-core/src/services/account.service.ts
95122
+ import * as crypto4 from "node:crypto";
95123
+
95124
+ class AccountService {
95125
+ deps;
95126
+ constructor(deps) {
95127
+ this.deps = deps;
95128
+ }
95129
+ async resolveTimebackStudent(timebackId) {
95130
+ const byTimebackId = await this.findByTimebackId(timebackId);
95131
+ if (byTimebackId) {
95132
+ setAttributes({ "app.account.student_resolution": "existing" });
95133
+ return byTimebackId;
95134
+ }
95135
+ const profile = await this.fetchOneRosterProfile(timebackId);
95136
+ const byEmailMatches = await this.deps.db.query.users.findMany({
95137
+ where: sql`lower(${users.email}) = lower(${profile.email})`,
95138
+ limit: 2
95139
+ });
95140
+ const byEmail = byEmailMatches.length === 1 ? byEmailMatches[0] : undefined;
95141
+ if (byEmail?.timebackId === timebackId) {
95142
+ return byEmail;
95143
+ }
95144
+ const resolution = byEmailMatches.length > 1 ? "conflict" : resolveStudentAccount(byEmail, await this.hasTimebackSignIn(byEmail));
95145
+ setAttributes({ "app.account.student_resolution": resolution });
95146
+ if (resolution === "conflict") {
95147
+ throw new ConflictError("This student's email belongs to another account");
95148
+ }
95149
+ if (byEmail && resolution === "link") {
95150
+ return this.link(byEmail, timebackId);
95151
+ }
95152
+ return this.create(profile, timebackId);
95153
+ }
95154
+ async hasTimebackSignIn(user) {
95155
+ if (!user) {
95156
+ return false;
95157
+ }
95158
+ const signIn = await this.deps.db.query.accounts.findFirst({
95159
+ columns: { id: true },
95160
+ where: and(eq(accounts.userId, user.id), inArray(accounts.providerId, [
95161
+ AUTH_PROVIDER_IDS.TIMEBACK,
95162
+ AUTH_PROVIDER_IDS.TIMEBACK_LTI,
95163
+ AUTH_PROVIDER_IDS.PLAYCADEMY
95164
+ ]))
95165
+ });
95166
+ setAttributes({ "app.account.has_timeback_sign_in": signIn !== undefined });
95167
+ return signIn !== undefined;
95168
+ }
95169
+ findByTimebackId(timebackId) {
95170
+ return this.deps.db.query.users.findFirst({ where: eq(users.timebackId, timebackId) });
95171
+ }
95172
+ async concurrentWinner(timebackId) {
95173
+ const winner = await this.findByTimebackId(timebackId);
95174
+ if (!winner) {
95175
+ throw new ConflictError("This student's email belongs to another account");
95176
+ }
95177
+ return winner;
95178
+ }
95179
+ async link(account, timebackId) {
95180
+ const [linked] = await this.deps.db.update(users).set({ timebackId, updatedAt: new Date }).where(and(eq(users.id, account.id), isNull(users.timebackId))).returning();
95181
+ return linked ?? this.concurrentWinner(timebackId);
95182
+ }
95183
+ async create(profile, timebackId) {
95184
+ const now = new Date;
95185
+ let created;
95186
+ try {
95187
+ [created] = await this.deps.db.insert(users).values({
95188
+ id: crypto4.randomUUID(),
95189
+ email: profile.email.toLowerCase(),
95190
+ emailVerified: true,
95191
+ username: generateUsername(profile.email),
95192
+ name: profile.name,
95193
+ timebackId,
95194
+ createdAt: now,
95195
+ updatedAt: now
95196
+ }).returning();
95197
+ } catch (error) {
95198
+ if (isUniqueViolation(error)) {
95199
+ return this.concurrentWinner(timebackId);
95200
+ }
95201
+ throw error;
95202
+ }
95203
+ if (!created) {
95204
+ throw new InternalError("Failed to create user");
95205
+ }
95206
+ return created;
95207
+ }
95208
+ async fetchOneRosterProfile(timebackId) {
95209
+ if (!this.deps.timeback) {
95210
+ throw new ServiceUnavailableError("Timeback is not available in this environment");
95211
+ }
95212
+ const record = await this.deps.timeback.api.oneroster.users.get(timebackId).catch((error) => {
95213
+ if (isApiError(error) && error.statusCode === 404) {
95214
+ return null;
95215
+ }
95216
+ setAttributes({
95217
+ "app.account.student_resolution": "timeback_unavailable",
95218
+ "app.timeback.status_code": isApiError(error) ? error.statusCode : undefined
95219
+ });
95220
+ throw new ServiceUnavailableError("Timeback is unavailable; retry shortly");
95221
+ });
95222
+ if (!record) {
95223
+ throw new NotFoundError("Timeback student", timebackId);
95224
+ }
95225
+ if (!record.email) {
95226
+ throw new NotFoundError("Email for Timeback student", timebackId);
95227
+ }
95228
+ const fullName = [record.givenName, record.familyName].filter(Boolean).join(" ");
95229
+ return {
95230
+ email: record.email,
95231
+ name: fullName || record.email.split("@")[0] || "Timeback User"
95232
+ };
95233
+ }
95234
+ }
95235
+ var init_account_service = __esm(async () => {
95236
+ init_drizzle_orm();
95237
+ init_src();
95238
+ init_tables_index();
95239
+ init_spans();
95240
+ init_errors2();
95241
+ init_lti_util();
95242
+ await init_errors8();
95243
+ });
95244
+
95245
+ // ../api-core/src/services/embed-partner.service.ts
95246
+ class EmbedPartnerService {
95247
+ deps;
95248
+ constructor(deps) {
95249
+ this.deps = deps;
95250
+ }
95251
+ async ensurePartner(clientId, name2) {
95252
+ const [partner] = await this.deps.db.insert(embedPartners).values({ clientId, name: name2 }).onConflictDoUpdate({
95253
+ target: embedPartners.clientId,
95254
+ set: { name: name2, updatedAt: new Date }
95255
+ }).returning();
95256
+ if (!partner) {
95257
+ throw new InternalError("Failed to ensure embed partner");
95258
+ }
95259
+ return partner;
95260
+ }
95261
+ addOrigin(clientId, origin) {
95262
+ return this.setOrigins(clientId, sql`CASE WHEN ${origin} = ANY(${embedPartners.allowedOrigins})
95263
+ THEN ${embedPartners.allowedOrigins}
95264
+ ELSE array_append(${embedPartners.allowedOrigins}, ${origin}) END`);
95265
+ }
95266
+ removeOrigin(clientId, origin) {
95267
+ return this.setOrigins(clientId, sql`array_remove(${embedPartners.allowedOrigins}, ${origin})`);
95268
+ }
95269
+ async setOrigins(clientId, origins) {
95270
+ const [partner] = await this.deps.db.update(embedPartners).set({ allowedOrigins: origins, updatedAt: new Date }).where(eq(embedPartners.clientId, clientId)).returning();
95271
+ if (!partner) {
95272
+ throw new NotFoundError("Embed partner", clientId);
95273
+ }
95274
+ return partner;
95275
+ }
95276
+ }
95277
+ var init_embed_partner_service = __esm(() => {
95278
+ init_drizzle_orm();
95279
+ init_tables_index();
95280
+ init_errors2();
95281
+ });
95282
+
95283
+ // ../api-core/src/utils/embed.util.ts
95284
+ function canPartnerLaunch(partner, origin) {
95285
+ return partner.enabled && partner.allowedOrigins.includes(origin);
95286
+ }
95287
+ function embedPageUrl(hubOrigin, slug, parentOrigin) {
95288
+ const url = new URL(`${EMBED_PAGE_PATH}/${encodeURIComponent(slug)}`, hubOrigin);
95289
+ url.searchParams.set(EMBED_PARENT_ORIGIN_PARAM, parentOrigin);
95290
+ return url.toString();
95291
+ }
95292
+ var init_embed_util = __esm(() => {
95293
+ init_src();
95294
+ });
95295
+
95296
+ // ../api-core/src/services/embed.service.ts
95297
+ class EmbedService {
95298
+ deps;
95299
+ constructor(deps) {
95300
+ this.deps = deps;
95301
+ }
95302
+ async getPartnerByClientId(clientId) {
95303
+ const partner = await this.deps.db.query.embedPartners.findFirst({
95304
+ where: eq(embedPartners.clientId, clientId)
95305
+ });
95306
+ if (!partner?.enabled) {
95307
+ throw new AccessDeniedError("This client is not an approved embed partner");
95308
+ }
95309
+ setAttributes({ "app.embed.partner_id": partner.id });
95310
+ return partner;
95311
+ }
95312
+ async isFrameOriginAllowed(origin, slug) {
95313
+ const game = this.deps.db.select({ id: games.id }).from(games).where(eq(games.slug, slug));
95314
+ 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);
95315
+ return partner !== undefined;
95316
+ }
95317
+ async createLaunch(partner, input) {
95318
+ const game = await this.deps.db.query.games.findFirst({
95319
+ where: eq(games.slug, input.gameSlug),
95320
+ columns: { id: true, slug: true }
95321
+ });
95322
+ if (!game) {
95323
+ throw new NotFoundError("Game", input.gameSlug);
95324
+ }
95325
+ setAttributes({ "app.game.id": game.id, "app.game.slug": game.slug });
95326
+ if (!canPartnerLaunch(partner, input.parentOrigin)) {
95327
+ throw new AccessDeniedError("This partner may not launch into that origin");
95328
+ }
95329
+ setAttributes({ "app.user.timeback_id": input.timebackId });
95330
+ const user = await this.deps.resolveTimebackStudent(input.timebackId);
95331
+ const pass = await generateSecureRandomString(PASS_LENGTH);
95332
+ const now = Date.now();
95333
+ const passExpiresAt = new Date(now + EMBED_PASS_TTL_MS);
95334
+ const [launch] = await this.deps.db.insert(embedLaunches).values({
95335
+ partnerId: partner.id,
95336
+ userId: user.id,
95337
+ gameId: game.id,
95338
+ parentOrigin: input.parentOrigin,
95339
+ timebackCourseId: input.timebackCourseId ?? null,
95340
+ passHash: await sha256Hex(pass),
95341
+ passExpiresAt,
95342
+ expiresAt: new Date(now + EMBED_LAUNCH_TTL_MS)
95343
+ }).returning({ id: embedLaunches.id });
95344
+ if (!launch) {
95345
+ throw new InternalError("Failed to create embed launch");
95346
+ }
95347
+ setAttributes({ "app.launch.id": launch.id, "app.user.id": user.id });
95348
+ return { launchId: launch.id, pass, passExpiresAt, gameSlug: game.slug };
95349
+ }
95350
+ async redeemLaunch(input, timeZone) {
95351
+ const launch = await this.consumePass(input);
95352
+ try {
95353
+ const user = await this.deps.db.query.users.findFirst({
95354
+ where: eq(users.id, launch.userId)
95355
+ });
95356
+ if (!user) {
95357
+ throw new NotFoundError("User", launch.userId);
95358
+ }
95359
+ const [game, profile, token] = await Promise.all([
95360
+ this.deps.getGameForStudent(launch.gameId, user),
95361
+ this.deps.getGameProfile(user, launch.gameId, timeZone),
95362
+ this.deps.mintGameToken(launch.gameId, user.id)
95363
+ ]);
95364
+ await this.deps.db.update(embedLaunches).set({ redeemedAt: new Date }).where(eq(embedLaunches.id, launch.id));
95365
+ return {
95366
+ launchId: launch.id,
95367
+ token,
95368
+ user,
95369
+ game,
95370
+ profile,
95371
+ timebackCourseId: launch.timebackCourseId
95372
+ };
95373
+ } catch (error) {
95374
+ setAttributes({ "app.embed.outcome": "prepare_failed" });
95375
+ await this.endLaunch(launch.id);
95376
+ throw error;
95377
+ }
95378
+ }
95379
+ async renewToken(partner, launchId) {
95380
+ setAttributes({ "app.launch.id": launchId });
95381
+ const launch = await this.deps.db.query.embedLaunches.findFirst({
95382
+ where: and(eq(embedLaunches.id, launchId), eq(embedLaunches.partnerId, partner.id))
95383
+ });
95384
+ if (!launch) {
95385
+ setAttributes({ "app.embed.outcome": "not_found" });
95386
+ throw new NotFoundError("Embed launch", launchId);
95387
+ }
95388
+ setAttributes({ "app.game.id": launch.gameId, "app.user.id": launch.userId });
95389
+ const outcome = renewalRefusal(launch, () => canPartnerLaunch(partner, launch.parentOrigin));
95390
+ setAttributes({ "app.embed.outcome": outcome ?? "renewed" });
95391
+ if (outcome) {
95392
+ throw new AccessDeniedError("This launch has ended");
95393
+ }
95394
+ return this.deps.mintGameToken(launch.gameId, launch.userId);
95395
+ }
95396
+ async endLaunch(launchId) {
95397
+ await this.deps.db.update(embedLaunches).set({ endedAt: sql`coalesce(${embedLaunches.endedAt}, now())`, passHash: null }).where(eq(embedLaunches.id, launchId));
95398
+ }
95399
+ async consumePass(input) {
95400
+ const now = new Date;
95401
+ 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();
95402
+ if (!launch) {
95403
+ setAttributes({ "app.embed.outcome": "pass_rejected" });
95404
+ throw new UnauthorizedError("This launch pass is not valid");
95405
+ }
95406
+ setAttributes({
95407
+ "app.launch.id": launch.id,
95408
+ "app.game.id": launch.gameId,
95409
+ "app.embed.partner_id": launch.partnerId,
95410
+ "app.user.id": launch.userId
95411
+ });
95412
+ const partner = await this.deps.db.query.embedPartners.findFirst({
95413
+ where: eq(embedPartners.id, launch.partnerId),
95414
+ columns: { enabled: true, allowedOrigins: true }
95415
+ });
95416
+ const originMatches = launch.parentOrigin === input.parentOrigin;
95417
+ const stillAllowed = partner !== undefined && canPartnerLaunch(partner, launch.parentOrigin);
95418
+ if (!originMatches || !stillAllowed) {
95419
+ await this.endLaunch(launch.id);
95420
+ setAttributes({
95421
+ "app.embed.outcome": originMatches ? "partner_disallowed" : "origin_mismatch"
95422
+ });
95423
+ throw new UnauthorizedError("This launch pass is not valid");
95424
+ }
95425
+ return launch;
95426
+ }
95427
+ }
95428
+ function renewalRefusal(launch, isAllowed) {
95429
+ if (!launch.redeemedAt) {
95430
+ return "not_started";
95431
+ }
95432
+ if (launch.endedAt) {
95433
+ return "ended";
95434
+ }
95435
+ if (launch.expiresAt <= new Date) {
95436
+ return "expired";
95437
+ }
95438
+ return isAllowed() ? undefined : "partner_disallowed";
95439
+ }
95440
+ var PASS_LENGTH = 43;
95441
+ var init_embed_service = __esm(() => {
95442
+ init_drizzle_orm();
95443
+ init_src();
95444
+ init_tables_index();
95445
+ init_spans();
95446
+ init_errors2();
95447
+ init_embed_util();
95448
+ });
95449
+
94692
95450
  // ../api-core/src/services/lti.service.ts
94693
95451
  class LtiService {
94694
95452
  deps;
@@ -94754,7 +95512,7 @@ class SessionService {
94754
95512
  }
94755
95513
  async resolveGame(gameIdOrSlug) {
94756
95514
  const db = this.deps.db;
94757
- 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);
95515
+ const isUuid = isValidUUID(gameIdOrSlug);
94758
95516
  const game = isUuid ? await db.query.games.findFirst({
94759
95517
  where: eq(games.id, gameIdOrSlug),
94760
95518
  columns: { id: true, slug: true }
@@ -94777,6 +95535,7 @@ var init_session_service = __esm(() => {
94777
95535
  init_drizzle_orm();
94778
95536
  init_tables_index();
94779
95537
  init_spans();
95538
+ init_src9();
94780
95539
  init_errors2();
94781
95540
  });
94782
95541
 
@@ -95052,21 +95811,43 @@ var init_verify_service = __esm(() => {
95052
95811
 
95053
95812
  // ../api-core/src/services/factory/standalone.ts
95054
95813
  function createStandaloneServices(deps) {
95055
- const { db, auth, timeback } = deps;
95814
+ const { db, auth, timeback, getGameForStudent, getTimebackData } = deps;
95056
95815
  const lti = new LtiService({ db });
95057
95816
  const session = new SessionService({ db, mintGameToken: auth.mintGameToken.bind(auth) });
95817
+ const account = new AccountService({ db, timeback });
95058
95818
  const user = new UserService({ db, timeback });
95819
+ const embed = new EmbedService({
95820
+ db,
95821
+ mintGameToken: auth.mintGameToken.bind(auth),
95822
+ resolveTimebackStudent: (timebackId) => account.resolveTimebackStudent(timebackId),
95823
+ getGameForStudent,
95824
+ getGameProfile: async (student, gameId, timeZone) => {
95825
+ const [profile, timebackData] = await Promise.all([
95826
+ user.getMe(student, gameId, timeZone),
95827
+ student.timebackId ? getTimebackData(student.id, gameId).catch(() => {
95828
+ setAttributes({ "app.embed.timeback_context": "unavailable" });
95829
+ return;
95830
+ }) : undefined
95831
+ ]);
95832
+ return { ...profile, timeback: timebackData };
95833
+ }
95834
+ });
95835
+ const embedPartner = new EmbedPartnerService({ db });
95059
95836
  const verify = new VerifyService({
95060
95837
  db,
95061
95838
  validateGameToken: auth.validateGameToken.bind(auth)
95062
95839
  });
95063
- return { lti, session, user, verify };
95840
+ return { account, embed, embedPartner, lti, session, user, verify };
95064
95841
  }
95065
- var init_standalone = __esm(() => {
95842
+ var init_standalone = __esm(async () => {
95843
+ init_spans();
95844
+ init_embed_partner_service();
95845
+ init_embed_service();
95066
95846
  init_lti_service();
95067
95847
  init_session_service();
95068
95848
  init_user_service();
95069
95849
  init_verify_service();
95850
+ await init_account_service();
95070
95851
  });
95071
95852
 
95072
95853
  // ../api-core/src/services/factory/index.ts
@@ -95109,7 +95890,13 @@ function createServices(ctx) {
95109
95890
  verifyAssessmentToken: auth.verifyAssessmentToken.bind(auth),
95110
95891
  ...gaming.validators
95111
95892
  });
95112
- const standalone = createStandaloneServices({ db, auth, timeback });
95893
+ const standalone = createStandaloneServices({
95894
+ db,
95895
+ auth,
95896
+ timeback,
95897
+ getGameForStudent: (gameId, student) => gaming.services.game.getById(gameId, student),
95898
+ getTimebackData: (userId, gameId) => platform.timeback.getUserData(userId, gameId)
95899
+ });
95113
95900
  return {
95114
95901
  ...infra,
95115
95902
  ...player,
@@ -95122,8 +95909,10 @@ var init_factory = __esm(async () => {
95122
95909
  init_game3();
95123
95910
  init_infra2();
95124
95911
  init_player();
95125
- init_standalone();
95126
- await init_platform2();
95912
+ await __promiseAll([
95913
+ init_platform2(),
95914
+ init_standalone()
95915
+ ]);
95127
95916
  });
95128
95917
 
95129
95918
  // ../api-core/src/types/context.type.ts
@@ -95257,6 +96046,17 @@ function defineControllerNames(namespace, handlers) {
95257
96046
  return handlers;
95258
96047
  }
95259
96048
 
96049
+ // ../api-core/src/utils/game-token.util.ts
96050
+ async function withTunnelUrl(ctx, token) {
96051
+ const baseUrl = ctx.config.isLocal ? await getTunnelUrl(ctx.config.baseUrl).catch(() => {
96052
+ return;
96053
+ }) : undefined;
96054
+ return { ...token, baseUrl };
96055
+ }
96056
+ var init_game_token_util = __esm(() => {
96057
+ init_tunnel();
96058
+ });
96059
+
95260
96060
  // ../api-core/src/utils/assessment-artifact-backfill.util.ts
95261
96061
  var init_assessment_artifact_backfill_util = __esm(() => {
95262
96062
  init_tables_index();
@@ -95266,37 +96066,8 @@ var init_assessment_artifact_backfill_util = __esm(() => {
95266
96066
  init_timeback_review_mapping_util();
95267
96067
  });
95268
96068
 
95269
- // ../api-core/src/utils/lti.util.ts
95270
- function generateUsername(email) {
95271
- const baseUsername = (email.split("@")[0] || "user").toLowerCase();
95272
- const cleanUsername = baseUsername.replace(/[^a-z0-9]/g, "");
95273
- const randomSuffix = Math.random().toString(36).substring(2, 7);
95274
- return `${cleanUsername}_${randomSuffix}`;
95275
- }
95276
- function extractRedirectPath(targetUri, currentHost) {
95277
- try {
95278
- const targetUrl = new URL(targetUri);
95279
- if (targetUrl.hostname === currentHost) {
95280
- return targetUrl.pathname + targetUrl.search;
95281
- }
95282
- } catch {}
95283
- return "/";
95284
- }
95285
- function validateLtiClaims(claims) {
95286
- const messageType = claims["https://purl.imsglobal.org/spec/lti/claim/message_type"];
95287
- const version = claims["https://purl.imsglobal.org/spec/lti/claim/version"];
95288
- if (messageType !== "LtiResourceLinkRequest") {
95289
- return `Invalid LTI message type: ${messageType}`;
95290
- }
95291
- if (version !== "1.3.0") {
95292
- return `Unsupported LTI version: ${version}`;
95293
- }
95294
- return null;
95295
- }
95296
- var init_lti_util = () => {};
95297
-
95298
96069
  // ../api-core/src/utils/lti-provisioning.ts
95299
- import * as crypto4 from "node:crypto";
96070
+ import * as crypto5 from "node:crypto";
95300
96071
  async function provisionLtiUser(db, claims) {
95301
96072
  const database = db;
95302
96073
  const email = claims.email;
@@ -95327,7 +96098,7 @@ async function provisionLtiUser(db, claims) {
95327
96098
  });
95328
96099
  if (!existingLtiAccount) {
95329
96100
  const [account] = await tx.insert(accounts).values({
95330
- id: crypto4.randomUUID(),
96101
+ id: crypto5.randomUUID(),
95331
96102
  userId: existingUser.id,
95332
96103
  accountId: ltiTimebackId,
95333
96104
  providerId,
@@ -95346,7 +96117,7 @@ async function provisionLtiUser(db, claims) {
95346
96117
  setAttribute("app.lti.provision", "linked_account");
95347
96118
  return existingUser;
95348
96119
  }
95349
- const newUserId = crypto4.randomUUID();
96120
+ const newUserId = crypto5.randomUUID();
95350
96121
  const createdUser = await database.transaction(async (tx) => {
95351
96122
  const [insertedUser] = await tx.insert(users).values({
95352
96123
  id: newUserId,
@@ -95361,7 +96132,7 @@ async function provisionLtiUser(db, claims) {
95361
96132
  throw new InternalError("Failed to create user");
95362
96133
  }
95363
96134
  await tx.insert(accounts).values({
95364
- id: crypto4.randomUUID(),
96135
+ id: crypto5.randomUUID(),
95365
96136
  userId: newUserId,
95366
96137
  accountId: ltiTimebackId,
95367
96138
  providerId,
@@ -95471,6 +96242,7 @@ var init_validation_util = __esm(() => {
95471
96242
  // ../api-core/src/utils/index.ts
95472
96243
  var init_utils7 = __esm(() => {
95473
96244
  init_auth_util();
96245
+ init_game_token_util();
95474
96246
  init_assessment_runtime_lock_util();
95475
96247
  init_assessment_artifact_envelope_util();
95476
96248
  init_assessment_artifact_backfill_util();
@@ -95744,6 +96516,9 @@ function createSandboxAuthProvider() {
95744
96516
  return null;
95745
96517
  }
95746
96518
  },
96519
+ async verifyEmbedPartnerToken() {
96520
+ return null;
96521
+ },
95747
96522
  async mintPlatformServiceToken(gameId, studentId) {
95748
96523
  return mintSandboxServiceToken("playcademy-game-metrics", { gameId, studentId });
95749
96524
  },
@@ -110139,7 +110914,7 @@ If you have no idea what this means or what Pirates is, let me explain: Pirates
110139
110914
  import process22 from "process";
110140
110915
  import os2 from "os";
110141
110916
  import tty from "tty";
110142
- import { randomUUID as randomUUID2 } from "crypto";
110917
+ import { randomUUID as randomUUID3 } from "crypto";
110143
110918
  function assembleStyles() {
110144
110919
  const codes = /* @__PURE__ */ new Map;
110145
110920
  for (const [groupName, group] of Object.entries(styles2)) {
@@ -111511,7 +112286,7 @@ function ilike2(column6, value) {
111511
112286
  function notIlike2(column6, value) {
111512
112287
  return sql4`${column6} not ilike ${value}`;
111513
112288
  }
111514
- function arrayContains(column6, values) {
112289
+ function arrayContains2(column6, values) {
111515
112290
  if (Array.isArray(values)) {
111516
112291
  if (values.length === 0) {
111517
112292
  throw new Error("arrayContains requires at least one value");
@@ -112806,7 +113581,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
112806
113581
  __defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
112807
113582
  }
112808
113583
  return to;
112809
- }, __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) => {
113584
+ }, __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) => {
112810
113585
  let isLastCharLower = false;
112811
113586
  let isLastCharUpper = false;
112812
113587
  let isLastLastCharUpper = false;
@@ -112841,7 +113616,7 @@ var __create2, __defProp2, __getOwnPropDesc, __getOwnPropNames2, __getProtoOf2,
112841
113616
  return input.replace(SEPARATORS_AND_IDENTIFIER, (_2, identifier) => toUpperCase(identifier)).replace(NUMBERS_AND_IDENTIFIER, (m) => toUpperCase(m));
112842
113617
  }, generateDrizzleJson = (imports, prevId, schemaFilters, casing2) => {
112843
113618
  const prepared = prepareFromExports(imports);
112844
- const id = randomUUID2();
113619
+ const id = randomUUID3();
112845
113620
  const snapshot = generatePgSnapshot(prepared.tables, prepared.enums, prepared.schemas, prepared.sequences, prepared.roles, prepared.policies, prepared.views, prepared.matViews, casing2, schemaFilters);
112846
113621
  return fillPgSnapshot({
112847
113622
  serialized: snapshot,
@@ -119754,7 +120529,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
119754
120529
  using: stringType2().optional(),
119755
120530
  tablespace: stringType2().optional()
119756
120531
  }).strict();
119757
- table8 = objectType2({
120532
+ table9 = objectType2({
119758
120533
  name: stringType2(),
119759
120534
  schema: stringType2(),
119760
120535
  columns: recordType2(stringType2(), column2),
@@ -119783,7 +120558,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
119783
120558
  gelSchemaExternal = objectType2({
119784
120559
  version: literalType2("1"),
119785
120560
  dialect: literalType2("gel"),
119786
- tables: arrayType2(table8),
120561
+ tables: arrayType2(table9),
119787
120562
  enums: arrayType2(enumSchemaV1),
119788
120563
  schemas: arrayType2(objectType2({ name: stringType2() })),
119789
120564
  _meta: objectType2({
@@ -119795,7 +120570,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);
119795
120570
  gelSchemaInternal = objectType2({
119796
120571
  version: literalType2("1"),
119797
120572
  dialect: literalType2("gel"),
119798
- tables: recordType2(stringType2(), table8),
120573
+ tables: recordType2(stringType2(), table9),
119799
120574
  enums: recordType2(stringType2(), enumSchema),
119800
120575
  schemas: recordType2(stringType2(), stringType2()),
119801
120576
  views: recordType2(stringType2(), view2).default({}),
@@ -132790,7 +133565,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
132790
133565
  ViewBaseConfig2 = Symbol.for("drizzle:ViewBaseConfig");
132791
133566
  }
132792
133567
  });
132793
- init_table8 = __esm2({
133568
+ init_table9 = __esm2({
132794
133569
  "../drizzle-orm/dist/table.js"() {
132795
133570
  init_entity2();
132796
133571
  init_table_utils2();
@@ -132840,7 +133615,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
132840
133615
  init_tracing2();
132841
133616
  init_view_common3();
132842
133617
  init_column2();
132843
- init_table8();
133618
+ init_table9();
132844
133619
  _a21 = entityKind2;
132845
133620
  FakePrimitiveParam = class {
132846
133621
  };
@@ -133186,7 +133961,7 @@ globstar while`, file, fr, pattern, pr, swallowee);
133186
133961
  init_column2();
133187
133962
  init_entity2();
133188
133963
  init_sql5();
133189
- init_table8();
133964
+ init_table9();
133190
133965
  init_view_common3();
133191
133966
  _a28 = entityKind2;
133192
133967
  ColumnAliasProxyHandler2 = class {
@@ -133361,7 +134136,7 @@ params: ${params}`);
133361
134136
  init_entity2();
133362
134137
  init_sql5();
133363
134138
  init_subquery2();
133364
- init_table8();
134139
+ init_table9();
133365
134140
  init_view_common3();
133366
134141
  textDecoder2 = typeof TextDecoder === "undefined" ? null : new TextDecoder;
133367
134142
  }
@@ -134613,7 +135388,7 @@ params: ${params}`);
134613
135388
  init_table22 = __esm2({
134614
135389
  "../drizzle-orm/dist/pg-core/table.js"() {
134615
135390
  init_entity2();
134616
- init_table8();
135391
+ init_table9();
134617
135392
  init_all2();
134618
135393
  InlineForeignKeys2 = Symbol.for("drizzle:PgInlineForeignKeys");
134619
135394
  EnableRLS2 = Symbol.for("drizzle:EnableRLS");
@@ -134673,7 +135448,7 @@ params: ${params}`);
134673
135448
  "../drizzle-orm/dist/sql/expressions/conditions.js"() {
134674
135449
  init_column2();
134675
135450
  init_entity2();
134676
- init_table8();
135451
+ init_table9();
134677
135452
  init_sql5();
134678
135453
  eq2 = (left, right) => {
134679
135454
  return sql4`${left} = ${bindIfParam2(right, left)}`;
@@ -134708,7 +135483,7 @@ params: ${params}`);
134708
135483
  });
134709
135484
  init_relations2 = __esm2({
134710
135485
  "../drizzle-orm/dist/relations.js"() {
134711
- init_table8();
135486
+ init_table9();
134712
135487
  init_column2();
134713
135488
  init_entity2();
134714
135489
  init_primary_keys2();
@@ -134830,7 +135605,7 @@ params: ${params}`);
134830
135605
  and: () => and2,
134831
135606
  applyMixins: () => applyMixins2,
134832
135607
  arrayContained: () => arrayContained,
134833
- arrayContains: () => arrayContains,
135608
+ arrayContains: () => arrayContains2,
134834
135609
  arrayOverlaps: () => arrayOverlaps,
134835
135610
  asc: () => asc2,
134836
135611
  avg: () => avg,
@@ -134922,7 +135697,7 @@ params: ${params}`);
134922
135697
  init_relations2();
134923
135698
  init_sql22();
134924
135699
  init_subquery2();
134925
- init_table8();
135700
+ init_table9();
134926
135701
  init_utils22();
134927
135702
  init_view_common3();
134928
135703
  }
@@ -135181,7 +135956,7 @@ params: ${params}`);
135181
135956
  init_casing2 = __esm2({
135182
135957
  "../drizzle-orm/dist/casing.js"() {
135183
135958
  init_entity2();
135184
- init_table8();
135959
+ init_table9();
135185
135960
  _a135 = entityKind2;
135186
135961
  CasingCache2 = class {
135187
135962
  constructor(casing2) {
@@ -135243,7 +136018,7 @@ params: ${params}`);
135243
136018
  init_sql22();
135244
136019
  init_sql5();
135245
136020
  init_subquery2();
135246
- init_table8();
136021
+ init_table9();
135247
136022
  init_utils22();
135248
136023
  init_view_common3();
135249
136024
  init_view_base2();
@@ -135827,7 +136602,7 @@ params: ${params}`);
135827
136602
  init_selection_proxy2();
135828
136603
  init_sql5();
135829
136604
  init_subquery2();
135830
- init_table8();
136605
+ init_table9();
135831
136606
  init_tracing2();
135832
136607
  init_utils22();
135833
136608
  init_utils22();
@@ -136448,7 +137223,7 @@ params: ${params}`);
136448
137223
  init_table22();
136449
137224
  init_sql5();
136450
137225
  init_subquery2();
136451
- init_table8();
137226
+ init_table9();
136452
137227
  init_view_common3();
136453
137228
  init_checks6();
136454
137229
  init_foreign_keys2();
@@ -136465,7 +137240,7 @@ params: ${params}`);
136465
137240
  init_entity2();
136466
137241
  init_query_promise2();
136467
137242
  init_selection_proxy2();
136468
- init_table8();
137243
+ init_table9();
136469
137244
  init_tracing2();
136470
137245
  init_utils22();
136471
137246
  init_utils42();
@@ -136535,7 +137310,7 @@ params: ${params}`);
136535
137310
  init_query_promise2();
136536
137311
  init_selection_proxy2();
136537
137312
  init_sql5();
136538
- init_table8();
137313
+ init_table9();
136539
137314
  init_tracing2();
136540
137315
  init_utils22();
136541
137316
  init_utils42();
@@ -136730,7 +137505,7 @@ params: ${params}`);
136730
137505
  init_selection_proxy2();
136731
137506
  init_sql5();
136732
137507
  init_subquery2();
136733
- init_table8();
137508
+ init_table9();
136734
137509
  init_utils22();
136735
137510
  init_view_common3();
136736
137511
  init_utils42();
@@ -139532,7 +140307,7 @@ ORDER BY
139532
140307
  init_table32 = __esm2({
139533
140308
  "../drizzle-orm/dist/sqlite-core/table.js"() {
139534
140309
  init_entity2();
139535
- init_table8();
140310
+ init_table9();
139536
140311
  init_all22();
139537
140312
  InlineForeignKeys22 = Symbol.for("drizzle:SQLiteInlineForeignKeys");
139538
140313
  SQLiteTable = class extends (_e32 = Table2, _d3 = entityKind2, _c7 = Table2.Symbol.Columns, _b151 = InlineForeignKeys22, _a207 = Table2.Symbol.ExtraConfigBuilder, _e32) {
@@ -139634,7 +140409,7 @@ ORDER BY
139634
140409
  init_entity2();
139635
140410
  init_sql5();
139636
140411
  init_subquery2();
139637
- init_table8();
140412
+ init_table9();
139638
140413
  init_view_common3();
139639
140414
  init_checks22();
139640
140415
  init_foreign_keys22();
@@ -139650,7 +140425,7 @@ ORDER BY
139650
140425
  init_query_promise2();
139651
140426
  init_selection_proxy2();
139652
140427
  init_table32();
139653
- init_table8();
140428
+ init_table9();
139654
140429
  init_utils22();
139655
140430
  init_utils72();
139656
140431
  SQLiteDeleteBase = class extends (_b152 = QueryPromise2, _a213 = entityKind2, _b152) {
@@ -139745,7 +140520,7 @@ ORDER BY
139745
140520
  init_columns22();
139746
140521
  init_table32();
139747
140522
  init_subquery2();
139748
- init_table8();
140523
+ init_table9();
139749
140524
  init_utils22();
139750
140525
  init_view_common3();
139751
140526
  init_view_base22();
@@ -140323,7 +141098,7 @@ ORDER BY
140323
141098
  init_selection_proxy2();
140324
141099
  init_sql5();
140325
141100
  init_subquery2();
140326
- init_table8();
141101
+ init_table9();
140327
141102
  init_utils22();
140328
141103
  init_view_common3();
140329
141104
  init_utils72();
@@ -140686,7 +141461,7 @@ ORDER BY
140686
141461
  init_query_promise2();
140687
141462
  init_sql5();
140688
141463
  init_table32();
140689
- init_table8();
141464
+ init_table9();
140690
141465
  init_utils22();
140691
141466
  init_utils72();
140692
141467
  init_query_builder32();
@@ -140809,7 +141584,7 @@ ORDER BY
140809
141584
  init_selection_proxy2();
140810
141585
  init_table32();
140811
141586
  init_subquery2();
140812
- init_table8();
141587
+ init_table9();
140813
141588
  init_utils22();
140814
141589
  init_view_common3();
140815
141590
  init_utils72();
@@ -143417,7 +144192,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
143417
144192
  init_table42 = __esm2({
143418
144193
  "../drizzle-orm/dist/mysql-core/table.js"() {
143419
144194
  init_entity2();
143420
- init_table8();
144195
+ init_table9();
143421
144196
  init_all3();
143422
144197
  InlineForeignKeys3 = Symbol.for("drizzle:MySqlInlineForeignKeys");
143423
144198
  MySqlTable = class extends (_e4 = Table2, _d4 = entityKind2, _c10 = Table2.Symbol.Columns, _b238 = InlineForeignKeys3, _a319 = Table2.Symbol.ExtraConfigBuilder, _e4) {
@@ -143480,7 +144255,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
143480
144255
  init_entity2();
143481
144256
  init_dist9();
143482
144257
  init_subquery2();
143483
- init_table8();
144258
+ init_table9();
143484
144259
  init_view_common3();
143485
144260
  init_checks32();
143486
144261
  init_foreign_keys3();
@@ -143496,7 +144271,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
143496
144271
  init_entity2();
143497
144272
  init_query_promise2();
143498
144273
  init_selection_proxy2();
143499
- init_table8();
144274
+ init_table9();
143500
144275
  init_utils82();
143501
144276
  MySqlDeleteBase = class extends (_b239 = QueryPromise2, _a3222 = entityKind2, _b239) {
143502
144277
  constructor(table6, session, dialect6, withList) {
@@ -143576,7 +144351,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
143576
144351
  init_expressions2();
143577
144352
  init_sql5();
143578
144353
  init_subquery2();
143579
- init_table8();
144354
+ init_table9();
143580
144355
  init_utils22();
143581
144356
  init_view_common3();
143582
144357
  init_common4();
@@ -144342,7 +145117,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
144342
145117
  init_selection_proxy2();
144343
145118
  init_sql5();
144344
145119
  init_subquery2();
144345
- init_table8();
145120
+ init_table9();
144346
145121
  init_utils22();
144347
145122
  init_view_common3();
144348
145123
  init_utils82();
@@ -144742,7 +145517,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
144742
145517
  init_entity2();
144743
145518
  init_query_promise2();
144744
145519
  init_sql5();
144745
- init_table8();
145520
+ init_table9();
144746
145521
  init_utils22();
144747
145522
  init_utils82();
144748
145523
  init_query_builder4();
@@ -144846,7 +145621,7 @@ ${withStyle.errorWarning(`We've found duplicated view name across ${source_defau
144846
145621
  init_entity2();
144847
145622
  init_query_promise2();
144848
145623
  init_selection_proxy2();
144849
- init_table8();
145624
+ init_table9();
144850
145625
  init_utils22();
144851
145626
  init_utils82();
144852
145627
  _a331 = entityKind2;
@@ -147654,7 +148429,7 @@ AND
147654
148429
  init_table52 = __esm2({
147655
148430
  "../drizzle-orm/dist/singlestore-core/table.js"() {
147656
148431
  init_entity2();
147657
- init_table8();
148432
+ init_table9();
147658
148433
  init_all4();
147659
148434
  SingleStoreTable = class extends (_d5 = Table2, _c13 = entityKind2, _b319 = Table2.Symbol.Columns, _a419 = Table2.Symbol.ExtraConfigBuilder, _d5) {
147660
148435
  constructor() {
@@ -147705,7 +148480,7 @@ AND
147705
148480
  init_entity2();
147706
148481
  init_sql5();
147707
148482
  init_subquery2();
147708
- init_table8();
148483
+ init_table9();
147709
148484
  init_indexes4();
147710
148485
  init_primary_keys4();
147711
148486
  init_table52();
@@ -147717,7 +148492,7 @@ AND
147717
148492
  init_entity2();
147718
148493
  init_query_promise2();
147719
148494
  init_selection_proxy2();
147720
- init_table8();
148495
+ init_table9();
147721
148496
  init_utils10();
147722
148497
  SingleStoreDeleteBase = class extends (_b320 = QueryPromise2, _a422 = entityKind2, _b320) {
147723
148498
  constructor(table6, session, dialect6, withList) {
@@ -147782,7 +148557,7 @@ AND
147782
148557
  init_entity2();
147783
148558
  init_query_promise2();
147784
148559
  init_sql5();
147785
- init_table8();
148560
+ init_table9();
147786
148561
  init_utils22();
147787
148562
  init_utils10();
147788
148563
  _a423 = entityKind2;
@@ -147880,7 +148655,7 @@ AND
147880
148655
  init_expressions2();
147881
148656
  init_sql5();
147882
148657
  init_subquery2();
147883
- init_table8();
148658
+ init_table9();
147884
148659
  init_utils22();
147885
148660
  init_view_common3();
147886
148661
  init_common5();
@@ -148411,7 +149186,7 @@ AND
148411
149186
  init_selection_proxy2();
148412
149187
  init_sql5();
148413
149188
  init_subquery2();
148414
- init_table8();
149189
+ init_table9();
148415
149190
  init_utils22();
148416
149191
  init_utils10();
148417
149192
  _a426 = entityKind2;
@@ -148780,7 +149555,7 @@ AND
148780
149555
  init_entity2();
148781
149556
  init_query_promise2();
148782
149557
  init_selection_proxy2();
148783
- init_table8();
149558
+ init_table9();
148784
149559
  init_utils22();
148785
149560
  init_utils10();
148786
149561
  _a430 = entityKind2;
@@ -151390,6 +152165,114 @@ var init_domain_controller = __esm(() => {
151390
152165
  });
151391
152166
  });
151392
152167
 
152168
+ // ../api-core/src/controllers/embed.controller.ts
152169
+ function requireUuidParam(value, name2) {
152170
+ if (!value) {
152171
+ throw ApiError.badRequest(`Missing ${name2}`);
152172
+ }
152173
+ if (!isValidUUID(value)) {
152174
+ throw ApiError.unprocessableEntity(`${name2} must be a valid UUID format`);
152175
+ }
152176
+ return value;
152177
+ }
152178
+ function bearerToken(request) {
152179
+ const header = request.headers.get("Authorization");
152180
+ return header?.startsWith("Bearer ") ? header.slice("Bearer ".length) : "";
152181
+ }
152182
+ async function requirePartner(ctx) {
152183
+ const token = bearerToken(ctx.request);
152184
+ const verified = token ? await ctx.providers.auth.verifyEmbedPartnerToken(token) : null;
152185
+ if (!verified) {
152186
+ throw ApiError.unauthorized("A valid embed partner access token is required");
152187
+ }
152188
+ return ctx.services.embed.getPartnerByClientId(verified.clientId);
152189
+ }
152190
+ async function requireEmbedAdmin(ctx) {
152191
+ const expected = ctx.config.embedAdminToken;
152192
+ if (!expected) {
152193
+ throw ApiError.serviceUnavailable("Embed partner management is not configured");
152194
+ }
152195
+ const token = bearerToken(ctx.request);
152196
+ const [given, wanted] = token ? await Promise.all([sha256Hex(token), sha256Hex(expected)]) : [];
152197
+ if (!given || given !== wanted) {
152198
+ throw ApiError.unauthorized("A valid embed admin token is required");
152199
+ }
152200
+ }
152201
+ function requireClientIdParam(ctx) {
152202
+ const clientId = EmbedPartnerClientIdSchema.safeParse(ctx.params.clientId);
152203
+ if (!clientId.success) {
152204
+ throw ApiError.badRequest("Missing or invalid clientId");
152205
+ }
152206
+ return clientId.data;
152207
+ }
152208
+ async function createLaunch(ctx) {
152209
+ const partner = await requirePartner(ctx);
152210
+ const body2 = await parseRequestBody(ctx.request, CreateEmbedLaunchSchema);
152211
+ const launch = await ctx.services.embed.createLaunch(partner, body2);
152212
+ return {
152213
+ launchId: launch.launchId,
152214
+ pass: launch.pass,
152215
+ passExpiresAt: launch.passExpiresAt.toISOString(),
152216
+ embedUrl: embedPageUrl(ctx.url.origin, launch.gameSlug, body2.parentOrigin)
152217
+ };
152218
+ }
152219
+ async function renewToken(ctx) {
152220
+ const partner = await requirePartner(ctx);
152221
+ const launchId = requireUuidParam(ctx.params.launchId, "launchId");
152222
+ return withTunnelUrl(ctx, await ctx.services.embed.renewToken(partner, launchId));
152223
+ }
152224
+ async function redeemPass(ctx) {
152225
+ const body2 = await parseRequestBody(ctx.request, RedeemEmbedPassSchema);
152226
+ const launch = await ctx.services.embed.redeemLaunch(body2, ctx.request.headers.get(PLAYCADEMY_BROWSER_TIME_ZONE_HEADER));
152227
+ return {
152228
+ launchId: launch.launchId,
152229
+ token: await withTunnelUrl(ctx, launch.token),
152230
+ userId: launch.user.id,
152231
+ game: launch.game,
152232
+ timebackCourseId: launch.timebackCourseId,
152233
+ localDay: launch.profile.localDay,
152234
+ timeback: launch.profile.timeback
152235
+ };
152236
+ }
152237
+ async function ensurePartner(ctx) {
152238
+ await requireEmbedAdmin(ctx);
152239
+ const clientId = requireClientIdParam(ctx);
152240
+ const body2 = await parseRequestBody(ctx.request, EnsureEmbedPartnerSchema);
152241
+ return ctx.services.embedPartner.ensurePartner(clientId, body2.name);
152242
+ }
152243
+ async function addPartnerOrigin(ctx) {
152244
+ await requireEmbedAdmin(ctx);
152245
+ const clientId = requireClientIdParam(ctx);
152246
+ const body2 = await parseRequestBody(ctx.request, AddEmbedPartnerOriginSchema);
152247
+ return ctx.services.embedPartner.addOrigin(clientId, body2.origin);
152248
+ }
152249
+ async function removePartnerOrigin(ctx) {
152250
+ await requireEmbedAdmin(ctx);
152251
+ const clientId = requireClientIdParam(ctx);
152252
+ const origin = EmbedOriginSchema.safeParse(ctx.url.searchParams.get("origin"));
152253
+ if (!origin.success) {
152254
+ throw ApiError.badRequest("Missing or invalid origin");
152255
+ }
152256
+ return ctx.services.embedPartner.removeOrigin(clientId, origin.data);
152257
+ }
152258
+ var embed2;
152259
+ var init_embed_controller = __esm(() => {
152260
+ init_src();
152261
+ init_schemas_index();
152262
+ init_src9();
152263
+ init_errors2();
152264
+ init_utils7();
152265
+ init_embed_util();
152266
+ embed2 = defineControllerNames("embed", {
152267
+ addPartnerOrigin,
152268
+ createLaunch,
152269
+ ensurePartner,
152270
+ redeemPass,
152271
+ removePartnerOrigin,
152272
+ renewToken
152273
+ });
152274
+ });
152275
+
151393
152276
  // ../api-core/src/controllers/game-member.controller.ts
151394
152277
  function requireUserId2(userId) {
151395
152278
  if (!userId) {
@@ -151919,7 +152802,6 @@ var MintTokenBody, mintToken, sessions2;
151919
152802
  var init_session_controller = __esm(() => {
151920
152803
  init_esm();
151921
152804
  init_spans();
151922
- init_tunnel();
151923
152805
  init_errors2();
151924
152806
  init_utils7();
151925
152807
  MintTokenBody = objectType({
@@ -151935,14 +152817,7 @@ var init_session_controller = __esm(() => {
151935
152817
  reason = MintTokenBody.parse(await ctx.request.clone().json()).reason;
151936
152818
  } catch {}
151937
152819
  setAttribute("app.token.reason", reason ?? "initial");
151938
- const { token, exp } = await ctx.services.session.mintToken(gameIdOrSlug, ctx.user.id);
151939
- let baseUrl;
151940
- if (ctx.config.isLocal) {
151941
- try {
151942
- baseUrl = await getTunnelUrl(ctx.config.baseUrl);
151943
- } catch {}
151944
- }
151945
- return { token, exp, baseUrl };
152820
+ return withTunnelUrl(ctx, await ctx.services.session.mintToken(gameIdOrSlug, ctx.user.id));
151946
152821
  });
151947
152822
  sessions2 = defineControllerNames("sessions", {
151948
152823
  mintToken
@@ -152000,7 +152875,7 @@ function parseQtiLibraryParams(searchParams) {
152000
152875
  limit
152001
152876
  };
152002
152877
  }
152003
- 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;
152878
+ 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;
152004
152879
  var init_timeback_controller = __esm(() => {
152005
152880
  init_esm();
152006
152881
  init_src();
@@ -152079,6 +152954,27 @@ var init_timeback_controller = __esm(() => {
152079
152954
  const body2 = await parseRequestBody(ctx.request, CreateGameTimebackIntegrationRequestSchema);
152080
152955
  return ctx.services.timeback.createIntegration(gameId, ctx.user, body2);
152081
152956
  });
152957
+ getHoleFillingCourses = requireGameManagementAccess(async (ctx) => {
152958
+ const gameId = ctx.params.gameId;
152959
+ if (!gameId) {
152960
+ throw ApiError.badRequest("Missing gameId");
152961
+ }
152962
+ if (!isValidUUID(gameId)) {
152963
+ throw ApiError.unprocessableEntity("Invalid gameId format");
152964
+ }
152965
+ return ctx.services.timeback.getHoleFillingCourses(gameId, ctx.user);
152966
+ });
152967
+ createHoleFillingCourse = requireDeveloper(async (ctx) => {
152968
+ const gameId = ctx.params.gameId;
152969
+ if (!gameId) {
152970
+ throw ApiError.badRequest("Missing gameId");
152971
+ }
152972
+ if (!isValidUUID(gameId)) {
152973
+ throw ApiError.unprocessableEntity("Invalid gameId format");
152974
+ }
152975
+ const body2 = await parseRequestBody(ctx.request, CreateGameTimebackHoleFillingCourseRequestSchema);
152976
+ return ctx.services.timeback.createHoleFillingCourse(gameId, ctx.user, body2);
152977
+ });
152082
152978
  updateIntegration = requireDeveloper(async (ctx) => {
152083
152979
  const { gameId, courseId } = ctx.params;
152084
152980
  if (!gameId || !courseId) {
@@ -152863,6 +153759,8 @@ var init_timeback_controller = __esm(() => {
152863
153759
  getIntegrations,
152864
153760
  getRemovedIntegrations,
152865
153761
  createIntegration,
153762
+ getHoleFillingCourses,
153763
+ createHoleFillingCourse,
152866
153764
  updateIntegration,
152867
153765
  deactivateCourse,
152868
153766
  reactivateCourse,
@@ -153006,6 +153904,7 @@ var init_controllers = __esm(() => {
153006
153904
  init_deployment_state_controller();
153007
153905
  init_developer_controller();
153008
153906
  init_domain_controller();
153907
+ init_embed_controller();
153009
153908
  init_game_member_controller();
153010
153909
  init_game_controller();
153011
153910
  init_kv_controller();
@@ -153250,7 +154149,7 @@ var init_crud = __esm(async () => {
153250
154149
  });
153251
154150
 
153252
154151
  // src/routes/platform/games/uploads.ts
153253
- import { randomUUID as randomUUID3 } from "node:crypto";
154152
+ import { randomUUID as randomUUID4 } from "node:crypto";
153254
154153
  async function initiateHandler(c) {
153255
154154
  const user = c.get("user");
153256
154155
  if (!user) {
@@ -153270,7 +154169,7 @@ async function initiateHandler(c) {
153270
154169
  }
153271
154170
  }, 422);
153272
154171
  }
153273
- const uploadToken = `sandbox-upload-${randomUUID3()}`;
154172
+ const uploadToken = `sandbox-upload-${randomUUID4()}`;
153274
154173
  const version = `v${Date.now()}`;
153275
154174
  pendingUploads.set(uploadToken, {
153276
154175
  gameId: body2.gameId,