Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Task]: Update Create module API response to get module metadata #39675

Open
ankitakinger opened this issue Mar 11, 2025 · 2 comments
Open

[Task]: Update Create module API response to get module metadata #39675

ankitakinger opened this issue Mar 11, 2025 · 2 comments
Assignees
Labels
Backend This marks the issue or pull request to reference server code JS module Issues affecting JS modules or its instances Module creator Issues related to the module creator side Packages & Git Pod All issues belonging to Packages and Git Packages Pod issues that belong to the packages pod Query module Issues affecting query modules or its instances Task A simple Todo

Comments

@ankitakinger
Copy link
Contributor

ankitakinger commented Mar 11, 2025

Update Create module API response to get module metadata in the same response similar to fetch package API response.

This is needed for the Package IDE changes being worked on where we would now directly redirect to the URL pkg/:packageId/:moduleId/edit/queries/:queryId instead of first going to pkg/:packageId/:moduleId/edit and then fetching the module entities which is then used to redirect to pkg/:packageId/:moduleId/edit/queries/:queryId.

This was needed in the new flow as we could notice consistent page re-renders on every module switch in the new flow.

@ankitakinger ankitakinger added JS module Issues affecting JS modules or its instances Packages Pod issues that belong to the packages pod Query module Issues affecting query modules or its instances Task A simple Todo labels Mar 11, 2025
@github-actions github-actions bot added the Packages & Git Pod All issues belonging to Packages and Git label Mar 11, 2025
@subrata71 subrata71 added Backend This marks the issue or pull request to reference server code Module creator Issues related to the module creator side labels Mar 11, 2025
@subrata71
Copy link
Contributor

Sample response of create QUERY MODULE:

{
    "responseMeta": {
        "status": 201,
        "success": true
    },
    "data": {
        "id": "67d0814dc7688953f534337e",
        "baseId": "67d0814dc7688953f534337e",
        "type": "QUERY_MODULE",
        "packageId": "67cac40386a33c216d87d6d7",
        "name": "QueryModule3",
        "inputsForm": [
            {
                "id": "hmojjennes",
                "sectionName": "",
                "children": []
            }
        ],
        "userPermissions": [
            "read:modules",
            "create:moduleExecutables",
            "create:moduleInstances",
            "manage:modules",
            "delete:modules",
            "read:moduleInstances"
        ],
        "settingsForm": [],
        "metadata": {
            "moduleId": "67d0814dc7688953f534337e",
            "pluginType": "API",
            "pluginId": "66ab4b5ce268ec17d28b4dc5",
            "publicEntity": {
                "id": "67d0814dc7688953f534337f",
                "baseId": "67d0814dc7688953f534337f",
                "workspaceId": "67cac3ab86a33c216d87d6cb",
                "pluginType": "API",
                "pluginId": "66ab4b5ce268ec17d28b4dc5",
                "name": "QueryModule3",
                "datasource": {
                    "userPermissions": [],
                    "name": "DEFAULT_GRAPHQL_DATASOURCE",
                    "pluginId": "66ab4b5ce268ec17d28b4dc5",
                    "workspaceId": "67cac3ab86a33c216d87d6cb",
                    "datasourceStorages": {},
                    "invalids": [],
                    "messages": [],
                    "isValid": true
                },
                "contextType": "MODULE",
                "actionConfiguration": {
                    "timeoutInMillisecond": 10000,
                    "paginationType": "NONE",
                    "headers": [
                        {
                            "key": "content-type",
                            "value": "application/json"
                        },
                        {
                            "key": "",
                            "value": ""
                        }
                    ],
                    "autoGeneratedHeaders": [],
                    "encodeParamsToggle": true,
                    "queryParameters": [
                        {
                            "key": "",
                            "value": ""
                        },
                        {
                            "key": "",
                            "value": ""
                        }
                    ],
                    "body": "",
                    "httpMethod": "POST",
                    "httpVersion": "HTTP11",
                    "pluginSpecifiedTemplates": [
                        {
                            "value": true
                        },
                        {
                            "value": ""
                        },
                        {
                            "value": {}
                        }
                    ],
                    "formData": {
                        "apiContentType": "application/json"
                    }
                },
                "dynamicBindingPathList": [],
                "isValid": true,
                "invalids": [],
                "messages": [],
                "jsonPathKeys": [],
                "confirmBeforeExecute": false,
                "userPermissions": [],
                "packageId": "67cac40386a33c216d87d6d7",
                "moduleId": "67d0814dc7688953f534337e",
                "isPublic": true,
                "entityReferenceType": "ACTION"
            }
        }
    },
    "errorDisplay": ""
}

@subrata71
Copy link
Contributor

Sample response of create JS module:

{
    "responseMeta": {
        "status": 201,
        "success": true
    },
    "data": {
        "id": "67d08163c7688953f5343380",
        "baseId": "67d08163c7688953f5343380",
        "type": "JS_MODULE",
        "packageId": "67cac40386a33c216d87d6d7",
        "name": "JSModule4",
        "userPermissions": [
            "read:modules",
            "create:moduleExecutables",
            "create:moduleInstances",
            "manage:modules",
            "delete:modules",
            "read:moduleInstances"
        ],
        "settingsForm": [],
        "metadata": {
            "moduleId": "67d08163c7688953f5343380",
            "pluginType": "JS",
            "pluginId": "66ab4b5ae268ec17d28b4db4",
            "publicEntity": {
                "id": "67d08163c7688953f5343383",
                "baseId": "67d08163c7688953f5343383",
                "workspaceId": "67cac3ab86a33c216d87d6cb",
                "name": "JSModule4",
                "contextType": "MODULE",
                "pluginId": "66ab4b5ae268ec17d28b4db4",
                "pluginType": "JS",
                "actions": [
                    {
                        "id": "67d08163c7688953f5343381",
                        "baseId": "67d08163c7688953f5343381",
                        "workspaceId": "67cac3ab86a33c216d87d6cb",
                        "pluginType": "JS",
                        "pluginId": "66ab4b5ae268ec17d28b4db4",
                        "name": "myFun1",
                        "fullyQualifiedName": "JSModule4.myFun1",
                        "datasource": {
                            "userPermissions": [],
                            "name": "UNUSED_DATASOURCE",
                            "pluginId": "66ab4b5ae268ec17d28b4db4",
                            "workspaceId": "67cac3ab86a33c216d87d6cb",
                            "datasourceStorages": {},
                            "messages": [],
                            "isValid": true
                        },
                        "contextType": "MODULE",
                        "collectionId": "67d08163c7688953f5343383",
                        "actionConfiguration": {
                            "timeoutInMillisecond": 10000,
                            "paginationType": "NONE",
                            "encodeParamsToggle": true,
                            "body": "function () {}",
                            "jsArguments": []
                        },
                        "executeOnLoad": false,
                        "clientSideExecution": true,
                        "dynamicBindingPathList": [
                            {
                                "key": "body"
                            }
                        ],
                        "isValid": true,
                        "invalids": [],
                        "messages": [],
                        "jsonPathKeys": [
                            "function () {}"
                        ],
                        "confirmBeforeExecute": false,
                        "userPermissions": [
                            "read:actions",
                            "delete:actions",
                            "execute:actions",
                            "manage:actions"
                        ],
                        "updatedAt": "2025-03-11T18:30:59Z",
                        "packageId": "67cac40386a33c216d87d6d7",
                        "moduleId": "67d08163c7688953f5343380",
                        "isPublic": true,
                        "entityReferenceType": "JSACTION"
                    },
                    {
                        "id": "67d08163c7688953f5343382",
                        "baseId": "67d08163c7688953f5343382",
                        "workspaceId": "67cac3ab86a33c216d87d6cb",
                        "pluginType": "JS",
                        "pluginId": "66ab4b5ae268ec17d28b4db4",
                        "name": "myFun2",
                        "fullyQualifiedName": "JSModule4.myFun2",
                        "datasource": {
                            "userPermissions": [],
                            "name": "UNUSED_DATASOURCE",
                            "pluginId": "66ab4b5ae268ec17d28b4db4",
                            "workspaceId": "67cac3ab86a33c216d87d6cb",
                            "datasourceStorages": {},
                            "messages": [],
                            "isValid": true
                        },
                        "contextType": "MODULE",
                        "collectionId": "67d08163c7688953f5343383",
                        "actionConfiguration": {
                            "timeoutInMillisecond": 10000,
                            "paginationType": "NONE",
                            "encodeParamsToggle": true,
                            "body": "async function () {}",
                            "jsArguments": []
                        },
                        "executeOnLoad": false,
                        "clientSideExecution": true,
                        "dynamicBindingPathList": [
                            {
                                "key": "body"
                            }
                        ],
                        "isValid": true,
                        "invalids": [],
                        "messages": [],
                        "jsonPathKeys": [
                            "async function () {}"
                        ],
                        "confirmBeforeExecute": false,
                        "userPermissions": [
                            "read:actions",
                            "delete:actions",
                            "execute:actions",
                            "manage:actions"
                        ],
                        "updatedAt": "2025-03-11T18:30:59Z",
                        "packageId": "67cac40386a33c216d87d6d7",
                        "moduleId": "67d08163c7688953f5343380",
                        "isPublic": true,
                        "entityReferenceType": "JSACTION"
                    }
                ],
                "archivedActions": [],
                "body": "export default {\n\tmyVar1: [],\n\tmyVar2: {},\n\tmyFun1 () {\n\t\t//\twrite code here\n\t\t//\tthis.myVar1 = [1,2,3]\n\t},\n\tasync myFun2 () {\n\t\t//\tuse async-await or promises\n\t\t//\tawait storeValue('varName', 'hello world')\n\t}\n}",
                "variables": [
                    {
                        "name": "myVar1",
                        "value": "[]"
                    },
                    {
                        "name": "myVar2",
                        "value": "{}"
                    }
                ],
                "userPermissions": [],
                "packageId": "67cac40386a33c216d87d6d7",
                "moduleId": "67d08163c7688953f5343380",
                "isPublic": true
            }
        }
    },
    "errorDisplay": ""
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend This marks the issue or pull request to reference server code JS module Issues affecting JS modules or its instances Module creator Issues related to the module creator side Packages & Git Pod All issues belonging to Packages and Git Packages Pod issues that belong to the packages pod Query module Issues affecting query modules or its instances Task A simple Todo
Projects
None yet
Development

No branches or pull requests

2 participants