@statezero/core 0.2.16 → 0.2.18

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 (136) hide show
  1. package/LICENSE +116 -116
  2. package/dist/adaptors/vue/composables.js +4 -4
  3. package/dist/cli/commands/syncActions.js +189 -189
  4. package/dist/cli/commands/syncModels.js +391 -391
  5. package/dist/core/eventReceivers.d.ts +1 -2
  6. package/dist/core/eventReceivers.js +16 -16
  7. package/dist/filtering/localFiltering.js +2 -1
  8. package/dist/flavours/django/f.js +1 -1
  9. package/dist/flavours/django/model.js +1 -1
  10. package/dist/flavours/django/operationFactory.d.ts +1 -1
  11. package/dist/flavours/django/operationFactory.js +1 -1
  12. package/dist/syncEngine/metrics/metricOptCalcs.js +1 -1
  13. package/dist/syncEngine/registries/metricRegistry.d.ts +1 -1
  14. package/dist/syncEngine/registries/metricRegistry.js +3 -3
  15. package/dist/syncEngine/stores/metricStore.d.ts +1 -1
  16. package/dist/syncEngine/stores/metricStore.js +1 -1
  17. package/dist/syncEngine/stores/operation.d.ts +1 -1
  18. package/dist/syncEngine/stores/operation.js +1 -1
  19. package/dist/syncEngine/stores/reactivity.d.ts +3 -3
  20. package/dist/syncEngine/stores/utils.js +1 -1
  21. package/dist/syncEngine/sync.d.ts +2 -1
  22. package/dist/syncEngine/sync.js +10 -9
  23. package/package.json +128 -126
  24. package/readme.md +210 -210
  25. package/dist/actions/backend1/django_app/calculate-hash.d.ts +0 -57
  26. package/dist/actions/backend1/django_app/calculate-hash.js +0 -80
  27. package/dist/actions/backend1/django_app/get-current-username.d.ts +0 -29
  28. package/dist/actions/backend1/django_app/get-current-username.js +0 -65
  29. package/dist/actions/backend1/django_app/get-server-status.d.ts +0 -38
  30. package/dist/actions/backend1/django_app/get-server-status.js +0 -68
  31. package/dist/actions/backend1/django_app/get-user-info.d.ts +0 -44
  32. package/dist/actions/backend1/django_app/get-user-info.js +0 -70
  33. package/dist/actions/backend1/django_app/index.d.ts +0 -6
  34. package/dist/actions/backend1/django_app/index.js +0 -6
  35. package/dist/actions/backend1/django_app/process-data.d.ts +0 -51
  36. package/dist/actions/backend1/django_app/process-data.js +0 -78
  37. package/dist/actions/backend1/django_app/send-notification.d.ts +0 -55
  38. package/dist/actions/backend1/django_app/send-notification.js +0 -81
  39. package/dist/actions/backend1/index.d.ts +0 -1
  40. package/dist/actions/backend1/index.js +0 -1
  41. package/dist/actions/default/django_app/calculate-hash.d.ts +0 -57
  42. package/dist/actions/default/django_app/calculate-hash.js +0 -80
  43. package/dist/actions/default/django_app/get-current-username.d.ts +0 -29
  44. package/dist/actions/default/django_app/get-current-username.js +0 -65
  45. package/dist/actions/default/django_app/get-server-status.d.ts +0 -38
  46. package/dist/actions/default/django_app/get-server-status.js +0 -68
  47. package/dist/actions/default/django_app/get-user-info.d.ts +0 -44
  48. package/dist/actions/default/django_app/get-user-info.js +0 -70
  49. package/dist/actions/default/django_app/index.d.ts +0 -6
  50. package/dist/actions/default/django_app/index.js +0 -6
  51. package/dist/actions/default/django_app/process-data.d.ts +0 -51
  52. package/dist/actions/default/django_app/process-data.js +0 -78
  53. package/dist/actions/default/django_app/send-notification.d.ts +0 -55
  54. package/dist/actions/default/django_app/send-notification.js +0 -81
  55. package/dist/actions/default/index.d.ts +0 -1
  56. package/dist/actions/default/index.js +0 -1
  57. package/dist/actions/index.d.ts +0 -1
  58. package/dist/actions/index.js +0 -5
  59. package/dist/models/backend1/django_app/comprehensivemodel.d.ts +0 -47
  60. package/dist/models/backend1/django_app/comprehensivemodel.js +0 -71
  61. package/dist/models/backend1/django_app/custompkmodel.d.ts +0 -44
  62. package/dist/models/backend1/django_app/custompkmodel.js +0 -69
  63. package/dist/models/backend1/django_app/dailyrate.d.ts +0 -47
  64. package/dist/models/backend1/django_app/dailyrate.js +0 -71
  65. package/dist/models/backend1/django_app/deepmodellevel1.d.ts +0 -47
  66. package/dist/models/backend1/django_app/deepmodellevel1.js +0 -72
  67. package/dist/models/backend1/django_app/deepmodellevel2.d.ts +0 -47
  68. package/dist/models/backend1/django_app/deepmodellevel2.js +0 -71
  69. package/dist/models/backend1/django_app/deepmodellevel3.d.ts +0 -44
  70. package/dist/models/backend1/django_app/deepmodellevel3.js +0 -69
  71. package/dist/models/backend1/django_app/dummymodel.d.ts +0 -47
  72. package/dist/models/backend1/django_app/dummymodel.js +0 -71
  73. package/dist/models/backend1/django_app/dummyrelatedmodel.d.ts +0 -44
  74. package/dist/models/backend1/django_app/dummyrelatedmodel.js +0 -69
  75. package/dist/models/backend1/django_app/filetest.d.ts +0 -44
  76. package/dist/models/backend1/django_app/filetest.js +0 -69
  77. package/dist/models/backend1/django_app/index.d.ts +0 -16
  78. package/dist/models/backend1/django_app/index.js +0 -16
  79. package/dist/models/backend1/django_app/modelwithcustompkrelation.d.ts +0 -47
  80. package/dist/models/backend1/django_app/modelwithcustompkrelation.js +0 -71
  81. package/dist/models/backend1/django_app/namefiltercustompkmodel.d.ts +0 -44
  82. package/dist/models/backend1/django_app/namefiltercustompkmodel.js +0 -69
  83. package/dist/models/backend1/django_app/order.d.ts +0 -47
  84. package/dist/models/backend1/django_app/order.js +0 -71
  85. package/dist/models/backend1/django_app/orderitem.d.ts +0 -47
  86. package/dist/models/backend1/django_app/orderitem.js +0 -72
  87. package/dist/models/backend1/django_app/product.d.ts +0 -47
  88. package/dist/models/backend1/django_app/product.js +0 -71
  89. package/dist/models/backend1/django_app/productcategory.d.ts +0 -44
  90. package/dist/models/backend1/django_app/productcategory.js +0 -69
  91. package/dist/models/backend1/django_app/rateplan.d.ts +0 -44
  92. package/dist/models/backend1/django_app/rateplan.js +0 -69
  93. package/dist/models/backend1/fileobject.d.ts +0 -4
  94. package/dist/models/backend1/fileobject.js +0 -9
  95. package/dist/models/backend1/index.d.ts +0 -2
  96. package/dist/models/backend1/index.js +0 -2
  97. package/dist/models/default/django_app/comprehensivemodel.d.ts +0 -47
  98. package/dist/models/default/django_app/comprehensivemodel.js +0 -71
  99. package/dist/models/default/django_app/custompkmodel.d.ts +0 -44
  100. package/dist/models/default/django_app/custompkmodel.js +0 -69
  101. package/dist/models/default/django_app/dailyrate.d.ts +0 -47
  102. package/dist/models/default/django_app/dailyrate.js +0 -71
  103. package/dist/models/default/django_app/deepmodellevel1.d.ts +0 -47
  104. package/dist/models/default/django_app/deepmodellevel1.js +0 -72
  105. package/dist/models/default/django_app/deepmodellevel2.d.ts +0 -47
  106. package/dist/models/default/django_app/deepmodellevel2.js +0 -71
  107. package/dist/models/default/django_app/deepmodellevel3.d.ts +0 -44
  108. package/dist/models/default/django_app/deepmodellevel3.js +0 -69
  109. package/dist/models/default/django_app/dummymodel.d.ts +0 -47
  110. package/dist/models/default/django_app/dummymodel.js +0 -71
  111. package/dist/models/default/django_app/dummyrelatedmodel.d.ts +0 -44
  112. package/dist/models/default/django_app/dummyrelatedmodel.js +0 -69
  113. package/dist/models/default/django_app/filetest.d.ts +0 -44
  114. package/dist/models/default/django_app/filetest.js +0 -69
  115. package/dist/models/default/django_app/index.d.ts +0 -16
  116. package/dist/models/default/django_app/index.js +0 -16
  117. package/dist/models/default/django_app/modelwithcustompkrelation.d.ts +0 -47
  118. package/dist/models/default/django_app/modelwithcustompkrelation.js +0 -71
  119. package/dist/models/default/django_app/namefiltercustompkmodel.d.ts +0 -44
  120. package/dist/models/default/django_app/namefiltercustompkmodel.js +0 -69
  121. package/dist/models/default/django_app/order.d.ts +0 -47
  122. package/dist/models/default/django_app/order.js +0 -71
  123. package/dist/models/default/django_app/orderitem.d.ts +0 -47
  124. package/dist/models/default/django_app/orderitem.js +0 -72
  125. package/dist/models/default/django_app/product.d.ts +0 -47
  126. package/dist/models/default/django_app/product.js +0 -71
  127. package/dist/models/default/django_app/productcategory.d.ts +0 -44
  128. package/dist/models/default/django_app/productcategory.js +0 -69
  129. package/dist/models/default/django_app/rateplan.d.ts +0 -44
  130. package/dist/models/default/django_app/rateplan.js +0 -69
  131. package/dist/models/default/fileobject.d.ts +0 -4
  132. package/dist/models/default/fileobject.js +0 -9
  133. package/dist/models/default/index.d.ts +0 -2
  134. package/dist/models/default/index.js +0 -2
  135. package/dist/models/index.d.ts +0 -1
  136. package/dist/models/index.js +0 -5
@@ -92,153 +92,153 @@ Handlebars.registerHelper("formatJsDoc", function (text) {
92
92
  .map((line) => ` * ${line}`)
93
93
  .join("\n");
94
94
  });
95
- const JS_ACTION_TEMPLATE = `/**
96
- * This file was auto-generated. Do not make direct changes to the file.
97
- * Action: {{title}}
98
- * App: {{app}}
99
- */
100
-
101
- import axios from 'axios';
102
- import { z } from 'zod';
103
- import { configInstance, parseStateZeroError, serializeActionPayload } from '{{modulePath}}';
104
- import actionSchema from './{{schemaFileName}}' assert { type: 'json' };
105
-
106
- {{#if inputSchemaString}}
107
- /**
108
- * Zod schema for the input of {{functionName}}.
109
- * NOTE: This is an object schema for validating the data payload.
110
- */
111
- export const {{functionName}}InputSchema = z.object({ {{{inputSchemaString}}} });
112
- {{/if}}
113
-
114
- {{#if responseSchemaString}}
115
- /**
116
- * Zod schema for the response of {{functionName}}.
117
- */
118
- export const {{functionName}}ResponseSchema = z.object({ {{{responseSchemaString}}} });
119
- {{/if}}
120
-
121
- /**
122
- {{#if docstring}}
123
- {{{formatJsDoc docstring}}}
124
- *
125
- {{else}}
126
- * {{title}}
127
- {{/if}}
128
- {{#each tsDocParams}}
129
- * @param {{{this.type}}} {{this.name}} - {{this.description}}
130
- {{/each}}
131
- * @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
132
- * @returns {Promise<Object>} A promise that resolves with the action's result.
133
- */
134
- export async function {{functionName}}({{{jsFunctionParams}}}) {
135
- // Construct the data payload from the function arguments
136
- {{#if payloadProperties}}
137
- const rawPayload = {
138
- {{{payloadProperties}}}
139
- };
140
- {{else}}
141
- const rawPayload = {};
142
- {{/if}}
143
-
144
- // Serialize payload - handles model instances (extracts PK), files, dates, etc.
145
- const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
146
-
147
- const config = configInstance.getConfig();
148
- const backend = config.backendConfigs['{{configKey}}'];
149
-
150
- if (!backend) {
151
- throw new Error(\`No backend configuration found for key: {{configKey}}\`);
152
- }
153
-
154
- const baseUrl = backend.API_URL.replace(/\\/+$/, '');
155
- const actionUrl = \`\${baseUrl}/actions/{{actionName}}/\`;
156
- const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
157
-
158
- try {
159
- const response = await axios.post(actionUrl, payload, {
160
- headers: { 'Content-Type': 'application/json', ...headers },
161
- ...axiosOverrides,
162
- });
163
-
164
- {{#if responseSchemaString}}
165
- return {{functionName}}ResponseSchema.parse(response.data);
166
- {{else}}
167
- return response.data;
168
- {{/if}}
169
- } catch (error) {
170
- if (error instanceof z.ZodError) {
171
- throw new Error(\`{{title}} failed: Invalid response from server. Details: \${error.message}\`);
172
- }
173
-
174
- if (error.response && error.response.data) {
175
- const parsedError = parseStateZeroError(error.response.data);
176
-
177
- if (Error.captureStackTrace) {
178
- Error.captureStackTrace(parsedError, {{functionName}});
179
- }
180
-
181
- throw parsedError;
182
- } else if (error.request) {
183
- throw new Error(\`{{title}} failed: No response received from server.\`);
184
- } else {
185
- throw new Error(\`{{title}} failed: \${error.message}\`);
186
- }
187
- }
188
- }
189
-
190
- export default {{functionName}};
191
-
192
- {{functionName}}.actionName = '{{actionName}}';
193
- {{functionName}}.title = '{{title}}';
194
- {{functionName}}.app = {{#if app}}'{{app}}'{{else}}null{{/if}};
195
- {{functionName}}.permissions = [{{#each permissions}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];
196
- {{functionName}}.configKey = '{{configKey}}';
95
+ const JS_ACTION_TEMPLATE = `/**
96
+ * This file was auto-generated. Do not make direct changes to the file.
97
+ * Action: {{title}}
98
+ * App: {{app}}
99
+ */
100
+
101
+ import axios from 'axios';
102
+ import { z } from 'zod';
103
+ import { configInstance, parseStateZeroError, serializeActionPayload } from '{{modulePath}}';
104
+ import actionSchema from './{{schemaFileName}}' assert { type: 'json' };
105
+
106
+ {{#if inputSchemaString}}
107
+ /**
108
+ * Zod schema for the input of {{functionName}}.
109
+ * NOTE: This is an object schema for validating the data payload.
110
+ */
111
+ export const {{functionName}}InputSchema = z.object({ {{{inputSchemaString}}} });
112
+ {{/if}}
113
+
114
+ {{#if responseSchemaString}}
115
+ /**
116
+ * Zod schema for the response of {{functionName}}.
117
+ */
118
+ export const {{functionName}}ResponseSchema = z.object({ {{{responseSchemaString}}} });
119
+ {{/if}}
120
+
121
+ /**
122
+ {{#if docstring}}
123
+ {{{formatJsDoc docstring}}}
124
+ *
125
+ {{else}}
126
+ * {{title}}
127
+ {{/if}}
128
+ {{#each tsDocParams}}
129
+ * @param {{{this.type}}} {{this.name}} - {{this.description}}
130
+ {{/each}}
131
+ * @param {Object} [axiosOverrides] - Allows overriding Axios request parameters.
132
+ * @returns {Promise<Object>} A promise that resolves with the action's result.
133
+ */
134
+ export async function {{functionName}}({{{jsFunctionParams}}}) {
135
+ // Construct the data payload from the function arguments
136
+ {{#if payloadProperties}}
137
+ const rawPayload = {
138
+ {{{payloadProperties}}}
139
+ };
140
+ {{else}}
141
+ const rawPayload = {};
142
+ {{/if}}
143
+
144
+ // Serialize payload - handles model instances (extracts PK), files, dates, etc.
145
+ const payload = serializeActionPayload(rawPayload, actionSchema.input_properties);
146
+
147
+ const config = configInstance.getConfig();
148
+ const backend = config.backendConfigs['{{configKey}}'];
149
+
150
+ if (!backend) {
151
+ throw new Error(\`No backend configuration found for key: {{configKey}}\`);
152
+ }
153
+
154
+ const baseUrl = backend.API_URL.replace(/\\/+$/, '');
155
+ const actionUrl = \`\${baseUrl}/actions/{{actionName}}/\`;
156
+ const headers = backend.getAuthHeaders ? backend.getAuthHeaders() : {};
157
+
158
+ try {
159
+ const response = await axios.post(actionUrl, payload, {
160
+ headers: { 'Content-Type': 'application/json', ...headers },
161
+ ...axiosOverrides,
162
+ });
163
+
164
+ {{#if responseSchemaString}}
165
+ return {{functionName}}ResponseSchema.parse(response.data);
166
+ {{else}}
167
+ return response.data;
168
+ {{/if}}
169
+ } catch (error) {
170
+ if (error instanceof z.ZodError) {
171
+ throw new Error(\`{{title}} failed: Invalid response from server. Details: \${error.message}\`);
172
+ }
173
+
174
+ if (error.response && error.response.data) {
175
+ const parsedError = parseStateZeroError(error.response.data);
176
+
177
+ if (Error.captureStackTrace) {
178
+ Error.captureStackTrace(parsedError, {{functionName}});
179
+ }
180
+
181
+ throw parsedError;
182
+ } else if (error.request) {
183
+ throw new Error(\`{{title}} failed: No response received from server.\`);
184
+ } else {
185
+ throw new Error(\`{{title}} failed: \${error.message}\`);
186
+ }
187
+ }
188
+ }
189
+
190
+ export default {{functionName}};
191
+
192
+ {{functionName}}.actionName = '{{actionName}}';
193
+ {{functionName}}.title = '{{title}}';
194
+ {{functionName}}.app = {{#if app}}'{{app}}'{{else}}null{{/if}};
195
+ {{functionName}}.permissions = [{{#each permissions}}'{{this}}'{{#unless @last}}, {{/unless}}{{/each}}];
196
+ {{functionName}}.configKey = '{{configKey}}';
197
197
  `;
198
- const TS_ACTION_DECLARATION_TEMPLATE = `/**
199
- * This file was auto-generated. Do not make direct changes to the file.
200
- * Action: {{title}}
201
- * App: {{app}}
202
- */
203
- import { z } from 'zod';
204
- import { AxiosRequestConfig } from 'axios';
205
-
206
- {{#if inputTsSchemaString}}
207
- export type {{functionName}}Input = { {{{inputTsSchemaString}}} };
208
- {{/if}}
209
-
210
- {{#if responseTsSchemaString}}
211
- export type {{functionName}}Response = { {{{responseTsSchemaString}}} };
212
- {{else}}
213
- export type {{functionName}}Response = any;
214
- {{/if}}
215
-
216
- /**
217
- {{#if docstring}}
218
- {{{formatJsDoc docstring}}}
219
- *
220
- {{else}}
221
- * {{title}}
222
- {{/if}}
223
- {{#each tsDocParams}}
224
- * @param {{{this.type}}} {{this.name}} - {{this.description}}
225
- {{/each}}
226
- * @param {AxiosRequestConfig} [axiosOverrides] - Allows overriding Axios request parameters.
227
- * @returns {Promise<{{functionName}}Response>} A promise that resolves with the action's result.
228
- */
229
- export declare function {{functionName}}(
230
- {{{tsFunctionParams}}}
231
- ): Promise<{{functionName}}Response>;
232
-
233
- export default {{functionName}};
234
-
235
- export declare namespace {{functionName}} {
236
- export const actionName: string;
237
- export const title: string;
238
- export const app: string | null;
239
- export const permissions: string[];
240
- export const configKey: string;
241
- }
198
+ const TS_ACTION_DECLARATION_TEMPLATE = `/**
199
+ * This file was auto-generated. Do not make direct changes to the file.
200
+ * Action: {{title}}
201
+ * App: {{app}}
202
+ */
203
+ import { z } from 'zod';
204
+ import { AxiosRequestConfig } from 'axios';
205
+
206
+ {{#if inputTsSchemaString}}
207
+ export type {{functionName}}Input = { {{{inputTsSchemaString}}} };
208
+ {{/if}}
209
+
210
+ {{#if responseTsSchemaString}}
211
+ export type {{functionName}}Response = { {{{responseTsSchemaString}}} };
212
+ {{else}}
213
+ export type {{functionName}}Response = any;
214
+ {{/if}}
215
+
216
+ /**
217
+ {{#if docstring}}
218
+ {{{formatJsDoc docstring}}}
219
+ *
220
+ {{else}}
221
+ * {{title}}
222
+ {{/if}}
223
+ {{#each tsDocParams}}
224
+ * @param {{{this.type}}} {{this.name}} - {{this.description}}
225
+ {{/each}}
226
+ * @param {AxiosRequestConfig} [axiosOverrides] - Allows overriding Axios request parameters.
227
+ * @returns {Promise<{{functionName}}Response>} A promise that resolves with the action's result.
228
+ */
229
+ export declare function {{functionName}}(
230
+ {{{tsFunctionParams}}}
231
+ ): Promise<{{functionName}}Response>;
232
+
233
+ export default {{functionName}};
234
+
235
+ export declare namespace {{functionName}} {
236
+ export const actionName: string;
237
+ export const title: string;
238
+ export const app: string | null;
239
+ export const permissions: string[];
240
+ export const configKey: string;
241
+ }
242
242
  `;
243
243
  const jsActionTemplate = Handlebars.compile(JS_ACTION_TEMPLATE);
244
244
  const dtsActionTemplate = Handlebars.compile(TS_ACTION_DECLARATION_TEMPLATE);
@@ -501,11 +501,11 @@ async function generateActionRegistry(generatedFiles, backendConfigs) {
501
501
  allSchemaImports.add(schemaImportStatement);
502
502
  schemasByBackend[backendKey][file.action] = schemaImportName;
503
503
  }
504
- let registryContent = `/**
505
- * This file was auto-generated. Do not make direct changes to the file.
506
- * It provides a registry of all generated actions.
507
- */
508
-
504
+ let registryContent = `/**
505
+ * This file was auto-generated. Do not make direct changes to the file.
506
+ * It provides a registry of all generated actions.
507
+ */
508
+
509
509
  `;
510
510
  // Add action imports
511
511
  registryContent += Array.from(allImports).sort().join("\n") + "\n\n";
@@ -533,35 +533,35 @@ async function generateActionRegistry(generatedFiles, backendConfigs) {
533
533
  registryContent += ` }${index < arr.length - 1 ? "," : ""}\n`;
534
534
  });
535
535
  registryContent += `};\n\n`;
536
- registryContent += `/**
537
- * Get an action function by name and config key
538
- * @param {string} actionName - The name of the action
539
- * @param {string} configKey - The backend config key
540
- * @returns {Function|null} The action function or null if not found
541
- */
542
- export function getAction(actionName, configKey) {
543
- const action = ACTION_REGISTRY[configKey]?.[actionName];
544
- if (!action) {
545
- console.warn(\`Action '\${actionName}' not found for config key '\${configKey}'.\`);
546
- return null;
547
- }
548
- return action;
549
- }
550
-
551
- /**
552
- * Get the full schema for an action
553
- * @param {string} actionName - The name of the action
554
- * @param {string} configKey - The backend config key
555
- * @returns {Object|null} The action schema or null if not found
556
- */
557
- export function getSchema(actionName, configKey) {
558
- const schema = SCHEMA_REGISTRY[configKey]?.[actionName];
559
- if (!schema) {
560
- console.warn(\`Schema for action '\${actionName}' not found for config key '\${configKey}'.\`);
561
- return null;
562
- }
563
- return schema;
564
- }
536
+ registryContent += `/**
537
+ * Get an action function by name and config key
538
+ * @param {string} actionName - The name of the action
539
+ * @param {string} configKey - The backend config key
540
+ * @returns {Function|null} The action function or null if not found
541
+ */
542
+ export function getAction(actionName, configKey) {
543
+ const action = ACTION_REGISTRY[configKey]?.[actionName];
544
+ if (!action) {
545
+ console.warn(\`Action '\${actionName}' not found for config key '\${configKey}'.\`);
546
+ return null;
547
+ }
548
+ return action;
549
+ }
550
+
551
+ /**
552
+ * Get the full schema for an action
553
+ * @param {string} actionName - The name of the action
554
+ * @param {string} configKey - The backend config key
555
+ * @returns {Object|null} The action schema or null if not found
556
+ */
557
+ export function getSchema(actionName, configKey) {
558
+ const schema = SCHEMA_REGISTRY[configKey]?.[actionName];
559
+ if (!schema) {
560
+ console.warn(\`Schema for action '\${actionName}' not found for config key '\${configKey}'.\`);
561
+ return null;
562
+ }
563
+ return schema;
564
+ }
565
565
  `;
566
566
  const registryFilePath = path.join(process.cwd(), "action-registry.js");
567
567
  await fs.writeFile(registryFilePath, registryContent);
@@ -569,8 +569,8 @@ export function getSchema(actionName, configKey) {
569
569
  }
570
570
  async function generateAppLevelIndexFiles(generatedFiles, backendConfigs) {
571
571
  const filesByBackend = _.groupBy(generatedFiles, "backend");
572
- const indexTemplate = Handlebars.compile(`{{#each files}}
573
- export * from '{{this.relativePath}}';
572
+ const indexTemplate = Handlebars.compile(`{{#each files}}
573
+ export * from '{{this.relativePath}}';
574
574
  {{/each}}`);
575
575
  for (const backendName in filesByBackend) {
576
576
  const backendFiles = filesByBackend[backendName];
@@ -589,7 +589,7 @@ export * from '{{this.relativePath}}';
589
589
  const indexContent = indexTemplate({ files: appIndexExports }).trim();
590
590
  await fs.writeFile(path.join(appDir, "index.js"), indexContent);
591
591
  await fs.writeFile(path.join(appDir, "index.d.ts"), indexContent);
592
- rootExports.push(`export * from './${appName}';`);
592
+ rootExports.push(`export * from './${appName}/index.js';`);
593
593
  }
594
594
  const rootIndexContent = rootExports.sort().join("\n");
595
595
  // Include backend key in the path for root index files
@@ -612,12 +612,12 @@ async function generateDefaultBackendIndex(backendConfigs) {
612
612
  const defaultBackend = backendConfigs['default'];
613
613
  const actionsDir = defaultBackend.GENERATED_ACTIONS_DIR;
614
614
  // Create top-level index files that re-export from default
615
- const indexContent = `/**
616
- * This file was auto-generated. Do not make direct changes to the file.
617
- * Re-exports from the 'default' backend for backwards compatibility.
618
- */
619
-
620
- export * from './default/index';
615
+ const indexContent = `/**
616
+ * This file was auto-generated. Do not make direct changes to the file.
617
+ * Re-exports from the 'default' backend for backwards compatibility.
618
+ */
619
+
620
+ export * from './default/index.js';
621
621
  `;
622
622
  const jsIndexPath = path.join(actionsDir, 'index.js');
623
623
  const dtsIndexPath = path.join(actionsDir, 'index.d.ts');