@burdenoff/microfe-hookmovies 2026.705.1 → 2026.706.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.
@@ -1 +1,2 @@
1
1
  import "./useHookMoviesApi.js";
2
+ import "./useFiles.js";
@@ -0,0 +1,66 @@
1
+ import "../context/index.js";
2
+ import "@tanstack/react-query";
3
+ import { graphqlFetch as e } from "@burdenoff/fe-libs/shared/graphql";
4
+ //#region src/hookmovies/hooks/useFiles.ts
5
+ var t = 21600, n = {
6
+ selfTapes: "/HookMovies/SelfTapes",
7
+ episodes: "/HookMovies/Episodes"
8
+ };
9
+ async function r(t, n) {
10
+ let r = await e({
11
+ gateway: "workspace",
12
+ query: t,
13
+ variables: n,
14
+ workspaceToken: !0
15
+ });
16
+ if (r.errors?.length) throw Error(r.errors[0]?.message ?? "Files request failed");
17
+ if (!r.data) throw Error("Files response did not include data");
18
+ return r.data;
19
+ }
20
+ var i = "\n mutation HokEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) { id }\n }\n", a = "\n mutation HokInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }\n", o = "\n mutation HokCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }\n", s = "\n query HokGetFileDownloadUrl($id: ID!, $expiresIn: Int) {\n getFileDownloadUrl(id: $id, expiresIn: $expiresIn)\n }\n";
21
+ function c(e, t) {
22
+ let n = e.lastIndexOf(".");
23
+ return n > -1 && n < e.length - 1 ? e.slice(n + 1).toLowerCase() : (t.split("/")[1] ?? "bin").toLowerCase();
24
+ }
25
+ async function l(e, n) {
26
+ let l = (await r(i, { path: n })).ensureFolderByPath?.id;
27
+ if (!l) throw Error("Could not resolve the upload folder.");
28
+ let u = e.type || "application/octet-stream", d = e.size, f = await r(a, { input: {
29
+ fileName: e.name,
30
+ extension: c(e.name, u),
31
+ fileSize: d,
32
+ mimeType: u,
33
+ folderId: l
34
+ } }), p = f.initiateUpload?.uploadUrl, m = f.initiateUpload?.session.id;
35
+ if (!p || !m) throw Error("The files service did not return an upload URL.");
36
+ let h = await fetch(p, {
37
+ method: "PUT",
38
+ body: e,
39
+ headers: { "Content-Type": u }
40
+ });
41
+ if (!h.ok) throw Error(`Upload to storage failed (${h.status}).`);
42
+ let g = (await r(o, { input: {
43
+ sessionId: m,
44
+ fileSize: d,
45
+ folderId: l
46
+ } })).completeUpload?.file;
47
+ if (!g?.id) throw Error("The upload could not be finalized.");
48
+ let _ = "";
49
+ try {
50
+ _ = (await r(s, {
51
+ id: g.id,
52
+ expiresIn: t
53
+ })).getFileDownloadUrl ?? "";
54
+ } catch {
55
+ _ = "";
56
+ }
57
+ return {
58
+ id: g.id,
59
+ url: _,
60
+ name: g.name
61
+ };
62
+ }
63
+ //#endregion
64
+ export { n as FILE_FOLDERS, l as uploadFileToFiles };
65
+
66
+ //# sourceMappingURL=useFiles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFiles.js","names":[],"sources":["../../../src/hookmovies/hooks/useFiles.ts"],"sourcesContent":["/**\n * File hooks — self-tapes & episode masters via wspace-files-svc (NO duplication).\n * @module hookmovies/hooks\n *\n * HookMovies never stores blobs. Episodes (master/mezzanine) and audition\n * self-tapes reference files owned by wspace-files-svc by id. Upload uses the\n * SAME proven `graphqlFetch` transport as every other read/write in this MFE\n * (the shell's workspace gateway + token), driving the wspace-files 3-step\n * presigned flow directly:\n * ensureFolderByPath -> initiateUpload -> HTTP PUT -> completeUpload\n * Display resolves a file id to a presigned URL via `getFileDownloadUrl`.\n *\n * NOTE: we deliberately do NOT use the Apollo-based `uploadBlobToFiles` /\n * `getWorkspaceClient()` helper here — this shell wires its data plane through\n * `graphqlFetch`, not a global Apollo client, so `getWorkspaceClient()` returns\n * an un-networked client and the upload silently no-ops. `graphqlFetch` is the\n * transport the whole MFE already uses successfully.\n */\n\nimport { useQuery } from '@tanstack/react-query';\nimport { graphqlFetch } from '@burdenoff/fe-libs/shared/graphql';\n\nimport { useHookMovies } from '../context';\n\n/**\n * Six hours. wspace-files-svc rejects any `expiresIn` above the S3 7-day cap\n * (604800s) with an INTERNAL_SERVER_ERROR, so we deliberately stay well under\n * it — these URLs back immediate preview/download, not durable references.\n */\nconst DOWNLOAD_URL_TTL_SECONDS = 21_600;\n\nexport const FILE_FOLDERS = {\n selfTapes: '/HookMovies/SelfTapes',\n episodes: '/HookMovies/Episodes',\n} as const;\n\nexport interface UploadedFile {\n id: string;\n url: string;\n name: string;\n}\n\n/** Thin wrapper over the workspace gateway using the MFE's proven transport. */\nasync function filesFetch<TData>(\n query: string,\n variables: Record<string, unknown>\n): Promise<TData> {\n const response = await graphqlFetch<TData>({\n gateway: 'workspace',\n query,\n variables,\n workspaceToken: true,\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Files request failed');\n }\n if (!response.data) {\n throw new Error('Files response did not include data');\n }\n return response.data;\n}\n\nconst ENSURE_FOLDER = `\n mutation HokEnsureFolder($path: String!) {\n ensureFolderByPath(path: $path) { id }\n }\n`;\n\nconst INITIATE_UPLOAD = `\n mutation HokInitiateUpload($input: InitiateUploadInput!) {\n initiateUpload(input: $input) {\n uploadUrl\n session { id }\n }\n }\n`;\n\nconst COMPLETE_UPLOAD = `\n mutation HokCompleteUpload($input: CompleteUploadInput!) {\n completeUpload(input: $input) {\n fileId\n file { id name }\n }\n }\n`;\n\nconst GET_FILE_DOWNLOAD_URL = `\n query HokGetFileDownloadUrl($id: ID!, $expiresIn: Int) {\n getFileDownloadUrl(id: $id, expiresIn: $expiresIn)\n }\n`;\n\nfunction fileExtension(name: string, mimeType: string): string {\n const dot = name.lastIndexOf('.');\n if (dot > -1 && dot < name.length - 1) return name.slice(dot + 1).toLowerCase();\n const fromMime = mimeType.split('/')[1];\n return (fromMime ?? 'bin').toLowerCase();\n}\n\n/**\n * Upload a file to wspace-files-svc and return its id + a presigned URL. The\n * caller persists the id (e.g. via `hokCreateEpisode({ fileId })`); the URL is\n * used for an immediate preview / download link.\n */\nexport async function uploadFileToFiles(file: File, folderPath: string): Promise<UploadedFile> {\n // 1. Resolve (or create) the destination folder — File.folderId is a real FK.\n const folder = await filesFetch<{ ensureFolderByPath?: { id: string } | null }>(ENSURE_FOLDER, {\n path: folderPath,\n });\n const folderId = folder.ensureFolderByPath?.id;\n if (!folderId) {\n throw new Error('Could not resolve the upload folder.');\n }\n\n const mimeType = file.type || 'application/octet-stream';\n const fileSize = file.size;\n\n // 2. Open a presigned upload session.\n const initiated = await filesFetch<{\n initiateUpload?: { uploadUrl?: string | null; session: { id: string } } | null;\n }>(INITIATE_UPLOAD, {\n input: {\n fileName: file.name,\n extension: fileExtension(file.name, mimeType),\n fileSize,\n mimeType,\n folderId,\n },\n });\n const uploadUrl = initiated.initiateUpload?.uploadUrl;\n const sessionId = initiated.initiateUpload?.session.id;\n if (!uploadUrl || !sessionId) {\n throw new Error('The files service did not return an upload URL.');\n }\n\n // 3. PUT the bytes straight to storage using the presigned URL. Content-Type\n // must match what was signed at initiateUpload.\n const putResponse = await fetch(uploadUrl, {\n method: 'PUT',\n body: file,\n headers: { 'Content-Type': mimeType },\n });\n if (!putResponse.ok) {\n throw new Error(`Upload to storage failed (${putResponse.status}).`);\n }\n\n // 4. Finalize — creates the File record. fileSize must match initiateUpload.\n const completed = await filesFetch<{\n completeUpload?: { fileId: string; file: { id: string; name: string } } | null;\n }>(COMPLETE_UPLOAD, {\n input: { sessionId, fileSize, folderId },\n });\n const fileRecord = completed.completeUpload?.file;\n if (!fileRecord?.id) {\n throw new Error('The upload could not be finalized.');\n }\n\n // 5. Resolve a presigned URL for immediate preview/download (best-effort).\n let url = '';\n try {\n const urlData = await filesFetch<{ getFileDownloadUrl?: string | null }>(\n GET_FILE_DOWNLOAD_URL,\n {\n id: fileRecord.id,\n expiresIn: DOWNLOAD_URL_TTL_SECONDS,\n }\n );\n url = urlData.getFileDownloadUrl ?? '';\n } catch {\n url = '';\n }\n\n return { id: fileRecord.id, url, name: fileRecord.name };\n}\n\n/** Resolve a wspace-files-svc file id to a presigned download URL for display. */\nexport function useFileUrl(fileId?: string | null) {\n const { apiGatewayUrl } = useHookMovies();\n return useQuery({\n queryKey: ['hookmovies', 'file-url', fileId ?? ''],\n enabled: Boolean(fileId),\n staleTime: 30 * 60 * 1000,\n retry: 1,\n queryFn: async () => {\n const response = await graphqlFetch<{ getFileDownloadUrl: string | null }>({\n gateway: 'workspace',\n baseUrl: apiGatewayUrl,\n workspaceToken: true,\n query: GET_FILE_DOWNLOAD_URL,\n variables: { id: fileId, expiresIn: DOWNLOAD_URL_TTL_SECONDS },\n });\n if (response.errors?.length) {\n throw new Error(response.errors[0]?.message ?? 'Could not resolve file URL');\n }\n return response.data?.getFileDownloadUrl ?? null;\n },\n });\n}\n"],"mappings":";;;;AA6BA,IAAM,IAA2B,OAEpB,IAAe;CAC1B,WAAW;CACX,UAAU;CACX;AASD,eAAe,EACb,GACA,GACgB;CAChB,IAAM,IAAW,MAAM,EAAoB;EACzC,SAAS;EACT;EACA;EACA,gBAAgB;EACjB,CAAC;AACF,KAAI,EAAS,QAAQ,OACnB,OAAU,MAAM,EAAS,OAAO,IAAI,WAAW,uBAAuB;AAExE,KAAI,CAAC,EAAS,KACZ,OAAU,MAAM,sCAAsC;AAExD,QAAO,EAAS;;AAGlB,IAAM,IAAgB,qGAMhB,IAAkB,4JASlB,IAAkB,2JASlB,IAAwB;AAM9B,SAAS,EAAc,GAAc,GAA0B;CAC7D,IAAM,IAAM,EAAK,YAAY,IAAI;AAGjC,QAFI,IAAM,MAAM,IAAM,EAAK,SAAS,IAAU,EAAK,MAAM,IAAM,EAAE,CAAC,aAAa,IAC9D,EAAS,MAAM,IAAI,CAAC,MACjB,OAAO,aAAa;;AAQ1C,eAAsB,EAAkB,GAAY,GAA2C;CAK7F,IAAM,KAHS,MAAM,EAA2D,GAAe,EAC7F,MAAM,GACP,CAAC,EACsB,oBAAoB;AAC5C,KAAI,CAAC,EACH,OAAU,MAAM,uCAAuC;CAGzD,IAAM,IAAW,EAAK,QAAQ,4BACxB,IAAW,EAAK,MAGhB,IAAY,MAAM,EAErB,GAAiB,EAClB,OAAO;EACL,UAAU,EAAK;EACf,WAAW,EAAc,EAAK,MAAM,EAAS;EAC7C;EACA;EACA;EACD,EACF,CAAC,EACI,IAAY,EAAU,gBAAgB,WACtC,IAAY,EAAU,gBAAgB,QAAQ;AACpD,KAAI,CAAC,KAAa,CAAC,EACjB,OAAU,MAAM,kDAAkD;CAKpE,IAAM,IAAc,MAAM,MAAM,GAAW;EACzC,QAAQ;EACR,MAAM;EACN,SAAS,EAAE,gBAAgB,GAAU;EACtC,CAAC;AACF,KAAI,CAAC,EAAY,GACf,OAAU,MAAM,6BAA6B,EAAY,OAAO,IAAI;CAStE,IAAM,KALY,MAAM,EAErB,GAAiB,EAClB,OAAO;EAAE;EAAW;EAAU;EAAU,EACzC,CAAC,EAC2B,gBAAgB;AAC7C,KAAI,CAAC,GAAY,GACf,OAAU,MAAM,qCAAqC;CAIvD,IAAI,IAAM;AACV,KAAI;AAQF,OAPgB,MAAM,EACpB,GACA;GACE,IAAI,EAAW;GACf,WAAW;GACZ,CACF,EACa,sBAAsB;SAC9B;AACN,MAAM;;AAGR,QAAO;EAAE,IAAI,EAAW;EAAI;EAAK,MAAM,EAAW;EAAM"}
@@ -15,29 +15,31 @@ var o = async (e, t, n) => {
15
15
  if (r.errors?.length) throw Error(r.errors[0]?.message ?? "GraphQL request failed");
16
16
  if (!r.data) throw Error("GraphQL response did not include data");
17
17
  return e.trimStart().startsWith("mutation") && a(), r.data;
18
- }, s = "hookmovies", c = "\n id title slug type status synopsis genres tags originalLanguage originCountry\n releaseYear releaseDate runtimeMinutes certification aiDisclosure studioId\n createdAt updatedAt\n", l = "\n id name slug description country websiteUrl isVerified tags createdAt updatedAt\n", u = "\n id name biography knownFor primaryLanguage portfolioRef tags createdAt updatedAt\n", d = "\n id title logline synopsis status currency budgetMinorUnits studioId producerId\n resultingTitleId artistrybaseProjectRef tags startDate endDate createdAt updatedAt\n", f = "\n id productionId roleName description status isMinorRole payMinorUnits currency\n location language submissionDeadline createdAt updatedAt\n", p = "\n id titleId authorId score body hasSpoilers helpfulCount verifiedWatch status\n createdAt updatedAt\n", m = "\n id titleId status modes territories exclusive currency licenseeId startsAt endsAt\n createdAt updatedAt\n", h = "\n id name description kind visibility ownerId itemCount createdAt updatedAt\n", g = "pageInfo { cursor hasMore }", _ = (t = {}, r = {
18
+ }, s = "hookmovies", c = "\n id title slug type status synopsis genres tags originalLanguage originCountry\n releaseYear releaseDate runtimeMinutes certification aiDisclosure studioId\n createdAt updatedAt\n", l = "\n id name slug description country websiteUrl isVerified tags createdAt updatedAt\n", u = "\n id name biography knownFor primaryLanguage portfolioRef tags createdAt updatedAt\n", d = "\n id title logline synopsis status currency budgetMinorUnits studioId producerId\n resultingTitleId artistrybaseProjectRef tags startDate endDate createdAt updatedAt\n", f = "\n id productionId roleName description status isMinorRole payMinorUnits currency\n location language submissionDeadline createdAt updatedAt\n", p = "\n id titleId authorId score body hasSpoilers helpfulCount verifiedWatch status\n createdAt updatedAt\n", m = "\n id titleId status modes territories exclusive currency licenseeId startsAt endsAt\n createdAt updatedAt\n", h = "\n id name description kind visibility ownerId itemCount createdAt updatedAt\n", g = "pageInfo { cursor hasMore }\n totalCount", _ = (t = {}, r = {
19
19
  limit: 50,
20
20
  offset: 0
21
- }) => {
22
- let { apiGatewayUrl: i } = e();
21
+ }, i) => {
22
+ let { apiGatewayUrl: a } = e();
23
23
  return n({
24
24
  queryKey: [
25
25
  s,
26
26
  "titles",
27
27
  t,
28
- r
28
+ r,
29
+ i ?? ""
29
30
  ],
30
- queryFn: async () => (await o(`query HokTitles($pagination: PaginationInput, $status: HokTitleStatus, $type: HokTitleType, $studioId: ID) {
31
- hokListTitles(pagination: $pagination, status: $status, type: $type, studioId: $studioId) {
31
+ queryFn: async () => (await o(`query HokTitles($pagination: PaginationInput, $search: String, $status: HokTitleStatus, $type: HokTitleType, $studioId: ID) {
32
+ hokListTitles(pagination: $pagination, search: $search, status: $status, type: $type, studioId: $studioId) {
32
33
  items { ${c} }
33
34
  ${g}
34
35
  }
35
36
  }`, {
36
37
  pagination: r,
38
+ search: i?.trim() ? i.trim() : void 0,
37
39
  status: t.status,
38
40
  type: t.type,
39
41
  studioId: t.studioId
40
- }, i)).hokListTitles
42
+ }, a)).hokListTitles
41
43
  });
42
44
  }, v = (t) => {
43
45
  let { apiGatewayUrl: r } = e();
@@ -120,20 +122,24 @@ var o = async (e, t, n) => {
120
122
  }, C = (t = {
121
123
  limit: 50,
122
124
  offset: 0
123
- }) => {
124
- let { apiGatewayUrl: r } = e();
125
+ }, r) => {
126
+ let { apiGatewayUrl: i } = e();
125
127
  return n({
126
128
  queryKey: [
127
129
  s,
128
130
  "studios",
129
- t
131
+ t,
132
+ r ?? ""
130
133
  ],
131
- queryFn: async () => (await o(`query HokStudios($pagination: PaginationInput) {
132
- hokListStudios(pagination: $pagination) {
134
+ queryFn: async () => (await o(`query HokStudios($pagination: PaginationInput, $search: String) {
135
+ hokListStudios(pagination: $pagination, search: $search) {
133
136
  items { ${l} }
134
137
  ${g}
135
138
  }
136
- }`, { pagination: t }, r)).hokListStudios
139
+ }`, {
140
+ pagination: t,
141
+ search: r?.trim() ? r.trim() : void 0
142
+ }, i)).hokListStudios
137
143
  });
138
144
  }, w = () => {
139
145
  let n = r(), { apiGatewayUrl: i } = e();
@@ -148,20 +154,24 @@ var o = async (e, t, n) => {
148
154
  }, T = (t = {
149
155
  limit: 50,
150
156
  offset: 0
151
- }) => {
152
- let { apiGatewayUrl: r } = e();
157
+ }, r) => {
158
+ let { apiGatewayUrl: i } = e();
153
159
  return n({
154
160
  queryKey: [
155
161
  s,
156
162
  "people",
157
- t
163
+ t,
164
+ r ?? ""
158
165
  ],
159
- queryFn: async () => (await o(`query HokPeople($pagination: PaginationInput) {
160
- hokListPeople(pagination: $pagination) {
166
+ queryFn: async () => (await o(`query HokPeople($pagination: PaginationInput, $search: String) {
167
+ hokListPeople(pagination: $pagination, search: $search) {
161
168
  items { ${u} }
162
169
  ${g}
163
170
  }
164
- }`, { pagination: t }, r)).hokListPeople
171
+ }`, {
172
+ pagination: t,
173
+ search: r?.trim() ? r.trim() : void 0
174
+ }, i)).hokListPeople
165
175
  });
166
176
  }, E = () => {
167
177
  let n = r(), { apiGatewayUrl: i } = e();
@@ -351,7 +361,7 @@ var o = async (e, t, n) => {
351
361
  ] });
352
362
  }
353
363
  });
354
- }, R = (t = {}, r = {
364
+ }, ee = (t = {}, r = {
355
365
  limit: 50,
356
366
  offset: 0
357
367
  }) => {
@@ -377,7 +387,7 @@ var o = async (e, t, n) => {
377
387
  titleId: t.titleId
378
388
  }, i)).hokListReviews
379
389
  });
380
- }, z = () => {
390
+ }, R = () => {
381
391
  let n = r(), { apiGatewayUrl: i } = e();
382
392
  return t({
383
393
  mutationFn: async (e) => (await o(`mutation HokCreateReview($input: HokCreateReviewInput!) {
@@ -387,7 +397,7 @@ var o = async (e, t, n) => {
387
397
  n.invalidateQueries({ queryKey: [s, "reviews"] });
388
398
  }
389
399
  });
390
- }, B = () => {
400
+ }, z = () => {
391
401
  let n = r(), { apiGatewayUrl: i } = e();
392
402
  return t({
393
403
  mutationFn: async (e) => (await o("mutation HokDeleteReview($id: ID!) { hokDeleteReview(id: $id) }", { id: e }, i)).hokDeleteReview,
@@ -395,7 +405,7 @@ var o = async (e, t, n) => {
395
405
  n.invalidateQueries({ queryKey: [s, "reviews"] });
396
406
  }
397
407
  });
398
- }, V = (t = {}, r = {
408
+ }, B = (t = {}, r = {
399
409
  limit: 50,
400
410
  offset: 0
401
411
  }) => {
@@ -421,7 +431,7 @@ var o = async (e, t, n) => {
421
431
  titleId: t.titleId
422
432
  }, i)).hokListRightsWindows
423
433
  });
424
- }, H = () => {
434
+ }, V = () => {
425
435
  let n = r(), { apiGatewayUrl: i } = e();
426
436
  return t({
427
437
  mutationFn: async (e) => (await o(`mutation HokCreateRightsWindow($input: HokCreateRightsWindowInput!) {
@@ -431,7 +441,7 @@ var o = async (e, t, n) => {
431
441
  n.invalidateQueries({ queryKey: [s, "rights"] });
432
442
  }
433
443
  });
434
- }, U = () => {
444
+ }, H = () => {
435
445
  let n = r(), { apiGatewayUrl: i } = e();
436
446
  return t({
437
447
  mutationFn: async ({ id: e, status: t }) => (await o(`mutation HokTransitionRightsWindow($id: ID!, $status: HokRightsWindowStatus!) {
@@ -444,7 +454,7 @@ var o = async (e, t, n) => {
444
454
  n.invalidateQueries({ queryKey: [s, "rights"] });
445
455
  }
446
456
  });
447
- }, W = () => {
457
+ }, U = () => {
448
458
  let n = r(), { apiGatewayUrl: i } = e();
449
459
  return t({
450
460
  mutationFn: async (e) => (await o("mutation HokRevokeEntitlement($id: ID!) { hokRevokeEntitlement(id: $id) }", { id: e }, i)).hokRevokeEntitlement,
@@ -452,7 +462,7 @@ var o = async (e, t, n) => {
452
462
  n.invalidateQueries({ queryKey: [s, "my-entitlements"] });
453
463
  }
454
464
  });
455
- }, G = (t) => {
465
+ }, W = (t) => {
456
466
  let { apiGatewayUrl: r } = e();
457
467
  return n({
458
468
  queryKey: [
@@ -462,7 +472,7 @@ var o = async (e, t, n) => {
462
472
  ],
463
473
  queryFn: async () => (await o("query HokMyEntitlements($titleId: ID) {\n hokMyEntitlements(titleId: $titleId) {\n id titleId userId mode source status territory expiresAt createdAt updatedAt\n title { id title }\n }\n }", { titleId: t }, r)).hokMyEntitlements
464
474
  });
465
- }, K = (t, r = {
475
+ }, G = (t, r = {
466
476
  limit: 50,
467
477
  offset: 0
468
478
  }) => {
@@ -484,7 +494,7 @@ var o = async (e, t, n) => {
484
494
  pagination: r
485
495
  }, i)).hokMyLists
486
496
  });
487
- }, q = () => {
497
+ }, K = () => {
488
498
  let n = r(), { apiGatewayUrl: i } = e();
489
499
  return t({
490
500
  mutationFn: async (e) => (await o(`mutation HokCreateList($input: HokCreateListInput!) {
@@ -494,7 +504,7 @@ var o = async (e, t, n) => {
494
504
  n.invalidateQueries({ queryKey: [s, "my-lists"] });
495
505
  }
496
506
  });
497
- }, J = () => {
507
+ }, q = () => {
498
508
  let n = r(), { apiGatewayUrl: i } = e();
499
509
  return t({
500
510
  mutationFn: async (e) => (await o("mutation HokDeleteList($id: ID!) { hokDeleteList(id: $id) }", { id: e }, i)).hokDeleteList,
@@ -502,7 +512,7 @@ var o = async (e, t, n) => {
502
512
  n.invalidateQueries({ queryKey: [s, "my-lists"] });
503
513
  }
504
514
  });
505
- }, Y = (t) => {
515
+ }, J = (t) => {
506
516
  let { apiGatewayUrl: r } = e();
507
517
  return n({
508
518
  queryKey: [
@@ -512,7 +522,83 @@ var o = async (e, t, n) => {
512
522
  ],
513
523
  queryFn: async () => (await o("query HokMyWatchProgress($titleId: ID) {\n hokMyWatchProgress(titleId: $titleId) {\n id titleId episodeId positionSeconds completed lastDevice updatedAt\n title { id title type }\n }\n }", { titleId: t }, r)).hokMyWatchProgress
514
524
  });
525
+ }, Y = () => {
526
+ let n = r(), { apiGatewayUrl: i } = e();
527
+ return t({
528
+ mutationFn: async (e) => (await o("mutation HokAddCredit($input: HokCreateCreditInput!) {\n hokAddCredit(input: $input) {\n id personId titleId role characterName billingOrder\n person { id name knownFor }\n }\n }", { input: e }, i)).hokAddCredit,
529
+ onSuccess: (e) => {
530
+ n.invalidateQueries({ queryKey: [
531
+ s,
532
+ "title",
533
+ e.titleId
534
+ ] });
535
+ }
536
+ });
515
537
  }, X = () => {
538
+ let n = r(), { apiGatewayUrl: i } = e();
539
+ return t({
540
+ mutationFn: async (e) => (await o("mutation HokCreateSeason($input: HokCreateSeasonInput!) {\n hokCreateSeason(input: $input) {\n id titleId number name synopsis airDate\n }\n }", { input: e }, i)).hokCreateSeason,
541
+ onSuccess: (e) => {
542
+ n.invalidateQueries({ queryKey: [
543
+ s,
544
+ "title",
545
+ e.titleId
546
+ ] });
547
+ }
548
+ });
549
+ }, Z = () => {
550
+ let n = r(), { apiGatewayUrl: i } = e();
551
+ return t({
552
+ mutationFn: async (e) => (await o("mutation HokCreateEpisode($input: HokCreateEpisodeInput!) {\n hokCreateEpisode(input: $input) {\n id titleId seasonId number name synopsis runtimeMinutes airDate\n }\n }", { input: e }, i)).hokCreateEpisode,
553
+ onSuccess: (e) => {
554
+ n.invalidateQueries({ queryKey: [
555
+ s,
556
+ "title",
557
+ e.titleId
558
+ ] });
559
+ }
560
+ });
561
+ }, Q = () => {
562
+ let n = r(), { apiGatewayUrl: i } = e();
563
+ return t({
564
+ mutationFn: async (e) => (await o("mutation HokRecordProgress($input: HokRecordProgressInput!) {\n hokRecordProgress(input: $input) {\n id titleId episodeId positionSeconds completed lastDevice updatedAt\n title { id title type }\n }\n }", { input: e }, i)).hokRecordProgress,
565
+ onSuccess: () => {
566
+ n.invalidateQueries({ queryKey: [s, "my-watch-progress"] });
567
+ }
568
+ });
569
+ }, $ = (t) => {
570
+ let { apiGatewayUrl: r } = e();
571
+ return n({
572
+ queryKey: [
573
+ s,
574
+ "check-entitlement",
575
+ t
576
+ ],
577
+ queryFn: async () => (await o("query HokCheckEntitlement($titleId: ID!) {\n hokCheckEntitlement(titleId: $titleId) { entitled modes }\n }", { titleId: t }, r)).hokCheckEntitlement,
578
+ enabled: !!t
579
+ });
580
+ }, te = () => {
581
+ let n = r(), { apiGatewayUrl: i } = e();
582
+ return t({
583
+ mutationFn: async (e) => (await o("mutation HokGrantEntitlement($input: HokGrantEntitlementInput!) {\n hokGrantEntitlement(input: $input) {\n id titleId userId mode source status territory expiresAt createdAt updatedAt\n title { id title }\n }\n }", { input: e }, i)).hokGrantEntitlement,
584
+ onSuccess: () => {
585
+ n.invalidateQueries({ queryKey: [s, "my-entitlements"] });
586
+ }
587
+ });
588
+ }, ne = () => {
589
+ let n = r(), { apiGatewayUrl: i } = e();
590
+ return t({
591
+ mutationFn: async ({ id: e, input: t }) => (await o(`mutation HokUpdateList($id: ID!, $input: HokUpdateListInput!) {
592
+ hokUpdateList(id: $id, input: $input) { ${h} }
593
+ }`, {
594
+ id: e,
595
+ input: t
596
+ }, i)).hokUpdateList,
597
+ onSuccess: () => {
598
+ n.invalidateQueries({ queryKey: [s, "my-lists"] });
599
+ }
600
+ });
601
+ }, re = () => {
516
602
  let { apiGatewayUrl: t } = e();
517
603
  return n({
518
604
  queryKey: [s, "health"],
@@ -521,6 +607,6 @@ var o = async (e, t, n) => {
521
607
  });
522
608
  };
523
609
  //#endregion
524
- export { I as useApplyToAudition, S as useArchiveTitle, N as useAuditionApplications, M as useAuditionById, j as useAuditions, F as useCloseAudition, P as useCreateAudition, q as useCreateList, E as useCreatePerson, k as useCreateProduction, z as useCreateReview, H as useCreateRightsWindow, w as useCreateStudio, y as useCreateTitle, J as useDeleteList, B as useDeleteReview, X as useHealth, G as useMyEntitlements, K as useMyLists, Y as useMyWatchProgress, T as usePeople, O as useProduction, D as useProductions, R as useReviews, W as useRevokeEntitlement, V as useRightsWindows, L as useScoreApplication, C as useStudios, v as useTitle, _ as useTitles, A as useTransitionProduction, U as useTransitionRightsWindow, x as useTransitionTitle, b as useUpdateTitle };
610
+ export { Y as useAddCredit, I as useApplyToAudition, S as useArchiveTitle, N as useAuditionApplications, M as useAuditionById, j as useAuditions, $ as useCheckEntitlement, F as useCloseAudition, P as useCreateAudition, Z as useCreateEpisode, K as useCreateList, E as useCreatePerson, k as useCreateProduction, R as useCreateReview, V as useCreateRightsWindow, X as useCreateSeason, w as useCreateStudio, y as useCreateTitle, q as useDeleteList, z as useDeleteReview, te as useGrantEntitlement, re as useHealth, W as useMyEntitlements, G as useMyLists, J as useMyWatchProgress, T as usePeople, O as useProduction, D as useProductions, Q as useRecordProgress, ee as useReviews, U as useRevokeEntitlement, B as useRightsWindows, L as useScoreApplication, C as useStudios, v as useTitle, _ as useTitles, A as useTransitionProduction, H as useTransitionRightsWindow, x as useTransitionTitle, ne as useUpdateList, b as useUpdateTitle };
525
611
 
526
612
  //# sourceMappingURL=useHookMoviesApi.js.map