@platform-mesh/portal-ui-lib 0.63.2 → 0.64.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"platform-mesh-portal-ui-lib-utils.mjs","sources":["../../projects/lib/utils/utils/build-graphql-input-type-name.ts","../../projects/lib/utils/utils/build-resource-list-operation.ts","../../projects/lib/utils/utils/flatten-field-tree.ts","../../projects/lib/utils/utils/columns-to-gql-fields.ts","../../projects/lib/utils/utils/resource-field-by-path.ts","../../projects/lib/utils/utils/get-value-by-path.ts","../../projects/lib/utils/utils/instance-permission-key.ts","../../projects/lib/utils/utils/is-local-setup.ts","../../projects/lib/utils/utils/is-namespaced-resource.ts","../../projects/lib/utils/utils/merge-list-with-subscription-result.ts","../../projects/lib/utils/utils/parse-raw-gql-query.ts","../../projects/lib/utils/utils/resource-action-allowed.ts","../../projects/lib/utils/utils/resource-sanitizer.ts","../../projects/lib/utils/utils/delete-property-by-path.ts","../../projects/lib/utils/utils/omit-empty-write-only-fields.ts","../../projects/lib/utils/utils/set-property-by-path.ts","../../projects/lib/utils/platform-mesh-portal-ui-lib-utils.ts"],"sourcesContent":["function sanitizeGroup(group: string): string {\n let sanitized = group.replace(/[^a-zA-Z0-9]/g, '_');\n if (/^[0-9]/.test(sanitized)) {\n sanitized = '_' + sanitized;\n }\n return sanitized;\n}\n\nfunction pascalize(snakeCase: string): string {\n return snakeCase\n .split('_')\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join('');\n}\n\nexport function buildGraphQLInputTypeName(\n apiGroup: string | undefined,\n version: string | undefined,\n entity: string,\n): string {\n let prefix: string;\n\n if (apiGroup && version) {\n prefix = pascalize(sanitizeGroup(apiGroup) + '_' + version);\n } else if (apiGroup) {\n prefix = pascalize(sanitizeGroup(apiGroup));\n } else if (version) {\n prefix = pascalize('_' + version);\n } else {\n return `${entity}_Input`;\n }\n\n return `${prefix}${entity}_Input`;\n}\n","export function buildResourcePath(\n input: {\n apiGroup?: string | undefined;\n entity: string;\n version?: string | undefined;\n },\n separator: string = '_',\n): string {\n return [input.apiGroup, input.version, input.entity]\n .filter((p): p is string => !!p)\n .join(separator);\n}\n","import { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\n/** Flattens nested `propertyCollection` trees into a list of leaf field definitions. */\nexport function flattenFieldTree(\n fields: readonly PlatformMeshFieldDefinition[] | undefined,\n): PlatformMeshFieldDefinition[] {\n const result: PlatformMeshFieldDefinition[] = [];\n for (const field of fields ?? []) {\n if (field.propertyCollection?.length) {\n result.push(...flattenFieldTree(field.propertyCollection));\n continue;\n }\n result.push(field);\n }\n return result;\n}\n","import { flattenFieldTree } from './flatten-field-tree';\nimport { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\nexport type GenerateGraphQLFieldsOptions = {\n /** Omit fields marked writeOnly (for queries/mutation return selections). */\n forRead?: boolean;\n};\n\n/** Builds GraphQL field selections for reads, omitting write-only secrets. */\nexport const generateGraphQLReadFields = (\n uiFields: readonly PlatformMeshFieldDefinition[],\n): any[] => generateGraphQLFields(uiFields, { forRead: true });\n\nexport const generateGraphQLFields = (\n uiFields: readonly PlatformMeshFieldDefinition[],\n options: GenerateGraphQLFieldsOptions = {},\n): any[] => {\n const graphQLFields: any[] = [];\n const flattened = flattenFieldTree(uiFields);\n const fields = options.forRead\n ? flattened.filter((field) => !field.writeOnly)\n : flattened;\n fields.map((field) => {\n if (field.property instanceof Array) {\n field.property.map((property) => generate(property, graphQLFields));\n } else {\n generate(field.property, graphQLFields);\n }\n });\n return graphQLFields;\n};\n\nconst generate = (root: string | undefined, fields: any = []) => {\n if (!root) {\n return [];\n }\n\n const paths = root.split('.');\n\n for (const part of paths) {\n if (paths.length === 1) {\n fields.push(part);\n return fields;\n }\n\n fields.push({\n [part]: [...generate(paths.splice(1).join('.'))],\n });\n\n return fields;\n }\n};\n","import {\n PropertyField,\n TransformType,\n} from '@platform-mesh/portal-ui-lib/models';\nimport { JSONPath } from 'jsonpath-plus';\n\nexport const getResourceValueByJsonPath = <T>(\n resource: T,\n field: {\n jsonPathExpression?: string;\n property?: string | string[];\n propertyField?: PropertyField;\n },\n) => {\n const property = field.jsonPathExpression || field.property;\n if (!property) {\n return undefined;\n }\n\n if (property instanceof Array) {\n console.error(\n `Property defined as an array: ${JSON.stringify(property)}, provide \"jsonPathExpression\" field to properly ready resource value`,\n );\n return undefined;\n }\n\n const prefix = property.startsWith('$.') ? '' : '$.';\n const queryResult = JSONPath({\n path: `${prefix}${property}`,\n json: resource as object,\n });\n const value = queryResult.length ? queryResult[0] : undefined;\n\n if (value && field.propertyField) {\n return executeTransform(\n value[field.propertyField.key],\n field.propertyField.transform,\n );\n }\n\n return value;\n};\n\nconst executeTransform = (\n value: string | undefined,\n transform: TransformType[] | undefined,\n): string | undefined => {\n if (value == null || transform == null || !transform.length) return value;\n\n return transform.reduce((acc, t) => {\n if (acc == null) return acc;\n\n switch (t) {\n case 'uppercase':\n return acc.toUpperCase();\n case 'lowercase':\n return acc.toLowerCase();\n case 'capitalize': {\n const str = String(acc);\n return str.length ? str.charAt(0).toUpperCase() + str.slice(1) : str;\n }\n case 'decode': {\n try {\n return decodeBase64(acc);\n } catch {\n return acc;\n }\n }\n case 'encode': {\n try {\n return encodeBase64(acc);\n } catch {\n return acc;\n }\n }\n default:\n return acc;\n }\n }, value);\n};\n\nexport const encodeBase64 = (str: string): string => {\n try {\n const utf8Bytes = new TextEncoder().encode(str);\n const binaryString = Array.from(utf8Bytes, (byte) =>\n String.fromCharCode(byte),\n ).join('');\n return btoa(binaryString);\n } catch (error) {\n console.error('Base64 encoding failed:', error);\n throw new Error('Failed to encode string to Base64');\n }\n};\n\nexport const decodeBase64 = (base64: string): string => {\n try {\n const binaryString = atob(base64);\n const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));\n return new TextDecoder().decode(bytes);\n } catch (error) {\n console.error('Base64 decoding failed:', error);\n throw new Error('Failed to decode Base64 string');\n }\n};\n","import { getResourceValueByJsonPath } from './resource-field-by-path';\nimport { Resource } from '@platform-mesh/portal-ui-lib/models';\n\nexport const getValueByPath = <T extends object, R = unknown>(\n obj: T,\n path: string,\n): R | undefined => {\n return getResourceValueByJsonPath(obj as Resource, {\n jsonPathExpression: path,\n });\n};\n","import { InstancePermission } from '@platform-mesh/portal-ui-lib/models';\n\nexport const permissionKey = (\n instance: Partial<Omit<InstancePermission, 'actions'>>,\n): string =>\n [instance.resource, instance.namespace, instance.name]\n .filter(Boolean)\n .join('/');\n","export const isLocalSetup = () => {\n return (\n window.location.hostname.includes('localhost') ||\n window.location.hostname.includes('portal.dev.local')\n );\n};\n","import { NodeContext } from '@openmfp/portal-ui-lib';\n\nexport function isNamespacedResource(nodeContext: Partial<NodeContext>) {\n return nodeContext?.resourceDefinition?.scope === 'Namespaced';\n}\n","import {\n Resource,\n ResourceOperationTypeMap,\n ResourceSubscriptionResult,\n} from '@platform-mesh/portal-ui-lib/models';\n\nexport interface MergeListWithSubscriptionResultOptions<T> {\n getItemKey: (item: T) => string | undefined;\n mapSubscriptionObjectToItem: (object: Resource) => T;\n}\n\nexport function mergeListWithSubscriptionResult<T>(\n items: T[],\n subscriptionResult: ResourceSubscriptionResult | undefined,\n options: MergeListWithSubscriptionResultOptions<T>,\n): T[] {\n if (!subscriptionResult) {\n return items;\n }\n\n const { getItemKey, mapSubscriptionObjectToItem } = options;\n\n const result = new Map<string, T>();\n items.forEach((item) => {\n const key = getItemKey(item);\n if (!key) {\n return;\n }\n result.set(key, item);\n });\n\n const { type, object } = subscriptionResult;\n const mappedObject = mapSubscriptionObjectToItem(object);\n const objectKey = getItemKey(mappedObject);\n if (!objectKey) {\n return items;\n }\n\n if (type === ResourceOperationTypeMap.ADDED) {\n result.set(objectKey, mappedObject);\n } else if (type === ResourceOperationTypeMap.MODIFIED) {\n if (result.has(objectKey)) {\n result.set(objectKey, mappedObject);\n }\n } else if (type === ResourceOperationTypeMap.DELETED) {\n result.delete(objectKey);\n }\n\n return [...result.values()];\n}\n","export const parseRawGqlQueryToFields = (s: string): any[] => {\n const tokens = s.replace(/[{}]/g, ' $& ').trim().split(/\\s+/);\n const root: any[] = [];\n const stack: any[][] = [root];\n\n for (let i = 0; i < tokens.length; i++) {\n const v = tokens[i];\n\n if (v === '{') continue;\n if (v === '}') {\n stack.pop();\n continue;\n }\n\n if (tokens[i + 1] === '{') {\n const node = { [v]: [] };\n stack.at(-1)?.push(node);\n stack.push(node[v]);\n } else {\n stack.at(-1)?.push(v);\n }\n }\n\n return root;\n};\n","/**\n * Tier-1 resource-level permission check (fail-open).\n *\n * Returns true when the verb is granted for the resource, OR when no\n * permissions were fetched for the resource at all (no entry in\n * portalPermissions → we don't gate). Returns false ONLY when permissions\n * WERE fetched for the resource and the verb is absent.\n */\nexport const resourceActionAllowed = (\n portalPermissions: { [key: string]: string[] } | undefined,\n resource: string | undefined,\n verb: string,\n): boolean => portalPermissions?.[resource ?? '']?.includes(verb) ?? true;\n","export function stripTypename<T>(value: T): T {\n if (Array.isArray(value)) {\n return (value as unknown as any[]).map((v) => stripTypename(v)) as T;\n }\n if (value && typeof value === 'object') {\n const { __typename, ...rest } = value as Record<string, unknown> & {\n __typename?: string;\n };\n for (const k of Object.keys(rest)) {\n // @ts-ignore - rest is an indexable object\n rest[k] = stripTypename((rest as any)[k]);\n }\n return rest as T;\n }\n return value;\n}\n","export function deletePropertyByPath<T extends Record<string, unknown>>(\n object: T,\n path: string,\n): T {\n const segments = path.split('.').filter(Boolean);\n if (segments.length === 0) {\n return object;\n }\n\n let current: Record<string, unknown> = object;\n\n for (let i = 0; i < segments.length - 1; i += 1) {\n const key = segments[i];\n const next = current[key];\n if (next == null || typeof next !== 'object') {\n return object;\n }\n current = next as Record<string, unknown>;\n }\n\n delete current[segments[segments.length - 1]];\n return object;\n}\n","import { deletePropertyByPath } from './delete-property-by-path';\nimport { flattenFieldTree } from './flatten-field-tree';\nimport { getValueByPath } from './get-value-by-path';\nimport { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\n/** Drops write-only fields whose value is empty so updates leave them unchanged. */\nexport function omitEmptyWriteOnlyFields<T extends Record<string, unknown>>(\n resource: T,\n fields: readonly PlatformMeshFieldDefinition[] | undefined,\n): T {\n const result = structuredClone(resource);\n\n for (const field of flattenFieldTree(fields)) {\n if (!field.writeOnly || typeof field.property !== 'string') {\n continue;\n }\n\n const value = getValueByPath(result, field.property);\n if (value === '' || value == null) {\n deletePropertyByPath(result, field.property);\n pruneEmptyParents(result, field.property);\n }\n }\n\n return result;\n}\n\nfunction pruneEmptyParents(\n object: Record<string, unknown>,\n path: string,\n): void {\n const segments = path.split('.').filter(Boolean);\n for (let i = segments.length - 1; i > 0; i -= 1) {\n const parentPath = segments.slice(0, i).join('.');\n const parent = getValueByPath(object, parentPath);\n if (\n parent &&\n typeof parent === 'object' &&\n !Array.isArray(parent) &&\n Object.keys(parent as Record<string, unknown>).length === 0\n ) {\n deletePropertyByPath(object, parentPath);\n } else {\n break;\n }\n }\n}\n","export function setPropertyByPath<T extends Record<string, any>>(\n object: T,\n path: string,\n value: unknown,\n): T {\n const segments = path.split('.').filter(Boolean);\n if (segments.length === 0) {\n return object;\n }\n\n let current: Record<string, any> = object;\n\n for (let i = 0; i < segments.length; i += 1) {\n const key = segments[i];\n if (i === segments.length - 1) {\n current[key] = value;\n break;\n }\n\n const existing = current[key];\n\n if (\n existing === undefined ||\n existing === null ||\n typeof existing !== 'object'\n ) {\n current[key] = {};\n }\n\n current = current[key];\n }\n\n return object;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA,SAAS,aAAa,CAAC,KAAa,EAAA;IAClC,IAAI,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;AACnD,IAAA,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,EA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CAAC,MAAM,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,MAAiC,CAAC,CAAC,MAAM,KAAK,CAAC,EAC3D;AACA,YAAA,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC;QAC1C;aAAO;YACL;QACF;IACF;AACF;;SC9CgB,iBAAiB,CAC/B,MAAS,EACT,IAAY,EACZ,KAAc,EAAA;AAEd,IAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC;AAChD,IAAA,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,MAAM;IACf;IAEA,IAAI,OAAO,GAAwB,MAAM;AAEzC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;AAC3C,QAAA,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC;QACvB,IAAI,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;AAC7B,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK;YACpB;QACF;AAEA,QAAA,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC;QAE7B,IACE,QAAQ,KAAK,SAAS;AACtB,YAAA,QAAQ,KAAK,IAAI;AACjB,YAAA,OAAO,QAAQ,KAAK,QAAQ,EAC5B;AACA,YAAA,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE;QACnB;AAEA,QAAA,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IACxB;AAEA,IAAA,OAAO,MAAM;AACf;;ACjCA;;AAEG;;;;"}
1
+ {"version":3,"file":"platform-mesh-portal-ui-lib-utils.mjs","sources":["../../projects/lib/utils/utils/build-graphql-input-type-name.ts","../../projects/lib/utils/utils/build-resource-list-operation.ts","../../projects/lib/utils/utils/flatten-field-tree.ts","../../projects/lib/utils/utils/columns-to-gql-fields.ts","../../projects/lib/utils/utils/resource-field-by-path.ts","../../projects/lib/utils/utils/get-value-by-path.ts","../../projects/lib/utils/utils/instance-permission-key.ts","../../projects/lib/utils/utils/is-local-setup.ts","../../projects/lib/utils/utils/is-namespaced-resource.ts","../../projects/lib/utils/utils/merge-list-with-subscription-result.ts","../../projects/lib/utils/utils/parse-raw-gql-query.ts","../../projects/lib/utils/utils/resource-action-allowed.ts","../../projects/lib/utils/utils/resource-sanitizer.ts","../../projects/lib/utils/utils/delete-property-by-path.ts","../../projects/lib/utils/utils/omit-empty-write-only-fields.ts","../../projects/lib/utils/utils/set-property-by-path.ts","../../projects/lib/utils/utils/luigi-navigation.ts","../../projects/lib/utils/platform-mesh-portal-ui-lib-utils.ts"],"sourcesContent":["function sanitizeGroup(group: string): string {\n let sanitized = group.replace(/[^a-zA-Z0-9]/g, '_');\n if (/^[0-9]/.test(sanitized)) {\n sanitized = '_' + sanitized;\n }\n return sanitized;\n}\n\nfunction pascalize(snakeCase: string): string {\n return snakeCase\n .split('_')\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join('');\n}\n\nexport function buildGraphQLInputTypeName(\n apiGroup: string | undefined,\n version: string | undefined,\n entity: string,\n): string {\n let prefix: string;\n\n if (apiGroup && version) {\n prefix = pascalize(sanitizeGroup(apiGroup) + '_' + version);\n } else if (apiGroup) {\n prefix = pascalize(sanitizeGroup(apiGroup));\n } else if (version) {\n prefix = pascalize('_' + version);\n } else {\n return `${entity}_Input`;\n }\n\n return `${prefix}${entity}_Input`;\n}\n","export function buildResourcePath(\n input: {\n apiGroup?: string | undefined;\n entity: string;\n version?: string | undefined;\n },\n separator: string = '_',\n): string {\n return [input.apiGroup, input.version, input.entity]\n .filter((p): p is string => !!p)\n .join(separator);\n}\n","import { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\n/** Flattens nested `propertyCollection` trees into a list of leaf field definitions. */\nexport function flattenFieldTree(\n fields: readonly PlatformMeshFieldDefinition[] | undefined,\n): PlatformMeshFieldDefinition[] {\n const result: PlatformMeshFieldDefinition[] = [];\n for (const field of fields ?? []) {\n if (field.propertyCollection?.length) {\n result.push(...flattenFieldTree(field.propertyCollection));\n continue;\n }\n result.push(field);\n }\n return result;\n}\n","import { flattenFieldTree } from './flatten-field-tree';\nimport { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\nexport type GenerateGraphQLFieldsOptions = {\n /** Omit fields marked writeOnly (for queries/mutation return selections). */\n forRead?: boolean;\n};\n\n/** Builds GraphQL field selections for reads, omitting write-only secrets. */\nexport const generateGraphQLReadFields = (\n uiFields: readonly PlatformMeshFieldDefinition[],\n): any[] => generateGraphQLFields(uiFields, { forRead: true });\n\nexport const generateGraphQLFields = (\n uiFields: readonly PlatformMeshFieldDefinition[],\n options: GenerateGraphQLFieldsOptions = {},\n): any[] => {\n const graphQLFields: any[] = [];\n const flattened = flattenFieldTree(uiFields);\n const fields = options.forRead\n ? flattened.filter((field) => !field.writeOnly)\n : flattened;\n fields.map((field) => {\n if (field.property instanceof Array) {\n field.property.map((property) => generate(property, graphQLFields));\n } else {\n generate(field.property, graphQLFields);\n }\n });\n return graphQLFields;\n};\n\nconst generate = (root: string | undefined, fields: any = []) => {\n if (!root) {\n return [];\n }\n\n const paths = root.split('.');\n\n for (const part of paths) {\n if (paths.length === 1) {\n fields.push(part);\n return fields;\n }\n\n fields.push({\n [part]: [...generate(paths.splice(1).join('.'))],\n });\n\n return fields;\n }\n};\n","import {\n PropertyField,\n TransformType,\n} from '@platform-mesh/portal-ui-lib/models';\nimport { JSONPath } from 'jsonpath-plus';\n\nexport const getResourceValueByJsonPath = <T>(\n resource: T,\n field: {\n jsonPathExpression?: string;\n property?: string | string[];\n propertyField?: PropertyField;\n },\n) => {\n const property = field.jsonPathExpression || field.property;\n if (!property) {\n return undefined;\n }\n\n if (property instanceof Array) {\n console.error(\n `Property defined as an array: ${JSON.stringify(property)}, provide \"jsonPathExpression\" field to properly ready resource value`,\n );\n return undefined;\n }\n\n const prefix = property.startsWith('$.') ? '' : '$.';\n const queryResult = JSONPath({\n path: `${prefix}${property}`,\n json: resource as object,\n });\n const value = queryResult.length ? queryResult[0] : undefined;\n\n if (value && field.propertyField) {\n return executeTransform(\n value[field.propertyField.key],\n field.propertyField.transform,\n );\n }\n\n return value;\n};\n\nconst executeTransform = (\n value: string | undefined,\n transform: TransformType[] | undefined,\n): string | undefined => {\n if (value == null || transform == null || !transform.length) return value;\n\n return transform.reduce((acc, t) => {\n if (acc == null) return acc;\n\n switch (t) {\n case 'uppercase':\n return acc.toUpperCase();\n case 'lowercase':\n return acc.toLowerCase();\n case 'capitalize': {\n const str = String(acc);\n return str.length ? str.charAt(0).toUpperCase() + str.slice(1) : str;\n }\n case 'decode': {\n try {\n return decodeBase64(acc);\n } catch {\n return acc;\n }\n }\n case 'encode': {\n try {\n return encodeBase64(acc);\n } catch {\n return acc;\n }\n }\n default:\n return acc;\n }\n }, value);\n};\n\nexport const encodeBase64 = (str: string): string => {\n try {\n const utf8Bytes = new TextEncoder().encode(str);\n const binaryString = Array.from(utf8Bytes, (byte) =>\n String.fromCharCode(byte),\n ).join('');\n return btoa(binaryString);\n } catch (error) {\n console.error('Base64 encoding failed:', error);\n throw new Error('Failed to encode string to Base64');\n }\n};\n\nexport const decodeBase64 = (base64: string): string => {\n try {\n const binaryString = atob(base64);\n const bytes = Uint8Array.from(binaryString, (char) => char.charCodeAt(0));\n return new TextDecoder().decode(bytes);\n } catch (error) {\n console.error('Base64 decoding failed:', error);\n throw new Error('Failed to decode Base64 string');\n }\n};\n","import { getResourceValueByJsonPath } from './resource-field-by-path';\nimport { Resource } from '@platform-mesh/portal-ui-lib/models';\n\nexport const getValueByPath = <T extends object, R = unknown>(\n obj: T,\n path: string,\n): R | undefined => {\n return getResourceValueByJsonPath(obj as Resource, {\n jsonPathExpression: path,\n });\n};\n","import { InstancePermission } from '@platform-mesh/portal-ui-lib/models';\n\nexport const permissionKey = (\n instance: Partial<Omit<InstancePermission, 'actions'>>,\n): string =>\n [instance.resource, instance.namespace, instance.name]\n .filter(Boolean)\n .join('/');\n","export const isLocalSetup = () => {\n return (\n window.location.hostname.includes('localhost') ||\n window.location.hostname.includes('portal.dev.local')\n );\n};\n","import { NodeContext } from '@openmfp/portal-ui-lib';\n\nexport function isNamespacedResource(nodeContext: Partial<NodeContext>) {\n return nodeContext?.resourceDefinition?.scope === 'Namespaced';\n}\n","import {\n Resource,\n ResourceOperationTypeMap,\n ResourceSubscriptionResult,\n} from '@platform-mesh/portal-ui-lib/models';\n\nexport interface MergeListWithSubscriptionResultOptions<T> {\n getItemKey: (item: T) => string | undefined;\n mapSubscriptionObjectToItem: (object: Resource) => T;\n}\n\nexport function mergeListWithSubscriptionResult<T>(\n items: T[],\n subscriptionResult: ResourceSubscriptionResult | undefined,\n options: MergeListWithSubscriptionResultOptions<T>,\n): T[] {\n if (!subscriptionResult) {\n return items;\n }\n\n const { getItemKey, mapSubscriptionObjectToItem } = options;\n\n const result = new Map<string, T>();\n items.forEach((item) => {\n const key = getItemKey(item);\n if (!key) {\n return;\n }\n result.set(key, item);\n });\n\n const { type, object } = subscriptionResult;\n const mappedObject = mapSubscriptionObjectToItem(object);\n const objectKey = getItemKey(mappedObject);\n if (!objectKey) {\n return items;\n }\n\n if (type === ResourceOperationTypeMap.ADDED) {\n result.set(objectKey, mappedObject);\n } else if (type === ResourceOperationTypeMap.MODIFIED) {\n if (result.has(objectKey)) {\n result.set(objectKey, mappedObject);\n }\n } else if (type === ResourceOperationTypeMap.DELETED) {\n result.delete(objectKey);\n }\n\n return [...result.values()];\n}\n","export const parseRawGqlQueryToFields = (s: string): any[] => {\n const tokens = s.replace(/[{}]/g, ' $& ').trim().split(/\\s+/);\n const root: any[] = [];\n const stack: any[][] = [root];\n\n for (let i = 0; i < tokens.length; i++) {\n const v = tokens[i];\n\n if (v === '{') continue;\n if (v === '}') {\n stack.pop();\n continue;\n }\n\n if (tokens[i + 1] === '{') {\n const node = { [v]: [] };\n stack.at(-1)?.push(node);\n stack.push(node[v]);\n } else {\n stack.at(-1)?.push(v);\n }\n }\n\n return root;\n};\n","/**\n * Tier-1 resource-level permission check (fail-open).\n *\n * Returns true when the verb is granted for the resource, OR when no\n * permissions were fetched for the resource at all (no entry in\n * portalPermissions → we don't gate). Returns false ONLY when permissions\n * WERE fetched for the resource and the verb is absent.\n */\nexport const resourceActionAllowed = (\n portalPermissions: { [key: string]: string[] } | undefined,\n resource: string | undefined,\n verb: string,\n): boolean => portalPermissions?.[resource ?? '']?.includes(verb) ?? true;\n","export function stripTypename<T>(value: T): T {\n if (Array.isArray(value)) {\n return (value as unknown as any[]).map((v) => stripTypename(v)) as T;\n }\n if (value && typeof value === 'object') {\n const { __typename, ...rest } = value as Record<string, unknown> & {\n __typename?: string;\n };\n for (const k of Object.keys(rest)) {\n // @ts-ignore - rest is an indexable object\n rest[k] = stripTypename((rest as any)[k]);\n }\n return rest as T;\n }\n return value;\n}\n","export function deletePropertyByPath<T extends Record<string, unknown>>(\n object: T,\n path: string,\n): T {\n const segments = path.split('.').filter(Boolean);\n if (segments.length === 0) {\n return object;\n }\n\n let current: Record<string, unknown> = object;\n\n for (let i = 0; i < segments.length - 1; i += 1) {\n const key = segments[i];\n const next = current[key];\n if (next == null || typeof next !== 'object') {\n return object;\n }\n current = next as Record<string, unknown>;\n }\n\n delete current[segments[segments.length - 1]];\n return object;\n}\n","import { deletePropertyByPath } from './delete-property-by-path';\nimport { flattenFieldTree } from './flatten-field-tree';\nimport { getValueByPath } from './get-value-by-path';\nimport { PlatformMeshFieldDefinition } from '@platform-mesh/portal-ui-lib/models';\n\n/** Drops write-only fields whose value is empty so updates leave them unchanged. */\nexport function omitEmptyWriteOnlyFields<T extends Record<string, unknown>>(\n resource: T,\n fields: readonly PlatformMeshFieldDefinition[] | undefined,\n): T {\n const result = structuredClone(resource);\n\n for (const field of flattenFieldTree(fields)) {\n if (!field.writeOnly || typeof field.property !== 'string') {\n continue;\n }\n\n const value = getValueByPath(result, field.property);\n if (value === '' || value == null) {\n deletePropertyByPath(result, field.property);\n pruneEmptyParents(result, field.property);\n }\n }\n\n return result;\n}\n\nfunction pruneEmptyParents(\n object: Record<string, unknown>,\n path: string,\n): void {\n const segments = path.split('.').filter(Boolean);\n for (let i = segments.length - 1; i > 0; i -= 1) {\n const parentPath = segments.slice(0, i).join('.');\n const parent = getValueByPath(object, parentPath);\n if (\n parent &&\n typeof parent === 'object' &&\n !Array.isArray(parent) &&\n Object.keys(parent as Record<string, unknown>).length === 0\n ) {\n deletePropertyByPath(object, parentPath);\n } else {\n break;\n }\n }\n}\n","export function setPropertyByPath<T extends Record<string, any>>(\n object: T,\n path: string,\n value: unknown,\n): T {\n const segments = path.split('.').filter(Boolean);\n if (segments.length === 0) {\n return object;\n }\n\n let current: Record<string, any> = object;\n\n for (let i = 0; i < segments.length; i += 1) {\n const key = segments[i];\n if (i === segments.length - 1) {\n current[key] = value;\n break;\n }\n\n const existing = current[key];\n\n if (\n existing === undefined ||\n existing === null ||\n typeof existing !== 'object'\n ) {\n current[key] = {};\n }\n\n current = current[key];\n }\n\n return object;\n}\n","/**\n * Navigates to a path via Luigi Core by posting a `luigi.navigation.open` message directly,\n * bypassing the public `LuigiCoreService.navigation().navigate()` API.\n *\n * This is intentional: the public API always calls `history.pushState`, with no way to\n * request `replaceState` instead. Luigi's internal `preventHistoryEntry` flag is read by\n * the Svelte shell and results in `history.replaceState`, but it is not exposed through\n * `linkManager.navigate()`. Posting the message directly lets us set that flag until\n * Luigi exposes it as a first-class option in its public navigation API.\n */\nexport function luigiNavigateTo(path: string, replaceHistory = false): void {\n window.postMessage(\n {\n msg: 'luigi.navigation.open',\n params: {\n link: path,\n relative: false,\n preserveView: false,\n nodeParams: {},\n errorSkipNavigation: false,\n fromContext: null,\n fromParent: false,\n fromClosestContext: false,\n preventHistoryEntry: replaceHistory,\n },\n },\n '*',\n );\n}\n","/**\n * Generated bundle index. Do not edit.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AAM;AACf;;ACjCA;;;;;;;;;AASG;SACa,eAAe,CAAC,IAAY,EAAE,cAAc,GAAG,KAAK,EAAA;IAClE,MAAM,CAAC,WAAW,CAChB;AACE,QAAA,GAAG,EAAE,uBAAuB;AAC5B,QAAA,MAAM,EAAE;AACN,YAAA,IAAI,EAAE,IAAI;AACV,YAAA,QAAQ,EAAE,KAAK;AACf,YAAA,YAAY,EAAE,KAAK;AACnB,YAAA,UAAU,EAAE,EAAE;AACd,YAAA,mBAAmB,EAAE,KAAK;AAC1B,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,UAAU,EAAE,KAAK;AACjB,YAAA,kBAAkB,EAAE,KAAK;AACzB,YAAA,mBAAmB,EAAE,cAAc;AACpC,SAAA;KACF,EACD,GAAG,CACJ;AACH;;AC5BA;;AAEG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platform-mesh/portal-ui-lib",
3
- "version": "0.63.2",
3
+ "version": "0.64.1",
4
4
  "repository": {
5
5
  "url": "git+https://github.com/platform-mesh/portal-ui-lib.git"
6
6
  },
@@ -86,6 +86,8 @@ declare class NodeContextProcessingServiceImpl implements NodeContextProcessingS
86
86
  private errorHandlerService;
87
87
  private luigiCoreService;
88
88
  processNodeContext(dynamicEntityId: string, entityNode: PortalLuigiNode, ctx: PortalNodeContext): Promise<void>;
89
+ private abandonPendingNavigation;
90
+ private isLocationWithinEntity;
89
91
  private addFieldsToContext;
90
92
  private addFieldsToContextFromAccountInfo;
91
93
  private getEntityPermissions;
@@ -1,9 +1,9 @@
1
1
  import { NodeContext } from '@openmfp/portal-ui-lib';
2
2
  import { ResourceDefinition, PermissionsDefinition, ButtonSettings, PlatformMeshFieldDefinition, Resource, DownloadKubeconfigFromSecretRefButtonSettings, ResourceOperationType, ResourcePagination, ResourceListResult, ResourceSubscriptionResult, AccountInfo, LogicalCluster } from '@platform-mesh/portal-ui-lib/models';
3
+ import * as apollo_angular from 'apollo-angular';
3
4
  import { Apollo } from 'apollo-angular';
4
5
  import * as i0 from '@angular/core';
5
6
  import { Observable } from 'rxjs';
6
- import * as _apollo_client from '@apollo/client';
7
7
  import { GenericResource } from '@openmfp/ngx';
8
8
  import { VariableOptions } from 'gql-query-builder';
9
9
 
@@ -155,11 +155,7 @@ interface ReadResourcesSubscriptionResult {
155
155
  type: ResourceOperationType;
156
156
  object: GenericResource;
157
157
  }
158
- /**
159
- * Provider-agnostic read API for resource lists. Implementations can be backed
160
- * by the GraphQL gateway (ResourceService) or by OpenSearch (OpenSearchService);
161
- * the proxy chooses one based on the `os-provider` Luigi feature toggle.
162
- */
158
+ /** Provider-agnostic read API for resource lists. Implementations can be backed by the GraphQL gateway (ResourceService) */
163
159
  interface ReadResources {
164
160
  list(nodeContext: ResourceNodeContext, pagination: ReadResourcesPagination, params: ReadResourcesParams): Observable<ReadResourcesResult>;
165
161
  subscribe(nodeContext: ResourceNodeContext, params: ReadResourcesParams & {
@@ -190,23 +186,8 @@ declare class ResourceService {
190
186
  getAccessibleName(item: Resource): string | undefined;
191
187
  private listWithRawQuery;
192
188
  resourceChangeSubscription(operation: string, fields: any[], nodeContext: ResourceNodeContext, resourceVersion: string, readFromParentKcpPath: boolean): Observable<ResourceSubscriptionResult | undefined>;
193
- private alertErrors;
194
- delete(resource: Resource, resourceDefinition: ResourceDefinition, nodeContext: ResourceNodeContext, readFromParentKcpPath?: boolean): Observable<{
195
- data: void | undefined;
196
- error?: _apollo_client.ErrorLike;
197
- } & {
198
- extensions?: Record<string, unknown>;
199
- } & {
200
- loading?: boolean;
201
- }>;
202
- create(resource: Resource, resourceDefinition: ResourceDefinition, nodeContext: ResourceNodeContext): Observable<{
203
- data: unknown;
204
- error?: _apollo_client.ErrorLike;
205
- } & {
206
- extensions?: Record<string, unknown>;
207
- } & {
208
- loading?: boolean;
209
- }>;
189
+ delete(resource: Resource, resourceDefinition: ResourceDefinition, nodeContext: ResourceNodeContext, readFromParentKcpPath?: boolean): Observable<apollo_angular.Apollo.MutateResult<void>>;
190
+ create(resource: Resource, resourceDefinition: ResourceDefinition, nodeContext: ResourceNodeContext): Observable<apollo_angular.Apollo.MutateResult<unknown>>;
210
191
  update(resource: Resource, resourceDefinition: ResourceDefinition, nodeContext: ResourceNodeContext, readFromParentKcpPath?: boolean, fields?: any[]): Observable<unknown>;
211
192
  getNamespace(nodeContext: ResourceNodeContext, resource?: Resource): string | undefined;
212
193
  private normalizeGqlBuilderVariables;
@@ -224,6 +205,7 @@ declare class ResourceService {
224
205
 
225
206
  declare class AccountInfoService {
226
207
  private apolloFactory;
208
+ private gatewayService;
227
209
  private readCache;
228
210
  read(nodeContext: ResourceNodeContext): Observable<AccountInfo>;
229
211
  static ɵfac: i0.ɵɵFactoryDeclaration<AccountInfoService, never>;
@@ -239,9 +221,12 @@ declare class LogicalClusterService {
239
221
 
240
222
  declare class ErrorHandlerService {
241
223
  private luigiCoreService;
242
- handleError(error: any): void;
224
+ handleError(error: any, msg?: string): void;
225
+ redirectToErrorPage(error: any, replaceHistory?: boolean): boolean;
226
+ private navigateToErrorPage;
243
227
  handleResourcePendingDeletion(_resource: Resource): void;
244
- isUnauthorizedAccess(error: any): boolean;
228
+ private isNotFound;
229
+ private isUnauthorizedAccess;
245
230
  static ɵfac: i0.ɵɵFactoryDeclaration<ErrorHandlerService, never>;
246
231
  static ɵprov: i0.ɵɵInjectableDeclaration<ErrorHandlerService>;
247
232
  }
@@ -65,5 +65,17 @@ declare function omitEmptyWriteOnlyFields<T extends Record<string, unknown>>(res
65
65
 
66
66
  declare function setPropertyByPath<T extends Record<string, any>>(object: T, path: string, value: unknown): T;
67
67
 
68
- export { buildGraphQLInputTypeName, buildResourcePath, decodeBase64, deletePropertyByPath, encodeBase64, flattenFieldTree, generateGraphQLFields, generateGraphQLReadFields, getResourceValueByJsonPath, getValueByPath, isLocalSetup, isNamespacedResource, mergeListWithSubscriptionResult, omitEmptyWriteOnlyFields, parseRawGqlQueryToFields, permissionKey, resourceActionAllowed, setPropertyByPath, stripTypename };
68
+ /**
69
+ * Navigates to a path via Luigi Core by posting a `luigi.navigation.open` message directly,
70
+ * bypassing the public `LuigiCoreService.navigation().navigate()` API.
71
+ *
72
+ * This is intentional: the public API always calls `history.pushState`, with no way to
73
+ * request `replaceState` instead. Luigi's internal `preventHistoryEntry` flag is read by
74
+ * the Svelte shell and results in `history.replaceState`, but it is not exposed through
75
+ * `linkManager.navigate()`. Posting the message directly lets us set that flag until
76
+ * Luigi exposes it as a first-class option in its public navigation API.
77
+ */
78
+ declare function luigiNavigateTo(path: string, replaceHistory?: boolean): void;
79
+
80
+ export { buildGraphQLInputTypeName, buildResourcePath, decodeBase64, deletePropertyByPath, encodeBase64, flattenFieldTree, generateGraphQLFields, generateGraphQLReadFields, getResourceValueByJsonPath, getValueByPath, isLocalSetup, isNamespacedResource, luigiNavigateTo, mergeListWithSubscriptionResult, omitEmptyWriteOnlyFields, parseRawGqlQueryToFields, permissionKey, resourceActionAllowed, setPropertyByPath, stripTypename };
69
81
  export type { GenerateGraphQLFieldsOptions, MergeListWithSubscriptionResultOptions };