@visa-check-r/integrations 0.0.113 → 0.0.114

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.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;
@@ -2726,7 +2729,8 @@ interface GetAIServerAuthRequest {
2726
2729
  requestType: "readiness_score" | "readiness_score_v2" | "sop_review" | "sop_answer_review" | "loe_review" | "loe_answer_review" | "refusal_analysis";
2727
2730
  }
2728
2731
  interface StartDraftRequest {
2729
- visaProfileId: string;
2732
+ /** Optional: a draft can be written with no profile and attached later. */
2733
+ visaProfileId?: string;
2730
2734
  documentType: "sop" | "loe";
2731
2735
  /** Improving an uploaded file, rather than drafting from answers. */
2732
2736
  fromUpload?: boolean;
@@ -2748,6 +2752,15 @@ declare const createAIServerService: (client: GraphQLClient) => {
2748
2752
  }, option?: RequestOption): Promise<GetAIServerAuthResponse | undefined>;
2749
2753
  /** Charges for an SOP or LOE draft and returns the token to write it. */
2750
2754
  startDraft(input: StartDraftRequest, option?: RequestOption): Promise<StartDraftResponse | undefined>;
2755
+ /** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
2756
+ listMyDrafts(option?: RequestOption): Promise<SOPReview[]>;
2757
+ /** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
2758
+ attachDraft(input: {
2759
+ draftId: string;
2760
+ visaProfileId: string;
2761
+ }, option?: RequestOption): Promise<SOPReview | undefined>;
2762
+ /** Stores a PDF to improve when the draft has no visa profile; returns its URL. */
2763
+ uploadDraftFile(file: File | Blob): Promise<string | undefined>;
2751
2764
  };
2752
2765
  type AIServerService = ReturnType<typeof createAIServerService>;
2753
2766
 
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;
@@ -2726,7 +2729,8 @@ interface GetAIServerAuthRequest {
2726
2729
  requestType: "readiness_score" | "readiness_score_v2" | "sop_review" | "sop_answer_review" | "loe_review" | "loe_answer_review" | "refusal_analysis";
2727
2730
  }
2728
2731
  interface StartDraftRequest {
2729
- visaProfileId: string;
2732
+ /** Optional: a draft can be written with no profile and attached later. */
2733
+ visaProfileId?: string;
2730
2734
  documentType: "sop" | "loe";
2731
2735
  /** Improving an uploaded file, rather than drafting from answers. */
2732
2736
  fromUpload?: boolean;
@@ -2748,6 +2752,15 @@ declare const createAIServerService: (client: GraphQLClient) => {
2748
2752
  }, option?: RequestOption): Promise<GetAIServerAuthResponse | undefined>;
2749
2753
  /** Charges for an SOP or LOE draft and returns the token to write it. */
2750
2754
  startDraft(input: StartDraftRequest, option?: RequestOption): Promise<StartDraftResponse | undefined>;
2755
+ /** The caller's SOP and LOE drafts that aren't attached to a visa profile. */
2756
+ listMyDrafts(option?: RequestOption): Promise<SOPReview[]>;
2757
+ /** Moves a draft onto a visa profile, replacing that profile's draft of the same kind. */
2758
+ attachDraft(input: {
2759
+ draftId: string;
2760
+ visaProfileId: string;
2761
+ }, option?: RequestOption): Promise<SOPReview | undefined>;
2762
+ /** Stores a PDF to improve when the draft has no visa profile; returns its URL. */
2763
+ uploadDraftFile(file: File | Blob): Promise<string | undefined>;
2751
2764
  };
2752
2765
  type AIServerService = ReturnType<typeof createAIServerService>;
2753
2766
 
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",
@@ -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!, $documentType: String!, $fromUpload: Boolean) {
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 PDF to improve when the draft has 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
  };