@wix/auto_sdk_site-import_imports 1.0.0 → 1.0.2

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.
@@ -53,6 +53,23 @@ interface StartImportRequest {
53
53
  * @maxLength 2048
54
54
  */
55
55
  fileUrls?: string[];
56
+ /**
57
+ * Start a brand-new import even though this account already has one for the
58
+ * same source. OPTIONAL, default false.
59
+ *
60
+ * By default an import belongs to the ACCOUNT's migration of a source (a site
61
+ * URL, or a set of uploaded files such as a CSV), not to the user or to a moment
62
+ * in time: when the account already has an import for this source, StartImport
63
+ * returns THAT import's `import_id` whatever its status — running, waiting for
64
+ * input, deployed, failed or cancelled — and starts nothing. The Wix site is not
65
+ * part of the source: a source has one import and one site, whether the caller
66
+ * started on a site or the import creates one. Continue the import with
67
+ * SendImportMessage. Set this to true to import the same URL or files again
68
+ * as a NEW source of its own (its own project, checkpoint, sandbox and site),
69
+ * whatever the existing import's status; the existing import is untouched and a
70
+ * later plain start still returns it. Reach the new import by its `import_id`.
71
+ */
72
+ forceNew?: boolean;
56
73
  }
57
74
  interface StartImportResponse {
58
75
  /**
@@ -78,6 +95,14 @@ interface StartImportResponse {
78
95
  * @format GUID
79
96
  */
80
97
  destinationSiteId?: string;
98
+ /**
99
+ * True when this call did NOT start an import because the account already had
100
+ * one for the same source, and `import_id` is that existing import. Nothing
101
+ * was submitted, so `request` was not delivered: send it with
102
+ * SendImportMessage if it should reach the agent. False when `force_new` started
103
+ * a new import.
104
+ */
105
+ existingImport?: boolean;
81
106
  }
82
107
  declare enum SourcePlatform {
83
108
  UNKNOWN_SOURCE_PLATFORM = "UNKNOWN_SOURCE_PLATFORM",
@@ -213,12 +238,6 @@ declare enum ImportStatus {
213
238
  DEPLOYED = "DEPLOYED",
214
239
  FAILED = "FAILED",
215
240
  CANCELLED = "CANCELLED",
216
- /**
217
- * Recoverable: the user's Wix session expired mid-import. Re-run StartImport
218
- * to resume — a fresh token is minted and the sandbox re-authenticates;
219
- * work already done is preserved.
220
- */
221
- AUTH_EXPIRED = "AUTH_EXPIRED",
222
241
  /**
223
242
  * Recoverable: the agent needs a user decision to continue. The question is
224
243
  * GetImportStatusResponse.message (with any suggested answers in `options`);
@@ -227,7 +246,7 @@ declare enum ImportStatus {
227
246
  NEEDS_INPUT = "NEEDS_INPUT"
228
247
  }
229
248
  /** @enumType */
230
- type ImportStatusWithLiterals = ImportStatus | 'UNKNOWN_IMPORT_STATUS' | 'IMPORTING' | 'DEPLOYED' | 'FAILED' | 'CANCELLED' | 'AUTH_EXPIRED' | 'NEEDS_INPUT';
249
+ type ImportStatusWithLiterals = ImportStatus | 'UNKNOWN_IMPORT_STATUS' | 'IMPORTING' | 'DEPLOYED' | 'FAILED' | 'CANCELLED' | 'NEEDS_INPUT';
231
250
  /**
232
251
  * One entry of the agent's recent activity feed — what the agent said or did,
233
252
  * so a polling client can render the import as a live chat conversation.
@@ -875,7 +894,7 @@ interface GetImportBySiteResponse {
875
894
  * @permissionId ecom:site_import:v1:import:start_import
876
895
  * @fqn wix.ecom.site_import.v1.SiteImportService.StartImport
877
896
  */
878
- declare function startImport(request: string, options?: StartImportOptions): Promise<NonNullablePaths<StartImportResponse, `importId` | `sourcePlatform` | `sourceConfidence` | `destinationSiteId`, 0>>;
897
+ declare function startImport(request: string, options?: StartImportOptions): Promise<NonNullablePaths<StartImportResponse, `importId` | `sourcePlatform` | `sourceConfidence` | `destinationSiteId` | `existingImport`, 0>>;
879
898
  interface StartImportOptions {
880
899
  /**
881
900
  * The source site being imported (e.g. "https://shop.example.com" or just
@@ -914,6 +933,23 @@ interface StartImportOptions {
914
933
  * @maxLength 2048
915
934
  */
916
935
  fileUrls?: string[];
936
+ /**
937
+ * Start a brand-new import even though this account already has one for the
938
+ * same source. OPTIONAL, default false.
939
+ *
940
+ * By default an import belongs to the ACCOUNT's migration of a source (a site
941
+ * URL, or a set of uploaded files such as a CSV), not to the user or to a moment
942
+ * in time: when the account already has an import for this source, StartImport
943
+ * returns THAT import's `import_id` whatever its status — running, waiting for
944
+ * input, deployed, failed or cancelled — and starts nothing. The Wix site is not
945
+ * part of the source: a source has one import and one site, whether the caller
946
+ * started on a site or the import creates one. Continue the import with
947
+ * SendImportMessage. Set this to true to import the same URL or files again
948
+ * as a NEW source of its own (its own project, checkpoint, sandbox and site),
949
+ * whatever the existing import's status; the existing import is untouched and a
950
+ * later plain start still returns it. Reach the new import by its `import_id`.
951
+ */
952
+ forceNew?: boolean;
917
953
  }
918
954
  /**
919
955
  * Poll the status of an import started with StartImport.
@@ -1208,8 +1244,8 @@ interface GetImportSourceFileForSiteOptions {
1208
1244
  * caller error (`SITE_UNIDENTIFIED`), same as `StartImport` — this rpc has no
1209
1245
  * request-text fallback, so a site or fileset must be named explicitly.
1210
1246
  * ACCOUNT tenancy (unlike the SITE-tenancy pair above): scoped to the
1211
- * CALLING USER's own imports only, never another account member's — see
1212
- * GetImportBySiteRequest's comment and spec 0025 for why.
1247
+ * ACCOUNT's import for the source, whichever member started it — see
1248
+ * GetImportBySiteRequest's comment.
1213
1249
  * Resolvable only within the import's 7-day resumability window (the same
1214
1250
  * window `SendImportMessage`'s `SESSION_EXPIRED` bounds) — a lookup outside
1215
1251
  * that window returns `IMPORT_NOT_FOUND`, indistinguishable from "never
@@ -73,6 +73,12 @@ function resolveWixEcomSiteImportV1SiteImportServiceUrl(opts) {
73
73
  srcPath: "/site-import",
74
74
  destPath: ""
75
75
  }
76
+ ],
77
+ "*.dev.wix-code.com": [
78
+ {
79
+ srcPath: "/_api/bix-site-import",
80
+ destPath: ""
81
+ }
76
82
  ]
77
83
  };
78
84
  return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
@@ -352,7 +358,6 @@ var ImportStatus = /* @__PURE__ */ ((ImportStatus2) => {
352
358
  ImportStatus2["DEPLOYED"] = "DEPLOYED";
353
359
  ImportStatus2["FAILED"] = "FAILED";
354
360
  ImportStatus2["CANCELLED"] = "CANCELLED";
355
- ImportStatus2["AUTH_EXPIRED"] = "AUTH_EXPIRED";
356
361
  ImportStatus2["NEEDS_INPUT"] = "NEEDS_INPUT";
357
362
  return ImportStatus2;
358
363
  })(ImportStatus || {});
@@ -394,7 +399,8 @@ async function startImport2(request, options) {
394
399
  const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
395
400
  request,
396
401
  sourceUrl: options?.sourceUrl,
397
- fileUrls: options?.fileUrls
402
+ fileUrls: options?.fileUrls,
403
+ forceNew: options?.forceNew
398
404
  });
399
405
  const reqOpts = startImport(payload);
400
406
  sideEffects?.onSiteCall?.();
@@ -410,7 +416,8 @@ async function startImport2(request, options) {
410
416
  explicitPathsToArguments: {
411
417
  request: "$[0]",
412
418
  sourceUrl: "$[1].sourceUrl",
413
- fileUrls: "$[1].fileUrls"
419
+ fileUrls: "$[1].fileUrls",
420
+ forceNew: "$[1].forceNew"
414
421
  },
415
422
  singleArgumentUnchanged: false
416
423
  },