@platform-mesh/portal-ui-lib 0.70.0 → 0.71.0
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/assets/platform-mesh-portal-ui-wc.js +253 -253
- package/fesm2022/platform-mesh-portal-ui-lib-models.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib-services.mjs +72 -54
- package/fesm2022/platform-mesh-portal-ui-lib-services.mjs.map +1 -1
- package/fesm2022/platform-mesh-portal-ui-lib-utils.mjs +11 -27
- package/fesm2022/platform-mesh-portal-ui-lib-utils.mjs.map +1 -1
- package/package.json +1 -1
- package/types/platform-mesh-portal-ui-lib-models.d.ts +2 -0
- package/types/platform-mesh-portal-ui-lib-services.d.ts +9 -3
- package/types/platform-mesh-portal-ui-lib-utils.d.ts +7 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-mesh-portal-ui-lib-models.mjs","sources":["../../projects/lib/models/constants/constants.ts","../../projects/lib/models/models/resource.ts","../../projects/lib/models/models/ui-definition.ts","../../projects/lib/models/platform-mesh-portal-ui-lib-models.ts"],"sourcesContent":["export const ALL_NAMESPACE = '-all-';\nexport const kcpRootOrgsPath = 'root:orgs';\n","import { PlatformMeshFieldDefinition, UIDefinition } from './ui-definition';\nimport { GenericResource } from '@openmfp/ngx';\nimport { Condition, ObjectMeta } from 'kubernetes-types/meta/v1';\n\nexport interface ResourceStatus {\n conditions: Condition[];\n}\n\nexport interface ResourceSpec extends Record<string, any> {\n type: string;\n description?: string;\n displayName?: string;\n}\n\nexport interface ResourceMeta extends ObjectMeta {\n name: string;\n}\n\nexport interface Resource extends GenericResource {\n metadata: ResourceMeta;\n spec?: ResourceSpec;\n status?: ResourceStatus;\n __typename?: string;\n data?: Record<string, any>;\n ready?: boolean;\n isAvailable?: boolean;\n accessibleName?: string;\n}\n\nexport interface PermissionsDefinition {\n group: string;\n resource: string;\n entityActions: string[];\n resourceActions: string[];\n entityContextKey: string;\n}\n\nexport interface ResourceDefinition {\n apiGroup?: string;\n version: string;\n entityCollection: string;\n entity: string;\n name?: string;\n scope?: KubernetesScope;\n namespace?: string;\n readyCondition?: PlatformMeshFieldDefinition;\n /**\n * Keep resources usable while their ready condition is false. Resources that\n * are pending deletion remain unavailable.\n */\n availableWhenNotReady?: boolean;\n ui?: UIDefinition;\n permissionsDefinition?: PermissionsDefinition;\n}\n\nexport const ResourceOperationTypeMap = {\n ADDED: 'ADDED',\n MODIFIED: 'MODIFIED',\n DELETED: 'DELETED',\n} as const;\n\nexport type ResourceOperationType =\n (typeof ResourceOperationTypeMap)[keyof typeof ResourceOperationTypeMap];\n\nexport interface ResourceSubscriptionResult {\n type: ResourceOperationType;\n object: Resource;\n}\n\nexport interface ResourcePagination {\n limit: number | undefined;\n continue: string | undefined;\n}\n\nexport interface ResourceListResult {\n resourceVersion: string;\n items: Resource[];\n continue: string | undefined;\n remainingItemCount?: number;\n}\n\nexport type KubernetesScope = 'Cluster' | 'Namespaced';\n","import {\n ButtonSettings,\n FieldFilterDefinition,\n FormFieldDefinition,\n TableFieldDefinition,\n} from '@openmfp/ngx';\n\nexport type {\n ButtonSettings,\n CssRule,\n GenericResource,\n ModalSettings,\n PropertyField,\n TransformType,\n UiSettings,\n ResourceFieldButtonClickEvent,\n} from '@openmfp/ngx';\n\nexport type PlatformMeshFieldDefinition = TableFieldDefinition &\n Omit<FormFieldDefinition, 'name' | 'label'> & {\n label?: string;\n dynamicValuesDefinition?: {\n operation: string;\n gqlQuery: string;\n gqlQueryVariables?: Record<string, string>;\n value: string;\n key: string;\n };\n };\n\nexport const DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION =\n 'download-kubeconfig-from-secret-ref';\n\n/**\n * `ButtonSettings` plus the extra data the kubeconfig download needs. Used\n * inside `UiView.actions[].uiSettings.buttonSettings`.\n */\nexport interface DownloadKubeconfigFromSecretRefButtonSettings extends ButtonSettings {\n action: typeof DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION;\n /** Resource property holding the referenced Secret name. */\n resourceProperty: string;\n /** Secret `data` key to download; defaults to `kubeconfig`. */\n dataKey?: string;\n /** Download filename; defaults to `kubeconfig.yaml`. */\n filename?: string;\n /**\n * Resource property holding the Secret namespace; falls back to the\n * resource's own namespace, then the node context namespace.\n */\n namespaceProperty?: string;\n}\n\nexport interface UiView {\n actions?: PlatformMeshFieldDefinition[];\n fields?: PlatformMeshFieldDefinition[];\n resourceDescription?: PlatformMeshFieldDefinition;\n resourceTitle?: PlatformMeshFieldDefinition;\n backgroundImageUrl?: string;\n}\n\nexport interface UIDefinition {\n logoUrl?: string;\n listView?: ListView;\n createView?: UiView;\n detailView?: DetailView;\n}\n\nexport interface ListView extends UiView {\n filters?: FieldFilterDefinition[];\n baselineFilters?: FieldFilterDefinition[];\n /**\n * Absolute path a row click navigates to, with `{resource.<dot.path>}` and\n * `{context.<dot.path>}` placeholders resolved against the clicked row and the\n * current Luigi context respectively — e.g.\n * `\"/workspaces/{context.org}/components/{resource.metadata.name}\"`.\n * When set, overrides the default relative navigation to the row's detail\n * view, so a flat list can link into an entity-scoped path.\n */\n resourceURL?: string;\n}\n\nexport interface DetailView extends UiView {\n showDownloadKubeconfig?: boolean;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,GAAG;AACtB,MAAM,eAAe,GAAG;;ACsDxB,MAAM,wBAAwB,GAAG;AACtC,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,OAAO,EAAE,SAAS;;;AC5Bb,MAAM,0CAA0C,GACrD;;AC/BF;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"platform-mesh-portal-ui-lib-models.mjs","sources":["../../projects/lib/models/constants/constants.ts","../../projects/lib/models/models/resource.ts","../../projects/lib/models/models/ui-definition.ts","../../projects/lib/models/platform-mesh-portal-ui-lib-models.ts"],"sourcesContent":["export const ALL_NAMESPACE = '-all-';\nexport const kcpRootOrgsPath = 'root:orgs';\n","import { PlatformMeshFieldDefinition, UIDefinition } from './ui-definition';\nimport { GenericResource } from '@openmfp/ngx';\nimport { Condition, ObjectMeta } from 'kubernetes-types/meta/v1';\n\nexport interface ResourceStatus {\n conditions: Condition[];\n}\n\nexport interface ResourceSpec extends Record<string, any> {\n type: string;\n description?: string;\n displayName?: string;\n}\n\nexport interface ResourceMeta extends ObjectMeta {\n name: string;\n}\n\nexport interface Resource extends GenericResource {\n metadata: ResourceMeta;\n spec?: ResourceSpec;\n status?: ResourceStatus;\n __typename?: string;\n data?: Record<string, any>;\n ready?: boolean;\n isAvailable?: boolean;\n accessibleName?: string;\n}\n\nexport interface PermissionsDefinition {\n group: string;\n resource: string;\n entityActions: string[];\n resourceActions: string[];\n entityContextKey: string;\n}\n\nexport interface ResourceDefinition {\n apiGroup?: string;\n version: string;\n entityCollection: string;\n entity: string;\n name?: string;\n scope?: KubernetesScope;\n namespace?: string;\n readyCondition?: PlatformMeshFieldDefinition;\n /**\n * Keep resources usable while their ready condition is false. Resources that\n * are pending deletion remain unavailable.\n */\n availableWhenNotReady?: boolean;\n ui?: UIDefinition;\n permissionsDefinition?: PermissionsDefinition;\n}\n\nexport const ResourceOperationTypeMap = {\n ADDED: 'ADDED',\n MODIFIED: 'MODIFIED',\n DELETED: 'DELETED',\n} as const;\n\nexport type ResourceOperationType =\n (typeof ResourceOperationTypeMap)[keyof typeof ResourceOperationTypeMap];\n\nexport interface ResourceSubscriptionResult {\n type: ResourceOperationType;\n object: Resource;\n}\n\nexport interface ResourcePagination {\n limit: number | undefined;\n continue: string | undefined;\n}\n\nexport interface ResourceListResult {\n resourceVersion: string;\n items: Resource[];\n continue: string | undefined;\n remainingItemCount?: number;\n}\n\nexport type KubernetesScope = 'Cluster' | 'Namespaced';\n","import {\n ButtonSettings,\n FieldFilterDefinition,\n FormFieldDefinition,\n TableFieldDefinition,\n} from '@openmfp/ngx';\n\nexport type {\n ButtonSettings,\n CssRule,\n GenericResource,\n ModalSettings,\n PropertyField,\n TransformType,\n UiSettings,\n ResourceFieldButtonClickEvent,\n} from '@openmfp/ngx';\n\nexport type PlatformMeshFieldDefinition = TableFieldDefinition &\n Omit<FormFieldDefinition, 'name' | 'label'> & {\n label?: string;\n dynamicValuesDefinition?: {\n operation: string;\n gqlQuery: string;\n gqlQueryVariables?: Record<string, string>;\n value: string;\n key: string;\n };\n };\n\nexport const DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION =\n 'download-kubeconfig-from-secret-ref';\n\n/**\n * `ButtonSettings` plus the extra data the kubeconfig download needs. Used\n * inside `UiView.actions[].uiSettings.buttonSettings`.\n */\nexport interface DownloadKubeconfigFromSecretRefButtonSettings extends ButtonSettings {\n action: typeof DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION;\n /** Resource property holding the referenced Secret name. */\n resourceProperty: string;\n /** Secret `data` key to download; defaults to `kubeconfig`. */\n dataKey?: string;\n /** Download filename; defaults to `kubeconfig.yaml`. */\n filename?: string;\n /**\n * Resource property holding the Secret namespace; falls back to the\n * resource's own namespace, then the node context namespace.\n */\n namespaceProperty?: string;\n}\n\nexport interface UiView {\n actions?: PlatformMeshFieldDefinition[];\n fields?: PlatformMeshFieldDefinition[];\n resourceDescription?: PlatformMeshFieldDefinition;\n resourceTitle?: PlatformMeshFieldDefinition;\n backgroundImageUrl?: string;\n}\n\nexport interface UIDefinition {\n logoUrl?: string;\n listView?: ListView;\n createView?: UiView;\n detailView?: DetailView;\n}\n\nexport interface ListView extends UiView {\n /** Horizontal overflow behavior for list and search tables. Defaults to Scroll. */\n overflowMode?: 'Scroll' | 'Popin';\n filters?: FieldFilterDefinition[];\n baselineFilters?: FieldFilterDefinition[];\n /**\n * Absolute path a row click navigates to, with `{resource.<dot.path>}` and\n * `{context.<dot.path>}` placeholders resolved against the clicked row and the\n * current Luigi context respectively — e.g.\n * `\"/workspaces/{context.org}/components/{resource.metadata.name}\"`.\n * When set, overrides the default relative navigation to the row's detail\n * view, so a flat list can link into an entity-scoped path.\n */\n resourceURL?: string;\n}\n\nexport interface DetailView extends UiView {\n showDownloadKubeconfig?: boolean;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,GAAG;AACtB,MAAM,eAAe,GAAG;;ACsDxB,MAAM,wBAAwB,GAAG;AACtC,IAAA,KAAK,EAAE,OAAO;AACd,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,OAAO,EAAE,SAAS;;;AC5Bb,MAAM,0CAA0C,GACrD;;AC/BF;;AAEG;;;;"}
|
|
@@ -11,8 +11,8 @@ import { HttpLink } from 'apollo-angular/http';
|
|
|
11
11
|
import { print } from 'graphql';
|
|
12
12
|
import { createClient } from 'graphql-sse';
|
|
13
13
|
import { of, throwError, catchError as catchError$1, map as map$1, firstValueFrom } from 'rxjs';
|
|
14
|
-
import { catchError, map, shareReplay } from 'rxjs/operators';
|
|
15
|
-
import { isNamespacedResource, getValueByPath, buildResourcePath, getResourceValueByJsonPath,
|
|
14
|
+
import { catchError, map, switchMap, shareReplay } from 'rxjs/operators';
|
|
15
|
+
import { isNamespacedResource, getValueByPath, buildResourcePath, getResourceValueByJsonPath, stripTypename, buildGraphQLInputTypeName, decodeBase64, generateGraphQLFields } from '@platform-mesh/portal-ui-lib/utils';
|
|
16
16
|
import * as gqlBuilder from 'gql-query-builder';
|
|
17
17
|
|
|
18
18
|
class GatewayService {
|
|
@@ -475,68 +475,86 @@ class ResourceService {
|
|
|
475
475
|
const isNamespaced = isNamespacedResource(nodeContext);
|
|
476
476
|
const { apiGroup, entity, version } = resourceDefinition;
|
|
477
477
|
const namespace = this.getNamespace(nodeContext, resource);
|
|
478
|
-
const
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
478
|
+
const apollo = this.apolloFactory.apollo(nodeContext);
|
|
479
|
+
return this.readInputTypeName(apollo, resourceDefinition).pipe(switchMap((inputTypeName) => {
|
|
480
|
+
const mutationFields = [
|
|
481
|
+
{
|
|
482
|
+
operation: `create${entity}`,
|
|
483
|
+
variables: {
|
|
484
|
+
...(isNamespaced && {
|
|
485
|
+
namespace: { type: 'String', value: namespace },
|
|
486
|
+
}),
|
|
487
|
+
object: {
|
|
488
|
+
type: `${inputTypeName}!`,
|
|
489
|
+
value: resource,
|
|
490
|
+
},
|
|
488
491
|
},
|
|
492
|
+
fields: ['__typename'],
|
|
489
493
|
},
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
});
|
|
494
|
+
];
|
|
495
|
+
const queryOptions = this.calcQueryOptions(mutationFields, [
|
|
496
|
+
{ operation: apiGroup },
|
|
497
|
+
{ operation: version },
|
|
498
|
+
]);
|
|
499
|
+
const mutation = gqlBuilder.mutation(queryOptions);
|
|
500
|
+
const query = this.parseGQLQuery(mutation.query);
|
|
501
|
+
return apollo.mutate({
|
|
502
|
+
mutation: query,
|
|
503
|
+
fetchPolicy: 'no-cache',
|
|
504
|
+
variables: mutation.variables,
|
|
505
|
+
});
|
|
506
|
+
}));
|
|
504
507
|
}
|
|
505
508
|
update(resource, resourceDefinition, nodeContext, readFromParentKcpPath = false, fields = ['__typename']) {
|
|
506
509
|
const isNamespaced = isNamespacedResource(nodeContext);
|
|
507
510
|
const { apiGroup, entity, version } = resourceDefinition;
|
|
508
511
|
const namespace = this.getNamespace(nodeContext, resource);
|
|
509
512
|
const cleanResource = stripTypename(resource);
|
|
510
|
-
const
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
513
|
+
const apollo = this.apolloFactory.apollo(nodeContext, readFromParentKcpPath);
|
|
514
|
+
return this.readInputTypeName(apollo, resourceDefinition).pipe(switchMap((inputTypeName) => {
|
|
515
|
+
const mutationFields = [
|
|
516
|
+
{
|
|
517
|
+
operation: `update${entity}`,
|
|
518
|
+
variables: {
|
|
519
|
+
...(isNamespaced && {
|
|
520
|
+
namespace: { type: 'String', value: namespace },
|
|
521
|
+
}),
|
|
522
|
+
name: { type: 'String!', value: resource.metadata.name },
|
|
523
|
+
object: {
|
|
524
|
+
type: `${inputTypeName}!`,
|
|
525
|
+
value: cleanResource,
|
|
526
|
+
},
|
|
521
527
|
},
|
|
528
|
+
fields: fields,
|
|
522
529
|
},
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
530
|
+
];
|
|
531
|
+
const queryOptions = this.calcQueryOptions(mutationFields, [
|
|
532
|
+
{ operation: apiGroup },
|
|
533
|
+
{ operation: version },
|
|
534
|
+
]);
|
|
535
|
+
const mutation = gqlBuilder.mutation(queryOptions);
|
|
536
|
+
const query = this.parseGQLQuery(mutation.query);
|
|
537
|
+
return apollo.mutate({
|
|
538
|
+
mutation: query,
|
|
539
|
+
fetchPolicy: 'no-cache',
|
|
540
|
+
variables: mutation.variables,
|
|
541
|
+
});
|
|
542
|
+
}), map((res) => getValueByPath(res.data, buildResourcePath({ apiGroup, entity: `update${entity}`, version }, '.'))));
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Reads the `__typename` of the query type that holds the resource, e.g.
|
|
546
|
+
* `{ network_api_foo_bar { v1alpha1 { __typename } } }`, and derives the
|
|
547
|
+
* mutation input type name from it. The gateway generates the schema, so
|
|
548
|
+
* its type names are the only source of truth.
|
|
549
|
+
*/
|
|
550
|
+
readInputTypeName(apollo, resourceDefinition) {
|
|
551
|
+
const { apiGroup, entity, version } = resourceDefinition;
|
|
552
|
+
const selection = [apiGroup, version]
|
|
553
|
+
.filter((field) => !!field)
|
|
554
|
+
.reduceRight((inner, field) => `${field} { ${inner} }`, '__typename');
|
|
555
|
+
return apollo
|
|
556
|
+
.query({ query: this.parseGQLQuery(`query { ${selection} }`) })
|
|
557
|
+
.pipe(map((res) => buildGraphQLInputTypeName(getValueByPath(res.data, buildResourcePath({ apiGroup, entity: '__typename', version }, '.')), entity)));
|
|
540
558
|
}
|
|
541
559
|
getNamespace(nodeContext, resource) {
|
|
542
560
|
// namespaceId can carry the '-all-' sentinel when the portal forwards the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform-mesh-portal-ui-lib-services.mjs","sources":["../../projects/lib/services/resource/gateway.service.ts","../../projects/lib/services/resource/apollo-factory.ts","../../projects/lib/services/resource/instance-permissions.service.ts","../../projects/lib/services/resource/resource.service.ts","../../projects/lib/services/resource/kubeconfig-secret.service.ts","../../projects/lib/services/resource/account-info.queries.ts","../../projects/lib/services/resource/account-info.service.ts","../../projects/lib/services/resource/logical-cluster.queries.ts","../../projects/lib/services/resource/logical-cluster.service.ts","../../projects/lib/services/resource/namespace.service.ts","../../projects/lib/services/error-handler.service.ts","../../projects/lib/services/org-ready.service.ts","../../projects/lib/services/platform-mesh-portal-ui-lib-services.ts"],"sourcesContent":["import { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport { kcpRootOrgsPath } from '@platform-mesh/portal-ui-lib/models';\n\n@Injectable({ providedIn: 'root' })\nexport class GatewayService {\n private luigiCoreService = inject(LuigiCoreService);\n\n public getGatewayUrl(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ) {\n const gatewayUrl = nodeContext.portalContext.crdGatewayApiUrl;\n const currentKcpPath = this.extractKcpPath(gatewayUrl);\n return gatewayUrl?.replace(\n currentKcpPath,\n this.resolveKcpPath(nodeContext, readFromParentKcpPath),\n );\n }\n\n public updateCrdGatewayUrlWithEntityPath(kcpPath: string) {\n const gatewayUrl =\n this.luigiCoreService.getGlobalContext().portalContext.crdGatewayApiUrl;\n const currentKcpPath = this.extractKcpPath(gatewayUrl);\n this.luigiCoreService.getGlobalContext().portalContext.crdGatewayApiUrl =\n gatewayUrl.replace(currentKcpPath, kcpPath);\n }\n\n public resolveKcpPath(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): string {\n const gatewayUrl = nodeContext.portalContext.crdGatewayApiUrl;\n\n let kcpPath = this.extractKcpPath(gatewayUrl);\n if (nodeContext.kcpPath) {\n kcpPath = nodeContext.kcpPath;\n }\n\n if (readFromParentKcpPath) {\n const lastIndex = kcpPath.lastIndexOf(':');\n if (lastIndex !== -1) {\n kcpPath = kcpPath.slice(0, lastIndex);\n }\n }\n\n return kcpPath;\n }\n\n private extractKcpPath(gatewayUrl: string): string {\n return gatewayUrl.match(new RegExp(`(${kcpRootOrgsPath}[^/]*)`))?.[1] || '';\n }\n}\n","import { GatewayService } from './gateway.service';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { AuthService, LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport {\n type ApolloClientOptions,\n ApolloLink,\n Observable as ApolloObservable,\n FetchResult,\n InMemoryCache,\n Operation,\n split,\n} from '@apollo/client/core';\nimport { SetContextLink } from '@apollo/client/link/context';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { Apollo } from 'apollo-angular';\nimport { HttpLink } from 'apollo-angular/http';\nimport { print } from 'graphql';\nimport { Client, ClientOptions, createClient } from 'graphql-sse';\n\nclass SSELink extends ApolloLink {\n private client: Client;\n\n constructor(options: ClientOptions) {\n super();\n this.client = createClient(options);\n }\n\n public override request(operation: Operation): ApolloObservable<FetchResult> {\n return new ApolloObservable((sink) => {\n return this.client.subscribe(\n { ...operation, query: print(operation.query) },\n {\n next: sink.next.bind(sink),\n complete: sink.complete.bind(sink),\n error: sink.error.bind(sink),\n },\n );\n });\n }\n}\n\nconst noopZone = {\n run: (fn: any) => fn(),\n runOutsideAngular: (fn: any) => fn(),\n} as any;\n\n// Long enough for an in-flight boot refresh to land, short enough to be\n// invisible next to a reload.\nconst AUTH_RETRY_DELAY_MS = 750;\n\nconst isUnauthorized = (error: unknown): boolean => {\n const err = error as {\n status?: number;\n statusCode?: number;\n networkError?: { status?: number; statusCode?: number };\n };\n return [\n err?.status,\n err?.statusCode,\n err?.networkError?.status,\n err?.networkError?.statusCode,\n ].includes(401);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ApolloFactory {\n private httpLink = inject(HttpLink);\n private gatewayService = inject(GatewayService);\n private authService = inject(AuthService);\n private luigiCoreService = inject(LuigiCoreService);\n\n public readonly apollo = (\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): Apollo =>\n new Apollo(\n noopZone,\n this.createApolloOptions(nodeContext, readFromParentKcpPath),\n );\n\n /**\n * The token must be resolved per request, never captured at client\n * creation: a client built before the shell delivers the token would\n * otherwise send \"Bearer undefined\" for its whole lifetime (silent 401s,\n * empty views until a hard reload). Prefer live sources over the node\n * context, which is a mount-time snapshot: in web-component bundles the\n * injected AuthService belongs to a separate injector that never runs a\n * refresh, so the shell's Luigi auth store is the only value that tracks\n * the boot refresh and later scheduled refreshes.\n */\n private resolveToken(nodeContext: ResourceNodeContext): string | undefined {\n return (\n this.authService.getToken() ||\n this.resolveLuigiStoreToken() ||\n nodeContext.token\n );\n }\n\n // Web components run on the shell window; iframe-based MFEs have no\n // window.Luigi, so the service throws and we fall through to the node\n // context. LuigiCoreService wraps the same shell global (stateless), so\n // it is injector-safe for web-component bundles.\n private resolveLuigiStoreToken(): string | undefined {\n try {\n return this.luigiCoreService.getAuthData()?.idToken;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Retries an operation exactly once when the gateway answers 401. The\n * Authorization header is rebuilt by the context link on the retry, so a\n * request that raced ahead of token delivery (or whose token expired in\n * flight) heals itself instead of leaving the view empty until a manual\n * reload. 401 means the request was rejected before execution, so this\n * is safe for mutations too.\n */\n private createAuthRetryLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n return new ApolloObservable((observer) => {\n let activeSub: { unsubscribe(): void } | undefined;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n const attempt = (isRetry: boolean) => {\n // A retry replaces the failed subscription; release the previous\n // one explicitly instead of relying on the errored link having\n // closed it downstream.\n activeSub?.unsubscribe();\n activeSub = forward(operation).subscribe({\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (error: unknown) => {\n if (!isRetry && isUnauthorized(error)) {\n retryTimer = setTimeout(\n () => attempt(true),\n AUTH_RETRY_DELAY_MS,\n );\n return;\n }\n observer.error(error);\n },\n });\n };\n attempt(false);\n return () => {\n if (retryTimer !== undefined) {\n clearTimeout(retryTimer);\n }\n activeSub?.unsubscribe();\n };\n });\n });\n }\n\n private createApolloOptions(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): ApolloClientOptions {\n const contextLink = new SetContextLink((prevContext) => {\n const baseHeaders =\n prevContext.headers instanceof HttpHeaders\n ? prevContext.headers\n : new HttpHeaders(prevContext.headers ?? {});\n\n return {\n ...prevContext,\n uri: () =>\n this.gatewayService.getGatewayUrl(nodeContext, readFromParentKcpPath),\n headers: baseHeaders\n .set('Authorization', `Bearer ${this.resolveToken(nodeContext)}`)\n .set('Accept', 'charset=utf-8'),\n };\n });\n\n const splitClient = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'subscription'\n );\n },\n new SSELink({\n url: () =>\n this.gatewayService.getGatewayUrl(nodeContext, readFromParentKcpPath),\n headers: () => ({\n Authorization: `Bearer ${this.resolveToken(nodeContext)}`,\n }),\n }),\n this.httpLink.create({}),\n );\n\n // Retry sits outermost so a retry re-runs the context link and picks\n // up a freshly resolved token.\n const link = ApolloLink.from([\n this.createAuthRetryLink(),\n contextLink,\n splitClient,\n ]);\n const cache = new InMemoryCache();\n\n return {\n link,\n cache,\n };\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport { PermissionsDefinition } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable, of } from 'rxjs';\nimport { catchError } from 'rxjs/operators';\n\nexport interface InstanceCheck {\n resource: string;\n group: string;\n namespace?: string;\n name: string;\n actions: string[];\n}\n\nexport interface ResourceCheckRequest {\n organization: string;\n accountPath?: string;\n checks: InstanceCheck[];\n}\n\nexport interface InstancePermissionResponse {\n resource: string;\n namespace?: string;\n name?: string;\n actions: string[];\n}\n\n@Injectable({ providedIn: 'root' })\nexport class InstancePermissionsService {\n private httpClient = inject(HttpClient);\n private luigiCoreService = inject(LuigiCoreService);\n\n private requestChecks(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instances: { name: string; namespace?: string }[],\n ): Observable<InstancePermissionResponse[]> {\n if (!permissionsDefinition?.entityActions.length || !instances.length) {\n return of([]);\n }\n\n const organization = nodeContext.organization;\n const accountPath = nodeContext.accountPath;\n const token = this.luigiCoreService.getAuthData()?.idToken;\n\n if (!organization || !token) {\n return of([]);\n }\n\n const checks: InstanceCheck[] = instances.map((instance) => ({\n resource: permissionsDefinition.resource,\n group: permissionsDefinition.group,\n name: instance.name,\n namespace: instance.namespace,\n actions: permissionsDefinition.entityActions,\n }));\n\n const body: ResourceCheckRequest = {\n organization,\n accountPath,\n checks,\n };\n\n return this.httpClient\n .post<InstancePermissionResponse[]>(\n '/rest/permissions/resource-check',\n body,\n { headers: { Authorization: `Bearer ${token}` } },\n )\n .pipe(catchError(() => of([])));\n }\n\n checkInstance(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instance: { name: string; namespace?: string },\n ): Observable<InstancePermissionResponse[]> {\n return this.requestChecks(nodeContext, permissionsDefinition, [instance]);\n }\n\n checkInstances(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instances: { name: string; namespace?: string }[],\n ): Observable<InstancePermissionResponse[]> {\n return this.requestChecks(nodeContext, permissionsDefinition, instances);\n }\n}\n","import {\n ReadResources,\n ReadResourcesPagination,\n ReadResourcesParams,\n ReadResourcesResult,\n ReadResourcesSubscriptionResult,\n} from '../read-resources/read-resources';\nimport { ApolloFactory } from './apollo-factory';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { TypedDocumentNode } from '@apollo/client/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport {\n ALL_NAMESPACE,\n Resource,\n ResourceDefinition,\n ResourceListResult,\n ResourcePagination,\n ResourceSubscriptionResult,\n} from '@platform-mesh/portal-ui-lib/models';\nimport {\n buildGraphQLInputTypeName,\n buildResourcePath,\n getResourceValueByJsonPath,\n getValueByPath,\n isNamespacedResource,\n stripTypename,\n} from '@platform-mesh/portal-ui-lib/utils';\nimport { gql } from 'apollo-angular';\nimport type {\n Fields,\n NestedField,\n QueryBuilderOptions,\n VariableOptions,\n} from 'gql-query-builder';\nimport * as gqlBuilder from 'gql-query-builder';\nimport { Observable, throwError } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\nexport interface ResourceRequestParams {\n entity: string;\n version: string;\n apiGroup?: string;\n}\n\nexport interface ListOptions {\n readFromParentKcpPath?: boolean;\n pagination?: ResourcePagination;\n variables?: VariableOptions;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResourceService {\n private apolloFactory = inject(ApolloFactory);\n private luigiCoreService = inject(LuigiCoreService);\n\n read(\n resourceId: string,\n params: ResourceRequestParams,\n fieldsOrRawQuery: any[] | string,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = true,\n ): Observable<Resource> {\n const isNamespaced = isNamespacedResource(nodeContext);\n const namespace = this.getNamespace(nodeContext);\n\n let query: string | TypedDocumentNode<any, any> = this.resolveReadQuery(\n params,\n fieldsOrRawQuery,\n resourceId,\n isNamespaced ? namespace : undefined,\n );\n\n query = this.parseGQLQuery(query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: {\n name: resourceId,\n ...(isNamespaced && {\n namespace: namespace,\n }),\n },\n })\n .pipe(\n map((res) =>\n getValueByPath<any, any>(res.data, buildResourcePath(params, '.')),\n ),\n );\n }\n\n private resolveReadQuery(\n params: ResourceRequestParams,\n fieldsOrRawQuery: any[] | string,\n resourceId: string,\n namespace: string | undefined,\n ) {\n if (fieldsOrRawQuery instanceof Array) {\n const { entity, version, apiGroup } = params;\n const queryFields = [\n {\n operation: entity,\n variables: {\n name: { value: resourceId, type: 'String!' },\n ...(namespace && {\n namespace: { value: namespace, type: 'String' },\n }),\n },\n fields: fieldsOrRawQuery,\n },\n ];\n\n const queryOptions = this.calcQueryOptions(queryFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n return gqlBuilder.query(queryOptions).query;\n } else {\n return fieldsOrRawQuery;\n }\n }\n\n list(\n operation: string,\n fieldsOrRawQuery: any[] | string,\n nodeContext: ResourceNodeContext,\n options: ListOptions = {},\n ): Observable<ResourceListResult | any> {\n const {\n readFromParentKcpPath = false,\n pagination,\n variables: extraVariables,\n } = options;\n\n const isNamespaced = isNamespacedResource(nodeContext);\n const variables = {\n ...(isNamespaced && {\n namespace: { type: 'String', value: this.getNamespace(nodeContext) },\n }),\n ...(pagination?.limit && {\n limit: { type: 'Int', value: pagination?.limit },\n }),\n ...(pagination?.continue && {\n continue: { type: 'String', value: pagination?.continue },\n }),\n ...extraVariables,\n };\n\n const resourceDefinition = nodeContext.resourceDefinition;\n if (!resourceDefinition) {\n return throwError(() => new Error('Resource definition is required'));\n }\n\n return fieldsOrRawQuery instanceof Array\n ? this.listWithFields(\n resourceDefinition,\n fieldsOrRawQuery,\n nodeContext,\n readFromParentKcpPath,\n variables,\n )\n : this.listWithRawQuery(\n operation,\n fieldsOrRawQuery,\n nodeContext,\n readFromParentKcpPath,\n variables,\n );\n }\n\n private getResourceReadyStatus(\n resource: Resource,\n nodeContext: ResourceNodeContext,\n ) {\n const readyCondition = nodeContext.resourceDefinition?.readyCondition;\n if (readyCondition) {\n return getResourceValueByJsonPath(resource, readyCondition);\n }\n\n return true;\n }\n\n private listWithFields(\n resourceDefinition: ResourceDefinition,\n fields: any[],\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean,\n variables: VariableOptions,\n ): Observable<ResourceListResult> {\n const { apiGroup, entityCollection, version } = resourceDefinition;\n const queryFields = [\n {\n operation: entityCollection,\n variables,\n fields: [\n 'resourceVersion',\n 'remainingItemCount',\n 'continue',\n { items: fields },\n ],\n },\n ];\n const queryOptions = this.calcQueryOptions(queryFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const listQuery = gqlBuilder.query(queryOptions);\n const query = this.parseGQLQuery(listQuery.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: listQuery.variables,\n })\n .pipe(\n map((res: any): ResourceListResult => {\n const resourceListResult = getValueByPath<any, any>(\n res.data,\n buildResourcePath(\n { apiGroup, version, entity: entityCollection },\n '.',\n ),\n );\n if (!resourceListResult) {\n throw new Error('Resource list result not found');\n }\n\n return resourceListResult;\n }),\n map((resourceListResult) => {\n const processedResult: Resource[] = resourceListResult.items\n .map((resource) => ({\n ...resource,\n ready: this.getResourceReadyStatus(resource, nodeContext),\n }))\n .map((r) => ({\n ...r,\n id: this.getResourceId(r),\n isAvailable: this.isAvailable(\n r,\n resourceDefinition.availableWhenNotReady,\n ),\n accessibleName: this.getAccessibleName(r),\n }));\n return { ...resourceListResult, items: processedResult };\n }),\n );\n }\n\n private getResourceId(resource: Resource) {\n return `${resource.metadata.name}${resource.metadata.namespace ? '_' + resource.metadata.namespace : ''}`;\n }\n\n isAvailable(item: Resource, availableWhenNotReady = false) {\n return (\n (!!item.ready || availableWhenNotReady) &&\n !item.metadata?.deletionTimestamp\n );\n }\n\n getAccessibleName(item: Resource): string | undefined {\n if (item.metadata?.deletionTimestamp) {\n return 'Resource is pending deletion';\n } else if (!item.ready) {\n return 'Resource is not ready';\n }\n\n return undefined;\n }\n\n private listWithRawQuery(\n operation: string,\n rawQuery: string,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean,\n variables: VariableOptions,\n ): Observable<any> {\n const query = this.parseGQLQuery(rawQuery);\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: this.normalizeGqlBuilderVariables(variables),\n })\n .pipe(\n map(\n (res: any): Resource[] =>\n getValueByPath<any, any>(res.data, operation) ?? [],\n ),\n );\n }\n\n resourceChangeSubscription(\n operation: string,\n fields: any[],\n nodeContext: ResourceNodeContext,\n resourceVersion: string,\n readFromParentKcpPath: boolean,\n ): Observable<ResourceSubscriptionResult | undefined> {\n const isNamespaced = isNamespacedResource(nodeContext);\n const variables = {\n ...(isNamespaced && {\n namespace: { type: 'String', value: this.getNamespace(nodeContext) },\n }),\n };\n const lowerCaseOperation = operation.toLowerCase();\n\n const subscriptionQuery = gqlBuilder.subscription({\n operation: lowerCaseOperation,\n fields: ['type', { object: fields }],\n variables: {\n ...variables,\n resourceVersion: {\n type: 'String',\n value: resourceVersion,\n },\n },\n });\n\n const query = this.parseGQLQuery(subscriptionQuery.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .subscribe({\n query,\n variables: subscriptionQuery.variables,\n })\n .pipe(\n map((res: any): ResourceSubscriptionResult | undefined => {\n const resource: ResourceSubscriptionResult | undefined =\n getValueByPath(res.data, lowerCaseOperation);\n if (resource) {\n resource.object.ready = this.getResourceReadyStatus(\n resource.object,\n nodeContext,\n );\n resource.object.id = this.getResourceId(resource.object);\n resource.object.isAvailable = this.isAvailable(\n resource.object,\n nodeContext.resourceDefinition?.availableWhenNotReady,\n );\n resource.object.accessibleName = this.getAccessibleName(\n resource.object,\n );\n }\n return resource;\n }),\n );\n }\n\n delete(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = false,\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const fields = [\n {\n operation: `delete${entity}`,\n variables: {\n name: { type: 'String!', value: resource.metadata.name },\n ...(isNamespaced && {\n namespace: {\n type: 'String',\n value: this.getNamespace(nodeContext),\n },\n }),\n },\n fields: [],\n },\n ];\n const queryOptions = this.calcQueryOptions(fields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .mutate<void>({\n mutation: query,\n variables: mutation.variables,\n });\n }\n\n create(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const namespace = this.getNamespace(nodeContext, resource);\n\n const mutationFields: any[] = [\n {\n operation: `create${entity}`,\n variables: {\n ...(isNamespaced && {\n namespace: { type: 'String', value: namespace },\n }),\n object: {\n type: `${buildGraphQLInputTypeName(apiGroup, version, entity)}!`,\n value: resource,\n },\n },\n fields: ['__typename'],\n },\n ];\n const queryOptions = this.calcQueryOptions(mutationFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return this.apolloFactory.apollo(nodeContext).mutate({\n mutation: query,\n fetchPolicy: 'no-cache',\n variables: mutation.variables,\n });\n }\n\n update(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = false,\n fields: any[] = ['__typename'],\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const namespace = this.getNamespace(nodeContext, resource);\n\n const cleanResource = stripTypename(resource);\n\n const mutationFields: any[] = [\n {\n operation: `update${entity}`,\n variables: {\n ...(isNamespaced && {\n namespace: { type: 'String', value: namespace },\n }),\n name: { type: 'String!', value: resource.metadata.name },\n object: {\n type: `${buildGraphQLInputTypeName(apiGroup, version, entity)}!`,\n value: cleanResource,\n },\n },\n fields: fields,\n },\n ];\n const queryOptions = this.calcQueryOptions(mutationFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .mutate({\n mutation: query,\n fetchPolicy: 'no-cache',\n variables: mutation.variables,\n })\n .pipe(\n map((res: any) =>\n getValueByPath(\n res.data,\n buildResourcePath(\n { apiGroup, entity: `update${entity}`, version },\n '.',\n ),\n ),\n ),\n );\n }\n\n getNamespace(\n nodeContext: ResourceNodeContext,\n resource?: Resource,\n ): string | undefined {\n // namespaceId can carry the '-all-' sentinel when the portal forwards the\n // namespace selection; it is never a real namespace, so fall through.\n if (nodeContext.namespaceId && nodeContext.namespaceId !== ALL_NAMESPACE) {\n return nodeContext.namespaceId;\n }\n\n if (resource?.metadata?.namespace) {\n return resource.metadata.namespace;\n }\n\n const namespace = this.luigiCoreService\n .routing()\n .getSearchParams().namespace;\n\n if (namespace) {\n return namespace === ALL_NAMESPACE ? undefined : namespace;\n }\n\n return undefined;\n }\n\n private normalizeGqlBuilderVariables(\n variables: VariableOptions,\n ): Record<string, any> {\n return Object.fromEntries(\n Object.entries(variables).map(([key, value]) => [key, value.value]),\n );\n }\n\n private calcQueryOptions(\n innerFields: Fields,\n wrappers: Partial<Omit<QueryBuilderOptions, 'fields'>>[],\n ): QueryBuilderOptions {\n const filteredWrappers = wrappers.filter(\n (wrapper): wrapper is Omit<QueryBuilderOptions, 'fields'> =>\n !!wrapper?.operation,\n );\n\n if (filteredWrappers.length === 0) {\n const completeQuery = innerFields.pop() as NestedField;\n if (completeQuery && completeQuery.operation && completeQuery.fields) {\n return completeQuery;\n }\n\n throw new Error('At least one wrapper or inner fields is required');\n }\n\n let fields = innerFields;\n let nextWrapper = filteredWrappers.pop() as Omit<\n QueryBuilderOptions,\n 'fields'\n >;\n\n filteredWrappers.forEach((wrapper) => {\n fields = [\n {\n operation: nextWrapper.operation,\n fields: innerFields,\n variables: nextWrapper.variables,\n },\n ];\n nextWrapper = wrapper;\n });\n\n return {\n operation: nextWrapper.operation,\n fields,\n variables: nextWrapper.variables,\n };\n }\n\n private parseGQLQuery(query: string) {\n try {\n return gql`\n ${query}\n `;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n this.luigiCoreService.showAlert({\n text: `Could not parse gql query: <br/><br/> ${query} <br/><br/> ${message}`,\n type: 'error',\n });\n throw error;\n }\n }\n\n /**\n * Returns a {@link ReadResources}-shaped adapter over this service so that\n * consumers can swap implementations behind a feature toggle without depending\n * on the GraphQL-specific signatures of `list` / `resourceChangeSubscription`.\n */\n asReadResources(): ReadResources {\n return {\n list: (\n nodeContext: ResourceNodeContext,\n pagination: ReadResourcesPagination,\n params: ReadResourcesParams,\n ): Observable<ReadResourcesResult> => {\n const operation =\n params.operation ??\n nodeContext.resourceDefinition?.entityCollection ??\n '';\n const fields =\n params.fields ??\n nodeContext.resourceDefinition?.ui?.listView?.fields ??\n [];\n const resourcePagination: ResourcePagination = {\n limit: pagination.limit,\n continue: pagination.cursor,\n };\n\n return this.list(operation, fields, nodeContext, {\n readFromParentKcpPath: params.readFromParentKcpPath ?? false,\n pagination: resourcePagination,\n }).pipe(\n map((result: ResourceListResult): ReadResourcesResult => ({\n items: result?.items ?? [],\n nextCursor: result?.continue,\n remainingItemCount: result?.remainingItemCount,\n resourceVersion: result?.resourceVersion,\n })),\n );\n },\n subscribe: (\n nodeContext: ResourceNodeContext,\n params: ReadResourcesParams & { resourceVersion?: string },\n ): Observable<ReadResourcesSubscriptionResult | undefined> => {\n const operation =\n nodeContext.resourceDefinition?.entityCollection ?? '';\n const fields = Array.isArray(params.fields)\n ? params.fields\n : ((nodeContext.resourceDefinition?.ui?.listView?.fields as any[]) ??\n []);\n\n return this.resourceChangeSubscription(\n operation,\n fields,\n nodeContext,\n params.resourceVersion ?? '',\n params.readFromParentKcpPath ?? false,\n );\n },\n };\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { ResourceService } from './resource.service';\nimport { Injectable, inject } from '@angular/core';\nimport {\n ALL_NAMESPACE,\n ButtonSettings,\n DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION,\n DownloadKubeconfigFromSecretRefButtonSettings,\n PlatformMeshFieldDefinition,\n Resource,\n ResourceDefinition,\n} from '@platform-mesh/portal-ui-lib/models';\nimport {\n decodeBase64,\n getResourceValueByJsonPath,\n} from '@platform-mesh/portal-ui-lib/utils';\nimport { Observable, catchError, map, throwError } from 'rxjs';\n\nconst SECRET_RESOURCE_DEFINITION: ResourceDefinition = {\n version: 'v1',\n entity: 'Secret',\n entityCollection: 'Secrets',\n scope: 'Namespaced',\n};\n\nconst DEFAULT_DATA_KEY = 'kubeconfig';\nconst DEFAULT_FILENAME = 'kubeconfig.yaml';\n\nexport interface KubeconfigDownload {\n contents: string;\n filename: string;\n}\n\ninterface SecretReference {\n name: string;\n namespace: string;\n}\n\nexport function isDownloadKubeconfigButtonSettings(\n buttonSettings: ButtonSettings | undefined,\n): buttonSettings is DownloadKubeconfigFromSecretRefButtonSettings {\n return buttonSettings?.action === DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KubeconfigSecretService {\n private resourceService = inject(ResourceService);\n\n /**\n * Fields the detail-view query has to read so the action can resolve its\n * Secret reference from the loaded resource.\n */\n secretReferenceQueryFields(\n buttonSettings: ButtonSettings | undefined,\n ): PlatformMeshFieldDefinition[] {\n if (!isDownloadKubeconfigButtonSettings(buttonSettings)) {\n return [];\n }\n\n const fields: PlatformMeshFieldDefinition[] = [];\n const resourceProperty = this.readString(buttonSettings.resourceProperty);\n if (resourceProperty) {\n fields.push({ property: resourceProperty });\n }\n const namespaceProperty = this.readString(buttonSettings.namespaceProperty);\n if (namespaceProperty) {\n fields.push({ property: namespaceProperty });\n }\n\n return fields;\n }\n\n isSecretReferenceAvailable(\n buttonSettings: ButtonSettings | undefined,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): boolean {\n return (\n isDownloadKubeconfigButtonSettings(buttonSettings) &&\n this.resolveSecretReference(buttonSettings, resource, context) !==\n undefined\n );\n }\n\n readKubeconfig(\n buttonSettings: ButtonSettings,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): Observable<KubeconfigDownload> {\n if (!isDownloadKubeconfigButtonSettings(buttonSettings)) {\n return throwError(\n () => new Error('Button is not a kubeconfig download action'),\n );\n }\n\n const secretReference = this.resolveSecretReference(\n buttonSettings,\n resource,\n context,\n );\n if (!secretReference) {\n return throwError(\n () => new Error('Kubeconfig Secret reference is not available'),\n );\n }\n\n const dataKey = this.readString(buttonSettings.dataKey) ?? DEFAULT_DATA_KEY;\n const filename =\n this.readString(buttonSettings.filename) ?? DEFAULT_FILENAME;\n const secretContext: ResourceNodeContext = {\n ...context,\n namespaceId: secretReference.namespace,\n resourceDefinition: SECRET_RESOURCE_DEFINITION,\n };\n\n return this.resourceService\n .read(\n secretReference.name,\n SECRET_RESOURCE_DEFINITION,\n ['data'],\n secretContext,\n false,\n )\n .pipe(\n catchError(() =>\n throwError(() => new Error('Kubeconfig Secret could not be read')),\n ),\n map((secret) => {\n const encodedKubeconfig = this.readString(secret?.data?.[dataKey]);\n if (!encodedKubeconfig) {\n throw new Error(\n `Kubeconfig data key \"${dataKey}\" is not available`,\n );\n }\n\n return {\n contents: decodeBase64(encodedKubeconfig),\n filename,\n };\n }),\n );\n }\n\n private resolveSecretReference(\n buttonSettings: DownloadKubeconfigFromSecretRefButtonSettings,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): SecretReference | undefined {\n if (!resource) {\n return undefined;\n }\n\n try {\n const resourceProperty = this.readString(buttonSettings.resourceProperty);\n if (!resourceProperty) {\n return undefined;\n }\n\n const name = this.readString(\n getResourceValueByJsonPath(resource, {\n property: resourceProperty,\n }),\n );\n const namespaceProperty = this.readString(\n buttonSettings.namespaceProperty,\n );\n const namespace = namespaceProperty\n ? this.namespaceOf(\n getResourceValueByJsonPath(resource, {\n property: namespaceProperty,\n }),\n )\n : (this.namespaceOf(resource.metadata?.namespace) ??\n this.namespaceOf(this.resourceService.getNamespace(context)));\n\n return name && namespace ? { name, namespace } : undefined;\n } catch {\n return undefined;\n }\n }\n\n private namespaceOf(value: unknown): string | undefined {\n const namespace = this.readString(value);\n return namespace && namespace !== ALL_NAMESPACE ? namespace : undefined;\n }\n\n private readString(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n }\n}\n","import { gql } from 'apollo-angular';\n\nexport const accountInfoRead = gql`\n {\n core_platform_mesh_io {\n v1alpha1 {\n AccountInfo(name: \"account\") {\n metadata {\n name\n annotations\n }\n spec {\n account {\n originClusterId\n }\n clusterInfo {\n ca\n }\n organization {\n originClusterId\n name\n }\n oidc {\n clients\n issuerUrl\n }\n }\n }\n }\n }\n }\n`;\n","import { accountInfoRead } from './account-info.queries';\nimport { ApolloFactory } from './apollo-factory';\nimport { GatewayService } from './gateway.service';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { AccountInfo } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable, throwError } from 'rxjs';\nimport { catchError, map, shareReplay } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountInfoService {\n private apolloFactory = inject(ApolloFactory);\n private gatewayService = inject(GatewayService);\n private readCache = new Map<string, Observable<AccountInfo>>();\n\n read(nodeContext: ResourceNodeContext): Observable<AccountInfo> {\n const cacheKey = this.gatewayService.getGatewayUrl(nodeContext);\n const cachedRead = this.readCache.get(cacheKey);\n if (cachedRead) {\n return cachedRead;\n }\n\n const request$ = this.apolloFactory\n .apollo(nodeContext)\n .query<AccountInfo>({\n query: accountInfoRead,\n })\n .pipe(\n map((res: any) => {\n const rawAccountInfo =\n res.data.core_platform_mesh_io.v1alpha1.AccountInfo;\n\n return {\n ...rawAccountInfo,\n spec: {\n ...rawAccountInfo.spec,\n oidc: {\n ...rawAccountInfo.spec.oidc,\n clients: JSON.parse(rawAccountInfo.spec.oidc.clients),\n },\n },\n };\n }),\n shareReplay(1),\n catchError((error) => {\n if (this.readCache.get(cacheKey) === request$) {\n this.readCache.delete(cacheKey);\n }\n return throwError(() => error);\n }),\n );\n\n this.readCache.set(cacheKey, request$);\n return request$;\n }\n}\n","import { gql } from 'apollo-angular';\n\nexport const queryLoginCluster = gql`\n {\n core_kcp_io {\n v1alpha1 {\n LogicalCluster(name: \"cluster\") {\n status {\n phase\n }\n }\n }\n }\n }\n`;\n","import { ApolloFactory } from './apollo-factory';\nimport { queryLoginCluster } from './logical-cluster.queries';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { LogicalCluster } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LogicalClusterService {\n private apolloFactory = inject(ApolloFactory);\n\n public read(nodeContext: ResourceNodeContext): Observable<LogicalCluster> {\n return this.apolloFactory\n .apollo(nodeContext)\n .query<LogicalCluster>({\n query: queryLoginCluster,\n })\n .pipe(map((res: any) => res.data.core_kcp_io.v1alpha1.LogicalCluster));\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { ResourceService } from './resource.service';\nimport { Injectable, inject } from '@angular/core';\nimport {\n ResourceDefinition,\n ResourceListResult,\n} from '@platform-mesh/portal-ui-lib/models';\nimport { generateGraphQLFields } from '@platform-mesh/portal-ui-lib/utils';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NamespaceService {\n private resourceService = inject(ResourceService);\n\n list(nodeContext: ResourceNodeContext): Observable<string[]> {\n return this.resourceService\n .list(\n 'v1_namespaces',\n generateGraphQLFields([{ property: 'metadata.name' }]),\n {\n portalContext: {\n crdGatewayApiUrl: nodeContext.portalContext.crdGatewayApiUrl,\n },\n resourceDefinition: {\n version: 'v1',\n entityCollection: 'Namespaces',\n entity: 'Namespace',\n scope: 'Cluster',\n } as ResourceDefinition,\n kcpPath: nodeContext.kcpPath,\n token: nodeContext.token,\n },\n )\n .pipe(\n map((result: ResourceListResult) =>\n result.items.map((item) => item.metadata.name),\n ),\n );\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\n\n@Injectable({ providedIn: 'root' })\nexport class ErrorHandlerService {\n private luigiCoreService = inject(LuigiCoreService);\n\n handleError(error: any, msg?: string) {\n const message =\n error?.message || error?.errors?.map((e: any) => e.message).join('\\n');\n this.luigiCoreService.showAlert({\n text:\n [msg, message].filter(Boolean).join('\\n') ||\n 'An unknown error occurred',\n type: 'error',\n });\n console.error(error);\n }\n\n errorCode(error: any): number {\n if (this.isUnauthorizedAccess(error)) {\n return 403;\n }\n\n return (\n [\n error?.statusCode,\n error?.status,\n error?.networkError?.statusCode,\n error?.networkError?.status,\n error?.response?.status,\n ].find(Boolean) ?? 500\n );\n }\n\n private isUnauthorizedAccess(error: any): boolean {\n return (\n !!error?.message?.toLowerCase().includes('forbidden') ||\n !!error?.message?.toLowerCase()?.includes('access denied')\n );\n }\n}\n","import { LogicalClusterService } from './resource';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AuthService,\n ConfigService,\n EnvConfigService,\n} from '@openmfp/portal-ui-lib';\nimport { firstValueFrom } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class OrganizationReadyService {\n private configService = inject(ConfigService);\n private envConfigService = inject(EnvConfigService);\n private logicalClusterService = inject(LogicalClusterService);\n private authService = inject(AuthService);\n\n private isReady = false;\n private pendingCheck?: Promise<boolean>;\n\n public isOrganizationReady(): Promise<boolean> {\n if (this.isReady) {\n return Promise.resolve(true);\n }\n\n this.pendingCheck ??= this.readOrganizationReady().finally(() => {\n this.pendingCheck = undefined;\n });\n\n return this.pendingCheck;\n }\n\n private async readOrganizationReady(): Promise<boolean> {\n const portalConfig = await this.configService.getPortalConfig();\n const { idpName } = await this.envConfigService.getEnvConfig();\n\n if (idpName === 'welcome') {\n return true;\n }\n\n try {\n const logicalCluster = await firstValueFrom(\n this.logicalClusterService.read({\n portalContext: {\n crdGatewayApiUrl: portalConfig.portalContext['crdGatewayApiUrl'],\n },\n token: this.authService.getToken(),\n accountId: idpName,\n }),\n );\n this.isReady = logicalCluster.status.phase === 'Ready';\n return this.isReady;\n } catch (error) {\n console.error('Org check failed', error);\n return true;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ApolloObservable","catchError","map"],"mappings":";;;;;;;;;;;;;;;;;MAMa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA8CpD,IAAA;AA5CQ,IAAA,aAAa,CAClB,WAAgC,EAChC,qBAAqB,GAAG,KAAK,EAAA;AAE7B,QAAA,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,gBAAgB;QAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;AACtD,QAAA,OAAO,UAAU,EAAE,OAAO,CACxB,cAAc,EACd,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACx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zB,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,IAAI;YACF,MAAM,cAAc,GAAG,MAAM,cAAc,CACzC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC;AAC9B,gBAAA,aAAa,EAAE;AACb,oBAAA,gBAAgB,EAAE,YAAY,CAAC,aAAa,CAAC,kBAAkB,CAAC;AACjE,iBAAA;AACD,gBAAA,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE;AAClC,gBAAA,SAAS,EAAE,OAAO;AACnB,aAAA,CAAC,CACH;YACD,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,OAAO;YACtD,OAAO,IAAI,CAAC,OAAO;QACrB;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC;AACxC,YAAA,OAAO,IAAI;QACb;IACF;8GA7CW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACTlC;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"platform-mesh-portal-ui-lib-services.mjs","sources":["../../projects/lib/services/resource/gateway.service.ts","../../projects/lib/services/resource/apollo-factory.ts","../../projects/lib/services/resource/instance-permissions.service.ts","../../projects/lib/services/resource/resource.service.ts","../../projects/lib/services/resource/kubeconfig-secret.service.ts","../../projects/lib/services/resource/account-info.queries.ts","../../projects/lib/services/resource/account-info.service.ts","../../projects/lib/services/resource/logical-cluster.queries.ts","../../projects/lib/services/resource/logical-cluster.service.ts","../../projects/lib/services/resource/namespace.service.ts","../../projects/lib/services/error-handler.service.ts","../../projects/lib/services/org-ready.service.ts","../../projects/lib/services/platform-mesh-portal-ui-lib-services.ts"],"sourcesContent":["import { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport { kcpRootOrgsPath } from '@platform-mesh/portal-ui-lib/models';\n\n@Injectable({ providedIn: 'root' })\nexport class GatewayService {\n private luigiCoreService = inject(LuigiCoreService);\n\n public getGatewayUrl(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ) {\n const gatewayUrl = nodeContext.portalContext.crdGatewayApiUrl;\n const currentKcpPath = this.extractKcpPath(gatewayUrl);\n return gatewayUrl?.replace(\n currentKcpPath,\n this.resolveKcpPath(nodeContext, readFromParentKcpPath),\n );\n }\n\n public updateCrdGatewayUrlWithEntityPath(kcpPath: string) {\n const gatewayUrl =\n this.luigiCoreService.getGlobalContext().portalContext.crdGatewayApiUrl;\n const currentKcpPath = this.extractKcpPath(gatewayUrl);\n this.luigiCoreService.getGlobalContext().portalContext.crdGatewayApiUrl =\n gatewayUrl.replace(currentKcpPath, kcpPath);\n }\n\n public resolveKcpPath(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): string {\n const gatewayUrl = nodeContext.portalContext.crdGatewayApiUrl;\n\n let kcpPath = this.extractKcpPath(gatewayUrl);\n if (nodeContext.kcpPath) {\n kcpPath = nodeContext.kcpPath;\n }\n\n if (readFromParentKcpPath) {\n const lastIndex = kcpPath.lastIndexOf(':');\n if (lastIndex !== -1) {\n kcpPath = kcpPath.slice(0, lastIndex);\n }\n }\n\n return kcpPath;\n }\n\n private extractKcpPath(gatewayUrl: string): string {\n return gatewayUrl.match(new RegExp(`(${kcpRootOrgsPath}[^/]*)`))?.[1] || '';\n }\n}\n","import { GatewayService } from './gateway.service';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { HttpHeaders } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { AuthService, LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport {\n type ApolloClientOptions,\n ApolloLink,\n Observable as ApolloObservable,\n FetchResult,\n InMemoryCache,\n Operation,\n split,\n} from '@apollo/client/core';\nimport { SetContextLink } from '@apollo/client/link/context';\nimport { getMainDefinition } from '@apollo/client/utilities';\nimport { Apollo } from 'apollo-angular';\nimport { HttpLink } from 'apollo-angular/http';\nimport { print } from 'graphql';\nimport { Client, ClientOptions, createClient } from 'graphql-sse';\n\nclass SSELink extends ApolloLink {\n private client: Client;\n\n constructor(options: ClientOptions) {\n super();\n this.client = createClient(options);\n }\n\n public override request(operation: Operation): ApolloObservable<FetchResult> {\n return new ApolloObservable((sink) => {\n return this.client.subscribe(\n { ...operation, query: print(operation.query) },\n {\n next: sink.next.bind(sink),\n complete: sink.complete.bind(sink),\n error: sink.error.bind(sink),\n },\n );\n });\n }\n}\n\nconst noopZone = {\n run: (fn: any) => fn(),\n runOutsideAngular: (fn: any) => fn(),\n} as any;\n\n// Long enough for an in-flight boot refresh to land, short enough to be\n// invisible next to a reload.\nconst AUTH_RETRY_DELAY_MS = 750;\n\nconst isUnauthorized = (error: unknown): boolean => {\n const err = error as {\n status?: number;\n statusCode?: number;\n networkError?: { status?: number; statusCode?: number };\n };\n return [\n err?.status,\n err?.statusCode,\n err?.networkError?.status,\n err?.networkError?.statusCode,\n ].includes(401);\n};\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ApolloFactory {\n private httpLink = inject(HttpLink);\n private gatewayService = inject(GatewayService);\n private authService = inject(AuthService);\n private luigiCoreService = inject(LuigiCoreService);\n\n public readonly apollo = (\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): Apollo =>\n new Apollo(\n noopZone,\n this.createApolloOptions(nodeContext, readFromParentKcpPath),\n );\n\n /**\n * The token must be resolved per request, never captured at client\n * creation: a client built before the shell delivers the token would\n * otherwise send \"Bearer undefined\" for its whole lifetime (silent 401s,\n * empty views until a hard reload). Prefer live sources over the node\n * context, which is a mount-time snapshot: in web-component bundles the\n * injected AuthService belongs to a separate injector that never runs a\n * refresh, so the shell's Luigi auth store is the only value that tracks\n * the boot refresh and later scheduled refreshes.\n */\n private resolveToken(nodeContext: ResourceNodeContext): string | undefined {\n return (\n this.authService.getToken() ||\n this.resolveLuigiStoreToken() ||\n nodeContext.token\n );\n }\n\n // Web components run on the shell window; iframe-based MFEs have no\n // window.Luigi, so the service throws and we fall through to the node\n // context. LuigiCoreService wraps the same shell global (stateless), so\n // it is injector-safe for web-component bundles.\n private resolveLuigiStoreToken(): string | undefined {\n try {\n return this.luigiCoreService.getAuthData()?.idToken;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Retries an operation exactly once when the gateway answers 401. The\n * Authorization header is rebuilt by the context link on the retry, so a\n * request that raced ahead of token delivery (or whose token expired in\n * flight) heals itself instead of leaving the view empty until a manual\n * reload. 401 means the request was rejected before execution, so this\n * is safe for mutations too.\n */\n private createAuthRetryLink(): ApolloLink {\n return new ApolloLink((operation, forward) => {\n return new ApolloObservable((observer) => {\n let activeSub: { unsubscribe(): void } | undefined;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n const attempt = (isRetry: boolean) => {\n // A retry replaces the failed subscription; release the previous\n // one explicitly instead of relying on the errored link having\n // closed it downstream.\n activeSub?.unsubscribe();\n activeSub = forward(operation).subscribe({\n next: observer.next.bind(observer),\n complete: observer.complete.bind(observer),\n error: (error: unknown) => {\n if (!isRetry && isUnauthorized(error)) {\n retryTimer = setTimeout(\n () => attempt(true),\n AUTH_RETRY_DELAY_MS,\n );\n return;\n }\n observer.error(error);\n },\n });\n };\n attempt(false);\n return () => {\n if (retryTimer !== undefined) {\n clearTimeout(retryTimer);\n }\n activeSub?.unsubscribe();\n };\n });\n });\n }\n\n private createApolloOptions(\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath = false,\n ): ApolloClientOptions {\n const contextLink = new SetContextLink((prevContext) => {\n const baseHeaders =\n prevContext.headers instanceof HttpHeaders\n ? prevContext.headers\n : new HttpHeaders(prevContext.headers ?? {});\n\n return {\n ...prevContext,\n uri: () =>\n this.gatewayService.getGatewayUrl(nodeContext, readFromParentKcpPath),\n headers: baseHeaders\n .set('Authorization', `Bearer ${this.resolveToken(nodeContext)}`)\n .set('Accept', 'charset=utf-8'),\n };\n });\n\n const splitClient = split(\n ({ query }) => {\n const definition = getMainDefinition(query);\n return (\n definition.kind === 'OperationDefinition' &&\n definition.operation === 'subscription'\n );\n },\n new SSELink({\n url: () =>\n this.gatewayService.getGatewayUrl(nodeContext, readFromParentKcpPath),\n headers: () => ({\n Authorization: `Bearer ${this.resolveToken(nodeContext)}`,\n }),\n }),\n this.httpLink.create({}),\n );\n\n // Retry sits outermost so a retry re-runs the context link and picks\n // up a freshly resolved token.\n const link = ApolloLink.from([\n this.createAuthRetryLink(),\n contextLink,\n splitClient,\n ]);\n const cache = new InMemoryCache();\n\n return {\n link,\n cache,\n };\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { HttpClient } from '@angular/common/http';\nimport { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport { PermissionsDefinition } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable, of } from 'rxjs';\nimport { catchError } from 'rxjs/operators';\n\nexport interface InstanceCheck {\n resource: string;\n group: string;\n namespace?: string;\n name: string;\n actions: string[];\n}\n\nexport interface ResourceCheckRequest {\n organization: string;\n accountPath?: string;\n checks: InstanceCheck[];\n}\n\nexport interface InstancePermissionResponse {\n resource: string;\n namespace?: string;\n name?: string;\n actions: string[];\n}\n\n@Injectable({ providedIn: 'root' })\nexport class InstancePermissionsService {\n private httpClient = inject(HttpClient);\n private luigiCoreService = inject(LuigiCoreService);\n\n private requestChecks(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instances: { name: string; namespace?: string }[],\n ): Observable<InstancePermissionResponse[]> {\n if (!permissionsDefinition?.entityActions.length || !instances.length) {\n return of([]);\n }\n\n const organization = nodeContext.organization;\n const accountPath = nodeContext.accountPath;\n const token = this.luigiCoreService.getAuthData()?.idToken;\n\n if (!organization || !token) {\n return of([]);\n }\n\n const checks: InstanceCheck[] = instances.map((instance) => ({\n resource: permissionsDefinition.resource,\n group: permissionsDefinition.group,\n name: instance.name,\n namespace: instance.namespace,\n actions: permissionsDefinition.entityActions,\n }));\n\n const body: ResourceCheckRequest = {\n organization,\n accountPath,\n checks,\n };\n\n return this.httpClient\n .post<InstancePermissionResponse[]>(\n '/rest/permissions/resource-check',\n body,\n { headers: { Authorization: `Bearer ${token}` } },\n )\n .pipe(catchError(() => of([])));\n }\n\n checkInstance(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instance: { name: string; namespace?: string },\n ): Observable<InstancePermissionResponse[]> {\n return this.requestChecks(nodeContext, permissionsDefinition, [instance]);\n }\n\n checkInstances(\n nodeContext: ResourceNodeContext,\n permissionsDefinition: PermissionsDefinition,\n instances: { name: string; namespace?: string }[],\n ): Observable<InstancePermissionResponse[]> {\n return this.requestChecks(nodeContext, permissionsDefinition, instances);\n }\n}\n","import {\n ReadResources,\n ReadResourcesPagination,\n ReadResourcesParams,\n ReadResourcesResult,\n ReadResourcesSubscriptionResult,\n} from '../read-resources/read-resources';\nimport { ApolloFactory } from './apollo-factory';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { TypedDocumentNode } from '@apollo/client/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\nimport {\n ALL_NAMESPACE,\n Resource,\n ResourceDefinition,\n ResourceListResult,\n ResourcePagination,\n ResourceSubscriptionResult,\n} from '@platform-mesh/portal-ui-lib/models';\nimport {\n buildGraphQLInputTypeName,\n buildResourcePath,\n getResourceValueByJsonPath,\n getValueByPath,\n isNamespacedResource,\n stripTypename,\n} from '@platform-mesh/portal-ui-lib/utils';\nimport { Apollo, gql } from 'apollo-angular';\nimport type {\n Fields,\n NestedField,\n QueryBuilderOptions,\n VariableOptions,\n} from 'gql-query-builder';\nimport * as gqlBuilder from 'gql-query-builder';\nimport { Observable, throwError } from 'rxjs';\nimport { map, switchMap } from 'rxjs/operators';\n\nexport interface ResourceRequestParams {\n entity: string;\n version: string;\n apiGroup?: string;\n}\n\nexport interface ListOptions {\n readFromParentKcpPath?: boolean;\n pagination?: ResourcePagination;\n variables?: VariableOptions;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class ResourceService {\n private apolloFactory = inject(ApolloFactory);\n private luigiCoreService = inject(LuigiCoreService);\n\n read(\n resourceId: string,\n params: ResourceRequestParams,\n fieldsOrRawQuery: any[] | string,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = true,\n ): Observable<Resource> {\n const isNamespaced = isNamespacedResource(nodeContext);\n const namespace = this.getNamespace(nodeContext);\n\n let query: string | TypedDocumentNode<any, any> = this.resolveReadQuery(\n params,\n fieldsOrRawQuery,\n resourceId,\n isNamespaced ? namespace : undefined,\n );\n\n query = this.parseGQLQuery(query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: {\n name: resourceId,\n ...(isNamespaced && {\n namespace: namespace,\n }),\n },\n })\n .pipe(\n map((res) =>\n getValueByPath<any, any>(res.data, buildResourcePath(params, '.')),\n ),\n );\n }\n\n private resolveReadQuery(\n params: ResourceRequestParams,\n fieldsOrRawQuery: any[] | string,\n resourceId: string,\n namespace: string | undefined,\n ) {\n if (fieldsOrRawQuery instanceof Array) {\n const { entity, version, apiGroup } = params;\n const queryFields = [\n {\n operation: entity,\n variables: {\n name: { value: resourceId, type: 'String!' },\n ...(namespace && {\n namespace: { value: namespace, type: 'String' },\n }),\n },\n fields: fieldsOrRawQuery,\n },\n ];\n\n const queryOptions = this.calcQueryOptions(queryFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n return gqlBuilder.query(queryOptions).query;\n } else {\n return fieldsOrRawQuery;\n }\n }\n\n list(\n operation: string,\n fieldsOrRawQuery: any[] | string,\n nodeContext: ResourceNodeContext,\n options: ListOptions = {},\n ): Observable<ResourceListResult | any> {\n const {\n readFromParentKcpPath = false,\n pagination,\n variables: extraVariables,\n } = options;\n\n const isNamespaced = isNamespacedResource(nodeContext);\n const variables = {\n ...(isNamespaced && {\n namespace: { type: 'String', value: this.getNamespace(nodeContext) },\n }),\n ...(pagination?.limit && {\n limit: { type: 'Int', value: pagination?.limit },\n }),\n ...(pagination?.continue && {\n continue: { type: 'String', value: pagination?.continue },\n }),\n ...extraVariables,\n };\n\n const resourceDefinition = nodeContext.resourceDefinition;\n if (!resourceDefinition) {\n return throwError(() => new Error('Resource definition is required'));\n }\n\n return fieldsOrRawQuery instanceof Array\n ? this.listWithFields(\n resourceDefinition,\n fieldsOrRawQuery,\n nodeContext,\n readFromParentKcpPath,\n variables,\n )\n : this.listWithRawQuery(\n operation,\n fieldsOrRawQuery,\n nodeContext,\n readFromParentKcpPath,\n variables,\n );\n }\n\n private getResourceReadyStatus(\n resource: Resource,\n nodeContext: ResourceNodeContext,\n ) {\n const readyCondition = nodeContext.resourceDefinition?.readyCondition;\n if (readyCondition) {\n return getResourceValueByJsonPath(resource, readyCondition);\n }\n\n return true;\n }\n\n private listWithFields(\n resourceDefinition: ResourceDefinition,\n fields: any[],\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean,\n variables: VariableOptions,\n ): Observable<ResourceListResult> {\n const { apiGroup, entityCollection, version } = resourceDefinition;\n const queryFields = [\n {\n operation: entityCollection,\n variables,\n fields: [\n 'resourceVersion',\n 'remainingItemCount',\n 'continue',\n { items: fields },\n ],\n },\n ];\n const queryOptions = this.calcQueryOptions(queryFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const listQuery = gqlBuilder.query(queryOptions);\n const query = this.parseGQLQuery(listQuery.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: listQuery.variables,\n })\n .pipe(\n map((res: any): ResourceListResult => {\n const resourceListResult = getValueByPath<any, any>(\n res.data,\n buildResourcePath(\n { apiGroup, version, entity: entityCollection },\n '.',\n ),\n );\n if (!resourceListResult) {\n throw new Error('Resource list result not found');\n }\n\n return resourceListResult;\n }),\n map((resourceListResult) => {\n const processedResult: Resource[] = resourceListResult.items\n .map((resource) => ({\n ...resource,\n ready: this.getResourceReadyStatus(resource, nodeContext),\n }))\n .map((r) => ({\n ...r,\n id: this.getResourceId(r),\n isAvailable: this.isAvailable(\n r,\n resourceDefinition.availableWhenNotReady,\n ),\n accessibleName: this.getAccessibleName(r),\n }));\n return { ...resourceListResult, items: processedResult };\n }),\n );\n }\n\n private getResourceId(resource: Resource) {\n return `${resource.metadata.name}${resource.metadata.namespace ? '_' + resource.metadata.namespace : ''}`;\n }\n\n isAvailable(item: Resource, availableWhenNotReady = false) {\n return (\n (!!item.ready || availableWhenNotReady) &&\n !item.metadata?.deletionTimestamp\n );\n }\n\n getAccessibleName(item: Resource): string | undefined {\n if (item.metadata?.deletionTimestamp) {\n return 'Resource is pending deletion';\n } else if (!item.ready) {\n return 'Resource is not ready';\n }\n\n return undefined;\n }\n\n private listWithRawQuery(\n operation: string,\n rawQuery: string,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean,\n variables: VariableOptions,\n ): Observable<any> {\n const query = this.parseGQLQuery(rawQuery);\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .query({\n query,\n variables: this.normalizeGqlBuilderVariables(variables),\n })\n .pipe(\n map(\n (res: any): Resource[] =>\n getValueByPath<any, any>(res.data, operation) ?? [],\n ),\n );\n }\n\n resourceChangeSubscription(\n operation: string,\n fields: any[],\n nodeContext: ResourceNodeContext,\n resourceVersion: string,\n readFromParentKcpPath: boolean,\n ): Observable<ResourceSubscriptionResult | undefined> {\n const isNamespaced = isNamespacedResource(nodeContext);\n const variables = {\n ...(isNamespaced && {\n namespace: { type: 'String', value: this.getNamespace(nodeContext) },\n }),\n };\n const lowerCaseOperation = operation.toLowerCase();\n\n const subscriptionQuery = gqlBuilder.subscription({\n operation: lowerCaseOperation,\n fields: ['type', { object: fields }],\n variables: {\n ...variables,\n resourceVersion: {\n type: 'String',\n value: resourceVersion,\n },\n },\n });\n\n const query = this.parseGQLQuery(subscriptionQuery.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .subscribe({\n query,\n variables: subscriptionQuery.variables,\n })\n .pipe(\n map((res: any): ResourceSubscriptionResult | undefined => {\n const resource: ResourceSubscriptionResult | undefined =\n getValueByPath(res.data, lowerCaseOperation);\n if (resource) {\n resource.object.ready = this.getResourceReadyStatus(\n resource.object,\n nodeContext,\n );\n resource.object.id = this.getResourceId(resource.object);\n resource.object.isAvailable = this.isAvailable(\n resource.object,\n nodeContext.resourceDefinition?.availableWhenNotReady,\n );\n resource.object.accessibleName = this.getAccessibleName(\n resource.object,\n );\n }\n return resource;\n }),\n );\n }\n\n delete(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = false,\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const fields = [\n {\n operation: `delete${entity}`,\n variables: {\n name: { type: 'String!', value: resource.metadata.name },\n ...(isNamespaced && {\n namespace: {\n type: 'String',\n value: this.getNamespace(nodeContext),\n },\n }),\n },\n fields: [],\n },\n ];\n const queryOptions = this.calcQueryOptions(fields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return this.apolloFactory\n .apollo(nodeContext, readFromParentKcpPath)\n .mutate<void>({\n mutation: query,\n variables: mutation.variables,\n });\n }\n\n create(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const namespace = this.getNamespace(nodeContext, resource);\n const apollo = this.apolloFactory.apollo(nodeContext);\n\n return this.readInputTypeName(apollo, resourceDefinition).pipe(\n switchMap((inputTypeName) => {\n const mutationFields: any[] = [\n {\n operation: `create${entity}`,\n variables: {\n ...(isNamespaced && {\n namespace: { type: 'String', value: namespace },\n }),\n object: {\n type: `${inputTypeName}!`,\n value: resource,\n },\n },\n fields: ['__typename'],\n },\n ];\n const queryOptions = this.calcQueryOptions(mutationFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return apollo.mutate({\n mutation: query,\n fetchPolicy: 'no-cache',\n variables: mutation.variables,\n });\n }),\n );\n }\n\n update(\n resource: Resource,\n resourceDefinition: ResourceDefinition,\n nodeContext: ResourceNodeContext,\n readFromParentKcpPath: boolean = false,\n fields: any[] = ['__typename'],\n ) {\n const isNamespaced = isNamespacedResource(nodeContext);\n const { apiGroup, entity, version } = resourceDefinition;\n const namespace = this.getNamespace(nodeContext, resource);\n\n const cleanResource = stripTypename(resource);\n const apollo = this.apolloFactory.apollo(\n nodeContext,\n readFromParentKcpPath,\n );\n\n return this.readInputTypeName(apollo, resourceDefinition).pipe(\n switchMap((inputTypeName) => {\n const mutationFields: any[] = [\n {\n operation: `update${entity}`,\n variables: {\n ...(isNamespaced && {\n namespace: { type: 'String', value: namespace },\n }),\n name: { type: 'String!', value: resource.metadata.name },\n object: {\n type: `${inputTypeName}!`,\n value: cleanResource,\n },\n },\n fields: fields,\n },\n ];\n const queryOptions = this.calcQueryOptions(mutationFields, [\n { operation: apiGroup },\n { operation: version },\n ]);\n const mutation = gqlBuilder.mutation(queryOptions);\n const query = this.parseGQLQuery(mutation.query);\n\n return apollo.mutate({\n mutation: query,\n fetchPolicy: 'no-cache',\n variables: mutation.variables,\n });\n }),\n map((res: any) =>\n getValueByPath(\n res.data,\n buildResourcePath(\n { apiGroup, entity: `update${entity}`, version },\n '.',\n ),\n ),\n ),\n );\n }\n\n /**\n * Reads the `__typename` of the query type that holds the resource, e.g.\n * `{ network_api_foo_bar { v1alpha1 { __typename } } }`, and derives the\n * mutation input type name from it. The gateway generates the schema, so\n * its type names are the only source of truth.\n */\n private readInputTypeName(\n apollo: Apollo,\n resourceDefinition: ResourceDefinition,\n ): Observable<string> {\n const { apiGroup, entity, version } = resourceDefinition;\n const selection = [apiGroup, version]\n .filter((field): field is string => !!field)\n .reduceRight((inner, field) => `${field} { ${inner} }`, '__typename');\n\n return apollo\n .query({ query: this.parseGQLQuery(`query { ${selection} }`) })\n .pipe(\n map((res: any) =>\n buildGraphQLInputTypeName(\n getValueByPath(\n res.data,\n buildResourcePath(\n { apiGroup, entity: '__typename', version },\n '.',\n ),\n ),\n entity,\n ),\n ),\n );\n }\n\n getNamespace(\n nodeContext: ResourceNodeContext,\n resource?: Resource,\n ): string | undefined {\n // namespaceId can carry the '-all-' sentinel when the portal forwards the\n // namespace selection; it is never a real namespace, so fall through.\n if (nodeContext.namespaceId && nodeContext.namespaceId !== ALL_NAMESPACE) {\n return nodeContext.namespaceId;\n }\n\n if (resource?.metadata?.namespace) {\n return resource.metadata.namespace;\n }\n\n const namespace = this.luigiCoreService\n .routing()\n .getSearchParams().namespace;\n\n if (namespace) {\n return namespace === ALL_NAMESPACE ? undefined : namespace;\n }\n\n return undefined;\n }\n\n private normalizeGqlBuilderVariables(\n variables: VariableOptions,\n ): Record<string, any> {\n return Object.fromEntries(\n Object.entries(variables).map(([key, value]) => [key, value.value]),\n );\n }\n\n private calcQueryOptions(\n innerFields: Fields,\n wrappers: Partial<Omit<QueryBuilderOptions, 'fields'>>[],\n ): QueryBuilderOptions {\n const filteredWrappers = wrappers.filter(\n (wrapper): wrapper is Omit<QueryBuilderOptions, 'fields'> =>\n !!wrapper?.operation,\n );\n\n if (filteredWrappers.length === 0) {\n const completeQuery = innerFields.pop() as NestedField;\n if (completeQuery && completeQuery.operation && completeQuery.fields) {\n return completeQuery;\n }\n\n throw new Error('At least one wrapper or inner fields is required');\n }\n\n let fields = innerFields;\n let nextWrapper = filteredWrappers.pop() as Omit<\n QueryBuilderOptions,\n 'fields'\n >;\n\n filteredWrappers.forEach((wrapper) => {\n fields = [\n {\n operation: nextWrapper.operation,\n fields: innerFields,\n variables: nextWrapper.variables,\n },\n ];\n nextWrapper = wrapper;\n });\n\n return {\n operation: nextWrapper.operation,\n fields,\n variables: nextWrapper.variables,\n };\n }\n\n private parseGQLQuery(query: string) {\n try {\n return gql`\n ${query}\n `;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n this.luigiCoreService.showAlert({\n text: `Could not parse gql query: <br/><br/> ${query} <br/><br/> ${message}`,\n type: 'error',\n });\n throw error;\n }\n }\n\n /**\n * Returns a {@link ReadResources}-shaped adapter over this service so that\n * consumers can swap implementations behind a feature toggle without depending\n * on the GraphQL-specific signatures of `list` / `resourceChangeSubscription`.\n */\n asReadResources(): ReadResources {\n return {\n list: (\n nodeContext: ResourceNodeContext,\n pagination: ReadResourcesPagination,\n params: ReadResourcesParams,\n ): Observable<ReadResourcesResult> => {\n const operation =\n params.operation ??\n nodeContext.resourceDefinition?.entityCollection ??\n '';\n const fields =\n params.fields ??\n nodeContext.resourceDefinition?.ui?.listView?.fields ??\n [];\n const resourcePagination: ResourcePagination = {\n limit: pagination.limit,\n continue: pagination.cursor,\n };\n\n return this.list(operation, fields, nodeContext, {\n readFromParentKcpPath: params.readFromParentKcpPath ?? false,\n pagination: resourcePagination,\n }).pipe(\n map((result: ResourceListResult): ReadResourcesResult => ({\n items: result?.items ?? [],\n nextCursor: result?.continue,\n remainingItemCount: result?.remainingItemCount,\n resourceVersion: result?.resourceVersion,\n })),\n );\n },\n subscribe: (\n nodeContext: ResourceNodeContext,\n params: ReadResourcesParams & { resourceVersion?: string },\n ): Observable<ReadResourcesSubscriptionResult | undefined> => {\n const operation =\n nodeContext.resourceDefinition?.entityCollection ?? '';\n const fields = Array.isArray(params.fields)\n ? params.fields\n : ((nodeContext.resourceDefinition?.ui?.listView?.fields as any[]) ??\n []);\n\n return this.resourceChangeSubscription(\n operation,\n fields,\n nodeContext,\n params.resourceVersion ?? '',\n params.readFromParentKcpPath ?? false,\n );\n },\n };\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { ResourceService } from './resource.service';\nimport { Injectable, inject } from '@angular/core';\nimport {\n ALL_NAMESPACE,\n ButtonSettings,\n DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION,\n DownloadKubeconfigFromSecretRefButtonSettings,\n PlatformMeshFieldDefinition,\n Resource,\n ResourceDefinition,\n} from '@platform-mesh/portal-ui-lib/models';\nimport {\n decodeBase64,\n getResourceValueByJsonPath,\n} from '@platform-mesh/portal-ui-lib/utils';\nimport { Observable, catchError, map, throwError } from 'rxjs';\n\nconst SECRET_RESOURCE_DEFINITION: ResourceDefinition = {\n version: 'v1',\n entity: 'Secret',\n entityCollection: 'Secrets',\n scope: 'Namespaced',\n};\n\nconst DEFAULT_DATA_KEY = 'kubeconfig';\nconst DEFAULT_FILENAME = 'kubeconfig.yaml';\n\nexport interface KubeconfigDownload {\n contents: string;\n filename: string;\n}\n\ninterface SecretReference {\n name: string;\n namespace: string;\n}\n\nexport function isDownloadKubeconfigButtonSettings(\n buttonSettings: ButtonSettings | undefined,\n): buttonSettings is DownloadKubeconfigFromSecretRefButtonSettings {\n return buttonSettings?.action === DOWNLOAD_KUBECONFIG_FROM_SECRET_REF_ACTION;\n}\n\n@Injectable({\n providedIn: 'root',\n})\nexport class KubeconfigSecretService {\n private resourceService = inject(ResourceService);\n\n /**\n * Fields the detail-view query has to read so the action can resolve its\n * Secret reference from the loaded resource.\n */\n secretReferenceQueryFields(\n buttonSettings: ButtonSettings | undefined,\n ): PlatformMeshFieldDefinition[] {\n if (!isDownloadKubeconfigButtonSettings(buttonSettings)) {\n return [];\n }\n\n const fields: PlatformMeshFieldDefinition[] = [];\n const resourceProperty = this.readString(buttonSettings.resourceProperty);\n if (resourceProperty) {\n fields.push({ property: resourceProperty });\n }\n const namespaceProperty = this.readString(buttonSettings.namespaceProperty);\n if (namespaceProperty) {\n fields.push({ property: namespaceProperty });\n }\n\n return fields;\n }\n\n isSecretReferenceAvailable(\n buttonSettings: ButtonSettings | undefined,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): boolean {\n return (\n isDownloadKubeconfigButtonSettings(buttonSettings) &&\n this.resolveSecretReference(buttonSettings, resource, context) !==\n undefined\n );\n }\n\n readKubeconfig(\n buttonSettings: ButtonSettings,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): Observable<KubeconfigDownload> {\n if (!isDownloadKubeconfigButtonSettings(buttonSettings)) {\n return throwError(\n () => new Error('Button is not a kubeconfig download action'),\n );\n }\n\n const secretReference = this.resolveSecretReference(\n buttonSettings,\n resource,\n context,\n );\n if (!secretReference) {\n return throwError(\n () => new Error('Kubeconfig Secret reference is not available'),\n );\n }\n\n const dataKey = this.readString(buttonSettings.dataKey) ?? DEFAULT_DATA_KEY;\n const filename =\n this.readString(buttonSettings.filename) ?? DEFAULT_FILENAME;\n const secretContext: ResourceNodeContext = {\n ...context,\n namespaceId: secretReference.namespace,\n resourceDefinition: SECRET_RESOURCE_DEFINITION,\n };\n\n return this.resourceService\n .read(\n secretReference.name,\n SECRET_RESOURCE_DEFINITION,\n ['data'],\n secretContext,\n false,\n )\n .pipe(\n catchError(() =>\n throwError(() => new Error('Kubeconfig Secret could not be read')),\n ),\n map((secret) => {\n const encodedKubeconfig = this.readString(secret?.data?.[dataKey]);\n if (!encodedKubeconfig) {\n throw new Error(\n `Kubeconfig data key \"${dataKey}\" is not available`,\n );\n }\n\n return {\n contents: decodeBase64(encodedKubeconfig),\n filename,\n };\n }),\n );\n }\n\n private resolveSecretReference(\n buttonSettings: DownloadKubeconfigFromSecretRefButtonSettings,\n resource: Resource | undefined,\n context: ResourceNodeContext,\n ): SecretReference | undefined {\n if (!resource) {\n return undefined;\n }\n\n try {\n const resourceProperty = this.readString(buttonSettings.resourceProperty);\n if (!resourceProperty) {\n return undefined;\n }\n\n const name = this.readString(\n getResourceValueByJsonPath(resource, {\n property: resourceProperty,\n }),\n );\n const namespaceProperty = this.readString(\n buttonSettings.namespaceProperty,\n );\n const namespace = namespaceProperty\n ? this.namespaceOf(\n getResourceValueByJsonPath(resource, {\n property: namespaceProperty,\n }),\n )\n : (this.namespaceOf(resource.metadata?.namespace) ??\n this.namespaceOf(this.resourceService.getNamespace(context)));\n\n return name && namespace ? { name, namespace } : undefined;\n } catch {\n return undefined;\n }\n }\n\n private namespaceOf(value: unknown): string | undefined {\n const namespace = this.readString(value);\n return namespace && namespace !== ALL_NAMESPACE ? namespace : undefined;\n }\n\n private readString(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n }\n}\n","import { gql } from 'apollo-angular';\n\nexport const accountInfoRead = gql`\n {\n core_platform_mesh_io {\n v1alpha1 {\n AccountInfo(name: \"account\") {\n metadata {\n name\n annotations\n }\n spec {\n account {\n originClusterId\n }\n clusterInfo {\n ca\n }\n organization {\n originClusterId\n name\n }\n oidc {\n clients\n issuerUrl\n }\n }\n }\n }\n }\n }\n`;\n","import { accountInfoRead } from './account-info.queries';\nimport { ApolloFactory } from './apollo-factory';\nimport { GatewayService } from './gateway.service';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { AccountInfo } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable, throwError } from 'rxjs';\nimport { catchError, map, shareReplay } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class AccountInfoService {\n private apolloFactory = inject(ApolloFactory);\n private gatewayService = inject(GatewayService);\n private readCache = new Map<string, Observable<AccountInfo>>();\n\n read(nodeContext: ResourceNodeContext): Observable<AccountInfo> {\n const cacheKey = this.gatewayService.getGatewayUrl(nodeContext);\n const cachedRead = this.readCache.get(cacheKey);\n if (cachedRead) {\n return cachedRead;\n }\n\n const request$ = this.apolloFactory\n .apollo(nodeContext)\n .query<AccountInfo>({\n query: accountInfoRead,\n })\n .pipe(\n map((res: any) => {\n const rawAccountInfo =\n res.data.core_platform_mesh_io.v1alpha1.AccountInfo;\n\n return {\n ...rawAccountInfo,\n spec: {\n ...rawAccountInfo.spec,\n oidc: {\n ...rawAccountInfo.spec.oidc,\n clients: JSON.parse(rawAccountInfo.spec.oidc.clients),\n },\n },\n };\n }),\n shareReplay(1),\n catchError((error) => {\n if (this.readCache.get(cacheKey) === request$) {\n this.readCache.delete(cacheKey);\n }\n return throwError(() => error);\n }),\n );\n\n this.readCache.set(cacheKey, request$);\n return request$;\n }\n}\n","import { gql } from 'apollo-angular';\n\nexport const queryLoginCluster = gql`\n {\n core_kcp_io {\n v1alpha1 {\n LogicalCluster(name: \"cluster\") {\n status {\n phase\n }\n }\n }\n }\n }\n`;\n","import { ApolloFactory } from './apollo-factory';\nimport { queryLoginCluster } from './logical-cluster.queries';\nimport { ResourceNodeContext } from './resource-node-context';\nimport { Injectable, inject } from '@angular/core';\nimport { LogicalCluster } from '@platform-mesh/portal-ui-lib/models';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class LogicalClusterService {\n private apolloFactory = inject(ApolloFactory);\n\n public read(nodeContext: ResourceNodeContext): Observable<LogicalCluster> {\n return this.apolloFactory\n .apollo(nodeContext)\n .query<LogicalCluster>({\n query: queryLoginCluster,\n })\n .pipe(map((res: any) => res.data.core_kcp_io.v1alpha1.LogicalCluster));\n }\n}\n","import { ResourceNodeContext } from './resource-node-context';\nimport { ResourceService } from './resource.service';\nimport { Injectable, inject } from '@angular/core';\nimport {\n ResourceDefinition,\n ResourceListResult,\n} from '@platform-mesh/portal-ui-lib/models';\nimport { generateGraphQLFields } from '@platform-mesh/portal-ui-lib/utils';\nimport { Observable } from 'rxjs';\nimport { map } from 'rxjs/operators';\n\n@Injectable({\n providedIn: 'root',\n})\nexport class NamespaceService {\n private resourceService = inject(ResourceService);\n\n list(nodeContext: ResourceNodeContext): Observable<string[]> {\n return this.resourceService\n .list(\n 'v1_namespaces',\n generateGraphQLFields([{ property: 'metadata.name' }]),\n {\n portalContext: {\n crdGatewayApiUrl: nodeContext.portalContext.crdGatewayApiUrl,\n },\n resourceDefinition: {\n version: 'v1',\n entityCollection: 'Namespaces',\n entity: 'Namespace',\n scope: 'Cluster',\n } as ResourceDefinition,\n kcpPath: nodeContext.kcpPath,\n token: nodeContext.token,\n },\n )\n .pipe(\n map((result: ResourceListResult) =>\n result.items.map((item) => item.metadata.name),\n ),\n );\n }\n}\n","import { Injectable, inject } from '@angular/core';\nimport { LuigiCoreService } from '@openmfp/portal-ui-lib';\n\n@Injectable({ providedIn: 'root' })\nexport class ErrorHandlerService {\n private luigiCoreService = inject(LuigiCoreService);\n\n handleError(error: any, msg?: string) {\n const message =\n error?.message || error?.errors?.map((e: any) => e.message).join('\\n');\n this.luigiCoreService.showAlert({\n text:\n [msg, message].filter(Boolean).join('\\n') ||\n 'An unknown error occurred',\n type: 'error',\n });\n console.error(error);\n }\n\n errorCode(error: any): number {\n if (this.isUnauthorizedAccess(error)) {\n return 403;\n }\n\n return (\n [\n error?.statusCode,\n error?.status,\n error?.networkError?.statusCode,\n error?.networkError?.status,\n error?.response?.status,\n ].find(Boolean) ?? 500\n );\n }\n\n private isUnauthorizedAccess(error: any): boolean {\n return (\n !!error?.message?.toLowerCase().includes('forbidden') ||\n !!error?.message?.toLowerCase()?.includes('access denied')\n );\n }\n}\n","import { LogicalClusterService } from './resource';\nimport { Injectable, inject } from '@angular/core';\nimport {\n AuthService,\n ConfigService,\n EnvConfigService,\n} from '@openmfp/portal-ui-lib';\nimport { firstValueFrom } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class OrganizationReadyService {\n private configService = inject(ConfigService);\n private envConfigService = inject(EnvConfigService);\n private logicalClusterService = inject(LogicalClusterService);\n private authService = inject(AuthService);\n\n private isReady = false;\n private pendingCheck?: Promise<boolean>;\n\n public isOrganizationReady(): Promise<boolean> {\n if (this.isReady) {\n return Promise.resolve(true);\n }\n\n this.pendingCheck ??= this.readOrganizationReady().finally(() => {\n this.pendingCheck = undefined;\n });\n\n return this.pendingCheck;\n }\n\n private async readOrganizationReady(): Promise<boolean> {\n const portalConfig = await this.configService.getPortalConfig();\n const { idpName } = await this.envConfigService.getEnvConfig();\n\n if (idpName === 'welcome') {\n return true;\n }\n\n try {\n const logicalCluster = await firstValueFrom(\n this.logicalClusterService.read({\n portalContext: {\n crdGatewayApiUrl: portalConfig.portalContext['crdGatewayApiUrl'],\n },\n token: this.authService.getToken(),\n accountId: idpName,\n }),\n );\n this.isReady = logicalCluster.status.phase === 'Ready';\n return this.isReady;\n } catch (error) {\n console.error('Org check failed', error);\n return true;\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["ApolloObservable","catchError","map"],"mappings":";;;;;;;;;;;;;;;;;MAMa,cAAc,CAAA;AAD3B,IAAA,WAAA,GAAA;AAEU,QAAA,IAAA,CAAA,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,CAAC;AA8CpD,IAAA;AA5CQ,IAAA,aAAa,CAClB,WAAgC,EAChC,qBAAqB,GAAG,KAAK,EAAA;AAE7B,QAAA,MAAM,UAAU,GAAG,WAAW,CAAC,aAAa,CAAC,gBAAgB;QAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC;AACtD,QAAA,OAAO,UAAU,EAAE,OAAO,CACxB,cAAc,EACd,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACxD;IACH;AAEO,IAAA,iCAAiC,CAAC,OAAe,EAAA;AACtD,QAAA,MAAM,UAAU,GACd,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,aAAa,CAAC,gBAAgB;QACz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G,cAAc,CAAC,MAAM,CAAC,KAAK,KAAK,OAAO;YACtD,OAAO,IAAI,CAAC,OAAO;QACrB;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC;AACxC,YAAA,OAAO,IAAI;QACb;IACF;8GA7CW,wBAAwB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAxB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,wBAAwB,cADX,MAAM,EAAA,CAAA,CAAA;;2FACnB,wBAAwB,EAAA,UAAA,EAAA,CAAA;kBADpC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACTlC;;AAEG;;;;"}
|
|
@@ -1,34 +1,18 @@
|
|
|
1
1
|
import { JSONPath } from 'jsonpath-plus';
|
|
2
2
|
import { ResourceOperationTypeMap } from '@platform-mesh/portal-ui-lib/models';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
.filter((segment) => segment.length > 0)
|
|
15
|
-
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
16
|
-
.join('');
|
|
17
|
-
}
|
|
18
|
-
function buildGraphQLInputTypeName(apiGroup, version, entity) {
|
|
19
|
-
let prefix;
|
|
20
|
-
if (apiGroup && version) {
|
|
21
|
-
prefix = pascalize(sanitizeGroup(apiGroup) + '_' + version);
|
|
22
|
-
}
|
|
23
|
-
else if (apiGroup) {
|
|
24
|
-
prefix = pascalize(sanitizeGroup(apiGroup));
|
|
25
|
-
}
|
|
26
|
-
else if (version) {
|
|
27
|
-
prefix = pascalize('_' + version);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return `${entity}_Input`;
|
|
4
|
+
const QUERY_SUFFIX = 'Query';
|
|
5
|
+
/**
|
|
6
|
+
* Builds the input type name of a mutation from the `__typename` of the query
|
|
7
|
+
* type that holds the resource (e.g. `NetworkAPIFooBarV1alpha1Query`). The
|
|
8
|
+
* gateway names the input type `<prefix><Kind>_Input` with the same prefix,
|
|
9
|
+
* so the UI does not need its own copy of the gateway's naming rule.
|
|
10
|
+
*/
|
|
11
|
+
function buildGraphQLInputTypeName(queryTypeName, entity) {
|
|
12
|
+
if (!queryTypeName?.endsWith(QUERY_SUFFIX)) {
|
|
13
|
+
throw new Error(`Unexpected GraphQL query type name: ${queryTypeName}`);
|
|
31
14
|
}
|
|
15
|
+
const prefix = queryTypeName.slice(0, -QUERY_SUFFIX.length);
|
|
32
16
|
return `${prefix}${entity}_Input`;
|
|
33
17
|
}
|
|
34
18
|
|