@gxp-dev/tools 2.0.27 → 2.0.28
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.
|
@@ -82,8 +82,9 @@ function groupPathsByTag(openApiSpec) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
// Extract permission from x-permission
|
|
85
|
+
// Extract permission and permission_key from x-permission
|
|
86
86
|
const permission = pathInfo["x-permission"]?.permission;
|
|
87
|
+
const permissionKey = pathInfo["x-permission"]?.permission_key;
|
|
87
88
|
|
|
88
89
|
tagGroups[tag].paths.push({
|
|
89
90
|
path: pathUrl,
|
|
@@ -91,6 +92,7 @@ function groupPathsByTag(openApiSpec) {
|
|
|
91
92
|
operationId: pathInfo.operationId || "",
|
|
92
93
|
summary: pathInfo.summary || "",
|
|
93
94
|
permission: permission || null,
|
|
95
|
+
permissionKey: permissionKey || null,
|
|
94
96
|
});
|
|
95
97
|
}
|
|
96
98
|
}
|
|
@@ -683,10 +685,26 @@ async function addDependencyCommand(argv) {
|
|
|
683
685
|
|
|
684
686
|
// Collect all permissions from selected paths
|
|
685
687
|
const allPermissions = new Set();
|
|
688
|
+
let permissionKey = null;
|
|
686
689
|
for (const pathInfo of selectedPaths) {
|
|
687
690
|
if (pathInfo.permission) {
|
|
688
691
|
allPermissions.add(pathInfo.permission);
|
|
689
692
|
}
|
|
693
|
+
// Get permission_key from first path that has it (should be same for all)
|
|
694
|
+
if (!permissionKey && pathInfo.permissionKey) {
|
|
695
|
+
permissionKey = pathInfo.permissionKey;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// Build operations object from selected paths
|
|
700
|
+
const operations = {};
|
|
701
|
+
for (const pathInfo of selectedPaths) {
|
|
702
|
+
if (pathInfo.operationId) {
|
|
703
|
+
// Remove "portal.v1.project." prefix from operationId
|
|
704
|
+
const cleanOperationId = pathInfo.operationId.replace(/^portal\.v1\.project\./, "");
|
|
705
|
+
// Prepend method to path (e.g., "get:/v1/projects/...")
|
|
706
|
+
operations[cleanOperationId] = `${pathInfo.method.toLowerCase()}:${pathInfo.path}`;
|
|
707
|
+
}
|
|
690
708
|
}
|
|
691
709
|
|
|
692
710
|
// Build events object
|
|
@@ -699,7 +717,9 @@ async function addDependencyCommand(argv) {
|
|
|
699
717
|
const dependency = {
|
|
700
718
|
identifier,
|
|
701
719
|
model: selectedTag.name,
|
|
720
|
+
permissionKey: permissionKey,
|
|
702
721
|
permissions: Array.from(allPermissions).sort(),
|
|
722
|
+
operations,
|
|
703
723
|
events,
|
|
704
724
|
};
|
|
705
725
|
|
package/package.json
CHANGED
|
@@ -129,6 +129,8 @@ export const useGxpStore = defineStore("gxp-portal-app", () => {
|
|
|
129
129
|
const portalAssets = ref({ ...defaultData.portalAssets });
|
|
130
130
|
const portal = ref(defaultData.portal);
|
|
131
131
|
|
|
132
|
+
const apiOperations = ref({});
|
|
133
|
+
|
|
132
134
|
// Loading state for manifest
|
|
133
135
|
const manifestLoaded = ref(false);
|
|
134
136
|
const manifestError = ref(null);
|
|
@@ -297,6 +299,24 @@ export const useGxpStore = defineStore("gxp-portal-app", () => {
|
|
|
297
299
|
// Initialize dependency-based sockets based on the new structure
|
|
298
300
|
if (Array.isArray(dependencies.value)) {
|
|
299
301
|
dependencies.value.forEach((dependency) => {
|
|
302
|
+
if (
|
|
303
|
+
dependency.operations &&
|
|
304
|
+
Object.keys(dependency.operations).length > 0
|
|
305
|
+
) {
|
|
306
|
+
Object.keys(dependency.operations).forEach((operation) => {
|
|
307
|
+
let method = "get";
|
|
308
|
+
let path = dependency.operations[operation];
|
|
309
|
+
if (path.includes(":")) {
|
|
310
|
+
let pathSplit = path.split(":");
|
|
311
|
+
method = pathSplit[0];
|
|
312
|
+
path = pathSplit[1];
|
|
313
|
+
}
|
|
314
|
+
apiOperations.value[operation] = {
|
|
315
|
+
method: method,
|
|
316
|
+
path: path,
|
|
317
|
+
};
|
|
318
|
+
});
|
|
319
|
+
}
|
|
300
320
|
if (dependency.events && Object.keys(dependency.events).length > 0) {
|
|
301
321
|
// Create socket listeners for each event type
|
|
302
322
|
sockets[dependency.identifier] = {};
|
|
@@ -375,9 +395,10 @@ export const useGxpStore = defineStore("gxp-portal-app", () => {
|
|
|
375
395
|
throw new Error(`DELETE ${endpoint}: ${error.message}`);
|
|
376
396
|
}
|
|
377
397
|
}
|
|
378
|
-
async function callApi(
|
|
398
|
+
async function callApi(operation, identifier, data = {}) {
|
|
379
399
|
try {
|
|
380
|
-
const
|
|
400
|
+
const operation = apiOperations.value[operation];
|
|
401
|
+
const response = await apiClient[operation.method](operation.path, data);
|
|
381
402
|
return response.data;
|
|
382
403
|
} catch (error) {
|
|
383
404
|
throw new Error(`${method} ${endpoint}: ${error.message}`);
|