@gxp-dev/tools 2.0.26 → 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,12 +82,17 @@ function groupPathsByTag(openApiSpec) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
// Extract permission and permission_key from x-permission
|
|
86
|
+
const permission = pathInfo["x-permission"]?.permission;
|
|
87
|
+
const permissionKey = pathInfo["x-permission"]?.permission_key;
|
|
88
|
+
|
|
85
89
|
tagGroups[tag].paths.push({
|
|
86
90
|
path: pathUrl,
|
|
87
91
|
method: method.toUpperCase(),
|
|
88
92
|
operationId: pathInfo.operationId || "",
|
|
89
93
|
summary: pathInfo.summary || "",
|
|
90
|
-
|
|
94
|
+
permission: permission || null,
|
|
95
|
+
permissionKey: permissionKey || null,
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
98
|
}
|
|
@@ -680,9 +685,25 @@ async function addDependencyCommand(argv) {
|
|
|
680
685
|
|
|
681
686
|
// Collect all permissions from selected paths
|
|
682
687
|
const allPermissions = new Set();
|
|
688
|
+
let permissionKey = null;
|
|
689
|
+
for (const pathInfo of selectedPaths) {
|
|
690
|
+
if (pathInfo.permission) {
|
|
691
|
+
allPermissions.add(pathInfo.permission);
|
|
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 = {};
|
|
683
701
|
for (const pathInfo of selectedPaths) {
|
|
684
|
-
|
|
685
|
-
|
|
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}`;
|
|
686
707
|
}
|
|
687
708
|
}
|
|
688
709
|
|
|
@@ -696,7 +717,9 @@ async function addDependencyCommand(argv) {
|
|
|
696
717
|
const dependency = {
|
|
697
718
|
identifier,
|
|
698
719
|
model: selectedTag.name,
|
|
720
|
+
permissionKey: permissionKey,
|
|
699
721
|
permissions: Array.from(allPermissions).sort(),
|
|
722
|
+
operations,
|
|
700
723
|
events,
|
|
701
724
|
};
|
|
702
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}`);
|