@brigadasos/nadeshiko-sdk 1.5.1-dev.e889ab8 → 2.0.0-dev.1607304

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/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ var __export = (target, all) => {
39
39
  // generated/dev/index.ts
40
40
  var exports_dev = {};
41
41
  __export(exports_dev, {
42
+ withRetry: () => withRetry,
42
43
  user: () => exports_user_gen,
43
44
  updateUserPreferences: () => updateUserPreferences,
44
45
  updateSeriesMedia: () => updateSeriesMedia,
@@ -63,6 +64,7 @@ __export(exports_dev, {
63
64
  removeSegmentFromCollection: () => removeSegmentFromCollection,
64
65
  removeMediaFromSeries: () => removeMediaFromSeries,
65
66
  purgeAdminQueueFailed: () => purgeAdminQueueFailed,
67
+ paginate: () => paginate,
66
68
  media: () => exports_media_gen,
67
69
  listUserLabs: () => listUserLabs,
68
70
  listUserActivity: () => listUserActivity,
@@ -123,7 +125,8 @@ __export(exports_dev, {
123
125
  autocompleteMedia: () => autocompleteMedia,
124
126
  admin: () => exports_admin_gen,
125
127
  addSegmentToCollection: () => addSegmentToCollection,
126
- addMediaToSeries: () => addMediaToSeries
128
+ addMediaToSeries: () => addMediaToSeries,
129
+ NadeshikoError: () => NadeshikoError
127
130
  });
128
131
  module.exports = __toCommonJS(exports_dev);
129
132
 
@@ -931,11 +934,7 @@ var client = createClient(createConfig({ baseUrl: "https://api.nadeshiko.co" }))
931
934
 
932
935
  // generated/dev/sdk.gen.ts
933
936
  var search = (options) => (options?.client ?? client).post({
934
- security: [{ scheme: "bearer", type: "http" }, {
935
- in: "cookie",
936
- name: "nadeshiko.session_token",
937
- type: "apiKey"
938
- }],
937
+ security: [{ scheme: "bearer", type: "http" }],
939
938
  url: "/v1/search",
940
939
  ...options,
941
940
  headers: {
@@ -944,11 +943,7 @@ var search = (options) => (options?.client ?? client).post({
944
943
  }
945
944
  });
946
945
  var getSearchStats = (options) => (options?.client ?? client).post({
947
- security: [{ scheme: "bearer", type: "http" }, {
948
- in: "cookie",
949
- name: "nadeshiko.session_token",
950
- type: "apiKey"
951
- }],
946
+ security: [{ scheme: "bearer", type: "http" }],
952
947
  url: "/v1/search/stats",
953
948
  ...options,
954
949
  headers: {
@@ -957,11 +952,7 @@ var getSearchStats = (options) => (options?.client ?? client).post({
957
952
  }
958
953
  });
959
954
  var searchWords = (options) => (options.client ?? client).post({
960
- security: [{ scheme: "bearer", type: "http" }, {
961
- in: "cookie",
962
- name: "nadeshiko.session_token",
963
- type: "apiKey"
964
- }],
955
+ security: [{ scheme: "bearer", type: "http" }],
965
956
  url: "/v1/search/words",
966
957
  ...options,
967
958
  headers: {
@@ -970,20 +961,12 @@ var searchWords = (options) => (options.client ?? client).post({
970
961
  }
971
962
  });
972
963
  var listMedia = (options) => (options?.client ?? client).get({
973
- security: [{ scheme: "bearer", type: "http" }, {
974
- in: "cookie",
975
- name: "nadeshiko.session_token",
976
- type: "apiKey"
977
- }],
964
+ security: [{ scheme: "bearer", type: "http" }],
978
965
  url: "/v1/media",
979
966
  ...options
980
967
  });
981
968
  var createMedia = (options) => (options.client ?? client).post({
982
- security: [{ scheme: "bearer", type: "http" }, {
983
- in: "cookie",
984
- name: "nadeshiko.session_token",
985
- type: "apiKey"
986
- }],
969
+ security: [{ scheme: "bearer", type: "http" }],
987
970
  url: "/v1/media",
988
971
  ...options,
989
972
  headers: {
@@ -992,29 +975,17 @@ var createMedia = (options) => (options.client ?? client).post({
992
975
  }
993
976
  });
994
977
  var autocompleteMedia = (options) => (options.client ?? client).get({
995
- security: [{ scheme: "bearer", type: "http" }, {
996
- in: "cookie",
997
- name: "nadeshiko.session_token",
998
- type: "apiKey"
999
- }],
978
+ security: [{ scheme: "bearer", type: "http" }],
1000
979
  url: "/v1/media/autocomplete",
1001
980
  ...options
1002
981
  });
1003
982
  var getSegmentByUuid = (options) => (options.client ?? client).get({
1004
- security: [{ scheme: "bearer", type: "http" }, {
1005
- in: "cookie",
1006
- name: "nadeshiko.session_token",
1007
- type: "apiKey"
1008
- }],
983
+ security: [{ scheme: "bearer", type: "http" }],
1009
984
  url: "/v1/media/segments/{uuid}",
1010
985
  ...options
1011
986
  });
1012
987
  var updateSegmentByUuid = (options) => (options.client ?? client).patch({
1013
- security: [{ scheme: "bearer", type: "http" }, {
1014
- in: "cookie",
1015
- name: "nadeshiko.session_token",
1016
- type: "apiKey"
1017
- }],
988
+ security: [{ scheme: "bearer", type: "http" }],
1018
989
  url: "/v1/media/segments/{uuid}",
1019
990
  ...options,
1020
991
  headers: {
@@ -1023,38 +994,22 @@ var updateSegmentByUuid = (options) => (options.client ?? client).patch({
1023
994
  }
1024
995
  });
1025
996
  var getSegmentContext = (options) => (options.client ?? client).get({
1026
- security: [{ scheme: "bearer", type: "http" }, {
1027
- in: "cookie",
1028
- name: "nadeshiko.session_token",
1029
- type: "apiKey"
1030
- }],
997
+ security: [{ scheme: "bearer", type: "http" }],
1031
998
  url: "/v1/media/segments/{uuid}/context",
1032
999
  ...options
1033
1000
  });
1034
1001
  var listSegmentRevisions = (options) => (options.client ?? client).get({
1035
- security: [{ scheme: "bearer", type: "http" }, {
1036
- in: "cookie",
1037
- name: "nadeshiko.session_token",
1038
- type: "apiKey"
1039
- }],
1002
+ security: [{ scheme: "bearer", type: "http" }],
1040
1003
  url: "/v1/media/segments/{uuid}/revisions",
1041
1004
  ...options
1042
1005
  });
1043
1006
  var listSeries = (options) => (options?.client ?? client).get({
1044
- security: [{ scheme: "bearer", type: "http" }, {
1045
- in: "cookie",
1046
- name: "nadeshiko.session_token",
1047
- type: "apiKey"
1048
- }],
1007
+ security: [{ scheme: "bearer", type: "http" }],
1049
1008
  url: "/v1/media/series",
1050
1009
  ...options
1051
1010
  });
1052
1011
  var createSeries = (options) => (options.client ?? client).post({
1053
- security: [{ scheme: "bearer", type: "http" }, {
1054
- in: "cookie",
1055
- name: "nadeshiko.session_token",
1056
- type: "apiKey"
1057
- }],
1012
+ security: [{ scheme: "bearer", type: "http" }],
1058
1013
  url: "/v1/media/series",
1059
1014
  ...options,
1060
1015
  headers: {
@@ -1063,29 +1018,17 @@ var createSeries = (options) => (options.client ?? client).post({
1063
1018
  }
1064
1019
  });
1065
1020
  var deleteSeries = (options) => (options.client ?? client).delete({
1066
- security: [{ scheme: "bearer", type: "http" }, {
1067
- in: "cookie",
1068
- name: "nadeshiko.session_token",
1069
- type: "apiKey"
1070
- }],
1021
+ security: [{ scheme: "bearer", type: "http" }],
1071
1022
  url: "/v1/media/series/{id}",
1072
1023
  ...options
1073
1024
  });
1074
1025
  var getSeries = (options) => (options.client ?? client).get({
1075
- security: [{ scheme: "bearer", type: "http" }, {
1076
- in: "cookie",
1077
- name: "nadeshiko.session_token",
1078
- type: "apiKey"
1079
- }],
1026
+ security: [{ scheme: "bearer", type: "http" }],
1080
1027
  url: "/v1/media/series/{id}",
1081
1028
  ...options
1082
1029
  });
1083
1030
  var updateSeries = (options) => (options.client ?? client).patch({
1084
- security: [{ scheme: "bearer", type: "http" }, {
1085
- in: "cookie",
1086
- name: "nadeshiko.session_token",
1087
- type: "apiKey"
1088
- }],
1031
+ security: [{ scheme: "bearer", type: "http" }],
1089
1032
  url: "/v1/media/series/{id}",
1090
1033
  ...options,
1091
1034
  headers: {
@@ -1094,11 +1037,7 @@ var updateSeries = (options) => (options.client ?? client).patch({
1094
1037
  }
1095
1038
  });
1096
1039
  var addMediaToSeries = (options) => (options.client ?? client).post({
1097
- security: [{ scheme: "bearer", type: "http" }, {
1098
- in: "cookie",
1099
- name: "nadeshiko.session_token",
1100
- type: "apiKey"
1101
- }],
1040
+ security: [{ scheme: "bearer", type: "http" }],
1102
1041
  url: "/v1/media/series/{id}/media",
1103
1042
  ...options,
1104
1043
  headers: {
@@ -1107,20 +1046,12 @@ var addMediaToSeries = (options) => (options.client ?? client).post({
1107
1046
  }
1108
1047
  });
1109
1048
  var removeMediaFromSeries = (options) => (options.client ?? client).delete({
1110
- security: [{ scheme: "bearer", type: "http" }, {
1111
- in: "cookie",
1112
- name: "nadeshiko.session_token",
1113
- type: "apiKey"
1114
- }],
1049
+ security: [{ scheme: "bearer", type: "http" }],
1115
1050
  url: "/v1/media/series/{id}/media/{mediaId}",
1116
1051
  ...options
1117
1052
  });
1118
1053
  var updateSeriesMedia = (options) => (options.client ?? client).patch({
1119
- security: [{ scheme: "bearer", type: "http" }, {
1120
- in: "cookie",
1121
- name: "nadeshiko.session_token",
1122
- type: "apiKey"
1123
- }],
1054
+ security: [{ scheme: "bearer", type: "http" }],
1124
1055
  url: "/v1/media/series/{id}/media/{mediaId}",
1125
1056
  ...options,
1126
1057
  headers: {
@@ -1129,47 +1060,27 @@ var updateSeriesMedia = (options) => (options.client ?? client).patch({
1129
1060
  }
1130
1061
  });
1131
1062
  var getCharacter = (options) => (options.client ?? client).get({
1132
- security: [{ scheme: "bearer", type: "http" }, {
1133
- in: "cookie",
1134
- name: "nadeshiko.session_token",
1135
- type: "apiKey"
1136
- }],
1063
+ security: [{ scheme: "bearer", type: "http" }],
1137
1064
  url: "/v1/media/characters/{id}",
1138
1065
  ...options
1139
1066
  });
1140
1067
  var getSeiyuu = (options) => (options.client ?? client).get({
1141
- security: [{ scheme: "bearer", type: "http" }, {
1142
- in: "cookie",
1143
- name: "nadeshiko.session_token",
1144
- type: "apiKey"
1145
- }],
1068
+ security: [{ scheme: "bearer", type: "http" }],
1146
1069
  url: "/v1/media/seiyuu/{id}",
1147
1070
  ...options
1148
1071
  });
1149
1072
  var deleteMedia = (options) => (options.client ?? client).delete({
1150
- security: [{ scheme: "bearer", type: "http" }, {
1151
- in: "cookie",
1152
- name: "nadeshiko.session_token",
1153
- type: "apiKey"
1154
- }],
1073
+ security: [{ scheme: "bearer", type: "http" }],
1155
1074
  url: "/v1/media/{id}",
1156
1075
  ...options
1157
1076
  });
1158
1077
  var getMedia = (options) => (options.client ?? client).get({
1159
- security: [{ scheme: "bearer", type: "http" }, {
1160
- in: "cookie",
1161
- name: "nadeshiko.session_token",
1162
- type: "apiKey"
1163
- }],
1078
+ security: [{ scheme: "bearer", type: "http" }],
1164
1079
  url: "/v1/media/{id}",
1165
1080
  ...options
1166
1081
  });
1167
1082
  var updateMedia = (options) => (options.client ?? client).patch({
1168
- security: [{ scheme: "bearer", type: "http" }, {
1169
- in: "cookie",
1170
- name: "nadeshiko.session_token",
1171
- type: "apiKey"
1172
- }],
1083
+ security: [{ scheme: "bearer", type: "http" }],
1173
1084
  url: "/v1/media/{id}",
1174
1085
  ...options,
1175
1086
  headers: {
@@ -1178,20 +1089,12 @@ var updateMedia = (options) => (options.client ?? client).patch({
1178
1089
  }
1179
1090
  });
1180
1091
  var listEpisodes = (options) => (options.client ?? client).get({
1181
- security: [{ scheme: "bearer", type: "http" }, {
1182
- in: "cookie",
1183
- name: "nadeshiko.session_token",
1184
- type: "apiKey"
1185
- }],
1092
+ security: [{ scheme: "bearer", type: "http" }],
1186
1093
  url: "/v1/media/{mediaId}/episodes",
1187
1094
  ...options
1188
1095
  });
1189
1096
  var createEpisode = (options) => (options.client ?? client).post({
1190
- security: [{ scheme: "bearer", type: "http" }, {
1191
- in: "cookie",
1192
- name: "nadeshiko.session_token",
1193
- type: "apiKey"
1194
- }],
1097
+ security: [{ scheme: "bearer", type: "http" }],
1195
1098
  url: "/v1/media/{mediaId}/episodes",
1196
1099
  ...options,
1197
1100
  headers: {
@@ -1200,29 +1103,17 @@ var createEpisode = (options) => (options.client ?? client).post({
1200
1103
  }
1201
1104
  });
1202
1105
  var deleteEpisode = (options) => (options.client ?? client).delete({
1203
- security: [{ scheme: "bearer", type: "http" }, {
1204
- in: "cookie",
1205
- name: "nadeshiko.session_token",
1206
- type: "apiKey"
1207
- }],
1106
+ security: [{ scheme: "bearer", type: "http" }],
1208
1107
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}",
1209
1108
  ...options
1210
1109
  });
1211
1110
  var getEpisode = (options) => (options.client ?? client).get({
1212
- security: [{ scheme: "bearer", type: "http" }, {
1213
- in: "cookie",
1214
- name: "nadeshiko.session_token",
1215
- type: "apiKey"
1216
- }],
1111
+ security: [{ scheme: "bearer", type: "http" }],
1217
1112
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}",
1218
1113
  ...options
1219
1114
  });
1220
1115
  var updateEpisode = (options) => (options.client ?? client).patch({
1221
- security: [{ scheme: "bearer", type: "http" }, {
1222
- in: "cookie",
1223
- name: "nadeshiko.session_token",
1224
- type: "apiKey"
1225
- }],
1116
+ security: [{ scheme: "bearer", type: "http" }],
1226
1117
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}",
1227
1118
  ...options,
1228
1119
  headers: {
@@ -1231,20 +1122,12 @@ var updateEpisode = (options) => (options.client ?? client).patch({
1231
1122
  }
1232
1123
  });
1233
1124
  var listSegments = (options) => (options.client ?? client).get({
1234
- security: [{ scheme: "bearer", type: "http" }, {
1235
- in: "cookie",
1236
- name: "nadeshiko.session_token",
1237
- type: "apiKey"
1238
- }],
1125
+ security: [{ scheme: "bearer", type: "http" }],
1239
1126
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments",
1240
1127
  ...options
1241
1128
  });
1242
1129
  var createSegment = (options) => (options.client ?? client).post({
1243
- security: [{ scheme: "bearer", type: "http" }, {
1244
- in: "cookie",
1245
- name: "nadeshiko.session_token",
1246
- type: "apiKey"
1247
- }],
1130
+ security: [{ scheme: "bearer", type: "http" }],
1248
1131
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments",
1249
1132
  ...options,
1250
1133
  headers: {
@@ -1253,11 +1136,7 @@ var createSegment = (options) => (options.client ?? client).post({
1253
1136
  }
1254
1137
  });
1255
1138
  var createSegmentsBatch = (options) => (options.client ?? client).post({
1256
- security: [{ scheme: "bearer", type: "http" }, {
1257
- in: "cookie",
1258
- name: "nadeshiko.session_token",
1259
- type: "apiKey"
1260
- }],
1139
+ security: [{ scheme: "bearer", type: "http" }],
1261
1140
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments/batch",
1262
1141
  ...options,
1263
1142
  headers: {
@@ -1266,29 +1145,17 @@ var createSegmentsBatch = (options) => (options.client ?? client).post({
1266
1145
  }
1267
1146
  });
1268
1147
  var deleteSegment = (options) => (options.client ?? client).delete({
1269
- security: [{ scheme: "bearer", type: "http" }, {
1270
- in: "cookie",
1271
- name: "nadeshiko.session_token",
1272
- type: "apiKey"
1273
- }],
1148
+ security: [{ scheme: "bearer", type: "http" }],
1274
1149
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments/{id}",
1275
1150
  ...options
1276
1151
  });
1277
1152
  var getSegment = (options) => (options.client ?? client).get({
1278
- security: [{ scheme: "bearer", type: "http" }, {
1279
- in: "cookie",
1280
- name: "nadeshiko.session_token",
1281
- type: "apiKey"
1282
- }],
1153
+ security: [{ scheme: "bearer", type: "http" }],
1283
1154
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments/{id}",
1284
1155
  ...options
1285
1156
  });
1286
1157
  var updateSegment = (options) => (options.client ?? client).patch({
1287
- security: [{ scheme: "bearer", type: "http" }, {
1288
- in: "cookie",
1289
- name: "nadeshiko.session_token",
1290
- type: "apiKey"
1291
- }],
1158
+ security: [{ scheme: "bearer", type: "http" }],
1292
1159
  url: "/v1/media/{mediaId}/episodes/{episodeNumber}/segments/{id}",
1293
1160
  ...options,
1294
1161
  headers: {
@@ -1732,6 +1599,98 @@ var updateAnnouncement = (options) => (options.client ?? client).put({
1732
1599
  ...options.headers
1733
1600
  }
1734
1601
  });
1602
+ // generated/dev/retry.ts
1603
+ var RETRYABLE_STATUS = new Set([408, 429, 500, 502, 503, 504]);
1604
+ function parseRetryAfter(value) {
1605
+ const seconds = Number(value);
1606
+ if (!Number.isNaN(seconds))
1607
+ return seconds * 1000;
1608
+ const date = new Date(value);
1609
+ if (!Number.isNaN(date.getTime()))
1610
+ return Math.max(0, date.getTime() - Date.now());
1611
+ return 1000;
1612
+ }
1613
+ function backoffDelay(attempt, initial, max) {
1614
+ const jitter = Math.random() * 100;
1615
+ return Math.min(initial * 2 ** attempt + jitter, max);
1616
+ }
1617
+ function sleep(ms) {
1618
+ return new Promise((resolve) => setTimeout(resolve, ms));
1619
+ }
1620
+ function withRetry(fetchImpl = globalThis.fetch, options = {}) {
1621
+ const { maxRetries = 2, initialDelayMs = 500, maxDelayMs = 30000, timeout } = options;
1622
+ return async function retryingFetch(input, init) {
1623
+ let attempt = 0;
1624
+ while (true) {
1625
+ let timedInit = init;
1626
+ if (timeout !== undefined && !init?.signal) {
1627
+ const controller = new AbortController;
1628
+ const timeoutId = setTimeout(() => controller.abort(new Error(`Request timed out after ${timeout}ms`)), timeout);
1629
+ timedInit = { ...init, signal: controller.signal };
1630
+ let response2;
1631
+ try {
1632
+ response2 = await fetchImpl(input, timedInit);
1633
+ clearTimeout(timeoutId);
1634
+ } catch (networkError) {
1635
+ clearTimeout(timeoutId);
1636
+ if (attempt >= maxRetries)
1637
+ throw networkError;
1638
+ await sleep(backoffDelay(attempt, initialDelayMs, maxDelayMs));
1639
+ attempt++;
1640
+ continue;
1641
+ }
1642
+ if (!RETRYABLE_STATUS.has(response2.status) || attempt >= maxRetries) {
1643
+ return response2;
1644
+ }
1645
+ const retryAfter2 = response2.headers.get("Retry-After");
1646
+ const waitMs2 = retryAfter2 ? parseRetryAfter(retryAfter2) : backoffDelay(attempt, initialDelayMs, maxDelayMs);
1647
+ await sleep(waitMs2);
1648
+ attempt++;
1649
+ continue;
1650
+ }
1651
+ let response;
1652
+ try {
1653
+ response = await fetchImpl(input, timedInit);
1654
+ } catch (networkError) {
1655
+ if (attempt >= maxRetries)
1656
+ throw networkError;
1657
+ await sleep(backoffDelay(attempt, initialDelayMs, maxDelayMs));
1658
+ attempt++;
1659
+ continue;
1660
+ }
1661
+ if (!RETRYABLE_STATUS.has(response.status) || attempt >= maxRetries) {
1662
+ return response;
1663
+ }
1664
+ const retryAfter = response.headers.get("Retry-After");
1665
+ const waitMs = retryAfter ? parseRetryAfter(retryAfter) : backoffDelay(attempt, initialDelayMs, maxDelayMs);
1666
+ await sleep(waitMs);
1667
+ attempt++;
1668
+ }
1669
+ };
1670
+ }
1671
+
1672
+ // generated/dev/errors.ts
1673
+ class NadeshikoError extends Error {
1674
+ code;
1675
+ title;
1676
+ detail;
1677
+ type;
1678
+ status;
1679
+ traceId;
1680
+ errors;
1681
+ constructor(body) {
1682
+ super(body.detail || body.title || `API error ${body.status}`);
1683
+ this.name = "NadeshikoError";
1684
+ this.code = body.code;
1685
+ this.title = body.title;
1686
+ this.detail = body.detail;
1687
+ this.type = body.type;
1688
+ this.status = body.status;
1689
+ this.traceId = body.instance;
1690
+ this.errors = body.errors;
1691
+ }
1692
+ }
1693
+
1735
1694
  // generated/dev/nadeshiko.gen.ts
1736
1695
  var environments = {
1737
1696
  LOCAL: "http://localhost:5000/api",
@@ -1746,7 +1705,8 @@ var defaultSessionTokenGetter = () => {
1746
1705
  return match ? decodeURIComponent(match[1]) : undefined;
1747
1706
  };
1748
1707
  function createNadeshikoClient(config) {
1749
- const baseUrl = config.baseUrl === undefined ? environments.PRODUCTION : (config.baseUrl in environments) ? environments[config.baseUrl] : config.baseUrl;
1708
+ const rawBaseUrl = config.baseURL ?? config.baseUrl;
1709
+ const baseUrl = rawBaseUrl === undefined ? environments.PRODUCTION : (rawBaseUrl in environments) ? environments[rawBaseUrl] : rawBaseUrl;
1750
1710
  const getApiKey = async () => {
1751
1711
  if (typeof config.apiKey === "function") {
1752
1712
  return await config.apiKey();
@@ -1756,6 +1716,7 @@ function createNadeshikoClient(config) {
1756
1716
  const getSessionToken = config.sessionToken ?? defaultSessionTokenGetter;
1757
1717
  const clientInstance = createClient(createConfig({
1758
1718
  baseUrl,
1719
+ fetch: withRetry(globalThis.fetch, config.retryOptions),
1759
1720
  auth: (auth) => {
1760
1721
  if (auth.in === "cookie") {
1761
1722
  return getSessionToken();
@@ -1763,87 +1724,93 @@ function createNadeshikoClient(config) {
1763
1724
  return getApiKey();
1764
1725
  }
1765
1726
  }));
1727
+ clientInstance.interceptors.error.use((error) => {
1728
+ if (error && typeof error === "object" && "code" in error && typeof error.code === "string") {
1729
+ return new NadeshikoError(error);
1730
+ }
1731
+ return error;
1732
+ });
1766
1733
  return {
1767
1734
  client: clientInstance,
1768
- search: (options) => search({ ...options, client: clientInstance }),
1769
- getSearchStats: (options) => getSearchStats({ ...options, client: clientInstance }),
1770
- searchWords: (options) => searchWords({ ...options, client: clientInstance }),
1771
- listMedia: (options) => listMedia({ ...options, client: clientInstance }),
1772
- getSegmentByUuid: (options) => getSegmentByUuid({ ...options, client: clientInstance }),
1773
- getSegmentContext: (options) => getSegmentContext({ ...options, client: clientInstance }),
1774
- listSeries: (options) => listSeries({ ...options, client: clientInstance }),
1775
- getSeries: (options) => getSeries({ ...options, client: clientInstance }),
1776
- getCharacter: (options) => getCharacter({ ...options, client: clientInstance }),
1777
- getSeiyuu: (options) => getSeiyuu({ ...options, client: clientInstance }),
1778
- getMedia: (options) => getMedia({ ...options, client: clientInstance }),
1779
- listEpisodes: (options) => listEpisodes({ ...options, client: clientInstance }),
1780
- getEpisode: (options) => getEpisode({ ...options, client: clientInstance }),
1781
- getSegment: (options) => getSegment({ ...options, client: clientInstance }),
1782
- createMedia: (options) => createMedia({ ...options, client: clientInstance }),
1783
- autocompleteMedia: (options) => autocompleteMedia({ ...options, client: clientInstance }),
1784
- updateSegmentByUuid: (options) => updateSegmentByUuid({ ...options, client: clientInstance }),
1785
- listSegmentRevisions: (options) => listSegmentRevisions({ ...options, client: clientInstance }),
1786
- createSeries: (options) => createSeries({ ...options, client: clientInstance }),
1787
- updateSeries: (options) => updateSeries({ ...options, client: clientInstance }),
1788
- deleteSeries: (options) => deleteSeries({ ...options, client: clientInstance }),
1789
- addMediaToSeries: (options) => addMediaToSeries({ ...options, client: clientInstance }),
1790
- updateSeriesMedia: (options) => updateSeriesMedia({ ...options, client: clientInstance }),
1791
- removeMediaFromSeries: (options) => removeMediaFromSeries({ ...options, client: clientInstance }),
1792
- updateMedia: (options) => updateMedia({ ...options, client: clientInstance }),
1793
- deleteMedia: (options) => deleteMedia({ ...options, client: clientInstance }),
1794
- createEpisode: (options) => createEpisode({ ...options, client: clientInstance }),
1795
- updateEpisode: (options) => updateEpisode({ ...options, client: clientInstance }),
1796
- deleteEpisode: (options) => deleteEpisode({ ...options, client: clientInstance }),
1797
- listSegments: (options) => listSegments({ ...options, client: clientInstance }),
1798
- createSegment: (options) => createSegment({ ...options, client: clientInstance }),
1799
- createSegmentsBatch: (options) => createSegmentsBatch({ ...options, client: clientInstance }),
1800
- updateSegment: (options) => updateSegment({ ...options, client: clientInstance }),
1801
- deleteSegment: (options) => deleteSegment({ ...options, client: clientInstance }),
1802
- getUserQuota: (options) => getUserQuota({ ...options, client: clientInstance }),
1803
- createUserReport: (options) => createUserReport({ ...options, client: clientInstance }),
1804
- getUserPreferences: (options) => getUserPreferences({ ...options, client: clientInstance }),
1805
- updateUserPreferences: (options) => updateUserPreferences({ ...options, client: clientInstance }),
1806
- listUserActivity: (options) => listUserActivity({ ...options, client: clientInstance }),
1807
- trackUserActivity: (options) => trackUserActivity({ ...options, client: clientInstance }),
1808
- deleteUserActivity: (options) => deleteUserActivity({ ...options, client: clientInstance }),
1809
- getUserActivityHeatmap: (options) => getUserActivityHeatmap({ ...options, client: clientInstance }),
1810
- getUserActivityStats: (options) => getUserActivityStats({ ...options, client: clientInstance }),
1811
- deleteUserActivityByDate: (options) => deleteUserActivityByDate({ ...options, client: clientInstance }),
1812
- deleteUserActivityById: (options) => deleteUserActivityById({ ...options, client: clientInstance }),
1813
- exportUserData: (options) => exportUserData({ ...options, client: clientInstance }),
1814
- listUserLabs: (options) => listUserLabs({ ...options, client: clientInstance }),
1815
- enrollUserLab: (options) => enrollUserLab({ ...options, client: clientInstance }),
1816
- unenrollUserLab: (options) => unenrollUserLab({ ...options, client: clientInstance }),
1817
- listCollections: (options) => listCollections({ ...options, client: clientInstance }),
1818
- createCollection: (options) => createCollection({ ...options, client: clientInstance }),
1819
- getCollection: (options) => getCollection({ ...options, client: clientInstance }),
1820
- updateCollection: (options) => updateCollection({ ...options, client: clientInstance }),
1821
- deleteCollection: (options) => deleteCollection({ ...options, client: clientInstance }),
1822
- addSegmentToCollection: (options) => addSegmentToCollection({ ...options, client: clientInstance }),
1823
- updateCollectionSegment: (options) => updateCollectionSegment({ ...options, client: clientInstance }),
1824
- removeSegmentFromCollection: (options) => removeSegmentFromCollection({ ...options, client: clientInstance }),
1825
- searchCollectionSegments: (options) => searchCollectionSegments({ ...options, client: clientInstance }),
1826
- getCollectionStats: (options) => getCollectionStats({ ...options, client: clientInstance }),
1827
- getAdminDashboard: (options) => getAdminDashboard({ ...options, client: clientInstance }),
1828
- getAdminHealth: (options) => getAdminHealth({ ...options, client: clientInstance }),
1829
- triggerReindex: (options) => triggerReindex({ ...options, client: clientInstance }),
1830
- listAdminQueueStats: (options) => listAdminQueueStats({ ...options, client: clientInstance }),
1831
- getAdminQueue: (options) => getAdminQueue({ ...options, client: clientInstance }),
1832
- listAdminQueueFailed: (options) => listAdminQueueFailed({ ...options, client: clientInstance }),
1833
- retryAdminQueueFailed: (options) => retryAdminQueueFailed({ ...options, client: clientInstance }),
1834
- purgeAdminQueueFailed: (options) => purgeAdminQueueFailed({ ...options, client: clientInstance }),
1835
- impersonateAdminUser: (options) => impersonateAdminUser({ ...options, client: clientInstance }),
1836
- clearAdminImpersonation: (options) => clearAdminImpersonation({ ...options, client: clientInstance }),
1837
- listAdminReports: (options) => listAdminReports({ ...options, client: clientInstance }),
1838
- batchUpdateAdminReports: (options) => batchUpdateAdminReports({ ...options, client: clientInstance }),
1839
- updateAdminReport: (options) => updateAdminReport({ ...options, client: clientInstance }),
1840
- listAdminMediaAudits: (options) => listAdminMediaAudits({ ...options, client: clientInstance }),
1841
- updateAdminMediaAudit: (options) => updateAdminMediaAudit({ ...options, client: clientInstance }),
1842
- runAdminMediaAudit: (options) => runAdminMediaAudit({ ...options, client: clientInstance }),
1843
- listAdminMediaAuditRuns: (options) => listAdminMediaAuditRuns({ ...options, client: clientInstance }),
1844
- getAdminMediaAuditRun: (options) => getAdminMediaAuditRun({ ...options, client: clientInstance }),
1845
- getAnnouncement: (options) => getAnnouncement({ ...options, client: clientInstance }),
1846
- updateAnnouncement: (options) => updateAnnouncement({ ...options, client: clientInstance })
1735
+ search: (options) => search({ throwOnError: true, ...options, client: clientInstance }),
1736
+ getSearchStats: (options) => getSearchStats({ throwOnError: true, ...options, client: clientInstance }),
1737
+ searchWords: (options) => searchWords({ throwOnError: true, ...options, client: clientInstance }),
1738
+ listMedia: (options) => listMedia({ throwOnError: true, ...options, client: clientInstance }),
1739
+ getSegmentByUuid: (options) => getSegmentByUuid({ throwOnError: true, ...options, client: clientInstance }),
1740
+ getSegmentContext: (options) => getSegmentContext({ throwOnError: true, ...options, client: clientInstance }),
1741
+ listSeries: (options) => listSeries({ throwOnError: true, ...options, client: clientInstance }),
1742
+ getSeries: (options) => getSeries({ throwOnError: true, ...options, client: clientInstance }),
1743
+ getMedia: (options) => getMedia({ throwOnError: true, ...options, client: clientInstance }),
1744
+ listEpisodes: (options) => listEpisodes({ throwOnError: true, ...options, client: clientInstance }),
1745
+ getEpisode: (options) => getEpisode({ throwOnError: true, ...options, client: clientInstance }),
1746
+ getSegment: (options) => getSegment({ throwOnError: true, ...options, client: clientInstance }),
1747
+ createMedia: (options) => createMedia({ throwOnError: true, ...options, client: clientInstance }),
1748
+ autocompleteMedia: (options) => autocompleteMedia({ throwOnError: true, ...options, client: clientInstance }),
1749
+ updateSegmentByUuid: (options) => updateSegmentByUuid({ throwOnError: true, ...options, client: clientInstance }),
1750
+ listSegmentRevisions: (options) => listSegmentRevisions({ throwOnError: true, ...options, client: clientInstance }),
1751
+ createSeries: (options) => createSeries({ throwOnError: true, ...options, client: clientInstance }),
1752
+ updateSeries: (options) => updateSeries({ throwOnError: true, ...options, client: clientInstance }),
1753
+ deleteSeries: (options) => deleteSeries({ throwOnError: true, ...options, client: clientInstance }),
1754
+ addMediaToSeries: (options) => addMediaToSeries({ throwOnError: true, ...options, client: clientInstance }),
1755
+ updateSeriesMedia: (options) => updateSeriesMedia({ throwOnError: true, ...options, client: clientInstance }),
1756
+ removeMediaFromSeries: (options) => removeMediaFromSeries({ throwOnError: true, ...options, client: clientInstance }),
1757
+ getCharacter: (options) => getCharacter({ throwOnError: true, ...options, client: clientInstance }),
1758
+ getSeiyuu: (options) => getSeiyuu({ throwOnError: true, ...options, client: clientInstance }),
1759
+ updateMedia: (options) => updateMedia({ throwOnError: true, ...options, client: clientInstance }),
1760
+ deleteMedia: (options) => deleteMedia({ throwOnError: true, ...options, client: clientInstance }),
1761
+ createEpisode: (options) => createEpisode({ throwOnError: true, ...options, client: clientInstance }),
1762
+ updateEpisode: (options) => updateEpisode({ throwOnError: true, ...options, client: clientInstance }),
1763
+ deleteEpisode: (options) => deleteEpisode({ throwOnError: true, ...options, client: clientInstance }),
1764
+ listSegments: (options) => listSegments({ throwOnError: true, ...options, client: clientInstance }),
1765
+ createSegment: (options) => createSegment({ throwOnError: true, ...options, client: clientInstance }),
1766
+ createSegmentsBatch: (options) => createSegmentsBatch({ throwOnError: true, ...options, client: clientInstance }),
1767
+ updateSegment: (options) => updateSegment({ throwOnError: true, ...options, client: clientInstance }),
1768
+ deleteSegment: (options) => deleteSegment({ throwOnError: true, ...options, client: clientInstance }),
1769
+ getUserQuota: (options) => getUserQuota({ throwOnError: true, ...options, client: clientInstance }),
1770
+ createUserReport: (options) => createUserReport({ throwOnError: true, ...options, client: clientInstance }),
1771
+ getUserPreferences: (options) => getUserPreferences({ throwOnError: true, ...options, client: clientInstance }),
1772
+ updateUserPreferences: (options) => updateUserPreferences({ throwOnError: true, ...options, client: clientInstance }),
1773
+ listUserActivity: (options) => listUserActivity({ throwOnError: true, ...options, client: clientInstance }),
1774
+ trackUserActivity: (options) => trackUserActivity({ throwOnError: true, ...options, client: clientInstance }),
1775
+ deleteUserActivity: (options) => deleteUserActivity({ throwOnError: true, ...options, client: clientInstance }),
1776
+ getUserActivityHeatmap: (options) => getUserActivityHeatmap({ throwOnError: true, ...options, client: clientInstance }),
1777
+ getUserActivityStats: (options) => getUserActivityStats({ throwOnError: true, ...options, client: clientInstance }),
1778
+ deleteUserActivityByDate: (options) => deleteUserActivityByDate({ throwOnError: true, ...options, client: clientInstance }),
1779
+ deleteUserActivityById: (options) => deleteUserActivityById({ throwOnError: true, ...options, client: clientInstance }),
1780
+ exportUserData: (options) => exportUserData({ throwOnError: true, ...options, client: clientInstance }),
1781
+ listUserLabs: (options) => listUserLabs({ throwOnError: true, ...options, client: clientInstance }),
1782
+ enrollUserLab: (options) => enrollUserLab({ throwOnError: true, ...options, client: clientInstance }),
1783
+ unenrollUserLab: (options) => unenrollUserLab({ throwOnError: true, ...options, client: clientInstance }),
1784
+ listCollections: (options) => listCollections({ throwOnError: true, ...options, client: clientInstance }),
1785
+ createCollection: (options) => createCollection({ throwOnError: true, ...options, client: clientInstance }),
1786
+ getCollection: (options) => getCollection({ throwOnError: true, ...options, client: clientInstance }),
1787
+ updateCollection: (options) => updateCollection({ throwOnError: true, ...options, client: clientInstance }),
1788
+ deleteCollection: (options) => deleteCollection({ throwOnError: true, ...options, client: clientInstance }),
1789
+ addSegmentToCollection: (options) => addSegmentToCollection({ throwOnError: true, ...options, client: clientInstance }),
1790
+ updateCollectionSegment: (options) => updateCollectionSegment({ throwOnError: true, ...options, client: clientInstance }),
1791
+ removeSegmentFromCollection: (options) => removeSegmentFromCollection({ throwOnError: true, ...options, client: clientInstance }),
1792
+ searchCollectionSegments: (options) => searchCollectionSegments({ throwOnError: true, ...options, client: clientInstance }),
1793
+ getCollectionStats: (options) => getCollectionStats({ throwOnError: true, ...options, client: clientInstance }),
1794
+ getAdminDashboard: (options) => getAdminDashboard({ throwOnError: true, ...options, client: clientInstance }),
1795
+ getAdminHealth: (options) => getAdminHealth({ throwOnError: true, ...options, client: clientInstance }),
1796
+ triggerReindex: (options) => triggerReindex({ throwOnError: true, ...options, client: clientInstance }),
1797
+ listAdminQueueStats: (options) => listAdminQueueStats({ throwOnError: true, ...options, client: clientInstance }),
1798
+ getAdminQueue: (options) => getAdminQueue({ throwOnError: true, ...options, client: clientInstance }),
1799
+ listAdminQueueFailed: (options) => listAdminQueueFailed({ throwOnError: true, ...options, client: clientInstance }),
1800
+ retryAdminQueueFailed: (options) => retryAdminQueueFailed({ throwOnError: true, ...options, client: clientInstance }),
1801
+ purgeAdminQueueFailed: (options) => purgeAdminQueueFailed({ throwOnError: true, ...options, client: clientInstance }),
1802
+ impersonateAdminUser: (options) => impersonateAdminUser({ throwOnError: true, ...options, client: clientInstance }),
1803
+ clearAdminImpersonation: (options) => clearAdminImpersonation({ throwOnError: true, ...options, client: clientInstance }),
1804
+ listAdminReports: (options) => listAdminReports({ throwOnError: true, ...options, client: clientInstance }),
1805
+ batchUpdateAdminReports: (options) => batchUpdateAdminReports({ throwOnError: true, ...options, client: clientInstance }),
1806
+ updateAdminReport: (options) => updateAdminReport({ throwOnError: true, ...options, client: clientInstance }),
1807
+ listAdminMediaAudits: (options) => listAdminMediaAudits({ throwOnError: true, ...options, client: clientInstance }),
1808
+ updateAdminMediaAudit: (options) => updateAdminMediaAudit({ throwOnError: true, ...options, client: clientInstance }),
1809
+ runAdminMediaAudit: (options) => runAdminMediaAudit({ throwOnError: true, ...options, client: clientInstance }),
1810
+ listAdminMediaAuditRuns: (options) => listAdminMediaAuditRuns({ throwOnError: true, ...options, client: clientInstance }),
1811
+ getAdminMediaAuditRun: (options) => getAdminMediaAuditRun({ throwOnError: true, ...options, client: clientInstance }),
1812
+ getAnnouncement: (options) => getAnnouncement({ throwOnError: true, ...options, client: clientInstance }),
1813
+ updateAnnouncement: (options) => updateAnnouncement({ throwOnError: true, ...options, client: clientInstance })
1847
1814
  };
1848
1815
  }
1849
1816
  // generated/dev/internal/media.gen.ts
@@ -1858,6 +1825,8 @@ __export(exports_media_gen, {
1858
1825
  removeMediaFromSeries: () => removeMediaFromSeries,
1859
1826
  listSegments: () => listSegments,
1860
1827
  listSegmentRevisions: () => listSegmentRevisions,
1828
+ getSeiyuu: () => getSeiyuu,
1829
+ getCharacter: () => getCharacter,
1861
1830
  deleteSeries: () => deleteSeries,
1862
1831
  deleteSegment: () => deleteSegment,
1863
1832
  deleteMedia: () => deleteMedia,
@@ -1927,6 +1896,35 @@ __export(exports_admin_gen, {
1927
1896
  clearAdminImpersonation: () => clearAdminImpersonation,
1928
1897
  batchUpdateAdminReports: () => batchUpdateAdminReports
1929
1898
  });
1899
+ // generated/dev/paginate.ts
1900
+ async function* paginate(fn, options, extract) {
1901
+ let cursor = null;
1902
+ let first = true;
1903
+ while (true) {
1904
+ const callOptions = first ? options : patchCursor(options, cursor);
1905
+ first = false;
1906
+ const result = await fn(callOptions);
1907
+ if ("error" in result && result.error !== undefined) {
1908
+ throw result.error;
1909
+ }
1910
+ const { items, pagination } = extract(result.data);
1911
+ for (const item of items) {
1912
+ yield item;
1913
+ }
1914
+ if (!pagination.hasMore || pagination.cursor === null)
1915
+ break;
1916
+ cursor = pagination.cursor;
1917
+ }
1918
+ }
1919
+ function patchCursor(options, cursor) {
1920
+ if (options.body !== undefined) {
1921
+ return { ...options, body: { ...options.body, cursor } };
1922
+ }
1923
+ if (options.query !== undefined) {
1924
+ return { ...options, query: { ...options.query, cursor } };
1925
+ }
1926
+ return { ...options, body: { cursor } };
1927
+ }
1930
1928
 
1931
- //# debugId=4A1D906EF6A4392464756E2164756E21
1929
+ //# debugId=E58CE5A8EFD2500564756E2164756E21
1932
1930
  //# sourceMappingURL=index.js.map