@visa-check-r/integrations 0.0.113 → 0.0.115
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.js +38 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.esm.js +38 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2244,7 +2244,8 @@ var sopReviewQuery = [
|
|
|
2244
2244
|
"visaProfileChecklistItemId",
|
|
2245
2245
|
"visaProfileId",
|
|
2246
2246
|
"isValidSOP",
|
|
2247
|
-
"documentType"
|
|
2247
|
+
"documentType",
|
|
2248
|
+
"visaType"
|
|
2248
2249
|
];
|
|
2249
2250
|
var documentReviewQuery = [
|
|
2250
2251
|
"title",
|
|
@@ -4290,7 +4291,7 @@ var getAIServerAuthResponseNestedFields = {
|
|
|
4290
4291
|
// src/services/ai-integration/schema/ai-server.schema.ts
|
|
4291
4292
|
var aiServerSchema = {
|
|
4292
4293
|
getAIServerAuth: (query) => `
|
|
4293
|
-
query getAIServerAuth($visaProfileId: String
|
|
4294
|
+
query getAIServerAuth($visaProfileId: String, $requestType: String!) {
|
|
4294
4295
|
getAIServerAuth(visaProfileId: $visaProfileId, requestType: $requestType) {
|
|
4295
4296
|
${query}
|
|
4296
4297
|
}
|
|
@@ -4319,7 +4320,7 @@ var createAIServerService = (client) => {
|
|
|
4319
4320
|
async startDraft(input, option) {
|
|
4320
4321
|
var _a;
|
|
4321
4322
|
const res = await client.request(
|
|
4322
|
-
`mutation startDraft($visaProfileId: String
|
|
4323
|
+
`mutation startDraft($visaProfileId: String, $documentType: String!, $fromUpload: Boolean) {
|
|
4323
4324
|
startDraft(visaProfileId: $visaProfileId, documentType: $documentType, fromUpload: $fromUpload) {
|
|
4324
4325
|
aiServerAuth { url accessToken }
|
|
4325
4326
|
}
|
|
@@ -4328,6 +4329,40 @@ var createAIServerService = (client) => {
|
|
|
4328
4329
|
option
|
|
4329
4330
|
);
|
|
4330
4331
|
return (_a = res.data) == null ? void 0 : _a.startDraft;
|
|
4332
|
+
},
|
|
4333
|
+
/** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
|
|
4334
|
+
async listMyDrafts(option) {
|
|
4335
|
+
var _a, _b, _c;
|
|
4336
|
+
const res = await client.request(
|
|
4337
|
+
`query listMyDrafts { listMyDrafts { drafts { id documentType visaType generatedSop createdAt } } }`,
|
|
4338
|
+
{},
|
|
4339
|
+
option
|
|
4340
|
+
);
|
|
4341
|
+
return (_c = (_b = (_a = res.data) == null ? void 0 : _a.listMyDrafts) == null ? void 0 : _b.drafts) != null ? _c : [];
|
|
4342
|
+
},
|
|
4343
|
+
/** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
|
|
4344
|
+
async attachDraft(input, option) {
|
|
4345
|
+
var _a, _b;
|
|
4346
|
+
const res = await client.request(
|
|
4347
|
+
`mutation attachDraft($draftId: String!, $visaProfileId: String!) { attachDraft(draftId: $draftId, visaProfileId: $visaProfileId) { draft { id visaProfileId documentType } } }`,
|
|
4348
|
+
input,
|
|
4349
|
+
option
|
|
4350
|
+
);
|
|
4351
|
+
return (_b = (_a = res.data) == null ? void 0 : _a.attachDraft) == null ? void 0 : _b.draft;
|
|
4352
|
+
},
|
|
4353
|
+
/** Stores a file for the AI to read when there's no visa profile; returns its URL. */
|
|
4354
|
+
async uploadDraftFile(file) {
|
|
4355
|
+
const formData = new FormData();
|
|
4356
|
+
formData.append("file", file);
|
|
4357
|
+
const token = await client.token();
|
|
4358
|
+
const res = await fetch(client["url"].replace("/graphql", "") + "/api/upload/draft", {
|
|
4359
|
+
method: "POST",
|
|
4360
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
4361
|
+
body: formData
|
|
4362
|
+
});
|
|
4363
|
+
const text = await res.text();
|
|
4364
|
+
if (!res.ok) throw new Error(text || "File upload failed");
|
|
4365
|
+
return JSON.parse(text).url;
|
|
4331
4366
|
}
|
|
4332
4367
|
};
|
|
4333
4368
|
};
|