@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.d.mts
CHANGED
|
@@ -213,6 +213,9 @@ interface SOPReview {
|
|
|
213
213
|
isValidSOP: BooleanLiteral;
|
|
214
214
|
/** Which draft this is; a profile has one of each. */
|
|
215
215
|
documentType?: "sop" | "loe";
|
|
216
|
+
/** Whose draft this is while it isn't attached to a visa profile. */
|
|
217
|
+
ownerId?: string;
|
|
218
|
+
visaType?: VisaType;
|
|
216
219
|
}
|
|
217
220
|
type VisaType = "study" | "visit" | "work" | "extendVisa" | "relocate";
|
|
218
221
|
type VisaApplicationMetricKey = "total" | VisaApplicationStatus;
|
|
@@ -2722,11 +2725,13 @@ type CouponService = ReturnType<typeof createCouponService>;
|
|
|
2722
2725
|
type AIServerAuthFields = (keyof AIServerAuth)[];
|
|
2723
2726
|
|
|
2724
2727
|
interface GetAIServerAuthRequest {
|
|
2725
|
-
|
|
2728
|
+
/** Optional for refusal_analysis, which can read the caller's own upload. */
|
|
2729
|
+
visaProfileId?: string;
|
|
2726
2730
|
requestType: "readiness_score" | "readiness_score_v2" | "sop_review" | "sop_answer_review" | "loe_review" | "loe_answer_review" | "refusal_analysis";
|
|
2727
2731
|
}
|
|
2728
2732
|
interface StartDraftRequest {
|
|
2729
|
-
|
|
2733
|
+
/** Optional: a draft can be written with no profile and attached later. */
|
|
2734
|
+
visaProfileId?: string;
|
|
2730
2735
|
documentType: "sop" | "loe";
|
|
2731
2736
|
/** Improving an uploaded file, rather than drafting from answers. */
|
|
2732
2737
|
fromUpload?: boolean;
|
|
@@ -2748,6 +2753,15 @@ declare const createAIServerService: (client: GraphQLClient) => {
|
|
|
2748
2753
|
}, option?: RequestOption): Promise<GetAIServerAuthResponse | undefined>;
|
|
2749
2754
|
/** Charges for an SOP or LOE draft and returns the token to write it. */
|
|
2750
2755
|
startDraft(input: StartDraftRequest, option?: RequestOption): Promise<StartDraftResponse | undefined>;
|
|
2756
|
+
/** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
|
|
2757
|
+
listMyDrafts(option?: RequestOption): Promise<SOPReview[]>;
|
|
2758
|
+
/** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
|
|
2759
|
+
attachDraft(input: {
|
|
2760
|
+
draftId: string;
|
|
2761
|
+
visaProfileId: string;
|
|
2762
|
+
}, option?: RequestOption): Promise<SOPReview | undefined>;
|
|
2763
|
+
/** Stores a file for the AI to read when there's no visa profile; returns its URL. */
|
|
2764
|
+
uploadDraftFile(file: File | Blob): Promise<string | undefined>;
|
|
2751
2765
|
};
|
|
2752
2766
|
type AIServerService = ReturnType<typeof createAIServerService>;
|
|
2753
2767
|
|
package/dist/index.d.ts
CHANGED
|
@@ -213,6 +213,9 @@ interface SOPReview {
|
|
|
213
213
|
isValidSOP: BooleanLiteral;
|
|
214
214
|
/** Which draft this is; a profile has one of each. */
|
|
215
215
|
documentType?: "sop" | "loe";
|
|
216
|
+
/** Whose draft this is while it isn't attached to a visa profile. */
|
|
217
|
+
ownerId?: string;
|
|
218
|
+
visaType?: VisaType;
|
|
216
219
|
}
|
|
217
220
|
type VisaType = "study" | "visit" | "work" | "extendVisa" | "relocate";
|
|
218
221
|
type VisaApplicationMetricKey = "total" | VisaApplicationStatus;
|
|
@@ -2722,11 +2725,13 @@ type CouponService = ReturnType<typeof createCouponService>;
|
|
|
2722
2725
|
type AIServerAuthFields = (keyof AIServerAuth)[];
|
|
2723
2726
|
|
|
2724
2727
|
interface GetAIServerAuthRequest {
|
|
2725
|
-
|
|
2728
|
+
/** Optional for refusal_analysis, which can read the caller's own upload. */
|
|
2729
|
+
visaProfileId?: string;
|
|
2726
2730
|
requestType: "readiness_score" | "readiness_score_v2" | "sop_review" | "sop_answer_review" | "loe_review" | "loe_answer_review" | "refusal_analysis";
|
|
2727
2731
|
}
|
|
2728
2732
|
interface StartDraftRequest {
|
|
2729
|
-
|
|
2733
|
+
/** Optional: a draft can be written with no profile and attached later. */
|
|
2734
|
+
visaProfileId?: string;
|
|
2730
2735
|
documentType: "sop" | "loe";
|
|
2731
2736
|
/** Improving an uploaded file, rather than drafting from answers. */
|
|
2732
2737
|
fromUpload?: boolean;
|
|
@@ -2748,6 +2753,15 @@ declare const createAIServerService: (client: GraphQLClient) => {
|
|
|
2748
2753
|
}, option?: RequestOption): Promise<GetAIServerAuthResponse | undefined>;
|
|
2749
2754
|
/** Charges for an SOP or LOE draft and returns the token to write it. */
|
|
2750
2755
|
startDraft(input: StartDraftRequest, option?: RequestOption): Promise<StartDraftResponse | undefined>;
|
|
2756
|
+
/** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
|
|
2757
|
+
listMyDrafts(option?: RequestOption): Promise<SOPReview[]>;
|
|
2758
|
+
/** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
|
|
2759
|
+
attachDraft(input: {
|
|
2760
|
+
draftId: string;
|
|
2761
|
+
visaProfileId: string;
|
|
2762
|
+
}, option?: RequestOption): Promise<SOPReview | undefined>;
|
|
2763
|
+
/** Stores a file for the AI to read when there's no visa profile; returns its URL. */
|
|
2764
|
+
uploadDraftFile(file: File | Blob): Promise<string | undefined>;
|
|
2751
2765
|
};
|
|
2752
2766
|
type AIServerService = ReturnType<typeof createAIServerService>;
|
|
2753
2767
|
|
package/dist/index.esm.js
CHANGED
|
@@ -2242,7 +2242,8 @@ var sopReviewQuery = [
|
|
|
2242
2242
|
"visaProfileChecklistItemId",
|
|
2243
2243
|
"visaProfileId",
|
|
2244
2244
|
"isValidSOP",
|
|
2245
|
-
"documentType"
|
|
2245
|
+
"documentType",
|
|
2246
|
+
"visaType"
|
|
2246
2247
|
];
|
|
2247
2248
|
var documentReviewQuery = [
|
|
2248
2249
|
"title",
|
|
@@ -4288,7 +4289,7 @@ var getAIServerAuthResponseNestedFields = {
|
|
|
4288
4289
|
// src/services/ai-integration/schema/ai-server.schema.ts
|
|
4289
4290
|
var aiServerSchema = {
|
|
4290
4291
|
getAIServerAuth: (query) => `
|
|
4291
|
-
query getAIServerAuth($visaProfileId: String
|
|
4292
|
+
query getAIServerAuth($visaProfileId: String, $requestType: String!) {
|
|
4292
4293
|
getAIServerAuth(visaProfileId: $visaProfileId, requestType: $requestType) {
|
|
4293
4294
|
${query}
|
|
4294
4295
|
}
|
|
@@ -4317,7 +4318,7 @@ var createAIServerService = (client) => {
|
|
|
4317
4318
|
async startDraft(input, option) {
|
|
4318
4319
|
var _a;
|
|
4319
4320
|
const res = await client.request(
|
|
4320
|
-
`mutation startDraft($visaProfileId: String
|
|
4321
|
+
`mutation startDraft($visaProfileId: String, $documentType: String!, $fromUpload: Boolean) {
|
|
4321
4322
|
startDraft(visaProfileId: $visaProfileId, documentType: $documentType, fromUpload: $fromUpload) {
|
|
4322
4323
|
aiServerAuth { url accessToken }
|
|
4323
4324
|
}
|
|
@@ -4326,6 +4327,40 @@ var createAIServerService = (client) => {
|
|
|
4326
4327
|
option
|
|
4327
4328
|
);
|
|
4328
4329
|
return (_a = res.data) == null ? void 0 : _a.startDraft;
|
|
4330
|
+
},
|
|
4331
|
+
/** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
|
|
4332
|
+
async listMyDrafts(option) {
|
|
4333
|
+
var _a, _b, _c;
|
|
4334
|
+
const res = await client.request(
|
|
4335
|
+
`query listMyDrafts { listMyDrafts { drafts { id documentType visaType generatedSop createdAt } } }`,
|
|
4336
|
+
{},
|
|
4337
|
+
option
|
|
4338
|
+
);
|
|
4339
|
+
return (_c = (_b = (_a = res.data) == null ? void 0 : _a.listMyDrafts) == null ? void 0 : _b.drafts) != null ? _c : [];
|
|
4340
|
+
},
|
|
4341
|
+
/** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
|
|
4342
|
+
async attachDraft(input, option) {
|
|
4343
|
+
var _a, _b;
|
|
4344
|
+
const res = await client.request(
|
|
4345
|
+
`mutation attachDraft($draftId: String!, $visaProfileId: String!) { attachDraft(draftId: $draftId, visaProfileId: $visaProfileId) { draft { id visaProfileId documentType } } }`,
|
|
4346
|
+
input,
|
|
4347
|
+
option
|
|
4348
|
+
);
|
|
4349
|
+
return (_b = (_a = res.data) == null ? void 0 : _a.attachDraft) == null ? void 0 : _b.draft;
|
|
4350
|
+
},
|
|
4351
|
+
/** Stores a file for the AI to read when there's no visa profile; returns its URL. */
|
|
4352
|
+
async uploadDraftFile(file) {
|
|
4353
|
+
const formData = new FormData();
|
|
4354
|
+
formData.append("file", file);
|
|
4355
|
+
const token = await client.token();
|
|
4356
|
+
const res = await fetch(client["url"].replace("/graphql", "") + "/api/upload/draft", {
|
|
4357
|
+
method: "POST",
|
|
4358
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
4359
|
+
body: formData
|
|
4360
|
+
});
|
|
4361
|
+
const text = await res.text();
|
|
4362
|
+
if (!res.ok) throw new Error(text || "File upload failed");
|
|
4363
|
+
return JSON.parse(text).url;
|
|
4329
4364
|
}
|
|
4330
4365
|
};
|
|
4331
4366
|
};
|