@collective-intelligence/external-apps-server-sdk 0.4.0 → 0.5.0

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/effect.d.ts CHANGED
@@ -966,6 +966,268 @@ export type AccessMemberHoldersRequest = {
966
966
  after?: string;
967
967
  limit?: number;
968
968
  };
969
+ export type ExternalApplicationRunSource = {
970
+ documentId: string;
971
+ downloadUrl: string;
972
+ pages: Array<{
973
+ end: number;
974
+ start: number;
975
+ }>;
976
+ title: string;
977
+ versionId: string;
978
+ };
979
+ export type ExternalApplicationsGetRunSourcesErrors = {
980
+ /**
981
+ * Error
982
+ */
983
+ 400: {
984
+ correlationId: string;
985
+ error: {
986
+ code: "invalid_request";
987
+ message: string;
988
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
989
+ retryable: false;
990
+ };
991
+ };
992
+ /**
993
+ * Error
994
+ */
995
+ 401: {
996
+ correlationId: string;
997
+ error: {
998
+ code: "authentication_required";
999
+ message: string;
1000
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1001
+ retryable: false;
1002
+ };
1003
+ };
1004
+ /**
1005
+ * Error
1006
+ */
1007
+ 403: {
1008
+ correlationId: string;
1009
+ error: {
1010
+ code: "authorization_denied";
1011
+ message: string;
1012
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1013
+ retryable: false;
1014
+ };
1015
+ };
1016
+ /**
1017
+ * Error
1018
+ */
1019
+ 404: {
1020
+ correlationId: string;
1021
+ error: {
1022
+ code: "operation_not_allowed";
1023
+ message: string;
1024
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1025
+ retryable: false;
1026
+ };
1027
+ } | {
1028
+ correlationId: string;
1029
+ error: {
1030
+ code: "not_found";
1031
+ message: string;
1032
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1033
+ retryable: false;
1034
+ };
1035
+ };
1036
+ /**
1037
+ * Error
1038
+ */
1039
+ 409: {
1040
+ correlationId: string;
1041
+ error: {
1042
+ code: "conflict";
1043
+ message: string;
1044
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1045
+ retryable: false;
1046
+ };
1047
+ } | {
1048
+ correlationId: string;
1049
+ error: {
1050
+ code: "run_not_settled";
1051
+ message: string;
1052
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1053
+ retryable: true;
1054
+ };
1055
+ };
1056
+ /**
1057
+ * Error
1058
+ */
1059
+ 500: {
1060
+ correlationId: string;
1061
+ error: {
1062
+ code: "internal_error";
1063
+ message: string;
1064
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1065
+ retryable: false;
1066
+ };
1067
+ };
1068
+ /**
1069
+ * Error
1070
+ */
1071
+ 503: {
1072
+ correlationId: string;
1073
+ error: {
1074
+ code: "temporarily_unavailable";
1075
+ message: string;
1076
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1077
+ retryable: true;
1078
+ };
1079
+ };
1080
+ };
1081
+ export type ExternalApplicationsGetRunSourcesError = ExternalApplicationsGetRunSourcesErrors[keyof ExternalApplicationsGetRunSourcesErrors];
1082
+ export type ExternalApplicationsPutRunFeedbackData = {
1083
+ body: {
1084
+ sentiment: "positive" | "negative";
1085
+ submitterNote?: string;
1086
+ };
1087
+ headers: {
1088
+ authorization?: string;
1089
+ "x-organization-id": string;
1090
+ "x-correlation-id"?: string;
1091
+ "x-external-audit-issuer"?: string;
1092
+ "x-external-audit-subject"?: string;
1093
+ "x-external-caller-kind"?: "anonymous_visitor";
1094
+ "x-external-ci-user-id"?: string;
1095
+ };
1096
+ path: {
1097
+ runId: string;
1098
+ };
1099
+ query?: never;
1100
+ url: "/application/v1/runs/{runId}/feedback";
1101
+ };
1102
+ export type ExternalApplicationsPutRunFeedbackErrors = {
1103
+ /**
1104
+ * Error
1105
+ */
1106
+ 400: {
1107
+ correlationId: string;
1108
+ error: {
1109
+ code: "invalid_request";
1110
+ message: string;
1111
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1112
+ retryable: false;
1113
+ };
1114
+ };
1115
+ /**
1116
+ * Error
1117
+ */
1118
+ 401: {
1119
+ correlationId: string;
1120
+ error: {
1121
+ code: "authentication_required";
1122
+ message: string;
1123
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1124
+ retryable: false;
1125
+ };
1126
+ };
1127
+ /**
1128
+ * Error
1129
+ */
1130
+ 403: {
1131
+ correlationId: string;
1132
+ error: {
1133
+ code: "authorization_denied";
1134
+ message: string;
1135
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1136
+ retryable: false;
1137
+ };
1138
+ };
1139
+ /**
1140
+ * Error
1141
+ */
1142
+ 404: {
1143
+ correlationId: string;
1144
+ error: {
1145
+ code: "operation_not_allowed";
1146
+ message: string;
1147
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1148
+ retryable: false;
1149
+ };
1150
+ } | {
1151
+ correlationId: string;
1152
+ error: {
1153
+ code: "not_found";
1154
+ message: string;
1155
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1156
+ retryable: false;
1157
+ };
1158
+ };
1159
+ /**
1160
+ * Error
1161
+ */
1162
+ 409: {
1163
+ correlationId: string;
1164
+ error: {
1165
+ code: "conflict";
1166
+ message: string;
1167
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1168
+ retryable: false;
1169
+ };
1170
+ } | {
1171
+ correlationId: string;
1172
+ error: {
1173
+ code: "run_not_settled";
1174
+ message: string;
1175
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1176
+ retryable: true;
1177
+ };
1178
+ };
1179
+ /**
1180
+ * Error
1181
+ */
1182
+ 422: {
1183
+ correlationId: string;
1184
+ error: {
1185
+ code: "feedback_note_required";
1186
+ message: string;
1187
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1188
+ retryable: false;
1189
+ };
1190
+ };
1191
+ /**
1192
+ * Error
1193
+ */
1194
+ 500: {
1195
+ correlationId: string;
1196
+ error: {
1197
+ code: "internal_error";
1198
+ message: string;
1199
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1200
+ retryable: false;
1201
+ };
1202
+ };
1203
+ /**
1204
+ * Error
1205
+ */
1206
+ 503: {
1207
+ correlationId: string;
1208
+ error: {
1209
+ code: "temporarily_unavailable";
1210
+ message: string;
1211
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1212
+ retryable: true;
1213
+ };
1214
+ };
1215
+ };
1216
+ export type ExternalApplicationsPutRunFeedbackError = ExternalApplicationsPutRunFeedbackErrors[keyof ExternalApplicationsPutRunFeedbackErrors];
1217
+ export type ExternalApplicationsPutRunFeedbackResponses = {
1218
+ /**
1219
+ * Success
1220
+ */
1221
+ 200: {
1222
+ correlationId: string;
1223
+ result: {
1224
+ runId: string;
1225
+ sentiment: "positive" | "negative";
1226
+ submitterNote: string | null;
1227
+ };
1228
+ };
1229
+ };
1230
+ export type ExternalApplicationsPutRunFeedbackResponse = ExternalApplicationsPutRunFeedbackResponses[keyof ExternalApplicationsPutRunFeedbackResponses];
969
1231
  export type ExternalApplicationsGetContextErrors = {
970
1232
  /**
971
1233
  * Error
@@ -975,7 +1237,7 @@ export type ExternalApplicationsGetContextErrors = {
975
1237
  error: {
976
1238
  code: "invalid_request";
977
1239
  message: string;
978
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1240
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
979
1241
  retryable: false;
980
1242
  };
981
1243
  };
@@ -987,7 +1249,7 @@ export type ExternalApplicationsGetContextErrors = {
987
1249
  error: {
988
1250
  code: "authentication_required";
989
1251
  message: string;
990
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1252
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
991
1253
  retryable: false;
992
1254
  };
993
1255
  };
@@ -999,7 +1261,7 @@ export type ExternalApplicationsGetContextErrors = {
999
1261
  error: {
1000
1262
  code: "authorization_denied";
1001
1263
  message: string;
1002
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1264
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1003
1265
  retryable: false;
1004
1266
  };
1005
1267
  };
@@ -1011,7 +1273,7 @@ export type ExternalApplicationsGetContextErrors = {
1011
1273
  error: {
1012
1274
  code: "operation_not_allowed";
1013
1275
  message: string;
1014
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1276
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1015
1277
  retryable: false;
1016
1278
  };
1017
1279
  } | {
@@ -1019,7 +1281,7 @@ export type ExternalApplicationsGetContextErrors = {
1019
1281
  error: {
1020
1282
  code: "not_found";
1021
1283
  message: string;
1022
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1284
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1023
1285
  retryable: false;
1024
1286
  };
1025
1287
  };
@@ -1031,7 +1293,7 @@ export type ExternalApplicationsGetContextErrors = {
1031
1293
  error: {
1032
1294
  code: "conflict";
1033
1295
  message: string;
1034
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1296
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1035
1297
  retryable: false;
1036
1298
  };
1037
1299
  };
@@ -1043,7 +1305,7 @@ export type ExternalApplicationsGetContextErrors = {
1043
1305
  error: {
1044
1306
  code: "internal_error";
1045
1307
  message: string;
1046
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1308
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1047
1309
  retryable: false;
1048
1310
  };
1049
1311
  };
@@ -1055,7 +1317,7 @@ export type ExternalApplicationsGetContextErrors = {
1055
1317
  error: {
1056
1318
  code: "temporarily_unavailable";
1057
1319
  message: string;
1058
- reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed";
1320
+ reason?: "users_create_forbidden" | "role_not_assignable" | "user_unavailable" | "target_inactive" | "user_not_found" | "user_not_created_by_app" | "application_unavailable" | "actor_not_allowed" | "page_depth_exceeded";
1059
1321
  retryable: true;
1060
1322
  };
1061
1323
  };
@@ -1744,16 +2006,36 @@ export interface DurableFileUpload {
1744
2006
  fileName: string;
1745
2007
  sizeBytes: number;
1746
2008
  }
1747
- export interface ExternalApplicationServiceOperationRequest {
2009
+ /** The rating of the answer of a run: a not useful one needs a note with text. */
2010
+ export type ExternalApplicationRunFeedback = ExternalApplicationsPutRunFeedbackData["body"] & {
2011
+ runId: string;
2012
+ };
2013
+ /** Operations that only a server client invokes. */
2014
+ export type ExternalApplicationServiceOperationRequest = {
1748
2015
  input: DurableFileUpload;
1749
2016
  operationId: "files_upload";
1750
- }
2017
+ } | {
2018
+ input: {
2019
+ runId: string;
2020
+ };
2021
+ operationId: "runs_sources";
2022
+ } | {
2023
+ input: ExternalApplicationRunFeedback;
2024
+ operationId: "runs_feedback";
2025
+ };
1751
2026
  export type ExternalApplicationServiceOperationSuccess = EnvelopeSuccess<"files_upload", {
1752
2027
  storageFileId: StorageFileId;
1753
- }>;
2028
+ }> | EnvelopeSuccess<"runs_sources", {
2029
+ sources: ExternalApplicationRunSource[];
2030
+ }> | EnvelopeSuccess<"runs_feedback", ExternalApplicationsPutRunFeedbackResponse["result"]>;
1754
2031
  /** Every operation a confidential server client may invoke. */
1755
2032
  export type ExternalApplicationServerOperationRequest = ExternalApplicationOperationRequest | ExternalApplicationServiceOperationRequest;
1756
- export type ExternalApplicationOperationFailure = ExternalApplicationsGetContextError;
2033
+ /**
2034
+ * A refusal of CI; only `runs_sources` and `runs_feedback` answer
2035
+ * `run_not_settled`, and only `runs_feedback` answers
2036
+ * `feedback_note_required`.
2037
+ */
2038
+ export type ExternalApplicationOperationFailure = ExternalApplicationsGetContextError | ExternalApplicationsGetRunSourcesError | ExternalApplicationsPutRunFeedbackError;
1757
2039
  export type ExternalApplicationServerOperationId = ExternalApplicationServerOperationRequest["operationId"];
1758
2040
  export type ExternalApplicationOperationRequestFor<Id extends ExternalApplicationServerOperationId> = Extract<ExternalApplicationServerOperationRequest, {
1759
2041
  operationId: Id;