@wix/ditto-codegen-public 1.0.69 → 1.0.70

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
@@ -77727,8 +77727,16 @@ var require_apiDocLoader = __commonJS({
77727
77727
  "ecom.currentCart.getCurrentCart": "ecom-currentCart-getCurrentCart-doc.txt",
77728
77728
  "ecom.currentCart.updateCurrentCart": "ecom-currentCart-updateCurrentCart-doc.txt"
77729
77729
  };
77730
- function loadApiDocumentation(apiNames) {
77731
- const apiDocs = (0, docLoader_1.loadDocumentation)(apiNames, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
77730
+ var DATA_API_NAMES = [
77731
+ "data.items.query",
77732
+ "data.items.insert",
77733
+ "data.items.remove",
77734
+ "data.items.update",
77735
+ "data.items.get"
77736
+ ];
77737
+ function loadApiDocumentation(apiNames, useData) {
77738
+ const apisToLoad = useData ? Array.from(/* @__PURE__ */ new Set([...apiNames, ...DATA_API_NAMES])) : apiNames;
77739
+ const apiDocs = (0, docLoader_1.loadDocumentation)(apisToLoad, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
77732
77740
  return apiDocs ? `
77733
77741
  <api_docs>
77734
77742
  ${apiDocs}
@@ -77800,9 +77808,9 @@ var require_servicePluginPrompt = __commonJS({
77800
77808
  var servicePluginDocLoader_1 = require_servicePluginDocLoader();
77801
77809
  var apiDocLoader_1 = require_apiDocLoader();
77802
77810
  var useElevate_1 = require_useElevate();
77803
- function getServicePluginPrompt(spiNames = [], apiNames = []) {
77811
+ function getServicePluginPrompt(spiNames = [], apiNames = [], useData = false) {
77804
77812
  const servicePluginDocs = (0, servicePluginDocLoader_1.loadServicePluginDocumentation)(spiNames);
77805
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
77813
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
77806
77814
  const elevate = (0, useElevate_1.useElevate)();
77807
77815
  return `
77808
77816
  <WIXCLI_SERVICE_PLUGIN_SYSTEM_PROMPT>
@@ -120751,15 +120759,16 @@ var require_SPIAgent = __commonJS({
120751
120759
  this.apiKey = apiKey;
120752
120760
  this.name = "SPIAgent";
120753
120761
  }
120754
- buildSystemPrompt(spiNames = [], apiNames = []) {
120755
- return (0, servicePluginPrompt_1.getServicePluginPrompt)(spiNames, apiNames);
120762
+ buildSystemPrompt(spiNames = [], apiNames = [], useData) {
120763
+ return (0, servicePluginPrompt_1.getServicePluginPrompt)(spiNames, apiNames, useData);
120756
120764
  }
120757
120765
  async generate(params) {
120758
- const { extension, blueprint } = params;
120766
+ const { extension, blueprint, planAndResources } = params;
120759
120767
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.ServicePluginExtension]);
120760
120768
  const allSpiNames = extension.relatedSpis?.map((spi) => spi.name).filter((name) => !!name) || [];
120761
120769
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
120762
- const systemPrompt = `${this.buildSystemPrompt(allSpiNames, apiNames)}
120770
+ const useData = Boolean(planAndResources?.createdCollections?.length);
120771
+ const systemPrompt = `${this.buildSystemPrompt(allSpiNames, apiNames, useData)}
120763
120772
  ${examples}
120764
120773
  `;
120765
120774
  console.log(`SPI Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
@@ -125037,8 +125046,8 @@ var require_backendEventPrompt = __commonJS({
125037
125046
  exports2.backendEventPrompt = void 0;
125038
125047
  var apiDocLoader_1 = require_apiDocLoader();
125039
125048
  var useElevate_1 = require_useElevate();
125040
- var backendEventPrompt = (apiNames) => {
125041
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
125049
+ var backendEventPrompt = (apiNames, useData) => {
125050
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
125042
125051
  const elevate = (0, useElevate_1.useElevate)();
125043
125052
  return `<BACKEND_EVENT_PROMPT>
125044
125053
  <role>
@@ -125134,14 +125143,15 @@ var require_BackendEventAgent = __commonJS({
125134
125143
  this.apiKey = apiKey;
125135
125144
  this.name = "BackendEventAgent";
125136
125145
  }
125137
- buildSystemPrompt(apiNames = []) {
125138
- return (0, backendEventPrompt_1.backendEventPrompt)(apiNames);
125146
+ buildSystemPrompt(apiNames = [], useData) {
125147
+ return (0, backendEventPrompt_1.backendEventPrompt)(apiNames, useData);
125139
125148
  }
125140
125149
  async generate(params) {
125141
- const { blueprint } = params;
125150
+ const { blueprint, planAndResources } = params;
125142
125151
  const examples = (0, load_examples_1.default)([load_examples_1.types.BackendEvent]);
125143
125152
  const allApiNames = (0, utils_1.extractApiNames)(params.extension);
125144
- const systemPrompt = `${this.buildSystemPrompt(allApiNames)}
125153
+ const useData = Boolean(planAndResources?.createdCollections?.length);
125154
+ const systemPrompt = `${this.buildSystemPrompt(allApiNames, useData)}
125145
125155
  ${examples}
125146
125156
  `;
125147
125157
  const appName = blueprint?.appName ? `'${blueprint.appName}'` : "";
@@ -127174,7 +127184,7 @@ var require_dashboardPagePrompt = __commonJS({
127174
127184
  ];
127175
127185
  var dashboardPagePrompt = async ({ useData, useApiSpec, useDynamicParameters, apiNames }) => {
127176
127186
  const wdsPrompt = await (0, wdsPackage_1.buildWdsSystemPrompt)(listOfWdsComponents);
127177
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
127187
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
127178
127188
  return `
127179
127189
  <WIXCLI_DASHBOARD_PAGE_SYSTEM_PROMPT>
127180
127190
 
@@ -128347,8 +128357,8 @@ var require_embededScript = __commonJS({
128347
128357
  exports2.embeddedScriptPrompt = void 0;
128348
128358
  var apiDocLoader_1 = require_apiDocLoader();
128349
128359
  var dynamicParameters_1 = require_dynamicParameters3();
128350
- var embeddedScriptPrompt = (hasDynamicParameters, apiNames) => {
128351
- const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames);
128360
+ var embeddedScriptPrompt = (hasDynamicParameters, apiNames, useData) => {
128361
+ const apiDocs = (0, apiDocLoader_1.loadApiDocumentation)(apiNames, useData);
128352
128362
  return `
128353
128363
  <WIXCLI_EMBEDDED_SCRIPT_SYSTEM_PROMPT>
128354
128364
 
@@ -128474,15 +128484,16 @@ var require_EmbeddedScriptAgent = __commonJS({
128474
128484
  this.apiKey = apiKey;
128475
128485
  this.name = "EmbeddedScriptAgent";
128476
128486
  }
128477
- buildSystemPrompt(hasDynamicParameters, apiNames) {
128478
- return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames);
128487
+ buildSystemPrompt(hasDynamicParameters, apiNames, useData) {
128488
+ return (0, embededScript_1.embeddedScriptPrompt)(hasDynamicParameters, apiNames, useData);
128479
128489
  }
128480
128490
  async generate(params) {
128481
128491
  const { blueprint, planAndResources } = params;
128482
128492
  const examples = (0, load_examples_1.loadExamples)([load_examples_1.types.EmbeddedScript]);
128483
128493
  const hasDynamicParameters = Boolean(planAndResources?.embeddedScriptParameters && planAndResources.embeddedScriptParameters.length > 0);
128484
128494
  const apiNames = (0, utils_1.extractApiNames)(params.extension);
128485
- const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames)}
128495
+ const useData = Boolean(planAndResources?.createdCollections?.length);
128496
+ const systemPrompt = `${this.buildSystemPrompt(hasDynamicParameters, apiNames, useData)}
128486
128497
  ${examples}
128487
128498
  `;
128488
128499
  console.log(`Embedded Script Agent System Prompt length: ${systemPrompt.length} (is that what you expect?)`);
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.70",
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": "8e07cdba6c6a46f618b6f98829f30e359e55b3138af2d62a2d3ee387"
28
28
  }