@wix/ditto-codegen-public 1.0.51 → 1.0.53
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.
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<ecom_cart_onCartCreated>
|
|
2
|
+
<purpose>Registers a callback function as an event handler. Triggered when a cart is created. This method registers a callback function as an event handler. When developing websites or building apps with Blocks, use a Velo backend event instead of this method. The way you call this method differs depending on the framework you are working in: When using the CLI, run the generate command to add an event extension, and then call this method within the extension code. When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server.</purpose>
|
|
3
|
+
<use_cases>
|
|
4
|
+
- Initialize cart tracking and analytics when a new cart is created
|
|
5
|
+
- Send welcome messages or onboarding communications to new cart owners
|
|
6
|
+
- Trigger automated workflows when a cart is first created
|
|
7
|
+
- Sync cart creation events with external systems or databases
|
|
8
|
+
- Apply initial cart settings or default configurations
|
|
9
|
+
- Send notifications when new shopping sessions begin
|
|
10
|
+
- Log new cart creation events for analytics and monitoring
|
|
11
|
+
- Initialize cart-specific features or personalization
|
|
12
|
+
</use_cases>
|
|
13
|
+
|
|
14
|
+
<method_declaration>
|
|
15
|
+
cart.onCartCreated(handler)
|
|
16
|
+
</method_declaration>
|
|
17
|
+
<required_parameters>
|
|
18
|
+
- handler: function - handler(event: CartCreatedEnvelope): void | Promise<void>
|
|
19
|
+
</required_parameters>
|
|
20
|
+
<optional_parameters>
|
|
21
|
+
None
|
|
22
|
+
</optional_parameters>
|
|
23
|
+
<import>import { cart } from '@wix/ecom'</import>
|
|
24
|
+
<types>
|
|
25
|
+
**CartCreatedEnvelope**
|
|
26
|
+
Properties:
|
|
27
|
+
- event: CartCreatedEnvelope - The cart update event envelope
|
|
28
|
+
|
|
29
|
+
**CartCreatedEnvelope**
|
|
30
|
+
Properties:
|
|
31
|
+
- entity: Cart - The updated cart entity
|
|
32
|
+
- metadata: EventMetadata - Event metadata
|
|
33
|
+
|
|
34
|
+
**Cart**
|
|
35
|
+
Properties:
|
|
36
|
+
- buyerInfo: BuyerInfo - Buyer information.
|
|
37
|
+
|
|
38
|
+
**BuyerInfo**
|
|
39
|
+
- contactId: string - Contact ID. For more information, see the Contacts API.
|
|
40
|
+
- email: string - Buyer email address.
|
|
41
|
+
- one of (id):
|
|
42
|
+
* visitorId: string - Visitor ID (format: GUID). If the buyer is not a site member.
|
|
43
|
+
* memberId: string - Member ID (format: GUID). If the buyer is a site member.
|
|
44
|
+
* userId: string - User ID (format: GUID). If the buyer, or cart owner, is a Wix user.
|
|
45
|
+
</types>
|
|
46
|
+
<important_notes>
|
|
47
|
+
- This method registers a callback function as an event handler
|
|
48
|
+
- When developing websites or building apps with Blocks, use a Velo backend event instead of this method
|
|
49
|
+
- The way you call this method differs depending on the framework you are working in:
|
|
50
|
+
- When using the CLI, run the generate command to add an event extension, and then call this method within the extension code
|
|
51
|
+
- When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server
|
|
52
|
+
- The handler function can be either synchronous (void) or asynchronous (Promise<void>)
|
|
53
|
+
- Triggered when a cart is created
|
|
54
|
+
- Required Permission: Read Orders
|
|
55
|
+
</important_notes>
|
|
56
|
+
|
|
57
|
+
<event_triggers>
|
|
58
|
+
- Cart Created: Triggered automatically when a new cart is successfully created
|
|
59
|
+
</event_triggers>
|
|
60
|
+
<example_usage>
|
|
61
|
+
```typescript
|
|
62
|
+
import { cart } from '@wix/ecom';
|
|
63
|
+
|
|
64
|
+
// Register event handler for cart creation
|
|
65
|
+
cart.onCartCreated((event) => {
|
|
66
|
+
console.log('Cart created:', event);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Async handler example
|
|
70
|
+
cart.onCartCreated(async (event) => {
|
|
71
|
+
await trackNewCart(event);
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
</example_usage>
|
|
75
|
+
<related_methods>
|
|
76
|
+
- cart.onCartUpdated() - Event handler for cart updates
|
|
77
|
+
- cart.onCartDeleted() - Event handler for cart deletion
|
|
78
|
+
- cart.getCurrentCart() - Retrieve the current cart
|
|
79
|
+
- cart.createCurrentCart() - Create a new cart
|
|
80
|
+
- cart.updateCurrentCart() - Update cart properties
|
|
81
|
+
- cart.addToCurrentCart() - Add items to cart
|
|
82
|
+
- cart.removeLineItemsFromCurrentCart() - Remove items from cart
|
|
83
|
+
</related_methods>
|
|
84
|
+
</ecom_cart_onCartCreated>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<ecom_cart_onCartUpdated>
|
|
2
|
+
<purpose>Registers a callback function as an event handler. Triggered when a cart is updated. This method registers a callback function as an event handler. When developing websites or building apps with Blocks, use a Velo backend event instead of this method. The way you call this method differs depending on the framework you are working in: When using the CLI, run the generate command to add an event extension, and then call this method within the extension code. When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server.</purpose>
|
|
3
|
+
<use_cases>
|
|
4
|
+
- Track cart changes for analytics and monitoring
|
|
5
|
+
- Update inventory systems when cart contents change
|
|
6
|
+
- Apply dynamic pricing or discounts based on cart updates
|
|
7
|
+
- Sync cart data with external systems or databases
|
|
8
|
+
- Trigger automated workflows when cart items change
|
|
9
|
+
- Send notifications or alerts for specific cart updates
|
|
10
|
+
- Log cart modifications for compliance and auditing
|
|
11
|
+
- Update product recommendations based on cart changes
|
|
12
|
+
</use_cases>
|
|
13
|
+
|
|
14
|
+
<method_declaration>
|
|
15
|
+
cart.onCartUpdated(handler)
|
|
16
|
+
</method_declaration>
|
|
17
|
+
<required_parameters>
|
|
18
|
+
- handler: function - handler(event: CartUpdatedEnvelope): void | Promise<void>
|
|
19
|
+
</required_parameters>
|
|
20
|
+
<optional_parameters>
|
|
21
|
+
None
|
|
22
|
+
</optional_parameters>
|
|
23
|
+
<import>import { cart } from '@wix/ecom'</import>
|
|
24
|
+
<types>
|
|
25
|
+
**CartUpdatedEnvelope**
|
|
26
|
+
Properties:
|
|
27
|
+
- event: CartUpdatedEnvelope - The cart update event envelope
|
|
28
|
+
|
|
29
|
+
**CartUpdatedEnvelope**
|
|
30
|
+
Properties:
|
|
31
|
+
- entity: Cart - The updated cart entity
|
|
32
|
+
- metadata: EventMetadata - Event metadata
|
|
33
|
+
|
|
34
|
+
**Cart**
|
|
35
|
+
Properties:
|
|
36
|
+
- buyerInfo: BuyerInfo - Buyer information.
|
|
37
|
+
|
|
38
|
+
**BuyerInfo**
|
|
39
|
+
- contactId: string - Contact ID. For more information, see the Contacts API.
|
|
40
|
+
- email: string - Buyer email address.
|
|
41
|
+
- one of (id):
|
|
42
|
+
* visitorId: string - Visitor ID (format: GUID). If the buyer is not a site member.
|
|
43
|
+
* memberId: string - Member ID (format: GUID). If the buyer is a site member.
|
|
44
|
+
* userId: string - User ID (format: GUID). If the buyer, or cart owner, is a Wix user.
|
|
45
|
+
</types>
|
|
46
|
+
<important_notes>
|
|
47
|
+
- This method registers a callback function as an event handler
|
|
48
|
+
- When developing websites or building apps with Blocks, use a Velo backend event instead of this method
|
|
49
|
+
- The way you call this method differs depending on the framework you are working in:
|
|
50
|
+
- When using the CLI, run the generate command to add an event extension, and then call this method within the extension code
|
|
51
|
+
- When building a self-hosted app, subscribe your app to the relevant event, and then call this method on your server
|
|
52
|
+
- The handler function can be either synchronous (void) or asynchronous (Promise<void>)
|
|
53
|
+
- Triggered when a cart is updated
|
|
54
|
+
- Required Permission: Read Orders
|
|
55
|
+
</important_notes>
|
|
56
|
+
|
|
57
|
+
<event_triggers>
|
|
58
|
+
- Cart Updated: Triggered automatically when a cart's contents, quantities, or properties are modified
|
|
59
|
+
</event_triggers>
|
|
60
|
+
<example_usage>
|
|
61
|
+
```typescript
|
|
62
|
+
import { cart } from '@wix/ecom';
|
|
63
|
+
|
|
64
|
+
// Register event handler for cart updates
|
|
65
|
+
cart.onCartUpdated((event) => {
|
|
66
|
+
console.log('Cart updated:', event);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Async handler example
|
|
70
|
+
cart.onCartUpdated(async (event) => {
|
|
71
|
+
await trackCartChanges(event);
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
</example_usage>
|
|
75
|
+
<related_methods>
|
|
76
|
+
- cart.onCartCreated() - Event handler for cart creation
|
|
77
|
+
- cart.onCartDeleted() - Event handler for cart deletion
|
|
78
|
+
- cart.getCurrentCart() - Retrieve the current cart
|
|
79
|
+
- cart.updateCurrentCart() - Update cart properties
|
|
80
|
+
- cart.addToCurrentCart() - Add items to cart
|
|
81
|
+
- cart.removeLineItemsFromCurrentCart() - Remove items from cart
|
|
82
|
+
- cart.updateCurrentCartLineItemQuantity() - Update line item quantities
|
|
83
|
+
</related_methods>
|
|
84
|
+
</ecom_cart_onCartUpdated>
|
package/dist/out.js
CHANGED
|
@@ -124972,7 +124972,9 @@ var require_apiDocLoader = __commonJS({
|
|
|
124972
124972
|
"stores.productsV3.updateProduct": "stores-productsV3-updateProduct-doc.txt",
|
|
124973
124973
|
"stores.products.onProductCreated": "stores-productV3-onProductCreated-doc.txt",
|
|
124974
124974
|
"data.items.onDataItemCreated": "data-items-onDataItemCreated.txt",
|
|
124975
|
-
"crm.contacts.onContactCreated": "crm-contacts-onContactCreated-doc.txt"
|
|
124975
|
+
"crm.contacts.onContactCreated": "crm-contacts-onContactCreated-doc.txt",
|
|
124976
|
+
"ecom.cart.onCartCreated": "ecom-cart-onCartCreated-doc.txt",
|
|
124977
|
+
"ecom.cart.onCartUpdated": "ecom-cart-onCartUpdated-doc.txt"
|
|
124976
124978
|
};
|
|
124977
124979
|
function loadApiDocumentation(apiNames) {
|
|
124978
124980
|
return (0, docLoader_1.loadDocumentation)(apiNames, API_TO_DOC_MAPPING, docLoader_1.DocType.API);
|
|
@@ -131085,7 +131087,7 @@ var require_extensionGenerators = __commonJS({
|
|
|
131085
131087
|
const servicePluginType = this.getServicePluginType(extension);
|
|
131086
131088
|
const builderMethod = this.servicePluginBuilderMap[servicePluginType];
|
|
131087
131089
|
const extensionConfig = this.createServicePluginData(name, scaffoldDir, id, servicePluginType);
|
|
131088
|
-
writeExtensionFile({
|
|
131090
|
+
return writeExtensionFile({
|
|
131089
131091
|
outputPath,
|
|
131090
131092
|
name,
|
|
131091
131093
|
builderMethodName: builderMethod,
|
|
@@ -131093,12 +131095,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131093
131095
|
extensionType: extension.type,
|
|
131094
131096
|
scaffoldDir
|
|
131095
131097
|
});
|
|
131096
|
-
break;
|
|
131097
131098
|
}
|
|
131098
131099
|
case types_1.ExtensionType.DASHBOARD_PAGE: {
|
|
131099
131100
|
const name = extension.name || "My Backoffice Page";
|
|
131100
131101
|
const extensionConfig = this.createDashboardPageData(id, name, scaffoldDir);
|
|
131101
|
-
writeExtensionFile({
|
|
131102
|
+
return writeExtensionFile({
|
|
131102
131103
|
outputPath,
|
|
131103
131104
|
name,
|
|
131104
131105
|
builderMethodName: "backofficePage",
|
|
@@ -131106,12 +131107,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131106
131107
|
extensionType: extension.type,
|
|
131107
131108
|
scaffoldDir
|
|
131108
131109
|
});
|
|
131109
|
-
break;
|
|
131110
131110
|
}
|
|
131111
131111
|
case types_1.ExtensionType.SITE_COMPONENT: {
|
|
131112
131112
|
const name = extension.name || "My Site Component";
|
|
131113
131113
|
const extensionConfig = this.createSiteComponentData(name, scaffoldDir, id);
|
|
131114
|
-
writeExtensionFile({
|
|
131114
|
+
return writeExtensionFile({
|
|
131115
131115
|
outputPath,
|
|
131116
131116
|
name,
|
|
131117
131117
|
builderMethodName: "siteComponent",
|
|
@@ -131119,12 +131119,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131119
131119
|
extensionType: extension.type,
|
|
131120
131120
|
scaffoldDir
|
|
131121
131121
|
});
|
|
131122
|
-
break;
|
|
131123
131122
|
}
|
|
131124
131123
|
case types_1.ExtensionType.SITE_WIDGET: {
|
|
131125
131124
|
const name = extension.name || "My Site Widget";
|
|
131126
131125
|
const extensionConfig = this.createCustomElementData(id, name, scaffoldDir);
|
|
131127
|
-
writeExtensionFile({
|
|
131126
|
+
return writeExtensionFile({
|
|
131128
131127
|
outputPath,
|
|
131129
131128
|
name,
|
|
131130
131129
|
builderMethodName: "customElement",
|
|
@@ -131132,7 +131131,6 @@ var require_extensionGenerators = __commonJS({
|
|
|
131132
131131
|
extensionType: extension.type,
|
|
131133
131132
|
scaffoldDir
|
|
131134
131133
|
});
|
|
131135
|
-
break;
|
|
131136
131134
|
}
|
|
131137
131135
|
case types_1.ExtensionType.EMBEDDED_SCRIPT: {
|
|
131138
131136
|
const name = extension.name || "My Embedded Script";
|
|
@@ -131141,7 +131139,7 @@ var require_extensionGenerators = __commonJS({
|
|
|
131141
131139
|
scriptType: EmbeddedScriptAgent_1.EmbeddedScriptType.ESSENTIAL
|
|
131142
131140
|
};
|
|
131143
131141
|
const extensionConfig = this.createEmbeddedScriptData(id, name, scaffoldDir, placement, scriptType);
|
|
131144
|
-
writeExtensionFile({
|
|
131142
|
+
return writeExtensionFile({
|
|
131145
131143
|
outputPath,
|
|
131146
131144
|
name,
|
|
131147
131145
|
builderMethodName: "embeddedScript",
|
|
@@ -131149,12 +131147,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131149
131147
|
extensionType: extension.type,
|
|
131150
131148
|
scaffoldDir
|
|
131151
131149
|
});
|
|
131152
|
-
break;
|
|
131153
131150
|
}
|
|
131154
131151
|
case types_1.ExtensionType.BACKEND_EVENT: {
|
|
131155
131152
|
const name = extension.name || "My Backend Event";
|
|
131156
131153
|
const extensionConfig = this.createBackendEventData(id, extension.relatedApis || [], scaffoldDir);
|
|
131157
|
-
writeExtensionFile({
|
|
131154
|
+
return writeExtensionFile({
|
|
131158
131155
|
outputPath,
|
|
131159
131156
|
name,
|
|
131160
131157
|
builderMethodName: "webhook",
|
|
@@ -131162,11 +131159,16 @@ var require_extensionGenerators = __commonJS({
|
|
|
131162
131159
|
extensionType: extension.type,
|
|
131163
131160
|
scaffoldDir
|
|
131164
131161
|
});
|
|
131165
|
-
break;
|
|
131166
131162
|
}
|
|
131163
|
+
case types_1.ExtensionType.BACKEND_API:
|
|
131164
|
+
case types_1.ExtensionType.WEBHOOK:
|
|
131165
|
+
case types_1.ExtensionType.WEB_METHODS:
|
|
131166
|
+
case types_1.ExtensionType.DASHBOARD_PLUGIN:
|
|
131167
|
+
case types_1.ExtensionType.DASHBOARD_MODAL:
|
|
131168
|
+
return null;
|
|
131167
131169
|
default:
|
|
131168
131170
|
console.log(`Skipping extension type: ${extension.type}. It doesn't need presence in the extensions.ts file (e.g. Backend API is astro only)`);
|
|
131169
|
-
return;
|
|
131171
|
+
return null;
|
|
131170
131172
|
}
|
|
131171
131173
|
}
|
|
131172
131174
|
static createBackendEventData(id, relatedApis, scaffoldDir) {
|
|
@@ -131287,7 +131289,9 @@ var require_extensionGenerators = __commonJS({
|
|
|
131287
131289
|
ExtensionFactory.apiToSlug = {
|
|
131288
131290
|
"stores.productsV3.onProductCreated": "wix.stores.catalog.v3.product_created",
|
|
131289
131291
|
"crm.contacts.onContactCreated": "wix.contacts.v4.contact_created",
|
|
131290
|
-
"data.items.onDataItemCreated": "wix.data.v2.data_item_created"
|
|
131292
|
+
"data.items.onDataItemCreated": "wix.data.v2.data_item_created",
|
|
131293
|
+
"ecom.cart.onCartCreated": "wix.ecom.v1.cart_created",
|
|
131294
|
+
"ecom.cart.onCartUpdated": "wix.ecom.v1.cart_updated"
|
|
131291
131295
|
};
|
|
131292
131296
|
function getScaffoldPath(scaffoldDir, file) {
|
|
131293
131297
|
return "./" + path_1.default.join(scaffoldDir, file).replace(/^src\//, "");
|
|
@@ -137921,6 +137925,64 @@ export default appBuilder;
|
|
|
137921
137925
|
}
|
|
137922
137926
|
});
|
|
137923
137927
|
|
|
137928
|
+
// dist/file-collector.js
|
|
137929
|
+
var require_file_collector = __commonJS({
|
|
137930
|
+
"dist/file-collector.js"(exports2) {
|
|
137931
|
+
"use strict";
|
|
137932
|
+
var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) {
|
|
137933
|
+
return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
|
|
137934
|
+
};
|
|
137935
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
137936
|
+
exports2.captureExistingFiles = captureExistingFiles;
|
|
137937
|
+
exports2.determineFileOperation = determineFileOperation;
|
|
137938
|
+
exports2.collectAllCreatedFiles = collectAllCreatedFiles;
|
|
137939
|
+
var fs_1 = __importDefault2(require("fs"));
|
|
137940
|
+
var path_1 = __importDefault2(require("path"));
|
|
137941
|
+
function captureExistingFiles(filePaths, outputPath) {
|
|
137942
|
+
const existingFiles = /* @__PURE__ */ new Set();
|
|
137943
|
+
filePaths.forEach((filePath) => {
|
|
137944
|
+
const fullPath = path_1.default.join(outputPath, filePath);
|
|
137945
|
+
if (fs_1.default.existsSync(fullPath)) {
|
|
137946
|
+
existingFiles.add(fullPath);
|
|
137947
|
+
}
|
|
137948
|
+
});
|
|
137949
|
+
return existingFiles;
|
|
137950
|
+
}
|
|
137951
|
+
function determineFileOperation(filePath, outputPath, existingFiles) {
|
|
137952
|
+
const fullPath = path_1.default.join(outputPath, filePath);
|
|
137953
|
+
return existingFiles.has(fullPath) ? "update" : "insert";
|
|
137954
|
+
}
|
|
137955
|
+
function collectAllCreatedFiles(options) {
|
|
137956
|
+
const { scaffolds = [], agentFiles, extensionFilePath, outputPath, existingFiles } = options;
|
|
137957
|
+
const allCreatedFiles = [];
|
|
137958
|
+
scaffolds.forEach((s) => {
|
|
137959
|
+
allCreatedFiles.push({
|
|
137960
|
+
path: s.path,
|
|
137961
|
+
operation: "insert",
|
|
137962
|
+
// Scaffolds are always new files
|
|
137963
|
+
content: s.content
|
|
137964
|
+
});
|
|
137965
|
+
});
|
|
137966
|
+
agentFiles.forEach((file) => {
|
|
137967
|
+
const hasScaffold = scaffolds.some((s) => s.path === file.path);
|
|
137968
|
+
allCreatedFiles.push({
|
|
137969
|
+
...file,
|
|
137970
|
+
operation: hasScaffold ? "insert" : determineFileOperation(file.path || "", outputPath, existingFiles)
|
|
137971
|
+
});
|
|
137972
|
+
});
|
|
137973
|
+
if (extensionFilePath) {
|
|
137974
|
+
allCreatedFiles.push({
|
|
137975
|
+
path: extensionFilePath,
|
|
137976
|
+
operation: determineFileOperation(extensionFilePath, outputPath, existingFiles),
|
|
137977
|
+
content: fs_1.default.readFileSync(path_1.default.join(outputPath, extensionFilePath), "utf-8")
|
|
137978
|
+
});
|
|
137979
|
+
}
|
|
137980
|
+
const uniqueFiles = Array.from(new Map(allCreatedFiles.map((file) => [file.path, file])).values());
|
|
137981
|
+
return uniqueFiles;
|
|
137982
|
+
}
|
|
137983
|
+
}
|
|
137984
|
+
});
|
|
137985
|
+
|
|
137924
137986
|
// dist/orchestrator.js
|
|
137925
137987
|
var require_orchestrator = __commonJS({
|
|
137926
137988
|
"dist/orchestrator.js"(exports2) {
|
|
@@ -137940,6 +138002,7 @@ var require_orchestrator = __commonJS({
|
|
|
137940
138002
|
var FixerFactory_1 = __importDefault2(require_FixerFactory());
|
|
137941
138003
|
var extensionGenerators_1 = require_extensionGenerators();
|
|
137942
138004
|
var extensionIndexer_1 = require_extensionIndexer();
|
|
138005
|
+
var file_collector_1 = require_file_collector();
|
|
137943
138006
|
var MAX_ERRORS_PER_BATCH = 20;
|
|
137944
138007
|
var DittoOrchestrator = class extends events_1.EventEmitter {
|
|
137945
138008
|
constructor(agentsFactory, apiKey) {
|
|
@@ -137955,6 +138018,41 @@ var require_orchestrator = __commonJS({
|
|
|
137955
138018
|
emitEvent(event, payload) {
|
|
137956
138019
|
return super.emit(event, payload);
|
|
137957
138020
|
}
|
|
138021
|
+
/**
|
|
138022
|
+
* Finalize the code generation for an extension by:
|
|
138023
|
+
* 1. Capturing which files existed before generation
|
|
138024
|
+
* 2. Writing the generated files to disk
|
|
138025
|
+
* 3. Generating the extension registration file
|
|
138026
|
+
* 4. Collecting all created files with correct operation types
|
|
138027
|
+
* 5. Emitting the agent:done event
|
|
138028
|
+
*
|
|
138029
|
+
* This wraps the common pattern used in all process* methods.
|
|
138030
|
+
*/
|
|
138031
|
+
finalizeExtensionGeneration(options) {
|
|
138032
|
+
const { extension, agentName, agentFiles, scaffolds = [], scaffoldPath, outputPath, generatedConfig } = options;
|
|
138033
|
+
const filesToCheck = agentFiles.map((f) => f.path || "");
|
|
138034
|
+
const existingFiles = (0, file_collector_1.captureExistingFiles)(filesToCheck, outputPath);
|
|
138035
|
+
this.writeFile(agentFiles, outputPath);
|
|
138036
|
+
const extensionFilePath = extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138037
|
+
extension,
|
|
138038
|
+
outputPath,
|
|
138039
|
+
scaffoldPath,
|
|
138040
|
+
generatedConfig
|
|
138041
|
+
});
|
|
138042
|
+
const allCreatedFiles = (0, file_collector_1.collectAllCreatedFiles)({
|
|
138043
|
+
scaffolds,
|
|
138044
|
+
agentFiles,
|
|
138045
|
+
extensionFilePath,
|
|
138046
|
+
outputPath,
|
|
138047
|
+
existingFiles
|
|
138048
|
+
});
|
|
138049
|
+
this.emitEvent("agent:done", {
|
|
138050
|
+
extension,
|
|
138051
|
+
name: agentName,
|
|
138052
|
+
files: allCreatedFiles
|
|
138053
|
+
});
|
|
138054
|
+
return extensionFilePath;
|
|
138055
|
+
}
|
|
137958
138056
|
writeFile(files, outputPath) {
|
|
137959
138057
|
if (!files) {
|
|
137960
138058
|
console.warn("\u26A0\uFE0F Skipping file operation: no files provided");
|
|
@@ -138108,22 +138206,19 @@ var require_orchestrator = __commonJS({
|
|
|
138108
138206
|
basePath: outputPath,
|
|
138109
138207
|
planAndResources
|
|
138110
138208
|
});
|
|
138111
|
-
this.
|
|
138112
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138209
|
+
this.finalizeExtensionGeneration({
|
|
138113
138210
|
extension,
|
|
138114
|
-
|
|
138211
|
+
agentName: embeddedScriptAgent.name,
|
|
138212
|
+
agentFiles: files,
|
|
138213
|
+
scaffolds: [scaffold],
|
|
138115
138214
|
scaffoldPath: scaffold.path,
|
|
138215
|
+
outputPath,
|
|
138116
138216
|
generatedConfig: {
|
|
138117
138217
|
type: types_1.ExtensionType.EMBEDDED_SCRIPT,
|
|
138118
138218
|
scriptType,
|
|
138119
138219
|
placement
|
|
138120
138220
|
}
|
|
138121
138221
|
});
|
|
138122
|
-
this.emitEvent("agent:done", {
|
|
138123
|
-
extension,
|
|
138124
|
-
name: embeddedScriptAgent.name,
|
|
138125
|
-
files
|
|
138126
|
-
});
|
|
138127
138222
|
}
|
|
138128
138223
|
async processDashboardPage(opts) {
|
|
138129
138224
|
const { extension, blueprint, outputPath, planAndResources } = opts;
|
|
@@ -138159,17 +138254,13 @@ var require_orchestrator = __commonJS({
|
|
|
138159
138254
|
decision,
|
|
138160
138255
|
extensionName: extension.name || ""
|
|
138161
138256
|
});
|
|
138162
|
-
this.writeFile(files, outputPath);
|
|
138163
138257
|
const pagePath = files[0].path || "";
|
|
138164
|
-
|
|
138165
|
-
extension,
|
|
138166
|
-
outputPath,
|
|
138167
|
-
scaffoldPath: pagePath
|
|
138168
|
-
});
|
|
138169
|
-
this.emitEvent("agent:done", {
|
|
138258
|
+
this.finalizeExtensionGeneration({
|
|
138170
138259
|
extension,
|
|
138171
|
-
|
|
138172
|
-
files
|
|
138260
|
+
agentName: "AutoPatternsGenerator",
|
|
138261
|
+
agentFiles: files,
|
|
138262
|
+
scaffoldPath: pagePath,
|
|
138263
|
+
outputPath
|
|
138173
138264
|
});
|
|
138174
138265
|
}
|
|
138175
138266
|
async processServicePlugin({ extension, blueprint, outputPath, planAndResources }) {
|
|
@@ -138201,13 +138292,14 @@ var require_orchestrator = __commonJS({
|
|
|
138201
138292
|
planAndResources,
|
|
138202
138293
|
basePath: outputPath
|
|
138203
138294
|
});
|
|
138204
|
-
this.
|
|
138205
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138295
|
+
this.finalizeExtensionGeneration({
|
|
138206
138296
|
extension,
|
|
138207
|
-
|
|
138208
|
-
|
|
138297
|
+
agentName: agent.name,
|
|
138298
|
+
agentFiles: files,
|
|
138299
|
+
scaffolds,
|
|
138300
|
+
scaffoldPath: scaffold.path,
|
|
138301
|
+
outputPath
|
|
138209
138302
|
});
|
|
138210
|
-
this.emitEvent("agent:done", { extension, name: agent.name, files });
|
|
138211
138303
|
}
|
|
138212
138304
|
async processStandardExtension({ extension, blueprint, outputPath, planAndResources }) {
|
|
138213
138305
|
this.emitEvent("scaffold:start", { extension });
|
|
@@ -138229,13 +138321,14 @@ var require_orchestrator = __commonJS({
|
|
|
138229
138321
|
planAndResources,
|
|
138230
138322
|
basePath: outputPath
|
|
138231
138323
|
});
|
|
138232
|
-
this.
|
|
138233
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138324
|
+
this.finalizeExtensionGeneration({
|
|
138234
138325
|
extension,
|
|
138235
|
-
|
|
138236
|
-
|
|
138326
|
+
agentName: agent.name,
|
|
138327
|
+
agentFiles: files,
|
|
138328
|
+
scaffolds,
|
|
138329
|
+
scaffoldPath: scaffold.path,
|
|
138330
|
+
outputPath
|
|
138237
138331
|
});
|
|
138238
|
-
this.emitEvent("agent:done", { extension, name: agent.name, files });
|
|
138239
138332
|
}
|
|
138240
138333
|
async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, planAndResources, scaffolds }) {
|
|
138241
138334
|
if (!extension.relatedSpis || extension.relatedSpis.length === 0) {
|
|
@@ -138262,16 +138355,13 @@ var require_orchestrator = __commonJS({
|
|
|
138262
138355
|
planAndResources,
|
|
138263
138356
|
basePath: outputPath
|
|
138264
138357
|
});
|
|
138265
|
-
this.
|
|
138266
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138267
|
-
extension: spiExtension,
|
|
138268
|
-
outputPath,
|
|
138269
|
-
scaffoldPath: scaffold.path
|
|
138270
|
-
});
|
|
138271
|
-
this.emitEvent("agent:done", {
|
|
138358
|
+
this.finalizeExtensionGeneration({
|
|
138272
138359
|
extension: spiExtension,
|
|
138273
|
-
|
|
138274
|
-
files
|
|
138360
|
+
agentName: agent.name,
|
|
138361
|
+
agentFiles: files,
|
|
138362
|
+
scaffolds: [scaffold],
|
|
138363
|
+
scaffoldPath: scaffold.path,
|
|
138364
|
+
outputPath
|
|
138275
138365
|
});
|
|
138276
138366
|
});
|
|
138277
138367
|
await Promise.all(parallelTasks);
|
|
@@ -138308,16 +138398,13 @@ var require_orchestrator = __commonJS({
|
|
|
138308
138398
|
relevantFilePaths: paths,
|
|
138309
138399
|
basePath: outputPath
|
|
138310
138400
|
});
|
|
138311
|
-
this.
|
|
138312
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138313
|
-
extension,
|
|
138314
|
-
outputPath,
|
|
138315
|
-
scaffoldPath: scaffold.path
|
|
138316
|
-
});
|
|
138317
|
-
this.emitEvent("agent:done", {
|
|
138401
|
+
this.finalizeExtensionGeneration({
|
|
138318
138402
|
extension,
|
|
138319
|
-
|
|
138320
|
-
files
|
|
138403
|
+
agentName: agent.name,
|
|
138404
|
+
agentFiles: files,
|
|
138405
|
+
scaffolds,
|
|
138406
|
+
scaffoldPath: scaffold.path,
|
|
138407
|
+
outputPath
|
|
138321
138408
|
});
|
|
138322
138409
|
} else {
|
|
138323
138410
|
const agent = this.agentsFactory.getAgent(extension);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.53",
|
|
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": "
|
|
27
|
+
"falconPackageHash": "d94dc48f341bb651a364e400fa9d529847f793aea1b16f60c544f13d"
|
|
28
28
|
}
|