@coursebuilder/adapter-drizzle 2.1.0 → 2.1.1

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.
Files changed (61) hide show
  1. package/dist/{chunk-HAQZSRJL.js → chunk-62VSIVME.js} +21 -3
  2. package/dist/{chunk-IBQGXFEX.js → chunk-RVXF3JZ7.js} +6 -3
  3. package/dist/{chunk-25RKHMRM.js → chunk-WEJL5OFI.js} +113 -110
  4. package/dist/index.js +16 -16
  5. package/dist/lib/mysql/cms-resource-actions.cjs +20 -2
  6. package/dist/lib/mysql/cms-resource-actions.cjs.map +1 -1
  7. package/dist/lib/mysql/cms-resource-actions.d.cts +15 -0
  8. package/dist/lib/mysql/cms-resource-actions.d.ts +15 -0
  9. package/dist/lib/mysql/cms-resource-actions.js +1 -1
  10. package/dist/lib/mysql/index.cjs +24 -3
  11. package/dist/lib/mysql/index.cjs.map +1 -1
  12. package/dist/lib/mysql/index.js +16 -16
  13. package/dist/lib/mysql/schemas/auth/accounts.js +4 -4
  14. package/dist/lib/mysql/schemas/auth/device-access-token.js +5 -5
  15. package/dist/lib/mysql/schemas/auth/device-verification.js +5 -5
  16. package/dist/lib/mysql/schemas/auth/personal-access-token.js +5 -5
  17. package/dist/lib/mysql/schemas/auth/profiles.js +4 -4
  18. package/dist/lib/mysql/schemas/auth/role-permissions.js +5 -5
  19. package/dist/lib/mysql/schemas/auth/roles.js +4 -4
  20. package/dist/lib/mysql/schemas/auth/sessions.js +5 -5
  21. package/dist/lib/mysql/schemas/auth/user-permissions.js +4 -4
  22. package/dist/lib/mysql/schemas/auth/user-prefs.js +4 -4
  23. package/dist/lib/mysql/schemas/auth/user-roles.js +4 -4
  24. package/dist/lib/mysql/schemas/auth/users.js +4 -4
  25. package/dist/lib/mysql/schemas/commerce/coupon.js +4 -4
  26. package/dist/lib/mysql/schemas/commerce/merchant-charge.js +4 -4
  27. package/dist/lib/mysql/schemas/commerce/merchant-subscription.js +4 -4
  28. package/dist/lib/mysql/schemas/commerce/price.js +4 -4
  29. package/dist/lib/mysql/schemas/commerce/product.js +4 -4
  30. package/dist/lib/mysql/schemas/commerce/purchase-user-transfer.js +5 -5
  31. package/dist/lib/mysql/schemas/commerce/purchase.js +4 -4
  32. package/dist/lib/mysql/schemas/commerce/subscription.js +4 -4
  33. package/dist/lib/mysql/schemas/commerce/upgradable-products.js +5 -5
  34. package/dist/lib/mysql/schemas/communication/comment.js +4 -4
  35. package/dist/lib/mysql/schemas/communication/communication-preferences.js +4 -4
  36. package/dist/lib/mysql/schemas/communication/question-response.js +5 -5
  37. package/dist/lib/mysql/schemas/content/content-contributions.js +4 -4
  38. package/dist/lib/mysql/schemas/content/content-resource-product.js +4 -4
  39. package/dist/lib/mysql/schemas/content/content-resource-resource.js +4 -4
  40. package/dist/lib/mysql/schemas/content/content-resource-tag.js +4 -4
  41. package/dist/lib/mysql/schemas/content/content-resource-version.js +4 -4
  42. package/dist/lib/mysql/schemas/content/content-resource.js +4 -4
  43. package/dist/lib/mysql/schemas/content/tag-tag.js +4 -4
  44. package/dist/lib/mysql/schemas/content/tag.js +4 -4
  45. package/dist/lib/mysql/schemas/entitlements/entitlement.js +5 -5
  46. package/dist/lib/mysql/schemas/org/organization-membership-roles.js +4 -4
  47. package/dist/lib/mysql/schemas/org/organization-memberships.js +4 -4
  48. package/dist/lib/mysql/schemas/org/organizations.js +4 -4
  49. package/package.json +2 -2
  50. package/src/lib/mysql/cms-resource-actions.ts +37 -0
  51. package/src/lib/mysql/index.ts +1 -0
  52. package/dist/chunk-3AF6MZQ7.js +0 -112
  53. package/dist/chunk-3EF5ZXLG.js +0 -101
  54. package/dist/chunk-4SWTV7Z3.js +0 -58
  55. package/dist/chunk-CFSRMUNC.js +0 -78
  56. package/dist/chunk-DUFH5L2F.js +0 -49
  57. package/dist/chunk-FJGNLVE4.js +0 -101
  58. package/dist/chunk-I2U5PTWN.js +0 -79
  59. package/dist/chunk-MYG6PCE3.js +0 -63
  60. package/dist/chunk-W6RPAAKG.js +0 -2144
  61. package/dist/chunk-WKJTU24D.js +0 -88
@@ -71,17 +71,32 @@ declare const CmsImageResourceRowSchema: z.ZodObject<{
71
71
  id: z.ZodString;
72
72
  url: z.ZodString;
73
73
  alt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
74
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
74
75
  createdAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
76
+ width: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
77
+ height: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
78
+ bytes: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
79
+ format: z.ZodNullable<z.ZodOptional<z.ZodString>>;
75
80
  }, "strip", z.ZodTypeAny, {
76
81
  id: string;
77
82
  url: string;
83
+ name?: string | null | undefined;
78
84
  createdAt?: Date | null | undefined;
79
85
  alt?: string | null | undefined;
86
+ width?: number | null | undefined;
87
+ height?: number | null | undefined;
88
+ bytes?: number | null | undefined;
89
+ format?: string | null | undefined;
80
90
  }, {
81
91
  id: string;
82
92
  url: string;
93
+ name?: string | null | undefined;
83
94
  createdAt?: Date | null | undefined;
84
95
  alt?: string | null | undefined;
96
+ width?: unknown;
97
+ height?: unknown;
98
+ bytes?: unknown;
99
+ format?: string | null | undefined;
85
100
  }>;
86
101
  type CmsImageResourceRow = z.infer<typeof CmsImageResourceRowSchema>;
87
102
  declare const ListResourcesForPickerInputSchema: z.ZodObject<{
@@ -71,17 +71,32 @@ declare const CmsImageResourceRowSchema: z.ZodObject<{
71
71
  id: z.ZodString;
72
72
  url: z.ZodString;
73
73
  alt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
74
+ name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
74
75
  createdAt: z.ZodNullable<z.ZodOptional<z.ZodDate>>;
76
+ width: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
77
+ height: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
78
+ bytes: z.ZodEffects<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, number | null | undefined, unknown>;
79
+ format: z.ZodNullable<z.ZodOptional<z.ZodString>>;
75
80
  }, "strip", z.ZodTypeAny, {
76
81
  id: string;
77
82
  url: string;
83
+ name?: string | null | undefined;
78
84
  createdAt?: Date | null | undefined;
79
85
  alt?: string | null | undefined;
86
+ width?: number | null | undefined;
87
+ height?: number | null | undefined;
88
+ bytes?: number | null | undefined;
89
+ format?: string | null | undefined;
80
90
  }, {
81
91
  id: string;
82
92
  url: string;
93
+ name?: string | null | undefined;
83
94
  createdAt?: Date | null | undefined;
84
95
  alt?: string | null | undefined;
96
+ width?: unknown;
97
+ height?: unknown;
98
+ bytes?: unknown;
99
+ format?: string | null | undefined;
85
100
  }>;
86
101
  type CmsImageResourceRow = z.infer<typeof CmsImageResourceRowSchema>;
87
102
  declare const ListResourcesForPickerInputSchema: z.ZodObject<{
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createCmsResourceActions
3
- } from "../../chunk-HAQZSRJL.js";
3
+ } from "../../chunk-62VSIVME.js";
4
4
  import "../../chunk-2X5XVNDN.js";
5
5
  export {
6
6
  createCmsResourceActions
@@ -9349,7 +9349,7 @@ var upgradableProductSchema = external_exports2.object({
9349
9349
  deletedAt: external_exports2.date().nullable()
9350
9350
  });
9351
9351
 
9352
- // ../core/dist/chunk-QHRMESWX.js
9352
+ // ../core/dist/chunk-F3WB3QT7.js
9353
9353
  var VideoChapterSchema = external_exports2.object({
9354
9354
  startTime: external_exports2.number().min(0),
9355
9355
  title: external_exports2.string().min(1).max(120)
@@ -9360,6 +9360,8 @@ var VideoResourceSchema = external_exports2.object({
9360
9360
  createdAt: external_exports2.coerce.date().optional(),
9361
9361
  title: external_exports2.string().optional().nullable(),
9362
9362
  duration: external_exports2.number().optional().nullable(),
9363
+ /** Max stored resolution, e.g. '1080p' — persisted on Mux asset.ready. */
9364
+ resolution: external_exports2.string().optional().nullable(),
9363
9365
  muxPlaybackId: external_exports2.string().optional().nullable(),
9364
9366
  muxAssetId: external_exports2.string().optional().nullable(),
9365
9367
  transcript: external_exports2.string().optional().nullable(),
@@ -13285,12 +13287,24 @@ __name(getEntitlementRelationsSchema, "getEntitlementRelationsSchema");
13285
13287
 
13286
13288
  // src/lib/mysql/cms-resource-actions.ts
13287
13289
  var import_drizzle_orm46 = require("drizzle-orm");
13290
+ var jsonNumber = external_exports.preprocess((value) => value == null ? null : Number(value), external_exports.number().nullable().optional());
13288
13291
  var CmsImageResourceRowSchema = external_exports.object({
13289
13292
  id: external_exports.string(),
13290
13293
  url: external_exports.string(),
13291
13294
  alt: external_exports.string().optional().nullable(),
13295
+ // Human filename (the uploaded file's name) — the media grid prefers it
13296
+ // over `alt` for the tile label; absent on older rows.
13297
+ name: external_exports.string().optional().nullable(),
13292
13298
  // Row creation time — the media tab's unified grid sorts by it.
13293
- createdAt: external_exports.coerce.date().optional().nullable()
13299
+ createdAt: external_exports.coerce.date().optional().nullable(),
13300
+ // Cloudinary metadata — optional/nullable so pre-metadata rows keep
13301
+ // working (JSON_EXTRACT returns NULL when the key is absent). Numeric
13302
+ // coercion preserves null (plain z.coerce.number() would turn it into 0);
13303
+ // MySQL JSON numerics can arrive as strings through some drivers.
13304
+ width: jsonNumber,
13305
+ height: jsonNumber,
13306
+ bytes: jsonNumber,
13307
+ format: external_exports.string().optional().nullable()
13294
13308
  });
13295
13309
  var ListResourcesForPickerInputSchema = external_exports.object({
13296
13310
  types: external_exports.array(external_exports.string()).min(1),
@@ -13396,7 +13410,13 @@ function createCmsResourceActions(options) {
13396
13410
  id: contentResource.id,
13397
13411
  url: import_drizzle_orm46.sql`JSON_UNQUOTE(JSON_EXTRACT(${contentResource.fields}, '$.url'))`,
13398
13412
  alt: import_drizzle_orm46.sql`JSON_UNQUOTE(JSON_EXTRACT(${contentResource.fields}, '$.alt'))`,
13399
- createdAt: contentResource.createdAt
13413
+ name: import_drizzle_orm46.sql`JSON_UNQUOTE(JSON_EXTRACT(${contentResource.fields}, '$.name'))`,
13414
+ createdAt: contentResource.createdAt,
13415
+ // Cloudinary metadata — NULL on pre-metadata rows (backfillable).
13416
+ width: import_drizzle_orm46.sql`JSON_EXTRACT(${contentResource.fields}, '$.width')`,
13417
+ height: import_drizzle_orm46.sql`JSON_EXTRACT(${contentResource.fields}, '$.height')`,
13418
+ bytes: import_drizzle_orm46.sql`JSON_EXTRACT(${contentResource.fields}, '$.bytes')`,
13419
+ format: import_drizzle_orm46.sql`JSON_UNQUOTE(JSON_EXTRACT(${contentResource.fields}, '$.format'))`
13400
13420
  }).from(contentResource).where((0, import_drizzle_orm46.eq)(contentResource.type, "imageResource")).orderBy((0, import_drizzle_orm46.desc)(contentResource.createdAt)).limit(capped).offset(skip);
13401
13421
  const parsed = external_exports.array(CmsImageResourceRowSchema).safeParse(rows);
13402
13422
  return parsed.success ? parsed.data : [];
@@ -15330,6 +15350,7 @@ function mySqlDrizzleAdapter(client, tableFn = import_mysql_core52.mysqlTable, p
15330
15350
  CAST(createdAt AS DATETIME) as createdAt,
15331
15351
  JSON_EXTRACT (${contentResource.fields}, "$.state") AS state,
15332
15352
  JSON_EXTRACT (${contentResource.fields}, "$.duration") AS duration,
15353
+ JSON_UNQUOTE(JSON_EXTRACT (${contentResource.fields}, "$.resolution")) AS resolution,
15333
15354
  JSON_EXTRACT (${contentResource.fields}, "$.muxPlaybackId") AS muxPlaybackId,
15334
15355
  JSON_EXTRACT (${contentResource.fields}, "$.muxAssetId") AS muxAssetId,
15335
15356
  JSON_EXTRACT (${contentResource.fields}, "$.transcript") AS transcript,