@wix/ditto-codegen-public 1.0.51 → 1.0.52
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.
- package/dist/out.js +141 -58
- package/package.json +2 -2
package/dist/out.js
CHANGED
|
@@ -131085,7 +131085,7 @@ var require_extensionGenerators = __commonJS({
|
|
|
131085
131085
|
const servicePluginType = this.getServicePluginType(extension);
|
|
131086
131086
|
const builderMethod = this.servicePluginBuilderMap[servicePluginType];
|
|
131087
131087
|
const extensionConfig = this.createServicePluginData(name, scaffoldDir, id, servicePluginType);
|
|
131088
|
-
writeExtensionFile({
|
|
131088
|
+
return writeExtensionFile({
|
|
131089
131089
|
outputPath,
|
|
131090
131090
|
name,
|
|
131091
131091
|
builderMethodName: builderMethod,
|
|
@@ -131093,12 +131093,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131093
131093
|
extensionType: extension.type,
|
|
131094
131094
|
scaffoldDir
|
|
131095
131095
|
});
|
|
131096
|
-
break;
|
|
131097
131096
|
}
|
|
131098
131097
|
case types_1.ExtensionType.DASHBOARD_PAGE: {
|
|
131099
131098
|
const name = extension.name || "My Backoffice Page";
|
|
131100
131099
|
const extensionConfig = this.createDashboardPageData(id, name, scaffoldDir);
|
|
131101
|
-
writeExtensionFile({
|
|
131100
|
+
return writeExtensionFile({
|
|
131102
131101
|
outputPath,
|
|
131103
131102
|
name,
|
|
131104
131103
|
builderMethodName: "backofficePage",
|
|
@@ -131106,12 +131105,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131106
131105
|
extensionType: extension.type,
|
|
131107
131106
|
scaffoldDir
|
|
131108
131107
|
});
|
|
131109
|
-
break;
|
|
131110
131108
|
}
|
|
131111
131109
|
case types_1.ExtensionType.SITE_COMPONENT: {
|
|
131112
131110
|
const name = extension.name || "My Site Component";
|
|
131113
131111
|
const extensionConfig = this.createSiteComponentData(name, scaffoldDir, id);
|
|
131114
|
-
writeExtensionFile({
|
|
131112
|
+
return writeExtensionFile({
|
|
131115
131113
|
outputPath,
|
|
131116
131114
|
name,
|
|
131117
131115
|
builderMethodName: "siteComponent",
|
|
@@ -131119,12 +131117,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131119
131117
|
extensionType: extension.type,
|
|
131120
131118
|
scaffoldDir
|
|
131121
131119
|
});
|
|
131122
|
-
break;
|
|
131123
131120
|
}
|
|
131124
131121
|
case types_1.ExtensionType.SITE_WIDGET: {
|
|
131125
131122
|
const name = extension.name || "My Site Widget";
|
|
131126
131123
|
const extensionConfig = this.createCustomElementData(id, name, scaffoldDir);
|
|
131127
|
-
writeExtensionFile({
|
|
131124
|
+
return writeExtensionFile({
|
|
131128
131125
|
outputPath,
|
|
131129
131126
|
name,
|
|
131130
131127
|
builderMethodName: "customElement",
|
|
@@ -131132,7 +131129,6 @@ var require_extensionGenerators = __commonJS({
|
|
|
131132
131129
|
extensionType: extension.type,
|
|
131133
131130
|
scaffoldDir
|
|
131134
131131
|
});
|
|
131135
|
-
break;
|
|
131136
131132
|
}
|
|
131137
131133
|
case types_1.ExtensionType.EMBEDDED_SCRIPT: {
|
|
131138
131134
|
const name = extension.name || "My Embedded Script";
|
|
@@ -131141,7 +131137,7 @@ var require_extensionGenerators = __commonJS({
|
|
|
131141
131137
|
scriptType: EmbeddedScriptAgent_1.EmbeddedScriptType.ESSENTIAL
|
|
131142
131138
|
};
|
|
131143
131139
|
const extensionConfig = this.createEmbeddedScriptData(id, name, scaffoldDir, placement, scriptType);
|
|
131144
|
-
writeExtensionFile({
|
|
131140
|
+
return writeExtensionFile({
|
|
131145
131141
|
outputPath,
|
|
131146
131142
|
name,
|
|
131147
131143
|
builderMethodName: "embeddedScript",
|
|
@@ -131149,12 +131145,11 @@ var require_extensionGenerators = __commonJS({
|
|
|
131149
131145
|
extensionType: extension.type,
|
|
131150
131146
|
scaffoldDir
|
|
131151
131147
|
});
|
|
131152
|
-
break;
|
|
131153
131148
|
}
|
|
131154
131149
|
case types_1.ExtensionType.BACKEND_EVENT: {
|
|
131155
131150
|
const name = extension.name || "My Backend Event";
|
|
131156
131151
|
const extensionConfig = this.createBackendEventData(id, extension.relatedApis || [], scaffoldDir);
|
|
131157
|
-
writeExtensionFile({
|
|
131152
|
+
return writeExtensionFile({
|
|
131158
131153
|
outputPath,
|
|
131159
131154
|
name,
|
|
131160
131155
|
builderMethodName: "webhook",
|
|
@@ -131162,11 +131157,16 @@ var require_extensionGenerators = __commonJS({
|
|
|
131162
131157
|
extensionType: extension.type,
|
|
131163
131158
|
scaffoldDir
|
|
131164
131159
|
});
|
|
131165
|
-
break;
|
|
131166
131160
|
}
|
|
131161
|
+
case types_1.ExtensionType.BACKEND_API:
|
|
131162
|
+
case types_1.ExtensionType.WEBHOOK:
|
|
131163
|
+
case types_1.ExtensionType.WEB_METHODS:
|
|
131164
|
+
case types_1.ExtensionType.DASHBOARD_PLUGIN:
|
|
131165
|
+
case types_1.ExtensionType.DASHBOARD_MODAL:
|
|
131166
|
+
return null;
|
|
131167
131167
|
default:
|
|
131168
131168
|
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;
|
|
131169
|
+
return null;
|
|
131170
131170
|
}
|
|
131171
131171
|
}
|
|
131172
131172
|
static createBackendEventData(id, relatedApis, scaffoldDir) {
|
|
@@ -137921,6 +137921,64 @@ export default appBuilder;
|
|
|
137921
137921
|
}
|
|
137922
137922
|
});
|
|
137923
137923
|
|
|
137924
|
+
// dist/file-collector.js
|
|
137925
|
+
var require_file_collector = __commonJS({
|
|
137926
|
+
"dist/file-collector.js"(exports2) {
|
|
137927
|
+
"use strict";
|
|
137928
|
+
var __importDefault2 = exports2 && exports2.__importDefault || function(mod2) {
|
|
137929
|
+
return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
|
|
137930
|
+
};
|
|
137931
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
137932
|
+
exports2.captureExistingFiles = captureExistingFiles;
|
|
137933
|
+
exports2.determineFileOperation = determineFileOperation;
|
|
137934
|
+
exports2.collectAllCreatedFiles = collectAllCreatedFiles;
|
|
137935
|
+
var fs_1 = __importDefault2(require("fs"));
|
|
137936
|
+
var path_1 = __importDefault2(require("path"));
|
|
137937
|
+
function captureExistingFiles(filePaths, outputPath) {
|
|
137938
|
+
const existingFiles = /* @__PURE__ */ new Set();
|
|
137939
|
+
filePaths.forEach((filePath) => {
|
|
137940
|
+
const fullPath = path_1.default.join(outputPath, filePath);
|
|
137941
|
+
if (fs_1.default.existsSync(fullPath)) {
|
|
137942
|
+
existingFiles.add(fullPath);
|
|
137943
|
+
}
|
|
137944
|
+
});
|
|
137945
|
+
return existingFiles;
|
|
137946
|
+
}
|
|
137947
|
+
function determineFileOperation(filePath, outputPath, existingFiles) {
|
|
137948
|
+
const fullPath = path_1.default.join(outputPath, filePath);
|
|
137949
|
+
return existingFiles.has(fullPath) ? "update" : "insert";
|
|
137950
|
+
}
|
|
137951
|
+
function collectAllCreatedFiles(options) {
|
|
137952
|
+
const { scaffolds = [], agentFiles, extensionFilePath, outputPath, existingFiles } = options;
|
|
137953
|
+
const allCreatedFiles = [];
|
|
137954
|
+
scaffolds.forEach((s) => {
|
|
137955
|
+
allCreatedFiles.push({
|
|
137956
|
+
path: s.path,
|
|
137957
|
+
operation: "insert",
|
|
137958
|
+
// Scaffolds are always new files
|
|
137959
|
+
content: s.content
|
|
137960
|
+
});
|
|
137961
|
+
});
|
|
137962
|
+
agentFiles.forEach((file) => {
|
|
137963
|
+
const hasScaffold = scaffolds.some((s) => s.path === file.path);
|
|
137964
|
+
allCreatedFiles.push({
|
|
137965
|
+
...file,
|
|
137966
|
+
operation: hasScaffold ? "insert" : determineFileOperation(file.path || "", outputPath, existingFiles)
|
|
137967
|
+
});
|
|
137968
|
+
});
|
|
137969
|
+
if (extensionFilePath) {
|
|
137970
|
+
allCreatedFiles.push({
|
|
137971
|
+
path: extensionFilePath,
|
|
137972
|
+
operation: determineFileOperation(extensionFilePath, outputPath, existingFiles),
|
|
137973
|
+
content: fs_1.default.readFileSync(path_1.default.join(outputPath, extensionFilePath), "utf-8")
|
|
137974
|
+
});
|
|
137975
|
+
}
|
|
137976
|
+
const uniqueFiles = Array.from(new Map(allCreatedFiles.map((file) => [file.path, file])).values());
|
|
137977
|
+
return uniqueFiles;
|
|
137978
|
+
}
|
|
137979
|
+
}
|
|
137980
|
+
});
|
|
137981
|
+
|
|
137924
137982
|
// dist/orchestrator.js
|
|
137925
137983
|
var require_orchestrator = __commonJS({
|
|
137926
137984
|
"dist/orchestrator.js"(exports2) {
|
|
@@ -137940,6 +137998,7 @@ var require_orchestrator = __commonJS({
|
|
|
137940
137998
|
var FixerFactory_1 = __importDefault2(require_FixerFactory());
|
|
137941
137999
|
var extensionGenerators_1 = require_extensionGenerators();
|
|
137942
138000
|
var extensionIndexer_1 = require_extensionIndexer();
|
|
138001
|
+
var file_collector_1 = require_file_collector();
|
|
137943
138002
|
var MAX_ERRORS_PER_BATCH = 20;
|
|
137944
138003
|
var DittoOrchestrator = class extends events_1.EventEmitter {
|
|
137945
138004
|
constructor(agentsFactory, apiKey) {
|
|
@@ -137955,6 +138014,41 @@ var require_orchestrator = __commonJS({
|
|
|
137955
138014
|
emitEvent(event, payload) {
|
|
137956
138015
|
return super.emit(event, payload);
|
|
137957
138016
|
}
|
|
138017
|
+
/**
|
|
138018
|
+
* Finalize the code generation for an extension by:
|
|
138019
|
+
* 1. Capturing which files existed before generation
|
|
138020
|
+
* 2. Writing the generated files to disk
|
|
138021
|
+
* 3. Generating the extension registration file
|
|
138022
|
+
* 4. Collecting all created files with correct operation types
|
|
138023
|
+
* 5. Emitting the agent:done event
|
|
138024
|
+
*
|
|
138025
|
+
* This wraps the common pattern used in all process* methods.
|
|
138026
|
+
*/
|
|
138027
|
+
finalizeExtensionGeneration(options) {
|
|
138028
|
+
const { extension, agentName, agentFiles, scaffolds = [], scaffoldPath, outputPath, generatedConfig } = options;
|
|
138029
|
+
const filesToCheck = agentFiles.map((f) => f.path || "");
|
|
138030
|
+
const existingFiles = (0, file_collector_1.captureExistingFiles)(filesToCheck, outputPath);
|
|
138031
|
+
this.writeFile(agentFiles, outputPath);
|
|
138032
|
+
const extensionFilePath = extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138033
|
+
extension,
|
|
138034
|
+
outputPath,
|
|
138035
|
+
scaffoldPath,
|
|
138036
|
+
generatedConfig
|
|
138037
|
+
});
|
|
138038
|
+
const allCreatedFiles = (0, file_collector_1.collectAllCreatedFiles)({
|
|
138039
|
+
scaffolds,
|
|
138040
|
+
agentFiles,
|
|
138041
|
+
extensionFilePath,
|
|
138042
|
+
outputPath,
|
|
138043
|
+
existingFiles
|
|
138044
|
+
});
|
|
138045
|
+
this.emitEvent("agent:done", {
|
|
138046
|
+
extension,
|
|
138047
|
+
name: agentName,
|
|
138048
|
+
files: allCreatedFiles
|
|
138049
|
+
});
|
|
138050
|
+
return extensionFilePath;
|
|
138051
|
+
}
|
|
137958
138052
|
writeFile(files, outputPath) {
|
|
137959
138053
|
if (!files) {
|
|
137960
138054
|
console.warn("\u26A0\uFE0F Skipping file operation: no files provided");
|
|
@@ -138108,22 +138202,19 @@ var require_orchestrator = __commonJS({
|
|
|
138108
138202
|
basePath: outputPath,
|
|
138109
138203
|
planAndResources
|
|
138110
138204
|
});
|
|
138111
|
-
this.
|
|
138112
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138205
|
+
this.finalizeExtensionGeneration({
|
|
138113
138206
|
extension,
|
|
138114
|
-
|
|
138207
|
+
agentName: embeddedScriptAgent.name,
|
|
138208
|
+
agentFiles: files,
|
|
138209
|
+
scaffolds: [scaffold],
|
|
138115
138210
|
scaffoldPath: scaffold.path,
|
|
138211
|
+
outputPath,
|
|
138116
138212
|
generatedConfig: {
|
|
138117
138213
|
type: types_1.ExtensionType.EMBEDDED_SCRIPT,
|
|
138118
138214
|
scriptType,
|
|
138119
138215
|
placement
|
|
138120
138216
|
}
|
|
138121
138217
|
});
|
|
138122
|
-
this.emitEvent("agent:done", {
|
|
138123
|
-
extension,
|
|
138124
|
-
name: embeddedScriptAgent.name,
|
|
138125
|
-
files
|
|
138126
|
-
});
|
|
138127
138218
|
}
|
|
138128
138219
|
async processDashboardPage(opts) {
|
|
138129
138220
|
const { extension, blueprint, outputPath, planAndResources } = opts;
|
|
@@ -138159,17 +138250,13 @@ var require_orchestrator = __commonJS({
|
|
|
138159
138250
|
decision,
|
|
138160
138251
|
extensionName: extension.name || ""
|
|
138161
138252
|
});
|
|
138162
|
-
this.writeFile(files, outputPath);
|
|
138163
138253
|
const pagePath = files[0].path || "";
|
|
138164
|
-
|
|
138165
|
-
extension,
|
|
138166
|
-
outputPath,
|
|
138167
|
-
scaffoldPath: pagePath
|
|
138168
|
-
});
|
|
138169
|
-
this.emitEvent("agent:done", {
|
|
138254
|
+
this.finalizeExtensionGeneration({
|
|
138170
138255
|
extension,
|
|
138171
|
-
|
|
138172
|
-
files
|
|
138256
|
+
agentName: "AutoPatternsGenerator",
|
|
138257
|
+
agentFiles: files,
|
|
138258
|
+
scaffoldPath: pagePath,
|
|
138259
|
+
outputPath
|
|
138173
138260
|
});
|
|
138174
138261
|
}
|
|
138175
138262
|
async processServicePlugin({ extension, blueprint, outputPath, planAndResources }) {
|
|
@@ -138201,13 +138288,14 @@ var require_orchestrator = __commonJS({
|
|
|
138201
138288
|
planAndResources,
|
|
138202
138289
|
basePath: outputPath
|
|
138203
138290
|
});
|
|
138204
|
-
this.
|
|
138205
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138291
|
+
this.finalizeExtensionGeneration({
|
|
138206
138292
|
extension,
|
|
138207
|
-
|
|
138208
|
-
|
|
138293
|
+
agentName: agent.name,
|
|
138294
|
+
agentFiles: files,
|
|
138295
|
+
scaffolds,
|
|
138296
|
+
scaffoldPath: scaffold.path,
|
|
138297
|
+
outputPath
|
|
138209
138298
|
});
|
|
138210
|
-
this.emitEvent("agent:done", { extension, name: agent.name, files });
|
|
138211
138299
|
}
|
|
138212
138300
|
async processStandardExtension({ extension, blueprint, outputPath, planAndResources }) {
|
|
138213
138301
|
this.emitEvent("scaffold:start", { extension });
|
|
@@ -138229,13 +138317,14 @@ var require_orchestrator = __commonJS({
|
|
|
138229
138317
|
planAndResources,
|
|
138230
138318
|
basePath: outputPath
|
|
138231
138319
|
});
|
|
138232
|
-
this.
|
|
138233
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138320
|
+
this.finalizeExtensionGeneration({
|
|
138234
138321
|
extension,
|
|
138235
|
-
|
|
138236
|
-
|
|
138322
|
+
agentName: agent.name,
|
|
138323
|
+
agentFiles: files,
|
|
138324
|
+
scaffolds,
|
|
138325
|
+
scaffoldPath: scaffold.path,
|
|
138326
|
+
outputPath
|
|
138237
138327
|
});
|
|
138238
|
-
this.emitEvent("agent:done", { extension, name: agent.name, files });
|
|
138239
138328
|
}
|
|
138240
138329
|
async processMultipleServicePluginScaffolds({ extension, blueprint, outputPath, planAndResources, scaffolds }) {
|
|
138241
138330
|
if (!extension.relatedSpis || extension.relatedSpis.length === 0) {
|
|
@@ -138262,16 +138351,13 @@ var require_orchestrator = __commonJS({
|
|
|
138262
138351
|
planAndResources,
|
|
138263
138352
|
basePath: outputPath
|
|
138264
138353
|
});
|
|
138265
|
-
this.
|
|
138266
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138267
|
-
extension: spiExtension,
|
|
138268
|
-
outputPath,
|
|
138269
|
-
scaffoldPath: scaffold.path
|
|
138270
|
-
});
|
|
138271
|
-
this.emitEvent("agent:done", {
|
|
138354
|
+
this.finalizeExtensionGeneration({
|
|
138272
138355
|
extension: spiExtension,
|
|
138273
|
-
|
|
138274
|
-
files
|
|
138356
|
+
agentName: agent.name,
|
|
138357
|
+
agentFiles: files,
|
|
138358
|
+
scaffolds: [scaffold],
|
|
138359
|
+
scaffoldPath: scaffold.path,
|
|
138360
|
+
outputPath
|
|
138275
138361
|
});
|
|
138276
138362
|
});
|
|
138277
138363
|
await Promise.all(parallelTasks);
|
|
@@ -138308,16 +138394,13 @@ var require_orchestrator = __commonJS({
|
|
|
138308
138394
|
relevantFilePaths: paths,
|
|
138309
138395
|
basePath: outputPath
|
|
138310
138396
|
});
|
|
138311
|
-
this.
|
|
138312
|
-
extensionGenerators_1.ExtensionFactory.generateExtension({
|
|
138313
|
-
extension,
|
|
138314
|
-
outputPath,
|
|
138315
|
-
scaffoldPath: scaffold.path
|
|
138316
|
-
});
|
|
138317
|
-
this.emitEvent("agent:done", {
|
|
138397
|
+
this.finalizeExtensionGeneration({
|
|
138318
138398
|
extension,
|
|
138319
|
-
|
|
138320
|
-
files
|
|
138399
|
+
agentName: agent.name,
|
|
138400
|
+
agentFiles: files,
|
|
138401
|
+
scaffolds,
|
|
138402
|
+
scaffoldPath: scaffold.path,
|
|
138403
|
+
outputPath
|
|
138321
138404
|
});
|
|
138322
138405
|
} else {
|
|
138323
138406
|
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.52",
|
|
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": "bf6de5e13a14f7029750e395ec346c195270563482615efe9243447e"
|
|
28
28
|
}
|