@wix/ditto-codegen-public 1.0.434 → 1.0.435

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.
Files changed (2) hide show
  1. package/dist/out.js +103 -30
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -39,7 +39,7 @@ var require_types_impl = __commonJS({
39
39
  "../../node_modules/@wix/ambassador-ctp-codegen-job-service-v1-job/cjs/build/types.impl.js"(exports2) {
40
40
  "use strict";
41
41
  Object.defineProperty(exports2, "__esModule", { value: true });
42
- exports2.WebhookIdentityType = exports2.UserDecisionQuestionType = exports2.TaskKind = exports2.Status = exports2.ProcessType = exports2.FileOperation = exports2.ErrorType = exports2.Environment = exports2.ChatMessageRole = exports2.ExtensionType = void 0;
42
+ exports2.WebhookIdentityType = exports2.UserDecisionQuestionType = exports2.TaskKind = exports2.Status = exports2.ProcessType = exports2.JobsSortOrder = exports2.FileOperation = exports2.ErrorType = exports2.Environment = exports2.ChatMessageRole = exports2.ExtensionType = void 0;
43
43
  var ExtensionType;
44
44
  (function(ExtensionType2) {
45
45
  ExtensionType2["UNDEFINED_EXTENSION_TYPE"] = "UNDEFINED_EXTENSION_TYPE";
@@ -89,6 +89,12 @@ var require_types_impl = __commonJS({
89
89
  FileOperation2["DELETE"] = "DELETE";
90
90
  FileOperation2["EDIT"] = "EDIT";
91
91
  })(FileOperation || (exports2.FileOperation = FileOperation = {}));
92
+ var JobsSortOrder;
93
+ (function(JobsSortOrder2) {
94
+ JobsSortOrder2["UNKNOWN_SORT_ORDER"] = "UNKNOWN_SORT_ORDER";
95
+ JobsSortOrder2["CREATED_AT_ASC"] = "CREATED_AT_ASC";
96
+ JobsSortOrder2["CREATED_AT_DESC"] = "CREATED_AT_DESC";
97
+ })(JobsSortOrder || (exports2.JobsSortOrder = JobsSortOrder = {}));
92
98
  var ProcessType;
93
99
  (function(ProcessType2) {
94
100
  ProcessType2["UNKNOWN_PROCESS_TYPE"] = "UNKNOWN_PROCESS_TYPE";
@@ -5836,7 +5842,7 @@ var require_utils4 = __commonJS({
5836
5842
  "../../node_modules/@wix/metro-runtime/cjs/build/serialization/utils.js"(exports2) {
5837
5843
  "use strict";
5838
5844
  Object.defineProperty(exports2, "__esModule", { value: true });
5839
- exports2.parseLeanSchemaRef = void 0;
5845
+ exports2.parseLeanSchemaRef = parseLeanSchemaRef;
5840
5846
  function parseLeanSchemaRef(renderedSchemaName = "") {
5841
5847
  const [typeOrName, schemaName] = getSchemaNameAndType(renderedSchemaName);
5842
5848
  if (schemaName) {
@@ -5849,7 +5855,6 @@ var require_utils4 = __commonJS({
5849
5855
  schemaName: typeOrName
5850
5856
  };
5851
5857
  }
5852
- exports2.parseLeanSchemaRef = parseLeanSchemaRef;
5853
5858
  var getSchemaNameAndType = (leanSchema) => leanSchema.split("#");
5854
5859
  }
5855
5860
  });
@@ -5884,7 +5889,7 @@ var require_utils5 = __commonJS({
5884
5889
  "../../node_modules/@wix/metro-runtime/cjs/build/utils.js"(exports2) {
5885
5890
  "use strict";
5886
5891
  Object.defineProperty(exports2, "__esModule", { value: true });
5887
- exports2.findByPath = void 0;
5892
+ exports2.findByPath = findByPath;
5888
5893
  function findByPath(obj, path, defaultValue, suffix) {
5889
5894
  let result = obj;
5890
5895
  for (const field of path.split(".")) {
@@ -5895,7 +5900,6 @@ var require_utils5 = __commonJS({
5895
5900
  }
5896
5901
  return `${result}${suffix}`;
5897
5902
  }
5898
- exports2.findByPath = findByPath;
5899
5903
  }
5900
5904
  });
5901
5905
 
@@ -5904,12 +5908,24 @@ var require_url_resolver = __commonJS({
5904
5908
  "../../node_modules/@wix/metro-runtime/cjs/build/url-resolver.js"(exports2) {
5905
5909
  "use strict";
5906
5910
  Object.defineProperty(exports2, "__esModule", { value: true });
5907
- exports2.resolveUrl = void 0;
5911
+ exports2.resolveUrl = resolveUrl;
5908
5912
  var utils_js_1 = require_utils5();
5909
5913
  var USER_DOMAIN = "_";
5914
+ var WWW_BASE_DOMAIN = "www._base_domain_";
5915
+ var WILDCARD_PREFIX = "*.";
5910
5916
  var DOMAINS = ["wix.com", "editorx.com"];
5911
- var WIX_API_DOMAINS = ["42.wixprod.net", "uw2-edt-1.wixprod.net"];
5917
+ var WIX_API_DOMAINS = [
5918
+ "42.wixprod.net",
5919
+ "uw2-edt-1.wixprod.net",
5920
+ "virginia-edt.wixprod.net"
5921
+ ];
5912
5922
  var DEV_WIX_CODE_DOMAIN = "dev.wix-code.com";
5923
+ var HOST_ALIASES = {
5924
+ // payments.base44.com runs customised Business Manager, which needs to work exactly the same as normal BM on manage.wix.com
5925
+ "payments.base44.com": "manage.wix.com",
5926
+ // https://system-kb.wixanswers.com/kb/en/article/editorx-domains-matching-to-wixcom
5927
+ "create.editorx.com": "editor.editorx.com"
5928
+ };
5913
5929
  var REGEX_CAPTURE_PROTO_FIELD = /{(.*)}/;
5914
5930
  var REGEX_CAPTURE_DOMAINS = new RegExp(`\\.(${DOMAINS.join("|")})$`);
5915
5931
  var REGEX_CAPTURE_API_DOMAINS = new RegExp(`\\.(${WIX_API_DOMAINS.join("|")})$`);
@@ -5920,7 +5936,6 @@ var require_url_resolver = __commonJS({
5920
5936
  const path = injectDataIntoProtoPath(opts.protoPath, opts.data || {});
5921
5937
  return resolvePath(path, mappings);
5922
5938
  }
5923
- exports2.resolveUrl = resolveUrl;
5924
5939
  function injectDataIntoProtoPath(protoPath, data) {
5925
5940
  return protoPath.split("/").map((path) => maybeProtoPathToData(path, data)).join("/");
5926
5941
  }
@@ -5938,24 +5953,27 @@ var require_url_resolver = __commonJS({
5938
5953
  return resolvedHost.replace(REGEX_CAPTURE_DOMAINS, "._base_domain_").replace(REGEX_CAPTURE_API_DOMAINS, "._api_base_domain_").replace(REGEX_CAPTURE_DEV_WIX_CODE_DOMAIN, "*.dev.wix-code.com");
5939
5954
  }
5940
5955
  function fixHostExceptions(host) {
5941
- return host.replace("create.editorx.com", "editor.editorx.com");
5956
+ return HOST_ALIASES[host] ?? host;
5942
5957
  }
5943
5958
  function resolveMappingsByDomain(domain, domainToMappings) {
5944
5959
  const mappings = domainToMappings[domain];
5945
5960
  if (mappings) {
5946
5961
  return mappings;
5947
5962
  }
5948
- const rootDomainMappings = resolveRootDomain(domain, domainToMappings);
5949
- if (!rootDomainMappings) {
5963
+ const matchedMappings = resolveRootDomain(domain, domainToMappings) ?? resolveWildcardDomain(domain, domainToMappings);
5964
+ if (!matchedMappings) {
5965
+ if (isBaseDomain(domain)) {
5966
+ const wwwMappings = domainToMappings[WWW_BASE_DOMAIN];
5967
+ if (wwwMappings) {
5968
+ return wwwMappings;
5969
+ }
5970
+ }
5950
5971
  const userMappings = domainToMappings[USER_DOMAIN];
5951
5972
  if (userMappings) {
5952
5973
  return userMappings;
5953
5974
  }
5954
- if (isBaseDomain(domain)) {
5955
- return domainToMappings[wwwBaseDomain];
5956
- }
5957
5975
  }
5958
- return rootDomainMappings ?? [];
5976
+ return matchedMappings ?? [];
5959
5977
  }
5960
5978
  function resolveRootDomain(domain, domainToMappings) {
5961
5979
  return Object.entries(domainToMappings).find(([entryDomain]) => {
@@ -5963,6 +5981,22 @@ var require_url_resolver = __commonJS({
5963
5981
  return rooDomainSegments.join(".") === entryDomain;
5964
5982
  })?.[1];
5965
5983
  }
5984
+ function resolveWildcardDomain(domain, domainToMappings) {
5985
+ const matchingEntries = Object.entries(domainToMappings).filter(([entryDomain]) => matchesWildcardDomain(domain, entryDomain));
5986
+ const [mostSpecificEntry] = matchingEntries.sort(([entryDomainA], [entryDomainB]) => entryDomainB.length - entryDomainA.length);
5987
+ if (!mostSpecificEntry) {
5988
+ return void 0;
5989
+ }
5990
+ const [, mappings] = mostSpecificEntry;
5991
+ return mappings;
5992
+ }
5993
+ function matchesWildcardDomain(domain, entryDomain) {
5994
+ if (!entryDomain.startsWith(WILDCARD_PREFIX)) {
5995
+ return false;
5996
+ }
5997
+ const suffix = entryDomain.slice(WILDCARD_PREFIX.length - 1);
5998
+ return domain.length > suffix.length && domain.endsWith(suffix);
5999
+ }
5966
6000
  function resolvePath(protoPath, mappings) {
5967
6001
  const mapping = mappings?.find((m) => protoPath.startsWith(m.destPath));
5968
6002
  if (!mapping) {
@@ -5973,7 +6007,6 @@ var require_url_resolver = __commonJS({
5973
6007
  function isBaseDomain(domain) {
5974
6008
  return !!domain.match(/\._base_domain_$/);
5975
6009
  }
5976
- var wwwBaseDomain = "www._base_domain_";
5977
6010
  }
5978
6011
  });
5979
6012
 
@@ -6238,7 +6271,7 @@ var require_flatten_params = __commonJS({
6238
6271
  "../../node_modules/@wix/metro-runtime/cjs/build/flatten-params.js"(exports2) {
6239
6272
  "use strict";
6240
6273
  Object.defineProperty(exports2, "__esModule", { value: true });
6241
- exports2.toURLSearchParams = void 0;
6274
+ exports2.toURLSearchParams = toURLSearchParams;
6242
6275
  var js_base64_1 = require_base642();
6243
6276
  function flattenParams(data, path = "") {
6244
6277
  const params = {};
@@ -6276,7 +6309,6 @@ var require_flatten_params = __commonJS({
6276
6309
  }, new URLSearchParams());
6277
6310
  }
6278
6311
  }
6279
- exports2.toURLSearchParams = toURLSearchParams;
6280
6312
  }
6281
6313
  });
6282
6314
 
@@ -6317,7 +6349,7 @@ var require_domain2 = __commonJS({
6317
6349
  (function(ConverterType2) {
6318
6350
  ConverterType2[ConverterType2["TO_JSON"] = 0] = "TO_JSON";
6319
6351
  ConverterType2[ConverterType2["FROM_JSON"] = 1] = "FROM_JSON";
6320
- })(ConverterType = exports2.ConverterType || (exports2.ConverterType = {}));
6352
+ })(ConverterType || (exports2.ConverterType = ConverterType = {}));
6321
6353
  }
6322
6354
  });
6323
6355
 
@@ -6326,7 +6358,7 @@ var require_serializer = __commonJS({
6326
6358
  "../../node_modules/@wix/metro-runtime/cjs/build/serializer/serializer.js"(exports2) {
6327
6359
  "use strict";
6328
6360
  Object.defineProperty(exports2, "__esModule", { value: true });
6329
- exports2.schemaSerializer = void 0;
6361
+ exports2.schemaSerializer = schemaSerializer;
6330
6362
  var index_js_1 = require_build();
6331
6363
  function schemaSerializer(rootSchema, depSchemas = {}, converterSets) {
6332
6364
  return function serialize(json = {}, converterType) {
@@ -6377,7 +6409,6 @@ var require_serializer = __commonJS({
6377
6409
  }
6378
6410
  };
6379
6411
  }
6380
- exports2.schemaSerializer = schemaSerializer;
6381
6412
  }
6382
6413
  });
6383
6414
 
@@ -6572,7 +6603,7 @@ var require_utils6 = __commonJS({
6572
6603
  "../../node_modules/@wix/metro-runtime/cjs/build/serializer/utils.js"(exports2) {
6573
6604
  "use strict";
6574
6605
  Object.defineProperty(exports2, "__esModule", { value: true });
6575
- exports2.typeToConverterSet = void 0;
6606
+ exports2.typeToConverterSet = typeToConverterSet;
6576
6607
  function typeToConverterSet(converterSets) {
6577
6608
  return converterSets.reduce((result, converterSet) => {
6578
6609
  const types = converterSet.types.reduce((typeResult, type) => {
@@ -6587,7 +6618,6 @@ var require_utils6 = __commonJS({
6587
6618
  };
6588
6619
  }, {});
6589
6620
  }
6590
- exports2.typeToConverterSet = typeToConverterSet;
6591
6621
  }
6592
6622
  });
6593
6623
 
@@ -6596,7 +6626,7 @@ var require_ambassador_index = __commonJS({
6596
6626
  "../../node_modules/@wix/metro-runtime/cjs/build/ambassador-index.js"(exports2) {
6597
6627
  "use strict";
6598
6628
  Object.defineProperty(exports2, "__esModule", { value: true });
6599
- exports2.serializer = void 0;
6629
+ exports2.serializer = serializer;
6600
6630
  var domain_js_1 = require_domain2();
6601
6631
  var serializer_js_1 = require_serializer();
6602
6632
  var converters_js_1 = require_converters();
@@ -6614,7 +6644,6 @@ var require_ambassador_index = __commonJS({
6614
6644
  }
6615
6645
  };
6616
6646
  }
6617
- exports2.serializer = serializer;
6618
6647
  function safeJsonParse(someString) {
6619
6648
  try {
6620
6649
  return JSON.parse(someString);
@@ -10540,6 +10569,41 @@ var require_wixTokenRefresh = __commonJS({
10540
10569
  }
10541
10570
  });
10542
10571
 
10572
+ // dist/experiments.js
10573
+ var require_experiments = __commonJS({
10574
+ "dist/experiments.js"(exports2) {
10575
+ "use strict";
10576
+ Object.defineProperty(exports2, "__esModule", { value: true });
10577
+ exports2.FILTERED_JOB_POLLING = void 0;
10578
+ exports2.isExperimentEnabled = isExperimentEnabled;
10579
+ var logger_12 = require_logger();
10580
+ exports2.FILTERED_JOB_POLLING = "codegenFilteredJobPolling";
10581
+ var parsedExperiments = null;
10582
+ function getExperiments() {
10583
+ if (parsedExperiments !== null) {
10584
+ return parsedExperiments;
10585
+ }
10586
+ const raw = process.env.CODEGEN_EXPERIMENTS;
10587
+ if (!raw) {
10588
+ parsedExperiments = {};
10589
+ return parsedExperiments;
10590
+ }
10591
+ try {
10592
+ parsedExperiments = JSON.parse(raw);
10593
+ } catch (error) {
10594
+ logger_12.logger.error("[Experiments] Failed to parse CODEGEN_EXPERIMENTS", {
10595
+ error: error instanceof Error ? error.message : String(error)
10596
+ });
10597
+ parsedExperiments = {};
10598
+ }
10599
+ return parsedExperiments;
10600
+ }
10601
+ function isExperimentEnabled(specName) {
10602
+ return getExperiments()[specName] === "true";
10603
+ }
10604
+ }
10605
+ });
10606
+
10543
10607
  // ../codegen-types/dist/errors/ErrorTypes.js
10544
10608
  var require_ErrorTypes = __commonJS({
10545
10609
  "../codegen-types/dist/errors/ErrorTypes.js"(exports2) {
@@ -10957,7 +11021,7 @@ var require_CodeGenService = __commonJS({
10957
11021
  "dist/services/CodeGenService.js"(exports2) {
10958
11022
  "use strict";
10959
11023
  Object.defineProperty(exports2, "__esModule", { value: true });
10960
- exports2.CodeGenService = exports2.TaskKind = exports2.Status = void 0;
11024
+ exports2.CodeGenService = exports2.JobsSortOrder = exports2.TaskKind = exports2.Status = void 0;
10961
11025
  exports2.createCodeGenErrorHandler = createCodeGenErrorHandler;
10962
11026
  var http_client_1 = require_index_node();
10963
11027
  var http_1 = require_http_impl();
@@ -10969,7 +11033,11 @@ var require_CodeGenService = __commonJS({
10969
11033
  Object.defineProperty(exports2, "TaskKind", { enumerable: true, get: function() {
10970
11034
  return types_1.TaskKind;
10971
11035
  } });
11036
+ Object.defineProperty(exports2, "JobsSortOrder", { enumerable: true, get: function() {
11037
+ return types_1.JobsSortOrder;
11038
+ } });
10972
11039
  var logger_12 = require_logger();
11040
+ var experiments_1 = require_experiments();
10973
11041
  var ditto_codegen_types_12 = require_dist4();
10974
11042
  var FILE_OPERATION = {
10975
11043
  [ditto_codegen_types_12.ExtensionGenerationOperation.INSERT]: types_1.FileOperation.INSERT,
@@ -11059,11 +11127,16 @@ var require_CodeGenService = __commonJS({
11059
11127
  }
11060
11128
  };
11061
11129
  this.fetchPendingJobs = async () => {
11062
- const resp = await this.request((0, http_1.listProjectJobs)({
11063
- projectId: this.projectId
11064
- }));
11130
+ const { sandboxId } = this;
11131
+ const filtered = sandboxId && (0, experiments_1.isExperimentEnabled)(experiments_1.FILTERED_JOB_POLLING) ? {
11132
+ projectId: this.projectId,
11133
+ filter: { status: types_1.Status.PENDING, sandboxId },
11134
+ paging: { limit: 1 },
11135
+ sortOrder: types_1.JobsSortOrder.CREATED_AT_ASC
11136
+ } : void 0;
11137
+ const resp = await this.request((0, http_1.listProjectJobs)(filtered ?? { projectId: this.projectId }));
11065
11138
  const jobs = resp.data?.jobs ?? [];
11066
- return jobs.filter(this.shouldProcessJob);
11139
+ return filtered ? jobs : jobs.filter(this.shouldProcessJob);
11067
11140
  };
11068
11141
  this.shouldProcessJob = (job) => {
11069
11142
  if (job.status !== types_1.Status.PENDING)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.434",
3
+ "version": "1.0.435",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "b849b4780b251c081a437506b4ded2164211e1e078b19bd3e61e64b7"
32
+ "falconPackageHash": "c800cf38305a8152baff949db90fba6913ed33954d9af629d14ee2a5"
33
33
  }