@wix/ditto-codegen-public 1.0.69 → 1.0.71

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.
@@ -39,14 +39,6 @@ async function getItemWithFields() {
39
39
  });
40
40
  // Returns only the specified fields plus system fields (_id, _owner, etc.)
41
41
  }
42
-
43
- // Get with consistent read for most up-to-date data
44
- async function getItemConsistent() {
45
- const item = await items.get("myCollection", "00001", {
46
- consistentRead: true
47
- });
48
- // Ensures data is up-to-date even immediately after an update
49
- }
50
42
  </usage>
51
43
 
52
44
  <type_definition>
@@ -15,25 +15,18 @@
15
15
  <usage>
16
16
  import { items } from "@wix/data";
17
17
 
18
- // Basic query
19
- const results = await items.query("myCollection")
20
- .eq("status", "active")
21
- .find();
22
-
23
- // Complex query with filtering and sorting
24
- const filteredResults = await items.query("myCollection")
25
- .eq("status", "active")
26
- .gt("price", 100)
27
- .ascending("title")
28
- .limit(20)
29
- .find();
30
-
31
18
  // Query with referenced items
32
19
  const withReferences = await items.query("myCollection")
33
20
  .include("authorRef")
34
- .find();
21
+ .find(); // find is mandatory
35
22
  </usage>
36
23
 
24
+ The query() method runs with the following WixDataQuery defaults that you can override:
25
+ - skip: 0
26
+ - limit: 50
27
+ - descending: by _createdDate
28
+ - include: none
29
+
37
30
  <type_definition>
38
31
  Method: data.items.query(dataCollectionId)
39
32
  Description: Creates a query to retrieve items from a database collection. The `query()` method builds a query to retrieve data items from a collection and returns a `WixDataQuery` object, which contains the query definition. You can refine the query by chaining [`WixDataQuery` methods](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/introduction) onto the query. `WixDataQuery` methods enable you to sort, filter, and control the query results. The methods chained to `query()` are applied in the order they are called. For example, if you sort by an `age` field in ascending order and then by a `name` field in descending order, the results are sorted first by the age of the items. If there are multiple results with the same age, they are further sorted by name in descending order, per age value. Finally, to run the query, chain [`find()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/find) or [`distinct()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/distinct) as the last method. The `query()` method runs with the following `WixDataQuery` defaults that you can override: - `skip`: `0` - `limit`: `50` - `descending`: by `_createdDate` - `include`: `none` > **Notes**: > - When calling `query()` immediately following an update to your collection, the data retrieved might not contain the most recent changes. If you need the most up-to-date data, set the `options.consistentRead` parameter of the [`find()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/find) or [`distinct()`](https://dev.wix.com/docs/sdk/backend-modules/data/items/wix-data-query/distinct) methods to `true`. Learn more about [Wix Data and eventual consistency](https://dev.wix.com/docs/sdk/backend-modules/data/eventual-consistency). > - To speed up data retrieval, the results of certain data queries are cached. Learn more about [caching data query results](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/data-api/about-caching-data-query-results). > - Items marked [in the CMS as hidden](https://support.wix.com/en/article/cms-controlling-live-site-item-visibility-from-your-collection) are not retrieved. > - If the collection that you are querying has references to other collections, by default the data from referenced collections is not retrieved. To retrieve data from the referenced items, specify them using the `include()` method. > - When querying [Wix app collections](https://dev.wix.com/docs/develop-websites/articles/databases/wix-data/collections/working-with-wix-app-collections-and-code), make sure the fields you use to refine your query support the intended operations. Learn more about [querying by Wix app collection fields](https://dev.wix.com/docs/develop-websites/articles/wix-apps/wix-app-collections/querying-wix-app-collections).
package/dist/out.js CHANGED
@@ -77023,6 +77023,13 @@ var require_CodeGenService = __commonJS({
77023
77023
  body: JSON.stringify({ status: TaskStatus.COMPLETED })
77024
77024
  });
77025
77025
  };
77026
+ this.updateJob = async (jobId, payload) => {
77027
+ await fetch(`${this.baseUrl}/projects/${this.projectId}/jobs/${jobId}`, {
77028
+ method: "PUT",
77029
+ headers: { "Content-Type": "application/json" },
77030
+ body: JSON.stringify({ payload })
77031
+ });
77032
+ };
77026
77033
  this.updateTask = async (jobId, taskId, status, payload) => {
77027
77034
  await fetch(`${this.baseUrl}/projects/${this.projectId}/jobs/${jobId}/tasks/${taskId}`, {
77028
77035
  method: "PUT",
@@ -77727,8 +77734,16 @@ var require_apiDocLoader = __commonJS({
77727
77734
  "ecom.currentCart.getCurrentCart": "ecom-currentCart-getCurrentCart-doc.txt",
77728
77735
  "ecom.currentCart.updateCurrentCart": "ecom-currentCart-updateCurrentCart-doc.txt"
77729
77736
  };
77730
- function loadApiDocumentation(apiNames) {
77731
- const apiDocs = (0, docLoader_1.loadDocumentation)(apiNames, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
77737
+ var DATA_API_NAMES = [
77738
+ "data.items.query",
77739
+ "data.items.insert",
77740
+ "data.items.remove",
77741
+ "data.items.update",
77742
+ "data.items.get"
77743
+ ];
77744
+ function loadApiDocumentation(apiNames, useData) {
77745
+ const apisToLoad = useData ? Array.from(/* @__PURE__ */ new Set([...apiNames, ...DATA_API_NAMES])) : apiNames;
77746
+ const apiDocs = (0, docLoader_1.loadDocumentation)(apisToLoad, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
77732
77747
  return apiDocs ? `
77733
77748
  <api_docs>
77734
77749
  ${apiDocs}
@@ -77800,9 +77815,9 @@ var require_servicePluginPrompt = __commonJS({
77800
77815
  var servicePluginDocLoader_1 = require_servicePluginDocLoader();
77801
77816
  var apiDocLoader_1 = require_apiDocLoader();
77802
77817
  var useElevate_1 = require_useElevate();
77803
- function getServicePluginPrompt(spiNames = [], apiNames = []) {
77818
+ function getServicePluginPrompt(spiNames = [], apiNames = [], useData = false) {
77804
77819
  const servicePluginDocs = (0, servicePluginDocLoader_1.loadServicePluginDocumentation)(spiNames);
77805
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
77820
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
77806
77821
  const elevate = (0, useElevate_1.useElevate)();
77807
77822
  return `
77808
77823
  <WIXCLI_SERVICE_PLUGIN_SYSTEM_PROMPT>
@@ -120751,15 +120766,16 @@ var require_SPIAgent = __commonJS({
120751
120766
  this.apiKey = apiKey;
120752
120767
  this.name = "SPIAgent";
120753
120768
  }
120754
- buildSystemPrompt(spiNames = [], apiNames = []) {
120755
- return (0, servicePluginPrompt_1.getServicePluginPrompt)(spiNames, apiNames);
120769
+ buildSystemPrompt(spiNames = [], apiNames = [], useData) {
120770
+ return (0, servicePluginPrompt_1.getServicePluginPrompt)(spiNames, apiNames, useData);
120756
120771
  }
120757
120772
  async generate(params) {
120758
- const { extension, blueprint } = params;
120773
+ const { extension, blueprint, planAndResources } = params;
120759
120774
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.ServicePluginExtension]);
120760
120775
  const allSpiNames = extension.relatedSpis?.map((spi) => spi.name).filter((name) => !!name) || [];
120761
120776
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
120762
- const systemPrompt = `${this.buildSystemPrompt(allSpiNames, apiNames)}
120777
+ const useData = Boolean(planAndResources?.createdCollections?.length);
120778
+ const systemPrompt = `${this.buildSystemPrompt(allSpiNames, apiNames, useData)}
120763
120779
  ${examples}
120764
120780
  `;
120765
120781
  console.log(`SPI Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
@@ -125037,8 +125053,8 @@ var require_backendEventPrompt = __commonJS({
125037
125053
  exports2.backendEventPrompt = void 0;
125038
125054
  var apiDocLoader_1 = require_apiDocLoader();
125039
125055
  var useElevate_1 = require_useElevate();
125040
- var backendEventPrompt = (apiNames) => {
125041
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
125056
+ var backendEventPrompt = (apiNames, useData) => {
125057
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
125042
125058
  const elevate = (0, useElevate_1.useElevate)();
125043
125059
  return `<BACKEND_EVENT_PROMPT>
125044
125060
  <role>
@@ -125134,14 +125150,15 @@ var require_BackendEventAgent = __commonJS({
125134
125150
  this.apiKey = apiKey;
125135
125151
  this.name = "BackendEventAgent";
125136
125152
  }
125137
- buildSystemPrompt(apiNames = []) {
125138
- return (0, backendEventPrompt_1.backendEventPrompt)(apiNames);
125153
+ buildSystemPrompt(apiNames = [], useData) {
125154
+ return (0, backendEventPrompt_1.backendEventPrompt)(apiNames, useData);
125139
125155
  }
125140
125156
  async generate(params) {
125141
- const { blueprint } = params;
125157
+ const { blueprint, planAndResources } = params;
125142
125158
  const examples = (0, load_examples_1.default)([load_examples_1.types.BackendEvent]);
125143
125159
  const allApiNames = (0, utils_1.extractApiNames)(params.extension);
125144
- const systemPrompt = `${this.buildSystemPrompt(allApiNames)}
125160
+ const useData = Boolean(planAndResources?.createdCollections?.length);
125161
+ const systemPrompt = `${this.buildSystemPrompt(allApiNames, useData)}
125145
125162
  ${examples}
125146
125163
  `;
125147
125164
  const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
@@ -127174,7 +127191,7 @@ var require_dashboardPagePrompt = __commonJS({
127174
127191
  ];
127175
127192
  var dashboardPagePrompt = async ({ useData, useApiSpec, useDynamicParameters, apiNames }) => {
127176
127193
  const wdsPrompt = await (0, wdsPackage_1.buildWdsSystemPrompt)(listOfWdsComponents);
127177
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
127194
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
127178
127195
  return `
127179
127196
  <WIXCLI_DASHBOARD_PAGE_SYSTEM_PROMPT>
127180
127197
 
@@ -128347,8 +128364,8 @@ var require_embededScript = __commonJS({
128347
128364
  exports2.embeddedScriptPrompt = void 0;
128348
128365
  var apiDocLoader_1 = require_apiDocLoader();
128349
128366
  var dynamicParameters_1 = require_dynamicParameters3();
128350
- var embeddedScriptPrompt = (hasDynamicParameters, apiNames) => {
128351
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
128367
+ var embeddedScriptPrompt = (hasDynamicParameters, apiNames, useData) => {
128368
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
128352
128369
  return `
128353
128370
  <WIXCLI_EMBEDDED_SCRIPT_SYSTEM_PROMPT>
128354
128371
 
@@ -128474,15 +128491,16 @@ var require_EmbeddedScriptAgent = __commonJS({
128474
128491
  this.apiKey = apiKey;
128475
128492
  this.name = "EmbeddedScriptAgent";
128476
128493
  }
128477
- buildSystemPrompt(hasDynamicParameters, apiNames) {
128478
- return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames);
128494
+ buildSystemPrompt(hasDynamicParameters, apiNames, useData) {
128495
+ return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames, useData);
128479
128496
  }
128480
128497
  async generate(params) {
128481
128498
  const { blueprint, planAndResources } = params;
128482
128499
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.EmbeddedScript]);
128483
128500
  const hasDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters && planAndResources.embeddedScriptParameters.length > 0);
128484
128501
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
128485
- const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames)}
128502
+ const useData = Boolean(planAndResources?.createdCollections?.length);
128503
+ const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames, useData)}
128486
128504
  ${examples}
128487
128505
  `;
128488
128506
  console.log(`Embedded Script Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
@@ -138747,6 +138765,7 @@ var require_codegen_flow_helpers = __commonJS({
138747
138765
  };
138748
138766
  Object.defineProperty(exports2, "__esModule", { value: true });
138749
138767
  exports2.setupAgentTaskTracking = setupAgentTaskTracking;
138768
+ exports2.updateJobPayload = updateJobPayload;
138750
138769
  exports2.updateParentTaskStatus = updateParentTaskStatus;
138751
138770
  exports2.getOutputPath = getOutputPath;
138752
138771
  var path_1 = __importDefault2(require("path"));
@@ -138786,6 +138805,9 @@ var require_codegen_flow_helpers = __commonJS({
138786
138805
  });
138787
138806
  });
138788
138807
  }
138808
+ async function updateJobPayload(jobContext, payload) {
138809
+ await __1.codeGenerationService.updateJob(jobContext.jobId, payload);
138810
+ }
138789
138811
  async function updateParentTaskStatus(jobContext, status, error) {
138790
138812
  await __1.codeGenerationService.updateTask(jobContext.jobId, jobContext.taskId, status, error ? { error: (0, utils_1.serializeError)(error) } : {});
138791
138813
  }
@@ -138828,6 +138850,9 @@ var require_init_codegen = __commonJS({
138828
138850
  accessToken: context_1.ctx.accessToken
138829
138851
  });
138830
138852
  await (0, codegen_flow_helpers_1.updateParentTaskStatus)(localJobContext, CodeGenService_1.TaskStatus.COMPLETED);
138853
+ await (0, codegen_flow_helpers_1.updateJobPayload)(localJobContext, {
138854
+ requiredPermissions: ["SCOPE.DC-DATA.DATA-COLLECTIONS-MANAGE"]
138855
+ });
138831
138856
  console.log(`[Init] Completed init codegen task: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
138832
138857
  } catch (error) {
138833
138858
  await (0, codegen_flow_helpers_1.updateParentTaskStatus)(localJobContext, CodeGenService_1.TaskStatus.FAILED, error);
@@ -138870,6 +138895,9 @@ var require_iterate_codegen = __commonJS({
138870
138895
  accessToken: context_1.ctx.accessToken
138871
138896
  });
138872
138897
  await (0, codegen_flow_helpers_1.updateParentTaskStatus)(localJobContext, CodeGenService_1.TaskStatus.COMPLETED);
138898
+ await (0, codegen_flow_helpers_1.updateJobPayload)(localJobContext, {
138899
+ requiredPermissions: ["SCOPE.DC-DATA.DATA-COLLECTIONS-MANAGE"]
138900
+ });
138873
138901
  console.log(`[Init] Completed iterate codegen task: jobId=${localJobContext.jobId}, taskId=${localJobContext.taskId}`);
138874
138902
  } catch (error) {
138875
138903
  await (0, codegen_flow_helpers_1.updateParentTaskStatus)(localJobContext, CodeGenService_1.TaskStatus.FAILED, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.69",
3
+ "version": "1.0.71",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -24,5 +24,5 @@
24
24
  "@wix/ditto-codegen": "1.0.0",
25
25
  "esbuild": "^0.25.9"
26
26
  },
27
- "falconPackageHash": "c2667a1bd2287aeab3fb96344df39df53ff34e686be509e20cf2cd93"
27
+ "falconPackageHash": "8cbdd50fff198d4acdc393fe265661b6227722e854c96f8c21feb25b"
28
28
  }