@simitgroup/simpleapp-generator 1.6.7-d-alpha → 1.6.7-f-alpha
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/ReleaseNote.md +9 -0
- package/dist/buildinschemas/webhooklog.d.ts.map +1 -1
- package/dist/buildinschemas/webhooklog.js +69 -75
- package/dist/buildinschemas/webhooklog.js.map +1 -1
- package/dist/framework.d.ts +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +7 -1
- package/dist/framework.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +85 -9
- package/dist/generate.js.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/webhooklog.ts +70 -77
- package/src/framework.ts +7 -0
- package/src/generate.ts +118 -2
- package/src/index.ts +10 -0
- package/src/type.ts +6 -0
- package/templates/basic/miniApi/resource.controller.ts.eta +139 -0
- package/templates/basic/miniApi/resource.module.ts.eta +16 -0
- package/templates/basic/miniApi/resource.service.ts.eta +109 -0
- package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +3 -6
- package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +0 -4
- package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +0 -8
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +5 -5
- package/templates/miniApi/src/modules/public/constants/api-scopes.ts.eta +76 -0
- package/templates/miniApi/src/modules/public/resources/resource.module.ts.eta +46 -0
- package/templates/miniAppJsSdk/src/index.ts.eta +21 -7
- package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +1 -9
- package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +0 -8
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/constants/resource.constant.ts.eta +0 -8
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +0 -8
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/bridge.type.ts.eta +20 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/resource-mapper.type.ts.eta +0 -8
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const pascalName = upperFirstCase(it.resourceName);
|
|
3
|
+
const apiName = it.typename.toUpperCase() + 'Api';
|
|
4
|
+
%>
|
|
5
|
+
|
|
6
|
+
import { BadRequestException, Injectable } from '@nestjs/common';
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import { <%= apiName %> } from 'src/openapi/backend-api';
|
|
9
|
+
import { ApiHeader } from 'src/types/api';
|
|
10
|
+
import { getOpenApiConfig } from 'src/utils/api';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class <%= pascalName %>Service {
|
|
14
|
+
protected guards = {
|
|
15
|
+
read: [],
|
|
16
|
+
create: [],
|
|
17
|
+
update: [],
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
constructor() {}
|
|
21
|
+
|
|
22
|
+
private getApi(headers: Record<string, string>) {
|
|
23
|
+
return new <%= apiName %>(getOpenApiConfig(headers));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
<% Object.entries(it.miniApp.whitelistApis).forEach(([action, value]) => { %>
|
|
27
|
+
<% if (value !== true && typeof value !== 'object') { return; } %>
|
|
28
|
+
|
|
29
|
+
<% if(action === 'list') { %>
|
|
30
|
+
async findAll(headers: ApiHeader) {
|
|
31
|
+
const api = this.getApi(headers);
|
|
32
|
+
const resp = await api.runSearch({});
|
|
33
|
+
return resp.data;
|
|
34
|
+
}
|
|
35
|
+
<% } else if(action === 'detail') { %>
|
|
36
|
+
async findOne(headers: ApiHeader, id: string) {
|
|
37
|
+
const api = this.getApi(headers);
|
|
38
|
+
const resp = await api.runFindOne(id);
|
|
39
|
+
return resp.data;
|
|
40
|
+
}
|
|
41
|
+
<% } else if(action === 'create') { %>
|
|
42
|
+
async create(headers: ApiHeader, resourceDto: any) {
|
|
43
|
+
const api = this.getApi(headers);
|
|
44
|
+
const resp = await api.runCreate(resourceDto);
|
|
45
|
+
return resp.data;
|
|
46
|
+
}
|
|
47
|
+
<% } else if(action === 'update') { %>
|
|
48
|
+
async update(headers: ApiHeader, id: string, resourceDto: any) {
|
|
49
|
+
const api = this.getApi(headers);
|
|
50
|
+
const resp = await api.runUpdate(id, resourceDto);
|
|
51
|
+
return resp.data;
|
|
52
|
+
}
|
|
53
|
+
<% } else if(action === 'patch') { %>
|
|
54
|
+
async patch(headers: ApiHeader, id: string, resourceDto: any) {
|
|
55
|
+
const api = this.getApi(headers);
|
|
56
|
+
const resp = await api.runPatch(id, resourceDto);
|
|
57
|
+
return resp.data;
|
|
58
|
+
}
|
|
59
|
+
<% } else if(action === 'delete') { %>
|
|
60
|
+
async delete(headers: ApiHeader, id: string) {
|
|
61
|
+
const api = this.getApi(headers);
|
|
62
|
+
const resp = await api.runDelete(id);
|
|
63
|
+
return resp.data;
|
|
64
|
+
}
|
|
65
|
+
<% } else if(action === 'autoComplete') { %>
|
|
66
|
+
async autocomplete(headers: ApiHeader, query: string, filter: any) {
|
|
67
|
+
const api = this.getApi(headers);
|
|
68
|
+
const resp = await api.autoComplete(query, filter);
|
|
69
|
+
return resp.data;
|
|
70
|
+
}
|
|
71
|
+
<% } else if(action === 'current') { %>
|
|
72
|
+
<% } else { %>
|
|
73
|
+
<% const apiSetting = it.apiSettings.find(item => item.action === action); %>
|
|
74
|
+
<% if (apiSetting) { %>
|
|
75
|
+
<% const hasBody = ['post', 'put', 'patch'].includes(apiSetting.method); %>
|
|
76
|
+
|
|
77
|
+
<%
|
|
78
|
+
const paramMatches = apiSetting.entryPoint.match(/:([\w]+)/g) || [];
|
|
79
|
+
const paramNames = paramMatches.map(p => p.replace(':', ''));
|
|
80
|
+
|
|
81
|
+
const args = paramNames.map(name => {
|
|
82
|
+
return `${name}: string`;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const output = [];
|
|
86
|
+
const queryParams = [];
|
|
87
|
+
|
|
88
|
+
for (let i = 0; i < paramNames.length; i++) {
|
|
89
|
+
const name = paramNames[i];
|
|
90
|
+
|
|
91
|
+
output.push(name);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (hasBody) {
|
|
95
|
+
args.push('data: any');
|
|
96
|
+
output.push('data');
|
|
97
|
+
}
|
|
98
|
+
%>
|
|
99
|
+
|
|
100
|
+
async <%= action %>(headers: ApiHeader, <%= args.join(', ') %>) {
|
|
101
|
+
const api = this.getApi(headers);
|
|
102
|
+
const resp = await api.run<%= upperFirstCase(action) %>(<%= output.join(', ') %>);
|
|
103
|
+
return resp.data;
|
|
104
|
+
}
|
|
105
|
+
<% } %>
|
|
106
|
+
<% } %>
|
|
107
|
+
<% }) %>
|
|
108
|
+
|
|
109
|
+
}
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
const pascalName = upperFirstCase(it.resourceName);
|
|
14
10
|
const apiName = it.typename.toUpperCase() + 'Api';
|
|
15
11
|
const typeActionName = pascalName + 'Actions';
|
|
@@ -18,6 +14,7 @@
|
|
|
18
14
|
const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
|
|
19
15
|
%>
|
|
20
16
|
|
|
17
|
+
import { MiniAppApiListParam } from "../../types/bridge.type";
|
|
21
18
|
import { MiniAppBridgeService } from "../bridge.service";
|
|
22
19
|
|
|
23
20
|
export class MiniApp<%= pascalName %>BridgeService {
|
|
@@ -33,8 +30,8 @@ export class MiniApp<%= pascalName %>BridgeService {
|
|
|
33
30
|
<% if (value !== true && typeof value !== 'object') { return; } %>
|
|
34
31
|
|
|
35
32
|
<% if(action === 'list') { %>
|
|
36
|
-
async list() {
|
|
37
|
-
return this.bridge.callApi(this.resourceName, "list");
|
|
33
|
+
async list(params?: MiniAppApiListParam | undefined) {
|
|
34
|
+
return this.bridge.callApi(this.resourceName, "list", { body: params });
|
|
38
35
|
}
|
|
39
36
|
<% } else if(action === 'detail') { %>
|
|
40
37
|
async detail(id: string) {
|
|
@@ -6,14 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const camelToKebab = (value) => {
|
|
14
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
const pascalName = upperFirstCase(it.resourceName);
|
|
18
10
|
const kebabName = camelToKebab(it.resourceName);
|
|
19
11
|
const apiName = it.typename.toUpperCase() + 'Api';
|
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
9
|
const pascalName = upperFirstCase(it.resourceName);
|
|
14
10
|
const apiName = it.typename.toUpperCase() + 'Api';
|
|
15
11
|
const typeActionName = 'MiniApp' + pascalName + 'Actions';
|
|
@@ -83,7 +79,11 @@ export class MiniApp<%= pascalName %>BridgeService {
|
|
|
83
79
|
|
|
84
80
|
<% if(action === 'list') { %>
|
|
85
81
|
protected async handleList(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
|
|
86
|
-
return (await this.api!.runSearch({
|
|
82
|
+
return (await this.api!.runSearch({
|
|
83
|
+
fields: message.params.body?.fields,
|
|
84
|
+
sorts: message.params.body?.sorts,
|
|
85
|
+
filter: message.params.body?.filters,
|
|
86
|
+
})).data;
|
|
87
87
|
}
|
|
88
88
|
<% } else if(action === 'detail') { %>
|
|
89
89
|
protected async handleDetail(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const getMiniAppInfo = (module) => {
|
|
3
|
+
const schema = module.schema;
|
|
4
|
+
const simpleAppConfig = schema['x-simpleapp-config'];
|
|
5
|
+
const miniAppWhitelistApis = simpleAppConfig?.miniApp?.whitelist || {};
|
|
6
|
+
const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
|
|
7
|
+
const resourcePascalName = upperFirstCase(simpleAppConfig.resourceName);
|
|
8
|
+
const resourceKebabName = camelToKebab(simpleAppConfig.resourceName);
|
|
9
|
+
const additionalApis = simpleAppConfig?.additionalApis || [];
|
|
10
|
+
let availableApis = {};
|
|
11
|
+
|
|
12
|
+
Object.entries(miniAppWhitelistApis).forEach(([action, value]) => {
|
|
13
|
+
if (value !== true && typeof value !== 'object') { return; }
|
|
14
|
+
let method = '';
|
|
15
|
+
switch(action) {
|
|
16
|
+
case 'list':
|
|
17
|
+
case 'detail':
|
|
18
|
+
method = 'get';
|
|
19
|
+
break;
|
|
20
|
+
|
|
21
|
+
case 'create':
|
|
22
|
+
case 'autoComplete':
|
|
23
|
+
method = 'post';
|
|
24
|
+
break;
|
|
25
|
+
|
|
26
|
+
case 'update':
|
|
27
|
+
method = 'put';
|
|
28
|
+
break;
|
|
29
|
+
|
|
30
|
+
case 'patch':
|
|
31
|
+
method = 'patch';
|
|
32
|
+
break;
|
|
33
|
+
|
|
34
|
+
case 'delete':
|
|
35
|
+
method = 'delete';
|
|
36
|
+
break;
|
|
37
|
+
|
|
38
|
+
case 'current':
|
|
39
|
+
return;
|
|
40
|
+
break;
|
|
41
|
+
|
|
42
|
+
default:
|
|
43
|
+
method = (additionalApis ?? []).find(item => item.action === action)?.method ?? '';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
availableApis[action] = {
|
|
48
|
+
method: method
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
miniAppWhitelistApis,
|
|
54
|
+
hasMiniAppWhitelistedApi,
|
|
55
|
+
resourceName: simpleAppConfig.resourceName,
|
|
56
|
+
resourcePascalName,
|
|
57
|
+
resourceKebabName,
|
|
58
|
+
availableApis
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const modules = it.modules.sort((a, b) => a.docname.localeCompare(b.docname, undefined, { sensitivity: 'base' }));
|
|
63
|
+
%>
|
|
64
|
+
|
|
65
|
+
const scopes = {
|
|
66
|
+
<% modules.forEach(module => { %>
|
|
67
|
+
<%
|
|
68
|
+
const { hasMiniAppWhitelistedApi, resourceName, miniAppWhitelistApis, availableApis } = getMiniAppInfo(module);
|
|
69
|
+
%>
|
|
70
|
+
<% if(hasMiniAppWhitelistedApi) { %>
|
|
71
|
+
<%= resourceName %>: <%~ JSON.stringify(availableApis) %>,
|
|
72
|
+
<% } %>
|
|
73
|
+
<% }); %>
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default scopes;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const getMiniAppInfo = (module) => {
|
|
3
|
+
const schema = module.schema;
|
|
4
|
+
const simpleAppConfig = schema['x-simpleapp-config'];
|
|
5
|
+
const miniAppWhitelistApis = simpleAppConfig?.miniApp?.whitelist || {};
|
|
6
|
+
const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
|
|
7
|
+
const resourcePascalName = upperFirstCase(simpleAppConfig.resourceName);
|
|
8
|
+
const resourceKebabName = camelToKebab(simpleAppConfig.resourceName);
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
hasMiniAppWhitelistedApi,
|
|
12
|
+
resourceName: simpleAppConfig.resourceName,
|
|
13
|
+
resourcePascalName,
|
|
14
|
+
resourceKebabName
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const modules = it.modules.sort((a, b) => a.docname.localeCompare(b.docname, undefined, { sensitivity: 'base' }));
|
|
19
|
+
%>
|
|
20
|
+
|
|
21
|
+
import { Module } from '@nestjs/common';
|
|
22
|
+
<% modules.forEach(module => { %>
|
|
23
|
+
<%
|
|
24
|
+
const { hasMiniAppWhitelistedApi, resourcePascalName, resourceKebabName } = getMiniAppInfo(module);
|
|
25
|
+
%>
|
|
26
|
+
<% if(hasMiniAppWhitelistedApi) { %>
|
|
27
|
+
import { <%= resourcePascalName %>Module } from './<%= resourceKebabName %>/<%= resourceKebabName %>.module';
|
|
28
|
+
<% } %>
|
|
29
|
+
<% }); %>
|
|
30
|
+
|
|
31
|
+
@Module({
|
|
32
|
+
imports: [
|
|
33
|
+
<% modules.forEach(module => { %>
|
|
34
|
+
<%
|
|
35
|
+
const { hasMiniAppWhitelistedApi, resourcePascalName } = getMiniAppInfo(module);
|
|
36
|
+
%>
|
|
37
|
+
<% if(hasMiniAppWhitelistedApi) { %>
|
|
38
|
+
<%= resourcePascalName %>Module,
|
|
39
|
+
<% } %>
|
|
40
|
+
<% }); %>
|
|
41
|
+
],
|
|
42
|
+
controllers: [],
|
|
43
|
+
providers: [],
|
|
44
|
+
exports: []
|
|
45
|
+
})
|
|
46
|
+
export class ResourceModule {}
|
|
@@ -5,24 +5,38 @@
|
|
|
5
5
|
* Author: --
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { MINI_APP_BRIDGE_MESSAGES } from
|
|
9
|
-
import { MiniAppBridgeResourceAccessor } from
|
|
10
|
-
import {
|
|
8
|
+
import { MINI_APP_BRIDGE_MESSAGES } from "./constants/common.constant";
|
|
9
|
+
import { MiniAppBridgeResourceAccessor } from "./services/bridge-resource-accessor.service";
|
|
10
|
+
import {
|
|
11
|
+
MiniAppBridgeMessageNavigate,
|
|
12
|
+
MiniAppBridgeMessageNavigateCurrentMiniApp,
|
|
13
|
+
} from "./types/bridge.type";
|
|
11
14
|
|
|
12
15
|
export class SimtrainEcoMiniAppJsSdk extends MiniAppBridgeResourceAccessor {
|
|
13
16
|
public ui = {
|
|
14
17
|
navigateTo: (target: string, id?: string, query?: string) => {
|
|
15
18
|
const message: MiniAppBridgeMessageNavigate = {
|
|
16
19
|
type: MINI_APP_BRIDGE_MESSAGES.NAVIGATE,
|
|
17
|
-
params: { target, id, query }
|
|
20
|
+
params: { target, id, query },
|
|
18
21
|
};
|
|
19
22
|
|
|
20
|
-
window.parent.postMessage(message,
|
|
21
|
-
}
|
|
23
|
+
window.parent.postMessage(message, "*");
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
public current = {
|
|
28
|
+
navigateTo: (target: string, query?: string) => {
|
|
29
|
+
const message: MiniAppBridgeMessageNavigateCurrentMiniApp = {
|
|
30
|
+
type: MINI_APP_BRIDGE_MESSAGES.NAVIGATE_CURRENT_MINI_APP,
|
|
31
|
+
params: { target, query },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
window.parent.postMessage(message, "*");
|
|
35
|
+
},
|
|
22
36
|
};
|
|
23
37
|
|
|
24
38
|
constructor() {
|
|
25
39
|
super();
|
|
26
|
-
console.log(
|
|
40
|
+
console.log("Hello from SimtrainEcoMiniAppJsSdk !!!");
|
|
27
41
|
}
|
|
28
42
|
}
|
|
@@ -6,15 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const camelToKebab = (value) => {
|
|
14
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const getMiniAppInfo = (module) => {
|
|
9
|
+
const getMiniAppInfo = (module) => {
|
|
18
10
|
const config = module.schema['x-simpleapp-config'];
|
|
19
11
|
const resourceName = config?.resourceName ?? config.documentName;
|
|
20
12
|
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const upperFirstCase = (value) => {
|
|
3
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const camelToKebab = (value) => {
|
|
7
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
2
|
const camelToSnake = (value) => {
|
|
11
3
|
return value.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
|
|
12
4
|
}
|
package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/constants/resource.constant.ts.eta
CHANGED
|
@@ -6,14 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const camelToKebab = (value) => {
|
|
14
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
const getMiniAppInfo = (module) => {
|
|
18
10
|
const config = module.schema['x-simpleapp-config'];
|
|
19
11
|
const resourceName = config?.resourceName ?? config.documentName;
|
|
@@ -6,14 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const camelToKebab = (value) => {
|
|
14
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
const getMiniAppInfo = (module) => {
|
|
18
10
|
const config = module.schema['x-simpleapp-config'];
|
|
19
11
|
const resourceName = config?.resourceName ?? config.documentName;
|
|
@@ -79,3 +79,23 @@ export type MiniAppBridgeMessageApiResponse<TData> = {
|
|
|
79
79
|
export type MiniAppBridgeMessageInitResponse = {
|
|
80
80
|
type: typeof MINI_APP_BRIDGE_MESSAGES.INIT_RESPONSE;
|
|
81
81
|
};
|
|
82
|
+
|
|
83
|
+
export type MiniAppApiListParam = {
|
|
84
|
+
fields?: string[];
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Same as Mongo DB filter
|
|
88
|
+
*/
|
|
89
|
+
filters?: {
|
|
90
|
+
[key: string]: any;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Same as Mongo DB sort
|
|
95
|
+
*/
|
|
96
|
+
sorts?:
|
|
97
|
+
| {
|
|
98
|
+
[key: string]: any;
|
|
99
|
+
}
|
|
100
|
+
| string[][];
|
|
101
|
+
};
|
package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/resource-mapper.type.ts.eta
CHANGED
|
@@ -6,14 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
<%
|
|
9
|
-
const upperFirstCase = (value) => {
|
|
10
|
-
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const camelToKebab = (value) => {
|
|
14
|
-
return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
const getMiniAppInfo = (module) => {
|
|
18
10
|
const config = module.schema['x-simpleapp-config'];
|
|
19
11
|
const resourceName = config?.resourceName ?? config.documentName;
|