@ttt-productions/q-core 0.1.62 → 0.1.64

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 (64) hide show
  1. package/dist/constants/business.d.ts +0 -1
  2. package/dist/constants/business.d.ts.map +1 -1
  3. package/dist/constants/business.js +0 -1
  4. package/dist/constants/business.js.map +1 -1
  5. package/dist/constants/index.d.ts +1 -0
  6. package/dist/constants/index.d.ts.map +1 -1
  7. package/dist/constants/index.js +1 -0
  8. package/dist/constants/index.js.map +1 -1
  9. package/dist/constants/phone-fields.d.ts +11 -0
  10. package/dist/constants/phone-fields.d.ts.map +1 -0
  11. package/dist/constants/phone-fields.js +12 -0
  12. package/dist/constants/phone-fields.js.map +1 -0
  13. package/dist/constants/text-fields.d.ts +0 -12
  14. package/dist/constants/text-fields.d.ts.map +1 -1
  15. package/dist/constants/text-fields.js +1 -13
  16. package/dist/constants/text-fields.js.map +1 -1
  17. package/dist/doc-schemas/league-team.d.ts +1 -1
  18. package/dist/doc-schemas/league-team.d.ts.map +1 -1
  19. package/dist/doc-schemas/league-team.js +4 -2
  20. package/dist/doc-schemas/league-team.js.map +1 -1
  21. package/dist/doc-schemas/registry.d.ts +2 -2
  22. package/dist/doc-schemas/user-profile.d.ts +1 -1
  23. package/dist/doc-schemas/user-profile.d.ts.map +1 -1
  24. package/dist/doc-schemas/user-profile.js +4 -2
  25. package/dist/doc-schemas/user-profile.js.map +1 -1
  26. package/dist/media/index.d.ts +0 -1
  27. package/dist/media/index.d.ts.map +1 -1
  28. package/dist/media/index.js +0 -1
  29. package/dist/media/index.js.map +1 -1
  30. package/dist/migration-console/manifest.d.ts.map +1 -1
  31. package/dist/migration-console/manifest.js +5 -3
  32. package/dist/migration-console/manifest.js.map +1 -1
  33. package/dist/schemas/account-settings.d.ts +1 -1
  34. package/dist/schemas/account-settings.d.ts.map +1 -1
  35. package/dist/schemas/account-settings.js +3 -1
  36. package/dist/schemas/account-settings.js.map +1 -1
  37. package/dist/schemas/atoms.d.ts.map +1 -1
  38. package/dist/schemas/atoms.js +4 -2
  39. package/dist/schemas/atoms.js.map +1 -1
  40. package/dist/schemas/index.d.ts +1 -0
  41. package/dist/schemas/index.d.ts.map +1 -1
  42. package/dist/schemas/index.js +1 -0
  43. package/dist/schemas/index.js.map +1 -1
  44. package/dist/schemas/phone-field.d.ts +7 -0
  45. package/dist/schemas/phone-field.d.ts.map +1 -0
  46. package/dist/schemas/phone-field.js +29 -0
  47. package/dist/schemas/phone-field.js.map +1 -0
  48. package/dist/utils/index.d.ts +1 -0
  49. package/dist/utils/index.d.ts.map +1 -1
  50. package/dist/utils/index.js +1 -0
  51. package/dist/utils/index.js.map +1 -1
  52. package/dist/utils/league-calendar.d.ts +2 -0
  53. package/dist/utils/league-calendar.d.ts.map +1 -1
  54. package/dist/utils/league-calendar.js +20 -2
  55. package/dist/utils/league-calendar.js.map +1 -1
  56. package/dist/utils/phone-field.d.ts +14 -0
  57. package/dist/utils/phone-field.d.ts.map +1 -0
  58. package/dist/utils/phone-field.js +15 -0
  59. package/dist/utils/phone-field.js.map +1 -0
  60. package/package.json +2 -2
  61. package/dist/media/picture-url.d.ts +0 -8
  62. package/dist/media/picture-url.d.ts.map +0 -1
  63. package/dist/media/picture-url.js +0 -13
  64. package/dist/media/picture-url.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"league-calendar.js","sourceRoot":"","sources":["../../src/utils/league-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,I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AAC,IAAI,CAAC,CAAC,CAAC,CAAC,EACf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAChB,CAAC;IACF,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC;QAC9D,MAAM,IAAI,UAAU,CAAC,wBAAwB,MAAM,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,oGAAoG;IACpG,gGAAgG;IAChG,MAAM,UAAU,GAAG,SAAS,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;IAC5E,8FAA8F;IAC9F,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;QACnF,MAAM,IAAI,UAAU,CAAC,yCAAyC,MAAM,MAAM,SAAS,IAAI,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { LEAGUE_TIME_ZONE } from '../constants/business.js';\n\n// `en-CA` formats a date as `YYYY-MM-DD`, the stored calendar-date shape.\nconst LEAGUE_DAY_FORMAT = new Intl.DateTimeFormat('en-CA', {\n timeZone: LEAGUE_TIME_ZONE,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n});\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\nexport function toLeagueDayKey(epochMs: number): string {\n return LEAGUE_DAY_FORMAT.format(new Date(epochMs));\n}\n\nexport function addCalendarDays(dayKey: string, days: number): string {\n const day = new Date(`${dayKey}T00:00:00.000Z`);\n if (Number.isNaN(day.getTime())) {\n throw new RangeError(`Not a calendar date: '${dayKey}'.`);\n }\n return new Date(day.getTime() + days * DAY_MS).toISOString().slice(0, 10);\n}\n\n// `h23` keeps midnight at hour 0.\nconst LEAGUE_WALL_CLOCK_FORMAT = new Intl.DateTimeFormat('en-US', {\n timeZone: LEAGUE_TIME_ZONE,\n hourCycle: 'h23',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n});\n\nconst CALENDAR_DAY_SHAPE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst TIME_OF_DAY_SHAPE = /^([01]\\d|2[0-3]):([0-5]\\d)$/;\n\nfunction leagueWallClockAsUtc(epochMs: number): number {\n const parts = Object.fromEntries(\n LEAGUE_WALL_CLOCK_FORMAT.formatToParts(new Date(epochMs)).map((part) => [\n part.type,\n part.value,\n ]),\n );\n return Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n );\n}\n\nexport function toLeagueTimeOfDay(epochMs: number): string {\n const wallClock = new Date(leagueWallClockAsUtc(epochMs));\n const hours = String(wallClock.getUTCHours()).padStart(2, '0');\n const minutes = String(wallClock.getUTCMinutes()).padStart(2, '0');\n return `${hours}:${minutes}`;\n}\n\nexport function leagueInstantOf(dayKey: string, timeOfDay: string): number {\n const day = CALENDAR_DAY_SHAPE.exec(dayKey);\n const time = TIME_OF_DAY_SHAPE.exec(timeOfDay);\n if (!day || !time)\n throw new RangeError(`Not a calendar day and time of day: '${dayKey}' '${timeOfDay}'.`);\n const wallClock = Date.UTC(\n Number(day[1]),\n Number(day[2]) - 1,\n Number(day[3]),\n Number(time[1]),\n Number(time[2]),\n );\n if (new Date(wallClock).toISOString().slice(0, 10) !== dayKey) {\n throw new RangeError(`Not a calendar day: '${dayKey}'.`);\n }\n // The offset at the wall-clock reading taken as UTC is within a day of the right one; read again at\n // the instant that offset gives, so a reading on the other side of a change settles on its own.\n const firstGuess = wallClock - (leagueWallClockAsUtc(wallClock) - wallClock);\n const instant = wallClock - (leagueWallClockAsUtc(firstGuess) - firstGuess);\n // A reading the clocks skip forward over settles on another hour; only a real one reads back.\n if (toLeagueDayKey(instant) !== dayKey || toLeagueTimeOfDay(instant) !== timeOfDay) {\n throw new RangeError(`Not a time the league's clocks show: '${dayKey}' '${timeOfDay}'.`);\n }\n return instant;\n}\n"]}
1
+ {"version":3,"file":"league-calendar.js","sourceRoot":"","sources":["../../src/utils/league-calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,0EAA0E;AAC1E,MAAM,iBAAiB,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE;IACzD,QAAQ,EAAE,gBAAgB;IAC1B,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,SAAS;IAChB,GAAG,EAAE,SAAS;CACf,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,iBAAiB,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,GAAG,MAAM,gBAAgB,CAAC,CAAC;IAChD,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAc,EAAE,IAAY;IAC1D,MAAM,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QACjB,MAAM,IAAI,UAAU,CAAC,yBAAyB,MAAM,IAAI,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,IAAI,IAAI,CAA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CAAC,CAAC,CAAC,EACf,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAChB,CAAC;IACF,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC;QAC9D,MAAM,IAAI,UAAU,CAAC,wBAAwB,MAAM,IAAI,CAAC,CAAC;IAC3D,CAAC;IACD,oGAAoG;IACpG,gGAAgG;IAChG,MAAM,UAAU,GAAG,SAAS,GAAG,CAAC,oBAAoB,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E,MAAM,OAAO,GAAG,SAAS,GAAG,CAAC,oBAAoB,CAAC,UAAU,CAAC,GAAG,UAAU,CAAC,CAAC;IAC5E,8FAA8F;IAC9F,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,MAAM,IAAI,iBAAiB,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE,CAAC;QACnF,MAAM,IAAI,UAAU,CAAC,yCAAyC,MAAM,MAAM,SAAS,IAAI,CAAC,CAAC;IAC3F,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["import { LEAGUE_TIME_ZONE } from '../constants/business.js';\n\n// `en-CA` formats a date as `YYYY-MM-DD`, the stored calendar-date shape.\nconst LEAGUE_DAY_FORMAT = new Intl.DateTimeFormat('en-CA', {\n timeZone: LEAGUE_TIME_ZONE,\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n});\n\nconst DAY_MS = 24 * 60 * 60 * 1000;\n\nexport function toLeagueDayKey(epochMs: number): string {\n return LEAGUE_DAY_FORMAT.format(new Date(epochMs));\n}\n\n// A stored calendar day read as its midnight in UTC, or null when it is not a day.\nexport function calendarDayDate(dayKey: string): Date | null {\n const day = new Date(`${dayKey}T00:00:00.000Z`);\n return Number.isNaN(day.getTime()) ? null : day;\n}\n\nexport function addCalendarDays(dayKey: string, days: number): string {\n const day = calendarDayDate(dayKey);\n if (day === null) {\n throw new RangeError(`Not a calendar date: '${dayKey}'.`);\n }\n return new Date(day.getTime() + days * DAY_MS).toISOString().slice(0, 10);\n}\n\n// In UTC, the zone `calendarDayDate` reads a calendar day in.\nconst GAME_DAY_FORMAT = new Intl.DateTimeFormat('en-US', {\n timeZone: 'UTC',\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n});\n\n// A game's calendar day as every schedule shows it (\"Mon, Jan 5\"); a value that is not a day\n// shows as stored.\nexport function formatGameDay(dayKey: string): string {\n const day = calendarDayDate(dayKey);\n return day ? GAME_DAY_FORMAT.format(day) : dayKey;\n}\n\n// `h23` keeps midnight at hour 0.\nconst LEAGUE_WALL_CLOCK_FORMAT = new Intl.DateTimeFormat('en-US', {\n timeZone: LEAGUE_TIME_ZONE,\n hourCycle: 'h23',\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit',\n});\n\nconst CALENDAR_DAY_SHAPE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\nconst TIME_OF_DAY_SHAPE = /^([01]\\d|2[0-3]):([0-5]\\d)$/;\n\nfunction leagueWallClockAsUtc(epochMs: number): number {\n const parts = Object.fromEntries(\n LEAGUE_WALL_CLOCK_FORMAT.formatToParts(new Date(epochMs)).map((part) => [\n part.type,\n part.value,\n ]),\n );\n return Date.UTC(\n Number(parts.year),\n Number(parts.month) - 1,\n Number(parts.day),\n Number(parts.hour),\n Number(parts.minute),\n Number(parts.second),\n );\n}\n\nexport function toLeagueTimeOfDay(epochMs: number): string {\n const wallClock = new Date(leagueWallClockAsUtc(epochMs));\n const hours = String(wallClock.getUTCHours()).padStart(2, '0');\n const minutes = String(wallClock.getUTCMinutes()).padStart(2, '0');\n return `${hours}:${minutes}`;\n}\n\nexport function leagueInstantOf(dayKey: string, timeOfDay: string): number {\n const day = CALENDAR_DAY_SHAPE.exec(dayKey);\n const time = TIME_OF_DAY_SHAPE.exec(timeOfDay);\n if (!day || !time)\n throw new RangeError(`Not a calendar day and time of day: '${dayKey}' '${timeOfDay}'.`);\n const wallClock = Date.UTC(\n Number(day[1]),\n Number(day[2]) - 1,\n Number(day[3]),\n Number(time[1]),\n Number(time[2]),\n );\n if (new Date(wallClock).toISOString().slice(0, 10) !== dayKey) {\n throw new RangeError(`Not a calendar day: '${dayKey}'.`);\n }\n // The offset at the wall-clock reading taken as UTC is within a day of the right one; read again at\n // the instant that offset gives, so a reading on the other side of a change settles on its own.\n const firstGuess = wallClock - (leagueWallClockAsUtc(wallClock) - wallClock);\n const instant = wallClock - (leagueWallClockAsUtc(firstGuess) - firstGuess);\n // A reading the clocks skip forward over settles on another hour; only a real one reads back.\n if (toLeagueDayKey(instant) !== dayKey || toLeagueTimeOfDay(instant) !== timeOfDay) {\n throw new RangeError(`Not a time the league's clocks show: '${dayKey}' '${timeOfDay}'.`);\n }\n return instant;\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type DeclaredPhoneFormat, type PhoneTextIssue } from '@ttt-productions/input-format-core';
2
+ export type PhoneFieldDeclaration = DeclaredPhoneFormat & {
3
+ readonly label: string;
4
+ };
5
+ export declare function phoneFieldRefusal(declaration: PhoneFieldDeclaration, issue: PhoneTextIssue): string;
6
+ export type PhoneFieldResult = {
7
+ readonly ok: true;
8
+ readonly digits: string | null;
9
+ } | {
10
+ readonly ok: false;
11
+ readonly reason: string;
12
+ };
13
+ export declare function checkPhoneField(declaration: PhoneFieldDeclaration, text: string): PhoneFieldResult;
14
+ //# sourceMappingURL=phone-field.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone-field.d.ts","sourceRoot":"","sources":["../../src/utils/phone-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAIrF,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,qBAAqB,EAClC,KAAK,EAAE,cAAc,GACpB,MAAM,CAIR;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpD,wBAAgB,eAAe,CAC7B,WAAW,EAAE,qBAAqB,EAClC,IAAI,EAAE,MAAM,GACX,gBAAgB,CAIlB"}
@@ -0,0 +1,15 @@
1
+ import { formatPhone, readPhoneText, } from '@ttt-productions/input-format-core';
2
+ const PHONE_EXAMPLE_DIGITS = '8145550123';
3
+ export function phoneFieldRefusal(declaration, issue) {
4
+ const { label } = declaration;
5
+ if (issue === 'missing')
6
+ return `${label} cannot be empty.`;
7
+ return `${label} must be a 10-digit US number with its area code, like ${formatPhone(PHONE_EXAMPLE_DIGITS, declaration)}.`;
8
+ }
9
+ export function checkPhoneField(declaration, text) {
10
+ const result = readPhoneText(text, declaration);
11
+ if (result.ok)
12
+ return { ok: true, digits: result.digits };
13
+ return { ok: false, reason: phoneFieldRefusal(declaration, result.issue) };
14
+ }
15
+ //# sourceMappingURL=phone-field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"phone-field.js","sourceRoot":"","sources":["../../src/utils/phone-field.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,GAGd,MAAM,oCAAoC,CAAC;AAI5C,MAAM,oBAAoB,GAAG,YAAY,CAAC;AAE1C,MAAM,UAAU,iBAAiB,CAC/B,WAAkC,EAClC,KAAqB;IAErB,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,GAAG,KAAK,mBAAmB,CAAC;IAC5D,OAAO,GAAG,KAAK,0DAA0D,WAAW,CAAC,oBAAoB,EAAE,WAAW,CAAC,GAAG,CAAC;AAC7H,CAAC;AAMD,MAAM,UAAU,eAAe,CAC7B,WAAkC,EAClC,IAAY;IAEZ,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IAC1D,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,CAAC,WAAW,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import {\n formatPhone,\n readPhoneText,\n type DeclaredPhoneFormat,\n type PhoneTextIssue,\n} from '@ttt-productions/input-format-core';\n\nexport type PhoneFieldDeclaration = DeclaredPhoneFormat & { readonly label: string };\n\nconst PHONE_EXAMPLE_DIGITS = '8145550123';\n\nexport function phoneFieldRefusal(\n declaration: PhoneFieldDeclaration,\n issue: PhoneTextIssue,\n): string {\n const { label } = declaration;\n if (issue === 'missing') return `${label} cannot be empty.`;\n return `${label} must be a 10-digit US number with its area code, like ${formatPhone(PHONE_EXAMPLE_DIGITS, declaration)}.`;\n}\n\nexport type PhoneFieldResult =\n | { readonly ok: true; readonly digits: string | null }\n | { readonly ok: false; readonly reason: string };\n\nexport function checkPhoneField(\n declaration: PhoneFieldDeclaration,\n text: string,\n): PhoneFieldResult {\n const result = readPhoneText(text, declaration);\n if (result.ok) return { ok: true, digits: result.digits };\n return { ok: false, reason: phoneFieldRefusal(declaration, result.issue) };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttt-productions/q-core",
3
- "version": "0.1.62",
3
+ "version": "0.1.64",
4
4
  "description": "Core types, Firestore path constants, zod schemas, and shared constants for Q-Sports",
5
5
  "repository": {
6
6
  "type": "git",
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "dependencies": {
80
80
  "@ttt-productions/edge-protocol-core": "^0.1.15",
81
- "@ttt-productions/input-format-core": "^0.1.4",
81
+ "@ttt-productions/input-format-core": "^0.1.5",
82
82
  "@ttt-productions/media-schemas": "^0.14.17",
83
83
  "@ttt-productions/notification-core": "^0.15.24",
84
84
  "@ttt-productions/short-link-core": "^0.0.2",
@@ -1,8 +0,0 @@
1
- import type { PictureVariantKey } from '../types/unions.js';
2
- export interface PictureUrlBuilderConfig {
3
- storageOrigin: string;
4
- bucket: string;
5
- }
6
- export type PictureUrlBuilder = (pictureId: string, variantKey: PictureVariantKey) => string;
7
- export declare function createPictureUrlBuilder(config: PictureUrlBuilderConfig): PictureUrlBuilder;
8
- //# sourceMappingURL=picture-url.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"picture-url.d.ts","sourceRoot":"","sources":["../../src/media/picture-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,KAAK,MAAM,CAAC;AAE7F,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,uBAAuB,GAAG,iBAAiB,CAU1F"}
@@ -1,13 +0,0 @@
1
- import { buildPictureObjectPath } from '../paths/storage-paths.js';
2
- export function createPictureUrlBuilder(config) {
3
- const origin = config.storageOrigin.replace(/\/+$/, '');
4
- const { bucket } = config;
5
- if (!origin || !bucket) {
6
- throw new Error('createPictureUrlBuilder: storageOrigin and bucket are required');
7
- }
8
- return (pictureId, variantKey) => {
9
- const objectPath = encodeURIComponent(buildPictureObjectPath(pictureId, variantKey));
10
- return `${origin}/v0/b/${bucket}/o/${objectPath}?alt=media`;
11
- };
12
- }
13
- //# sourceMappingURL=picture-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"picture-url.js","sourceRoot":"","sources":["../../src/media/picture-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAUnE,MAAM,UAAU,uBAAuB,CAAC,MAA+B;IACrE,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC1B,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACpF,CAAC;IACD,OAAO,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE;QAC/B,MAAM,UAAU,GAAG,kBAAkB,CAAC,sBAAsB,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;QACrF,OAAO,GAAG,MAAM,SAAS,MAAM,MAAM,UAAU,YAAY,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { buildPictureObjectPath } from '../paths/storage-paths.js';\nimport type { PictureVariantKey } from '../types/unions.js';\n\nexport interface PictureUrlBuilderConfig {\n storageOrigin: string;\n bucket: string;\n}\n\nexport type PictureUrlBuilder = (pictureId: string, variantKey: PictureVariantKey) => string;\n\nexport function createPictureUrlBuilder(config: PictureUrlBuilderConfig): PictureUrlBuilder {\n const origin = config.storageOrigin.replace(/\\/+$/, '');\n const { bucket } = config;\n if (!origin || !bucket) {\n throw new Error('createPictureUrlBuilder: storageOrigin and bucket are required');\n }\n return (pictureId, variantKey) => {\n const objectPath = encodeURIComponent(buildPictureObjectPath(pictureId, variantKey));\n return `${origin}/v0/b/${bucket}/o/${objectPath}?alt=media`;\n };\n}\n"]}