@wavemaker-ai/react-codegen 1.0.0-rc.647684 → 12.0.0-rc.335
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/command.js +52 -7
- package/command.js.map +1 -1
- package/dist/transpiler/index.d.mts +42 -1
- package/dist/transpiler/index.mjs +682 -90
- package/dist/transpiler/index.mjs.map +1 -1
- package/dist/transpiler/wm-styles.css +10 -20
- package/index.js +7 -0
- package/index.js.map +1 -1
- package/package-lock.json +102 -102
- package/package.json +1 -1
- package/src/app.generator.js +223 -35
- package/src/app.generator.js.map +1 -1
- package/src/handlebar-helpers.js +32 -0
- package/src/handlebar-helpers.js.map +1 -1
- package/src/increment-builder.js +32 -2
- package/src/increment-builder.js.map +1 -1
- package/src/profiles/profile.js +2 -0
- package/src/profiles/profile.js.map +1 -1
- package/src/profiles/web-preview.profile.js +4 -0
- package/src/profiles/web-preview.profile.js.map +1 -1
- package/src/services/designtime-collector.js +235 -0
- package/src/services/designtime-collector.js.map +1 -0
- package/src/services/doc-normalizer.js +185 -0
- package/src/services/doc-normalizer.js.map +1 -0
- package/src/services/method-emitter.js +367 -0
- package/src/services/method-emitter.js.map +1 -0
- package/src/services/model-emitter.js +281 -0
- package/src/services/model-emitter.js.map +1 -0
- package/src/services/schema-to-ts.js +50 -0
- package/src/services/schema-to-ts.js.map +1 -0
- package/src/services/service.generator.js +223 -0
- package/src/services/service.generator.js.map +1 -0
- package/src/transpile/bind.ex.transformer.js +4 -1
- package/src/transpile/bind.ex.transformer.js.map +1 -1
- package/src/transpile/components/container/accordion.transformer.js +4 -4
- package/src/transpile/components/container/accordion.transformer.js.map +1 -1
- package/src/transpile/components/container/tabs.transformer.js +4 -2
- package/src/transpile/components/container/tabs.transformer.js.map +1 -1
- package/src/transpile/components/data/list/list-transformer.js +7 -2
- package/src/transpile/components/data/list/list-transformer.js.map +1 -1
- package/src/transpile/components/data/table/table.transformer.js +14 -20
- package/src/transpile/components/data/table/table.transformer.js.map +1 -1
- package/src/transpile/components/data/table/utils.js +90 -0
- package/src/transpile/components/data/table/utils.js.map +1 -1
- package/src/transpile/components/dialogs/dialog-actions.transformer.js +4 -6
- package/src/transpile/components/dialogs/dialog-actions.transformer.js.map +1 -1
- package/src/transpile/components/dialogs/dialog.transformer.js +14 -3
- package/src/transpile/components/dialogs/dialog.transformer.js.map +1 -1
- package/src/transpile/components/layout/layout-region-factory.js +8 -2
- package/src/transpile/components/layout/layout-region-factory.js.map +1 -1
- package/src/transpile/components/nav/nav.transformer.js +3 -5
- package/src/transpile/components/nav/nav.transformer.js.map +1 -1
- package/src/transpile/components/utils.js +11 -5
- package/src/transpile/components/utils.js.map +1 -1
- package/src/transpile/transpile.js +62 -21
- package/src/transpile/transpile.js.map +1 -1
- package/src/transpile/variables-template-source.js +2 -2
- package/src/transpile/variables-template-source.js.map +1 -1
- package/src/utils.browser.js +51 -6
- package/src/utils.browser.js.map +1 -1
- package/src/variables/variable.transformer.js +623 -12
- package/src/variables/variable.transformer.js.map +1 -1
- package/templates/project/app/client.layout.tsx +7 -7
- package/templates/project/app/components.css +10 -0
- package/templates/project/app/widgetInlineStylesOverride.css +0 -20
- package/templates/project/package.json +6 -5
- package/templates/project/services/base.service.ts +361 -0
- package/templates/service/service-class.hbs +19 -0
- package/templates/variables.template +67 -1
|
@@ -15,6 +15,23 @@ import {
|
|
|
15
15
|
{{#each imports}}
|
|
16
16
|
{{{this}}};
|
|
17
17
|
{{/each}}
|
|
18
|
+
{{#each context}}
|
|
19
|
+
{{#each this}}
|
|
20
|
+
{{#ifEqualsAny classname (array 'ServiceVariable' 'LiveVariable') this}}
|
|
21
|
+
{{#if hasInvokeHttp}}
|
|
22
|
+
{{#onlyUniqueEntries this}}
|
|
23
|
+
import { {{#if serviceExportName}}{{serviceExportName}} as {{/if}}{{serviceInstanceName}} } from '@/services/{{#if serviceImportPath}}{{serviceImportPath}}{{else}}{{#if ../../isPrefabApp}}prefabs/{{../../prefabName}}/{{/if}}{{#if service}}{{service}}/{{/if}}{{serviceFileClass}}{{/if}}';
|
|
24
|
+
{{/onlyUniqueEntries}}
|
|
25
|
+
{{/if}}
|
|
26
|
+
{{/ifEqualsAny}}
|
|
27
|
+
{{#each crudTargets}}
|
|
28
|
+
{{#onlyUniqueEntries this}}
|
|
29
|
+
import { {{serviceExportName}} as {{serviceInstanceName}} } from '@/services/{{importPath}}';
|
|
30
|
+
{{/onlyUniqueEntries}}
|
|
31
|
+
{{/each}}
|
|
32
|
+
{{/each}}
|
|
33
|
+
{{/each}}
|
|
34
|
+
|
|
18
35
|
|
|
19
36
|
export default ({{scope}}:any) => {
|
|
20
37
|
return {
|
|
@@ -243,10 +260,59 @@ export default ({{scope}}:any) => {
|
|
|
243
260
|
_id: '{{_id}}',
|
|
244
261
|
{{/if}}
|
|
245
262
|
{{#ifNotEmpty filterExpressions this}}
|
|
246
|
-
filterExpressions: {{{stringify filterExpressions}}}
|
|
263
|
+
filterExpressions: {{{stringify filterExpressions}}},
|
|
247
264
|
{{/ifNotEmpty}}
|
|
248
265
|
{{/ifEquals}}
|
|
249
266
|
|
|
267
|
+
{{#if crudTargets}}
|
|
268
|
+
invokeHttp: async (...args: any) => {
|
|
269
|
+
// The runtime passes the CRUD operation this call is for as the 3rd argument
|
|
270
|
+
// (see useHttp's send()); a CrudVariable names a GROUP, not one operation.
|
|
271
|
+
const [requestParams, params, invokedOperation] = args;
|
|
272
|
+
const operation = invokedOperation ?? '{{operationType}}';
|
|
273
|
+
switch (operation) {
|
|
274
|
+
{{#each crudTargets}}
|
|
275
|
+
case '{{operationType}}':
|
|
276
|
+
return await {{serviceInstanceName}}.{{invokeFnName}}({{#each callArgs}}{{{this}}}, {{/each}}requestParams);
|
|
277
|
+
{{/each}}
|
|
278
|
+
default:
|
|
279
|
+
throw new Error(
|
|
280
|
+
`CrudVariable '{{name}}' has no generated operation for '${operation}' ` +
|
|
281
|
+
`(available: {{#each crudTargets}}{{operationType}} {{/each}})`
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{{/if}}
|
|
286
|
+
{{#ifEqualsAny classname (array 'ServiceVariable' 'LiveVariable') this}}
|
|
287
|
+
{{#if hasInvokeHttp}}
|
|
288
|
+
{{#if liveTargets}}
|
|
289
|
+
invokeHttp: async (...args: any) => {
|
|
290
|
+
// `operation` on this variable is only the DEFAULT. Every LiveVariable carries
|
|
291
|
+
// all four record methods, and a table bound to it as `datasource` asks it for
|
|
292
|
+
// whichever the user performed — the manager names it in params.operation.
|
|
293
|
+
const [requestParams, params] = args;
|
|
294
|
+
switch (params?.operation) {
|
|
295
|
+
{{#each liveTargets}}
|
|
296
|
+
case '{{action}}':
|
|
297
|
+
return await {{../serviceInstanceName}}.{{invokeFnName}}({{#if hasResolvedCallArgs}}{{#each callArgs}}{{{this}}}, {{/each}}{{else}}params, {{/if}}requestParams);
|
|
298
|
+
{{/each}}
|
|
299
|
+
default:
|
|
300
|
+
throw new Error(
|
|
301
|
+
`LiveVariable '{{name}}' has no generated method for DB operation ` +
|
|
302
|
+
`'${params?.operation}' ` +
|
|
303
|
+
`(available: {{#each liveTargets}}{{action}} {{/each}})`
|
|
304
|
+
);
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{{else}}
|
|
308
|
+
invokeHttp: async (...args: any) => {
|
|
309
|
+
const [requestParams, params] = args;
|
|
310
|
+
return await {{serviceInstanceName}}.{{invokeFnName}}({{#if hasResolvedCallArgs}}{{#each callArgs}}{{{this}}}, {{/each}}{{else}}params, {{/if}}requestParams);
|
|
311
|
+
},
|
|
312
|
+
{{/if}}
|
|
313
|
+
{{/if}}
|
|
314
|
+
{{/ifEqualsAny}}
|
|
315
|
+
|
|
250
316
|
}),
|
|
251
317
|
{{/each}}
|
|
252
318
|
},
|