@prairielearn/migrations 5.0.4 → 5.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @prairielearn/migrations
2
2
 
3
+ ## 5.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - 382dbd8: Bump dependencies
8
+
3
9
  ## 5.0.4
4
10
 
5
11
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- export declare const BatchedMigrationJobStatusSchema: z.ZodEnum<["pending", "failed", "succeeded"]>;
2
+ declare const BatchedMigrationJobStatusSchema: z.ZodEnum<["pending", "failed", "succeeded"]>;
3
3
  export type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;
4
4
  export declare const BatchedMigrationJobRowSchema: z.ZodObject<{
5
5
  id: z.ZodString;
@@ -40,4 +40,5 @@ export declare const BatchedMigrationJobRowSchema: z.ZodObject<{
40
40
  }>;
41
41
  export type BatchedMigrationJobRow = z.infer<typeof BatchedMigrationJobRowSchema>;
42
42
  export declare function selectRecentJobsWithStatus(batchedMigrationId: string, status: BatchedMigrationJobStatus, limit: number): Promise<BatchedMigrationJobRow[]>;
43
+ export {};
43
44
  //# sourceMappingURL=batched-migration-job.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batched-migration-job.d.ts","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,+BAA+B,+CAA6C,CAAC;AAC1F,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,wBAAsB,0BAA0B,CAC9C,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,yBAAyB,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAMnC","sourcesContent":["import { z } from 'zod';\n\nimport { loadSqlEquiv, queryRows } from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);\nexport type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;\n\nexport const BatchedMigrationJobRowSchema = z.object({\n id: z.string(),\n batched_migration_id: z.string(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationJobStatusSchema,\n attempts: z.number(),\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n finished_at: z.date().nullable(),\n data: z.unknown(),\n});\nexport type BatchedMigrationJobRow = z.infer<typeof BatchedMigrationJobRowSchema>;\n\nexport async function selectRecentJobsWithStatus(\n batchedMigrationId: string,\n status: BatchedMigrationJobStatus,\n limit: number,\n): Promise<BatchedMigrationJobRow[]> {\n return await queryRows(\n sql.select_recent_jobs_with_status,\n { batched_migration_id: batchedMigrationId, status, limit },\n BatchedMigrationJobRowSchema,\n );\n}\n"]}
1
+ {"version":3,"file":"batched-migration-job.d.ts","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,QAAA,MAAM,+BAA+B,+CAA6C,CAAC;AACnF,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,wBAAsB,0BAA0B,CAC9C,kBAAkB,EAAE,MAAM,EAC1B,MAAM,EAAE,yBAAyB,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAMnC","sourcesContent":["import { z } from 'zod';\n\nimport { loadSqlEquiv, queryRows } from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nconst BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);\nexport type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;\n\nexport const BatchedMigrationJobRowSchema = z.object({\n id: z.string(),\n batched_migration_id: z.string(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationJobStatusSchema,\n attempts: z.number(),\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n finished_at: z.date().nullable(),\n data: z.unknown(),\n});\nexport type BatchedMigrationJobRow = z.infer<typeof BatchedMigrationJobRowSchema>;\n\nexport async function selectRecentJobsWithStatus(\n batchedMigrationId: string,\n status: BatchedMigrationJobStatus,\n limit: number,\n): Promise<BatchedMigrationJobRow[]> {\n return await queryRows(\n sql.select_recent_jobs_with_status,\n { batched_migration_id: batchedMigrationId, status, limit },\n BatchedMigrationJobRowSchema,\n );\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { loadSqlEquiv, queryRows } from '@prairielearn/postgres';
3
3
  const sql = loadSqlEquiv(import.meta.filename);
4
- export const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);
4
+ const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);
5
5
  export const BatchedMigrationJobRowSchema = z.object({
6
6
  id: z.string(),
7
7
  batched_migration_id: z.string(),
@@ -1 +1 @@
1
- {"version":3,"file":"batched-migration-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C;AACJ,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { loadSqlEquiv, queryRows } from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);\nexport type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;\n\nexport const BatchedMigrationJobRowSchema = z.object({\n id: z.string(),\n batched_migration_id: z.string(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationJobStatusSchema,\n attempts: z.number(),\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n finished_at: z.date().nullable(),\n data: z.unknown(),\n});\nexport type BatchedMigrationJobRow = z.infer<typeof BatchedMigrationJobRowSchema>;\n\nexport async function selectRecentJobsWithStatus(\n batchedMigrationId: string,\n status: BatchedMigrationJobStatus,\n limit: number,\n): Promise<BatchedMigrationJobRow[]> {\n return await queryRows(\n sql.select_recent_jobs_with_status,\n { batched_migration_id: batchedMigrationId, status, limit },\n BatchedMigrationJobRowSchema,\n );\n}\n"]}
1
+ {"version":3,"file":"batched-migration-job.js","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE/C,MAAM,+BAA+B,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC;AAGnF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,MAAM,EAAE,+BAA+B;IACvC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC/B,WAAW,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAChC,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;CAClB,CAAC,CAAC;AAGH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,kBAA0B,EAC1B,MAAiC,EACjC,KAAa;IAEb,OAAO,MAAM,SAAS,CACpB,GAAG,CAAC,8BAA8B,EAClC,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,EAC3D,4BAA4B,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { loadSqlEquiv, queryRows } from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nconst BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);\nexport type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;\n\nexport const BatchedMigrationJobRowSchema = z.object({\n id: z.string(),\n batched_migration_id: z.string(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationJobStatusSchema,\n attempts: z.number(),\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n finished_at: z.date().nullable(),\n data: z.unknown(),\n});\nexport type BatchedMigrationJobRow = z.infer<typeof BatchedMigrationJobRowSchema>;\n\nexport async function selectRecentJobsWithStatus(\n batchedMigrationId: string,\n status: BatchedMigrationJobStatus,\n limit: number,\n): Promise<BatchedMigrationJobRow[]> {\n return await queryRows(\n sql.select_recent_jobs_with_status,\n { batched_migration_id: batchedMigrationId, status, limit },\n BatchedMigrationJobRowSchema,\n );\n}\n"]}
@@ -39,7 +39,7 @@ export declare const BatchedMigrationRowSchema: z.ZodObject<{
39
39
  started_at: Date | null;
40
40
  }>;
41
41
  export type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;
42
- export interface BatchedMigrationParameters {
42
+ interface BatchedMigrationParameters {
43
43
  min?: bigint | string | null;
44
44
  max: bigint | string | null;
45
45
  batchSize?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"batched-migration.d.ts","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,4BAA4B,kFAOvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,8BAA8B,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAGxF;AAED,wBAAgB,sCAAsC,CACpD,GAAG,EAAE,8BAA8B,GAClC,OAAO,CAAC,GAAG,IAAI,8BAA8B,CAO/C;AAED,KAAK,mBAAmB,GAAG,IAAI,CAC7B,mBAAmB,EACnB,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,CAC3F,CAAC;AAEF;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,mBAAmB,GAC7B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAErC;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;KAE/D;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED,wBAAsB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhG","sourcesContent":["import { z } from 'zod';\n\nimport {\n execute,\n loadSqlEquiv,\n queryOptionalRow,\n queryRow,\n queryRows,\n} from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationStatusSchema = z.enum([\n 'pending',\n 'paused',\n 'running',\n 'finalizing',\n 'failed',\n 'succeeded',\n]);\nexport type BatchedMigrationStatus = z.infer<typeof BatchedMigrationStatusSchema>;\n\nexport const BatchedMigrationRowSchema = z.object({\n id: z.string(),\n project: z.string(),\n filename: z.string(),\n timestamp: z.string(),\n batch_size: z.number(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationStatusSchema,\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n});\nexport type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;\n\nexport interface BatchedMigrationParameters {\n min?: bigint | string | null;\n max: bigint | string | null;\n batchSize?: number;\n}\n\nexport interface BatchedMigrationImplementation {\n getParameters(): Promise<BatchedMigrationParameters>;\n execute(start: bigint, end: bigint): Promise<void>;\n}\n\n/**\n * Identity function that helps to write correct batched migrations.\n */\nexport function makeBatchedMigration<T extends BatchedMigrationImplementation>(fns: T): T {\n validateBatchedMigrationImplementation(fns);\n return fns;\n}\n\nexport function validateBatchedMigrationImplementation(\n fns: BatchedMigrationImplementation,\n): asserts fns is BatchedMigrationImplementation {\n if (typeof fns.getParameters !== 'function') {\n throw new Error('getParameters() must be a function');\n }\n if (typeof fns.execute !== 'function') {\n throw new Error('execute() must be a function');\n }\n}\n\ntype NewBatchedMigration = Pick<\n BatchedMigrationRow,\n 'project' | 'filename' | 'timestamp' | 'batch_size' | 'min_value' | 'max_value' | 'status'\n>;\n\n/**\n * Inserts a new batched migration. If one already exists for the given\n * project/timestamp pair, returns null, otherwise returns the inserted row.\n */\nexport async function insertBatchedMigration(\n migration: NewBatchedMigration,\n): Promise<BatchedMigrationRow | null> {\n return await queryOptionalRow(sql.insert_batched_migration, migration, BatchedMigrationRowSchema);\n}\n\nexport async function selectAllBatchedMigrations(project: string) {\n return await queryRows(sql.select_all_batched_migrations, { project }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigration(\n project: string,\n id: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(sql.select_batched_migration, { project, id }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigrationForTimestamp(\n project: string,\n timestamp: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.select_batched_migration_for_timestamp,\n { project, timestamp },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function updateBatchedMigrationStatus(\n id: string,\n status: BatchedMigrationStatus,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.update_batched_migration_status,\n { id, status },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function retryFailedBatchedMigrationJobs(project: string, id: string): Promise<void> {\n await execute(sql.retry_failed_jobs, { project, id });\n}\n"]}
1
+ {"version":3,"file":"batched-migration.d.ts","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,4BAA4B,kFAOvC,CAAC;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYpC,CAAC;AACH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,UAAU,0BAA0B;IAClC,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACrD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,8BAA8B,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAGxF;AAED,wBAAgB,sCAAsC,CACpD,GAAG,EAAE,8BAA8B,GAClC,OAAO,CAAC,GAAG,IAAI,8BAA8B,CAO/C;AAED,KAAK,mBAAmB,GAAG,IAAI,CAC7B,mBAAmB,EACnB,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,CAC3F,CAAC;AAEF;;;GAGG;AACH,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,mBAAmB,GAC7B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAErC;AAED,wBAAsB,0BAA0B,CAAC,OAAO,EAAE,MAAM;;;;;;;;;;;;KAE/D;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,mBAAmB,CAAC,CAE9B;AAED,wBAAsB,kCAAkC,CACtD,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,CAM9B;AAED,wBAAsB,+BAA+B,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEhG","sourcesContent":["import { z } from 'zod';\n\nimport {\n execute,\n loadSqlEquiv,\n queryOptionalRow,\n queryRow,\n queryRows,\n} from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationStatusSchema = z.enum([\n 'pending',\n 'paused',\n 'running',\n 'finalizing',\n 'failed',\n 'succeeded',\n]);\nexport type BatchedMigrationStatus = z.infer<typeof BatchedMigrationStatusSchema>;\n\nexport const BatchedMigrationRowSchema = z.object({\n id: z.string(),\n project: z.string(),\n filename: z.string(),\n timestamp: z.string(),\n batch_size: z.number(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationStatusSchema,\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n});\nexport type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;\n\ninterface BatchedMigrationParameters {\n min?: bigint | string | null;\n max: bigint | string | null;\n batchSize?: number;\n}\n\nexport interface BatchedMigrationImplementation {\n getParameters(): Promise<BatchedMigrationParameters>;\n execute(start: bigint, end: bigint): Promise<void>;\n}\n\n/**\n * Identity function that helps to write correct batched migrations.\n */\nexport function makeBatchedMigration<T extends BatchedMigrationImplementation>(fns: T): T {\n validateBatchedMigrationImplementation(fns);\n return fns;\n}\n\nexport function validateBatchedMigrationImplementation(\n fns: BatchedMigrationImplementation,\n): asserts fns is BatchedMigrationImplementation {\n if (typeof fns.getParameters !== 'function') {\n throw new Error('getParameters() must be a function');\n }\n if (typeof fns.execute !== 'function') {\n throw new Error('execute() must be a function');\n }\n}\n\ntype NewBatchedMigration = Pick<\n BatchedMigrationRow,\n 'project' | 'filename' | 'timestamp' | 'batch_size' | 'min_value' | 'max_value' | 'status'\n>;\n\n/**\n * Inserts a new batched migration. If one already exists for the given\n * project/timestamp pair, returns null, otherwise returns the inserted row.\n */\nexport async function insertBatchedMigration(\n migration: NewBatchedMigration,\n): Promise<BatchedMigrationRow | null> {\n return await queryOptionalRow(sql.insert_batched_migration, migration, BatchedMigrationRowSchema);\n}\n\nexport async function selectAllBatchedMigrations(project: string) {\n return await queryRows(sql.select_all_batched_migrations, { project }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigration(\n project: string,\n id: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(sql.select_batched_migration, { project, id }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigrationForTimestamp(\n project: string,\n timestamp: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.select_batched_migration_for_timestamp,\n { project, timestamp },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function updateBatchedMigrationStatus(\n id: string,\n status: BatchedMigrationStatus,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.update_batched_migration_status,\n { id, status },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function retryFailedBatchedMigrationJobs(project: string, id: string): Promise<void> {\n await execute(sql.retry_failed_jobs, { project, id });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"batched-migration.js","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,SAAS,GACV,MAAM,wBAAwB,CAAC;AAEhC,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,IAAI,CAAC;IACjD,SAAS;IACT,QAAQ;IACR,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,WAAW;CACZ,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACrC,MAAM,EAAE,4BAA4B;IACpC,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,IAAI,EAAE;IACpB,UAAU,EAAE,CAAC,CAAC,IA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EACV,MAA8B;IAE9B,OAAO,MAAM,QAAQ,CACnB,GAAG,CAAC,+BAA+B,EACnC,EAAE,EAAE,EAAE,MAAM,EAAE,EACd,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,OAAe,EAAE,EAAU;IAC/E,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport {\n execute,\n loadSqlEquiv,\n queryOptionalRow,\n queryRow,\n queryRows,\n} from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationStatusSchema = z.enum([\n 'pending',\n 'paused',\n 'running',\n 'finalizing',\n 'failed',\n 'succeeded',\n]);\nexport type BatchedMigrationStatus = z.infer<typeof BatchedMigrationStatusSchema>;\n\nexport const BatchedMigrationRowSchema = z.object({\n id: z.string(),\n project: z.string(),\n filename: z.string(),\n timestamp: z.string(),\n batch_size: z.number(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationStatusSchema,\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n});\nexport type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;\n\nexport interface BatchedMigrationParameters {\n min?: bigint | string | null;\n max: bigint | string | null;\n batchSize?: number;\n}\n\nexport interface BatchedMigrationImplementation {\n getParameters(): Promise<BatchedMigrationParameters>;\n execute(start: bigint, end: bigint): Promise<void>;\n}\n\n/**\n * Identity function that helps to write correct batched migrations.\n */\nexport function makeBatchedMigration<T extends BatchedMigrationImplementation>(fns: T): T {\n validateBatchedMigrationImplementation(fns);\n return fns;\n}\n\nexport function validateBatchedMigrationImplementation(\n fns: BatchedMigrationImplementation,\n): asserts fns is BatchedMigrationImplementation {\n if (typeof fns.getParameters !== 'function') {\n throw new Error('getParameters() must be a function');\n }\n if (typeof fns.execute !== 'function') {\n throw new Error('execute() must be a function');\n }\n}\n\ntype NewBatchedMigration = Pick<\n BatchedMigrationRow,\n 'project' | 'filename' | 'timestamp' | 'batch_size' | 'min_value' | 'max_value' | 'status'\n>;\n\n/**\n * Inserts a new batched migration. If one already exists for the given\n * project/timestamp pair, returns null, otherwise returns the inserted row.\n */\nexport async function insertBatchedMigration(\n migration: NewBatchedMigration,\n): Promise<BatchedMigrationRow | null> {\n return await queryOptionalRow(sql.insert_batched_migration, migration, BatchedMigrationRowSchema);\n}\n\nexport async function selectAllBatchedMigrations(project: string) {\n return await queryRows(sql.select_all_batched_migrations, { project }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigration(\n project: string,\n id: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(sql.select_batched_migration, { project, id }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigrationForTimestamp(\n project: string,\n timestamp: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.select_batched_migration_for_timestamp,\n { project, timestamp },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function updateBatchedMigrationStatus(\n id: string,\n status: BatchedMigrationStatus,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.update_batched_migration_status,\n { id, status },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function retryFailedBatchedMigrationJobs(project: string, id: string): Promise<void> {\n await execute(sql.retry_failed_jobs, { project, id });\n}\n"]}
1
+ {"version":3,"file":"batched-migration.js","sourceRoot":"","sources":["../../src/batched-migrations/batched-migration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,QAAQ,EACR,SAAS,GACV,MAAM,wBAAwB,CAAC;AAEhC,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAE/C,MAAM,CAAC,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,SAA8B;IAE9B,OAAO,MAAM,gBAAgB,CAAC,GAAG,CAAC,wBAAwB,EAAE,SAAS,EAAE,yBAAyB,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,OAAe;IAC9D,OAAO,MAAM,SAAS,CAAC,GAAG,CAAC,6BAA6B,EAAE,EAAE,OAAO,EAAE,EAAE,yBAAyB,CAAC,CAAC;AACpG,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,OAAe,EACf,EAAU;IAEV,OAAO,MAAM,QAAQ,CAAC,GAAG,CAAC,wBAAwB,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,yBAAyB,CAAC,CAAC;AAClG,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,OAAe,EACf,SAAiB;IAEjB,OAAO,MAAM,QAAQ,CACnB,GAAG,CAAC,sCAAsC,EAC1C,EAAE,OAAO,EAAE,SAAS,EAAE,EACtB,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,EAAU,EACV,MAA8B;IAE9B,OAAO,MAAM,QAAQ,CACnB,GAAG,CAAC,+BAA+B,EACnC,EAAE,EAAE,EAAE,MAAM,EAAE,EACd,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,+BAA+B,CAAC,OAAe,EAAE,EAAU;IAC/E,MAAM,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport {\n execute,\n loadSqlEquiv,\n queryOptionalRow,\n queryRow,\n queryRows,\n} from '@prairielearn/postgres';\n\nconst sql = loadSqlEquiv(import.meta.filename);\n\nexport const BatchedMigrationStatusSchema = z.enum([\n 'pending',\n 'paused',\n 'running',\n 'finalizing',\n 'failed',\n 'succeeded',\n]);\nexport type BatchedMigrationStatus = z.infer<typeof BatchedMigrationStatusSchema>;\n\nexport const BatchedMigrationRowSchema = z.object({\n id: z.string(),\n project: z.string(),\n filename: z.string(),\n timestamp: z.string(),\n batch_size: z.number(),\n min_value: z.bigint({ coerce: true }),\n max_value: z.bigint({ coerce: true }),\n status: BatchedMigrationStatusSchema,\n created_at: z.date(),\n updated_at: z.date(),\n started_at: z.date().nullable(),\n});\nexport type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;\n\ninterface BatchedMigrationParameters {\n min?: bigint | string | null;\n max: bigint | string | null;\n batchSize?: number;\n}\n\nexport interface BatchedMigrationImplementation {\n getParameters(): Promise<BatchedMigrationParameters>;\n execute(start: bigint, end: bigint): Promise<void>;\n}\n\n/**\n * Identity function that helps to write correct batched migrations.\n */\nexport function makeBatchedMigration<T extends BatchedMigrationImplementation>(fns: T): T {\n validateBatchedMigrationImplementation(fns);\n return fns;\n}\n\nexport function validateBatchedMigrationImplementation(\n fns: BatchedMigrationImplementation,\n): asserts fns is BatchedMigrationImplementation {\n if (typeof fns.getParameters !== 'function') {\n throw new Error('getParameters() must be a function');\n }\n if (typeof fns.execute !== 'function') {\n throw new Error('execute() must be a function');\n }\n}\n\ntype NewBatchedMigration = Pick<\n BatchedMigrationRow,\n 'project' | 'filename' | 'timestamp' | 'batch_size' | 'min_value' | 'max_value' | 'status'\n>;\n\n/**\n * Inserts a new batched migration. If one already exists for the given\n * project/timestamp pair, returns null, otherwise returns the inserted row.\n */\nexport async function insertBatchedMigration(\n migration: NewBatchedMigration,\n): Promise<BatchedMigrationRow | null> {\n return await queryOptionalRow(sql.insert_batched_migration, migration, BatchedMigrationRowSchema);\n}\n\nexport async function selectAllBatchedMigrations(project: string) {\n return await queryRows(sql.select_all_batched_migrations, { project }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigration(\n project: string,\n id: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(sql.select_batched_migration, { project, id }, BatchedMigrationRowSchema);\n}\n\nexport async function selectBatchedMigrationForTimestamp(\n project: string,\n timestamp: string,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.select_batched_migration_for_timestamp,\n { project, timestamp },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function updateBatchedMigrationStatus(\n id: string,\n status: BatchedMigrationStatus,\n): Promise<BatchedMigrationRow> {\n return await queryRow(\n sql.update_batched_migration_status,\n { id, status },\n BatchedMigrationRowSchema,\n );\n}\n\nexport async function retryFailedBatchedMigrationJobs(project: string, id: string): Promise<void> {\n await execute(sql.retry_failed_jobs, { project, id });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"20230406184103_successful_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230406184103_successful_migration.ts"],"names":[],"mappings":";;;;;;;;AAEA,wBAUG","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n min: 1n,\n max: 100n,\n batchSize: 10,\n };\n },\n\n async execute(_min: bigint, _max: bigint) {},\n});\n"]}
1
+ {"version":3,"file":"20230406184103_successful_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230406184103_successful_migration.ts"],"names":[],"mappings":";;;;;;kBAWsB,MAAM,QAAQ,MAAM","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n min: 1n,\n max: 100n,\n batchSize: 10,\n };\n },\n\n async execute(_min: bigint, _max: bigint) {},\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"20230406184107_failing_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230406184107_failing_migration.ts"],"names":[],"mappings":";;;;;;;;AAEA,wBAYG","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n min: 2n,\n max: 200n,\n batchSize: 20,\n };\n },\n\n async execute(_min, _max) {\n throw new Error('Testing failure');\n },\n});\n"]}
1
+ {"version":3,"file":"20230406184107_failing_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230406184107_failing_migration.ts"],"names":[],"mappings":"","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n min: 2n,\n max: 200n,\n batchSize: 20,\n };\n },\n\n async execute(_min, _max) {\n throw new Error('Testing failure');\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"20230407230446_no_rows_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230407230446_no_rows_migration.ts"],"names":[],"mappings":";;;;;;;AAEA,wBAYG","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n // Simulates the case where there are no rows to process. A null\n // max value is what we would get for some query like\n // `SELECT MAX(id) FROM table;`.\n max: null,\n batchSize: 10,\n };\n },\n\n async execute(_min: bigint, _max: bigint) {},\n});\n"]}
1
+ {"version":3,"file":"20230407230446_no_rows_migration.d.ts","sourceRoot":"","sources":["../../../src/batched-migrations/fixtures/20230407230446_no_rows_migration.ts"],"names":[],"mappings":";;;;;kBAasB,MAAM,QAAQ,MAAM","sourcesContent":["import { makeBatchedMigration } from '../batched-migration.js';\n\nexport default makeBatchedMigration({\n async getParameters() {\n return {\n // Simulates the case where there are no rows to process. A null\n // max value is what we would get for some query like\n // `SELECT MAX(id) FROM table;`.\n max: null,\n batchSize: 10,\n };\n },\n\n async execute(_min: bigint, _max: bigint) {},\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prairielearn/migrations",
3
- "version": "5.0.4",
3
+ "version": "5.0.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,24 +17,23 @@
17
17
  "test": "vitest run --coverage"
18
18
  },
19
19
  "dependencies": {
20
- "@prairielearn/error": "^3.0.5",
21
- "@prairielearn/logger": "^3.1.2",
20
+ "@prairielearn/error": "^3.0.6",
21
+ "@prairielearn/logger": "^3.1.3",
22
22
  "@prairielearn/named-locks": "^4.0.4",
23
- "@prairielearn/postgres": "^6.0.2",
23
+ "@prairielearn/postgres": "^6.0.3",
24
24
  "fs-extra": "^11.3.4",
25
25
  "serialize-error": "^13.0.1",
26
- "zod": "^3.25.76"
26
+ "zod": "^3.25.76 <4"
27
27
  },
28
28
  "devDependencies": {
29
- "@prairielearn/tsconfig": "^2.0.0",
29
+ "@prairielearn/tsconfig": "^2.1.0",
30
30
  "@types/fs-extra": "^11.0.4",
31
31
  "@types/node": "^24.12.2",
32
- "@typescript/native-preview": "^7.0.0-dev.20260305.1",
33
- "@vitest/coverage-v8": "^4.1.2",
32
+ "@typescript/native-preview": "beta",
33
+ "@vitest/coverage-v8": "^4.1.5",
34
34
  "tmp-promise": "^3.0.3",
35
35
  "tsx": "^4.21.0",
36
- "typescript": "^5.9.3",
37
36
  "typescript-cp": "^0.1.9",
38
- "vitest": "^4.1.2"
37
+ "vitest": "^4.1.5"
39
38
  }
40
39
  }
@@ -4,7 +4,7 @@ import { loadSqlEquiv, queryRows } from '@prairielearn/postgres';
4
4
 
5
5
  const sql = loadSqlEquiv(import.meta.filename);
6
6
 
7
- export const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);
7
+ const BatchedMigrationJobStatusSchema = z.enum(['pending', 'failed', 'succeeded']);
8
8
  export type BatchedMigrationJobStatus = z.infer<typeof BatchedMigrationJobStatusSchema>;
9
9
 
10
10
  export const BatchedMigrationJobRowSchema = z.object({
@@ -35,7 +35,7 @@ export const BatchedMigrationRowSchema = z.object({
35
35
  });
36
36
  export type BatchedMigrationRow = z.infer<typeof BatchedMigrationRowSchema>;
37
37
 
38
- export interface BatchedMigrationParameters {
38
+ interface BatchedMigrationParameters {
39
39
  min?: bigint | string | null;
40
40
  max: bigint | string | null;
41
41
  batchSize?: number;
package/tsconfig.json CHANGED
@@ -1,11 +1,3 @@
1
1
  {
2
- "extends": "@prairielearn/tsconfig/tsconfig.package.json",
3
- "compilerOptions": {
4
- "outDir": "./dist",
5
- "rootDir": "./src",
6
- "types": ["node"],
7
- // Use native ESM.
8
- "module": "NodeNext",
9
- "moduleResolution": "NodeNext"
10
- }
2
+ "extends": "@prairielearn/tsconfig/tsconfig.package-node.json"
11
3
  }