@opentabs-dev/opentabs-plugin-twitch 0.0.82 → 0.0.84

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.
@@ -414,21 +414,23 @@
414
414
  if (!auth) throw ToolError.auth("Not authenticated \u2014 please log in to Twitch.");
415
415
  const body = { query };
416
416
  if (variables) body.variables = variables;
417
- const response = await fetchFromPage(GQL_URL, {
418
- method: "POST",
419
- credentials: "omit",
420
- headers: {
421
- "Client-Id": CLIENT_ID,
422
- Authorization: `OAuth ${auth.token}`,
423
- "Content-Type": "application/json"
424
- },
425
- body: JSON.stringify(body)
426
- });
427
- if (!response.ok) {
428
- if (response.status === 401 || response.status === 403) {
417
+ let response;
418
+ try {
419
+ response = await fetchFromPage(GQL_URL, {
420
+ method: "POST",
421
+ credentials: "omit",
422
+ headers: {
423
+ "Client-Id": CLIENT_ID,
424
+ Authorization: `OAuth ${auth.token}`,
425
+ "Content-Type": "application/json"
426
+ },
427
+ body: JSON.stringify(body)
428
+ });
429
+ } catch (error48) {
430
+ if (error48 instanceof ToolError && error48.category === "auth") {
429
431
  clearAuthCache("twitch");
430
432
  }
431
- throw httpStatusToToolError(response, "Twitch GQL request failed");
433
+ throw error48;
432
434
  }
433
435
  const result = await response.json();
434
436
  if (result.errors?.length && !result.data) {
@@ -14394,7 +14396,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14394
14396
  output: external_exports.object({ user: userSchema }),
14395
14397
  handle: async (params) => {
14396
14398
  const data = await gql(`{
14397
- user(login: "${params.login.replace(/"/g, '\\"')}") {
14399
+ user(login: "${params.login.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}") {
14398
14400
  id login displayName description
14399
14401
  profileImageURL(width: 300)
14400
14402
  createdAt
@@ -14588,7 +14590,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14588
14590
  output: external_exports.object({ channels: external_exports.array(channelResultSchema) }),
14589
14591
  handle: async (params) => {
14590
14592
  const data = await gql(`{
14591
- searchFor(userQuery: "${params.query.replace(/"/g, '\\"')}", platform: "web", options: { targets: [{ index: CHANNEL }] }) {
14593
+ searchFor(userQuery: "${params.query.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}", platform: "web", options: { targets: [{ index: CHANNEL }] }) {
14592
14594
  channels {
14593
14595
  items {
14594
14596
  id login displayName
@@ -14632,7 +14634,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14632
14634
  output: external_exports.object({ categories: external_exports.array(gameSchema) }),
14633
14635
  handle: async (params) => {
14634
14636
  const data = await gql(`{
14635
- searchFor(userQuery: "${params.query.replace(/"/g, '\\"')}", platform: "web", options: { targets: [{ index: GAME }] }) {
14637
+ searchFor(userQuery: "${params.query.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}", platform: "web", options: { targets: [{ index: GAME }] }) {
14636
14638
  games {
14637
14639
  items { id name displayName viewersCount broadcastersCount boxArtURL }
14638
14640
  }
@@ -14699,7 +14701,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14699
14701
  const first = params.first ?? 10;
14700
14702
  const period = params.period ?? "LAST_WEEK";
14701
14703
  const data = await gql(`{
14702
- game(name: "${params.name.replace(/"/g, '\\"')}") {
14704
+ game(name: "${params.name.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}") {
14703
14705
  clips(first: ${first}, criteria: { period: ${period} }) {
14704
14706
  edges {
14705
14707
  node {
@@ -14885,7 +14887,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
14885
14887
  };
14886
14888
  var src_default = new TwitchPlugin();
14887
14889
 
14888
- // dist/_adapter_entry_86a7d6fa-fe98-49df-b381-840c7e002c39.ts
14890
+ // dist/_adapter_entry_ca5cc22b-9109-4aa2-858d-35a90f67f2d7.ts
14889
14891
  if (!globalThis.__openTabs) {
14890
14892
  globalThis.__openTabs = {};
14891
14893
  } else {
@@ -15101,5 +15103,5 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15101
15103
  };
15102
15104
  delete src_default.onDeactivate;
15103
15105
  }
15104
- })();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["twitch"]){var a=o.adapters["twitch"];a.__adapterHash="b23d51919f37c82b072699d2dfa847edcbf0b36babe0acee8a6d52755bb2ded2";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"twitch",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
15106
+ })();(function(){var o=(globalThis).__openTabs;if(o&&o.adapters&&o.adapters["twitch"]){var a=o.adapters["twitch"];a.__adapterHash="8af1d4a903ae6f13ad52968b061af7acb37ff87120d6a65e54f1e25c72b4ebfa";if(a.tools&&Array.isArray(a.tools)){for(var i=0;i<a.tools.length;i++){Object.freeze(a.tools[i]);}Object.freeze(a.tools);}Object.freeze(a);Object.defineProperty(o.adapters,"twitch",{value:a,writable:false,configurable:false,enumerable:true});Object.defineProperty(o,"adapters",{value:o.adapters,writable:false,configurable:false});}})();
15105
15107
  //# sourceMappingURL=adapter.iife.js.map