@flexkit/studio 0.2.20 → 0.2.22
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/dist/activity-nav-button-7RLCHOFV.js +2 -0
- package/dist/{activity-nav-button-V5DFHADL.js.map → activity-nav-button-7RLCHOFV.js.map} +1 -1
- package/dist/astro.js +1 -1
- package/dist/chat-page-WLKJ3QNZ.js +4 -0
- package/dist/chat-page-WLKJ3QNZ.js.map +1 -0
- package/dist/{chunk-D5WYD5M4.js → chunk-4LVMCUHR.js} +2 -2
- package/dist/{chunk-D5WYD5M4.js.map → chunk-4LVMCUHR.js.map} +1 -1
- package/dist/{chunk-ME55YNBF.js → chunk-4PUMSUJL.js} +2 -2
- package/dist/{chunk-ME55YNBF.js.map → chunk-4PUMSUJL.js.map} +1 -1
- package/dist/{chunk-B7QMGBK5.js → chunk-6AI7322C.js} +3 -3
- package/dist/{chunk-B7QMGBK5.js.map → chunk-6AI7322C.js.map} +1 -1
- package/dist/{chunk-BMX4URYN.js → chunk-7ERLYAPR.js} +2 -2
- package/dist/{chunk-BMX4URYN.js.map → chunk-7ERLYAPR.js.map} +1 -1
- package/dist/chunk-7KLXWCDS.js +3 -0
- package/dist/chunk-7KLXWCDS.js.map +1 -0
- package/dist/chunk-BM7INZL3.js +3 -0
- package/dist/chunk-BM7INZL3.js.map +1 -0
- package/dist/chunk-ELOJGLAR.js +2 -0
- package/dist/chunk-ELOJGLAR.js.map +1 -0
- package/dist/{chunk-GFAOY74A.js → chunk-GGC75EMC.js} +2 -0
- package/dist/{chunk-HLHLBMLJ.js → chunk-HBTMGDOM.js} +2 -2
- package/dist/{chunk-HLHLBMLJ.js.map → chunk-HBTMGDOM.js.map} +1 -1
- package/dist/{chunk-MKK65RQB.js → chunk-HGXYSP47.js} +5 -5
- package/dist/{chunk-MKK65RQB.js.map → chunk-HGXYSP47.js.map} +1 -1
- package/dist/chunk-HKN6BX5U.js +2 -0
- package/dist/chunk-HKN6BX5U.js.map +1 -0
- package/dist/chunk-JIB4PRLH.js +3 -0
- package/dist/chunk-JIB4PRLH.js.map +1 -0
- package/dist/{chunk-2P2QV3K6.js → chunk-K2KW6UYG.js} +2 -2
- package/dist/{chunk-2P2QV3K6.js.map → chunk-K2KW6UYG.js.map} +1 -1
- package/dist/{chunk-ZZRA4567.js → chunk-LIMXKPEK.js} +2 -2
- package/dist/{chunk-ZZRA4567.js.map → chunk-LIMXKPEK.js.map} +1 -1
- package/dist/chunk-MHVZXDVL.js +2 -0
- package/dist/{chunk-BXN72PW2.js.map → chunk-MHVZXDVL.js.map} +1 -1
- package/dist/chunk-MLHXPTBT.js +2 -0
- package/dist/chunk-MLHXPTBT.js.map +1 -0
- package/dist/{chunk-UOR437J2.js → chunk-QCVQJN5O.js} +2 -2
- package/dist/{chunk-UOR437J2.js.map → chunk-QCVQJN5O.js.map} +1 -1
- package/dist/{chunk-F2DT6NRK.js → chunk-QTFFVG7C.js} +2 -2
- package/dist/{chunk-F2DT6NRK.js.map → chunk-QTFFVG7C.js.map} +1 -1
- package/dist/chunk-RPLKJVDQ.js +7 -0
- package/dist/{chunk-NYSQU73M.js.map → chunk-RPLKJVDQ.js.map} +1 -1
- package/dist/{chunk-RY6PECIT.js → chunk-SE4HJCGA.js} +2 -2
- package/dist/{chunk-RY6PECIT.js.map → chunk-SE4HJCGA.js.map} +1 -1
- package/dist/{chunk-DHVKE36X.js → chunk-SY67F62K.js} +3 -3
- package/dist/{chunk-DHVKE36X.js.map → chunk-SY67F62K.js.map} +1 -1
- package/dist/chunk-UCHWUGRT.js +378 -0
- package/dist/chunk-UCHWUGRT.js.map +1 -0
- package/dist/{chunk-JWBER5NX.js → chunk-UJEDL3IZ.js} +2 -2
- package/dist/{chunk-JWBER5NX.js.map → chunk-UJEDL3IZ.js.map} +1 -1
- package/dist/chunk-YXUEPR7K.js +4 -0
- package/dist/{chunk-LK67JOQA.js.map → chunk-YXUEPR7K.js.map} +1 -1
- package/dist/electron.js +1 -1
- package/dist/{entry-XVLXKEQV.js → entry-GWZ7DELK.js} +2 -2
- package/dist/{entry-XVLXKEQV.js.map → entry-GWZ7DELK.js.map} +1 -1
- package/dist/index.css +21 -0
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/list-FQZII7QD.js +3 -0
- package/dist/{list-4OJMI4CB.js.map → list-FQZII7QD.js.map} +1 -1
- package/dist/list-LMIKCT2W.js +2 -0
- package/dist/{list-RABV2F3H.js.map → list-LMIKCT2W.js.map} +1 -1
- package/dist/nextjs.js +1 -1
- package/dist/{pages-7LWBCW2X.js → pages-NKE7FV34.js} +3 -3
- package/dist/{pages-7LWBCW2X.js.map → pages-NKE7FV34.js.map} +1 -1
- package/dist/plugin-pages-4HTADSK3.js +2 -0
- package/dist/{plugin-pages-PQWTH7P5.js.map → plugin-pages-4HTADSK3.js.map} +1 -1
- package/dist/record-links-FDWV4X5W.js +2 -0
- package/dist/{record-links-BFHPBOAL.js.map → record-links-FDWV4X5W.js.map} +1 -1
- package/dist/{root-COI626G2.js → root-GYJGAS22.js} +2 -2
- package/dist/{root-COI626G2.js.map → root-GYJGAS22.js.map} +1 -1
- package/dist/root-OSXC52GL.js +2 -0
- package/dist/{root-PDSTTPHO.js.map → root-OSXC52GL.js.map} +1 -1
- package/dist/root-VL4EM2IS.js +23 -0
- package/dist/{root-FTT4XDCE.js.map → root-VL4EM2IS.js.map} +1 -1
- package/dist/{root-RXMRNU4M.js → root-X3V4NC2D.js} +2 -2
- package/dist/{root-RXMRNU4M.js.map → root-X3V4NC2D.js.map} +1 -1
- package/dist/root-YDHREGTF.js +14 -0
- package/dist/root-YDHREGTF.js.map +1 -0
- package/dist/{root-BS6QCYLO.js → root-ZYUSZZWR.js} +3 -3
- package/dist/{root-BS6QCYLO.js.map → root-ZYUSZZWR.js.map} +1 -1
- package/dist/{search-VPS2UHPQ.js → search-UW7WE2CS.js} +2 -2
- package/dist/{search-VPS2UHPQ.js.map → search-UW7WE2CS.js.map} +1 -1
- package/dist/skills-pages-Q4YSUQVZ.js +2 -0
- package/dist/skills-pages-Q4YSUQVZ.js.map +1 -0
- package/dist/source-PGSWL4DQ.js +2 -0
- package/dist/{source-MNHZQD4T.js.map → source-PGSWL4DQ.js.map} +1 -1
- package/dist/tanstack-start.js +1 -1
- package/dist/{user-nav-36ACWXOW.js → user-nav-B37OEVQN.js} +2 -2
- package/dist/{user-nav-36ACWXOW.js.map → user-nav-B37OEVQN.js.map} +1 -1
- package/package.json +9 -6
- package/dist/activity-nav-button-V5DFHADL.js +0 -2
- package/dist/chat-page-4G4XQ26P.js +0 -4
- package/dist/chat-page-4G4XQ26P.js.map +0 -1
- package/dist/chunk-2HYQVMP3.js +0 -3
- package/dist/chunk-2HYQVMP3.js.map +0 -1
- package/dist/chunk-445XKMAG.js +0 -379
- package/dist/chunk-445XKMAG.js.map +0 -1
- package/dist/chunk-A7XHA2P6.js +0 -3
- package/dist/chunk-A7XHA2P6.js.map +0 -1
- package/dist/chunk-BMO7JFAX.js +0 -2
- package/dist/chunk-BMO7JFAX.js.map +0 -1
- package/dist/chunk-BXN72PW2.js +0 -2
- package/dist/chunk-LK67JOQA.js +0 -4
- package/dist/chunk-NYSQU73M.js +0 -7
- package/dist/list-4OJMI4CB.js +0 -3
- package/dist/list-RABV2F3H.js +0 -2
- package/dist/plugin-pages-PQWTH7P5.js +0 -2
- package/dist/record-links-BFHPBOAL.js +0 -2
- package/dist/root-FTT4XDCE.js +0 -23
- package/dist/root-PDSTTPHO.js +0 -2
- package/dist/root-TZYOIXVG.js +0 -2
- package/dist/root-TZYOIXVG.js.map +0 -1
- package/dist/skills-pages-G6JK7KKQ.js +0 -2
- package/dist/skills-pages-G6JK7KKQ.js.map +0 -1
- package/dist/source-MNHZQD4T.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/graph/graph.ts"],"names":["EXPAND_PAGE","SAMPLE_LIMIT","MAX_NODES","DETAIL_ATTRIBUTE_LIMIT","HIDDEN_ENTITIES","GRAPH_PALETTE","nodeKey","entity","id","getRelationshipAttributes","attribute","getAttributeScope","getGraphEntities","schema","getEntity","name","find","propEq","getEntityLabel","getEntityColors","theme","palette","index","getDisplaySelection","scope","display","getDisplayAttribute","scopeType","getScopeFields","getRelatedSelection","args","relatedEntity","getCountSelection","EXPAND_HOP_MAX_RECORDS","buildRecordsQuery","expand","relationships","buildExpandQuery","buildCountsQuery","getDetailAttributes","buildDetailsQuery","fields","getTotalEntities","entities","buildTotalsQuery","formatDetailValue","value","first","captionOf","record","scoped","edgeOf","source","target","sourceAttribute","targetAttribute","left","leftAttribute","right","graphFromRecords","records","nodes","edges","counts","relatedEntityName","relatedRecords","total","relatedRecord","edge","fetchedFromRecords","fetched","related","key","graphPath","projectId","ids","params","parseGraphParams","search"],"mappings":"mIAYO,IAAMA,CAAAA,CAAc,EAAA,CAEdC,CAAAA,CAAe,GAEfC,CAAAA,CAAY,GAAA,CAEZC,CAAAA,CAAyB,EAAA,CAGhCC,EAAkB,IAAI,GAAA,CAAI,CAAC,QAAQ,CAAC,CAAA,CAU7BC,CAAAA,CAAgB,CAC3B,MAAO,CACL,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SACF,CAAA,CACA,IAAA,CAAM,CACJ,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SACF,CACF,EAgCO,SAASC,CAAAA,CAAQC,CAAAA,CAAgBC,CAAAA,CAAoB,CAC1D,OAAO,CAAA,EAAGD,CAAM,CAAA,CAAA,EAAIC,CAAE,CAAA,CACxB,CAGO,SAASC,CAAAA,CAA0BF,CAAAA,CAA6B,CACrE,OAAOA,EAAO,UAAA,CAAW,MAAA,CACtBG,CAAAA,EACCC,CAAAA,CAAkBD,CAAS,CAAA,GAAM,cAA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A,CAAG,IAAA,EAAM,CAAA,CACrB,MAAA,CAAO,OAAO,CAAA,CAEjB,OAAO,CAAE,MAAA,CAAAD,CAAAA,CAAQ,GAAA,CAAAoE,CAAI,CACvB","file":"chunk-ME55YNBF.js","sourcesContent":["import { find, propEq } from 'ramda';\nimport { getAttributeScope } from '../../core/attribute-scope';\nimport { getDisplayAttribute } from '../../core/get-display-attribute';\nimport type { Attribute, Entity } from '../../core/types';\n\n/**\n * Pure helpers of the Graph app: the GraphQL queries that fetch records with\n * their relationships, and the mapping of their results to the nodes and\n * edges the canvas draws. No React, no sigma, so the rules are unit-testable.\n */\n\n/** Related records fetched per relationship attribute in one go. */\nexport const EXPAND_PAGE = 25;\n/** Records loaded when starting from an entity. */\nexport const SAMPLE_LIMIT = 25;\n/** Nodes a canvas holds at most; later additions are dropped with a notice. */\nexport const MAX_NODES = 2000;\n/** Attributes shown in the inspector at most. */\nexport const DETAIL_ATTRIBUTE_LIMIT = 12;\n\n/** Entities whose nodes are never drawn: assets are media, not records. */\nconst HIDDEN_ENTITIES = new Set(['_asset']);\n\n/**\n * Categorical palette, one hue per entity in schema order (light and dark\n * surfaces step the same hues). The first eight are the validated dataviz\n * palette; the next four were checked with its script so adjacent pairs\n * stay apart under colour-blindness simulation and no pair on either\n * surface comes closer than the reference palette's own closest pair.\n * Projects with more entities than hues reuse them.\n */\nexport const GRAPH_PALETTE = {\n light: [\n '#2a78d6',\n '#eb6834',\n '#1baf7a',\n '#eda100',\n '#e87ba4',\n '#008300',\n '#6250d6',\n '#e34948',\n '#0e9aa7',\n '#6b8e23',\n '#9c27b0',\n '#a05a2c',\n ],\n dark: [\n '#3987e5',\n '#d95926',\n '#199e70',\n '#c98500',\n '#d55181',\n '#008300',\n '#9085e9',\n '#e66767',\n '#1a9fb0',\n '#6f8a28',\n '#c058d6',\n '#a35226',\n ],\n} as const;\n\nexport interface GraphNode {\n key: string;\n entity: string;\n id: string;\n label: string;\n}\n\nexport interface GraphEdge {\n key: string;\n source: string;\n target: string;\n /** The relationship attribute on the source node's entity. */\n sourceAttribute: string;\n /** The mirror attribute on the target node's entity. */\n targetAttribute: string;\n}\n\n/** Related records per relationship attribute, keyed by node, as the API counted them. */\nexport type GraphCounts = { [nodeKey: string]: { [attribute: string]: number } };\n\nexport interface GraphData {\n nodes: GraphNode[];\n edges: GraphEdge[];\n counts: GraphCounts;\n}\n\nexport type GraphRecord = { _id: string; [key: string]: unknown };\n\ntype ConnectionCount = { aggregate?: { count?: { nodes?: number } } };\n\nexport function nodeKey(entity: string, id: string): string {\n return `${entity}:${id}`;\n}\n\n/** Relationship attributes of an entity that point at drawable entities. */\nexport function getRelationshipAttributes(entity: Entity): Attribute[] {\n return entity.attributes.filter(\n (attribute) =>\n getAttributeScope(attribute) === 'relationship' &&\n attribute.relationship !== undefined &&\n !HIDDEN_ENTITIES.has(attribute.relationship.entity)\n );\n}\n\n/** Entities worth starting from: at least one drawable relationship. */\nexport function getGraphEntities(schema: Entity[]): Entity[] {\n return schema.filter((entity) => !HIDDEN_ENTITIES.has(entity.name) && getRelationshipAttributes(entity).length > 0);\n}\n\nexport function getEntity(schema: Entity[], name: string): Entity | undefined {\n return find<Entity>(propEq(name, 'name'))(schema);\n}\n\nexport function getEntityLabel(entity: Entity): string {\n return entity.menu?.label ?? entity.plural;\n}\n\n/** Colour per entity name, assigned in schema order and never re-cycled on filter. */\nexport function getEntityColors(schema: Entity[], theme: 'light' | 'dark'): { [entity: string]: string } {\n const palette = GRAPH_PALETTE[theme];\n\n return Object.fromEntries(\n schema.filter((entity) => !HIDDEN_ENTITIES.has(entity.name)).map((entity, index) => [entity.name, palette[index % palette.length]])\n );\n}\n\n/**\n * Selection of the display attribute: a scalar for global attributes, the\n * current scope's value for local ones. Relationship display attributes fall\n * back to the id.\n */\nexport function getDisplaySelection(entity: Entity | undefined, scope: string): string {\n const display = getDisplayAttribute(entity);\n\n if (!display) {\n return '';\n }\n\n const scopeType = getAttributeScope(display);\n\n if (scopeType === 'global') {\n return display.name;\n }\n\n if (scopeType === 'local') {\n return `${display.name} { ${getScopeFields(scope)} }`;\n }\n\n return '';\n}\n\n/** The scope value and the default one to fall back on, as the Desk queries select them. */\nexport function getScopeFields(scope: string): string {\n return scope === 'default' ? 'default' : `default ${scope}`;\n}\n\nfunction getRelatedSelection(attribute: Attribute, schema: Entity[], scope: string, args: string): string {\n const relatedEntity = getEntity(schema, attribute.relationship?.entity ?? '');\n\n return `${attribute.name}${args} { _id ${getDisplaySelection(relatedEntity, scope)} }`;\n}\n\nfunction getCountSelection(attribute: Attribute): string {\n return `${attribute.name}Connection { aggregate { count { nodes } } }`;\n}\n\n/** Records a one-hop load covers at most; more records come without their relationships. */\nexport const EXPAND_HOP_MAX_RECORDS = 5;\n\n/**\n * Records by id or a sample of them; with `expand`, each comes with the first\n * page of every drawable relationship. Totals are left to the inspector:\n * counting every relationship of every record is what makes a load slow.\n */\nexport function buildRecordsQuery({\n entity,\n schema,\n scope,\n expand,\n}: {\n entity: Entity;\n schema: Entity[];\n scope: string;\n expand: boolean;\n}): string {\n const relationships = expand\n ? getRelationshipAttributes(entity).map((attribute) =>\n getRelatedSelection(attribute, schema, scope, `(limit: ${EXPAND_PAGE})`)\n )\n : [];\n\n return `query GraphRecords($where: ${entity.name}Where, $limit: Int) {\n ${entity.plural}(where: $where, limit: $limit) {\n _id\n ${getDisplaySelection(entity, scope)}\n ${relationships.join('\\n ')}\n }\n}`;\n}\n\n/** One more page of a single relationship of one record. */\nexport function buildExpandQuery({\n entity,\n schema,\n scope,\n attribute,\n}: {\n entity: Entity;\n schema: Entity[];\n scope: string;\n attribute: Attribute;\n}): string {\n return `query GraphExpand($id: ID!, $offset: Int, $limit: Int) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n ${getRelatedSelection(attribute, schema, scope, '(limit: $limit, offset: $offset)')}\n }\n}`;\n}\n\n/** The total per drawable relationship of one record. */\nexport function buildCountsQuery({ entity }: { entity: Entity }): string {\n return `query GraphCounts($id: ID!) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n ${getRelationshipAttributes(entity).map(getCountSelection).join('\\n ')}\n }\n}`;\n}\n\n/** Attributes the inspector lists: visible scalars, global or in the current scope; rich text is skipped. */\nexport function getDetailAttributes(entity: Entity): Attribute[] {\n return entity.attributes\n .filter((attribute) => {\n const scopeType = getAttributeScope(attribute);\n\n return (\n !attribute.hidden &&\n attribute.dataType !== 'asset' &&\n attribute.inputType !== 'editor' &&\n (scopeType === 'global' || scopeType === 'local')\n );\n })\n .slice(0, DETAIL_ATTRIBUTE_LIMIT);\n}\n\n/** The scalar values of one record for the inspector. */\nexport function buildDetailsQuery({ entity, scope }: { entity: Entity; scope: string }): string {\n const fields = getDetailAttributes(entity).map((attribute) =>\n getAttributeScope(attribute) === 'local' ? `${attribute.name} { ${getScopeFields(scope)} }` : attribute.name\n );\n\n return `query GraphDetails($id: ID!) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n _updatedAt\n ${fields.join('\\n ')}\n }\n}`;\n}\n\n/** Entities whose count-store total the API exposes (not space-bound). */\nexport function getTotalEntities(entities: Entity[]): Entity[] {\n return entities.filter((entity) => (entity.spaces?.length ?? 0) === 0);\n}\n\nexport function buildTotalsQuery(entities: Entity[]): string {\n return `query GraphTotals {\\n ${getTotalEntities(entities)\n .map((entity) => `${entity.plural}Total`)\n .join('\\n ')}\\n}`;\n}\n\n/** A scalar as the inspector shows it: the scope value of a local attribute, else the value itself. */\nexport function formatDetailValue(value: unknown, scope: string): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n if (Array.isArray(value)) {\n const [first] = value as { [key: string]: unknown }[];\n\n return formatDetailValue(first?.[scope] ?? first?.default, scope);\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n\n return String(value);\n}\n\n/** The caption of a record: its display value in the scope, else in the default scope, else its id. */\nexport function captionOf(record: GraphRecord, entity: Entity | undefined, scope: string): string {\n const display = getDisplayAttribute(entity);\n const value = display ? record[display.name] : undefined;\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n\n if (Array.isArray(value)) {\n const [first] = value as { [key: string]: unknown }[];\n const scoped = first?.[scope] ?? first?.default;\n\n if (typeof scoped === 'string' || typeof scoped === 'number') {\n return String(scoped);\n }\n }\n\n return record._id;\n}\n\n/**\n * The edge between two nodes for a relationship: one Neo4j relationship per\n * entity pair, so the key is the same whichever side it was fetched from.\n */\nexport function edgeOf(source: GraphNode, target: GraphNode, attribute: Attribute): GraphEdge {\n const sourceAttribute = attribute.name;\n const targetAttribute = attribute.relationship?.field ?? attribute.name;\n const [left] = [source.key, target.key].sort();\n const leftAttribute = left === source.key ? sourceAttribute : targetAttribute;\n const right = left === source.key ? target.key : source.key;\n\n return { key: `${left}|${right}|${leftAttribute}`, source: source.key, target: target.key, sourceAttribute, targetAttribute };\n}\n\n/**\n * Nodes and edges from records of an entity; the related records under each\n * relationship attribute become nodes too, and `xConnection` aggregates\n * become counts.\n */\nexport function graphFromRecords({\n records,\n entity,\n schema,\n scope,\n}: {\n records: GraphRecord[];\n entity: Entity;\n schema: Entity[];\n scope: string;\n}): GraphData {\n const nodes = new Map<string, GraphNode>();\n const edges = new Map<string, GraphEdge>();\n const counts: GraphCounts = {};\n const relationships = getRelationshipAttributes(entity);\n\n records.forEach((record) => {\n const source: GraphNode = {\n key: nodeKey(entity.name, record._id),\n entity: entity.name,\n id: record._id,\n label: captionOf(record, entity, scope),\n };\n nodes.set(source.key, source);\n\n relationships.forEach((attribute) => {\n const relatedEntityName = attribute.relationship?.entity ?? '';\n const relatedEntity = getEntity(schema, relatedEntityName);\n const relatedRecords = record[attribute.name];\n const connection = record[`${attribute.name}Connection`] as ConnectionCount | undefined;\n const total = connection?.aggregate?.count?.nodes;\n\n if (typeof total === 'number') {\n counts[source.key] = { ...counts[source.key], [attribute.name]: total };\n }\n\n if (!Array.isArray(relatedRecords)) {\n return;\n }\n\n (relatedRecords as GraphRecord[]).forEach((relatedRecord) => {\n const target: GraphNode = {\n key: nodeKey(relatedEntityName, relatedRecord._id),\n entity: relatedEntityName,\n id: relatedRecord._id,\n label: captionOf(relatedRecord, relatedEntity, scope),\n };\n\n if (!nodes.has(target.key)) {\n nodes.set(target.key, target);\n }\n\n if (target.key !== source.key) {\n const edge = edgeOf(source, target, attribute);\n\n if (!edges.has(edge.key)) {\n edges.set(edge.key, edge);\n }\n }\n });\n });\n });\n\n return { nodes: [...nodes.values()], edges: [...edges.values()], counts };\n}\n\n/** How many related records each record carries per relationship, to continue paging from. */\nexport function fetchedFromRecords(records: GraphRecord[], entity: Entity): GraphCounts {\n const fetched: GraphCounts = {};\n\n records.forEach((record) => {\n getRelationshipAttributes(entity).forEach((attribute) => {\n const related = record[attribute.name];\n\n if (Array.isArray(related)) {\n const key = nodeKey(entity.name, record._id);\n fetched[key] = { ...fetched[key], [attribute.name]: related.length };\n }\n });\n });\n\n return fetched;\n}\n\n/** The Graph app route for an entity, optionally for given records. */\nexport function graphPath(projectId: string, { entity, ids }: { entity: string; ids?: string[] }): string {\n const params = new URLSearchParams({ entity });\n\n if (ids && ids.length > 0) {\n params.set('ids', ids.join(','));\n }\n\n return `/${projectId}/graph?${params.toString()}`;\n}\n\nexport function parseGraphParams(search: string): { entity: string; ids: string[] } | null {\n const params = new URLSearchParams(search);\n const entity = params.get('entity');\n\n if (!entity) {\n return null;\n }\n\n const ids = (params.get('ids') ?? '')\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean);\n\n return { entity, ids };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/apps/graph/graph.ts"],"names":["EXPAND_PAGE","SAMPLE_LIMIT","MAX_NODES","DETAIL_ATTRIBUTE_LIMIT","HIDDEN_ENTITIES","GRAPH_PALETTE","nodeKey","entity","id","getRelationshipAttributes","attribute","getAttributeScope","getGraphEntities","schema","getEntity","name","find","propEq","getEntityLabel","getEntityColors","theme","palette","index","getDisplaySelection","scope","display","getDisplayAttribute","scopeType","getScopeFields","getRelatedSelection","args","relatedEntity","getCountSelection","EXPAND_HOP_MAX_RECORDS","buildRecordsQuery","expand","relationships","buildExpandQuery","buildCountsQuery","getDetailAttributes","buildDetailsQuery","fields","getTotalEntities","entities","buildTotalsQuery","formatDetailValue","value","first","captionOf","record","scoped","edgeOf","source","target","sourceAttribute","targetAttribute","left","leftAttribute","right","graphFromRecords","records","nodes","edges","counts","relatedEntityName","relatedRecords","total","relatedRecord","edge","fetchedFromRecords","fetched","related","key","graphPath","projectId","ids","params","parseGraphParams","search"],"mappings":"mIAYO,IAAMA,CAAAA,CAAc,EAAA,CAEdC,CAAAA,CAAe,GAEfC,CAAAA,CAAY,GAAA,CAEZC,CAAAA,CAAyB,EAAA,CAGhCC,EAAkB,IAAI,GAAA,CAAI,CAAC,QAAQ,CAAC,CAAA,CAU7BC,CAAAA,CAAgB,CAC3B,MAAO,CACL,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SACF,CAAA,CACA,IAAA,CAAM,CACJ,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,UACA,SAAA,CACA,SAAA,CACA,SAAA,CACA,SACF,CACF,EAgCO,SAASC,CAAAA,CAAQC,CAAAA,CAAgBC,CAAAA,CAAoB,CAC1D,OAAO,CAAA,EAAGD,CAAM,CAAA,CAAA,EAAIC,CAAE,CAAA,CACxB,CAGO,SAASC,CAAAA,CAA0BF,CAAAA,CAA6B,CACrE,OAAOA,EAAO,UAAA,CAAW,MAAA,CACtBG,CAAAA,EACCC,CAAAA,CAAkBD,CAAS,CAAA,GAAM,cAAA,EACjCA,CAAAA,CAAU,eAAiB,MAAA,EAC3B,CAACN,CAAAA,CAAgB,GAAA,CAAIM,EAAU,YAAA,CAAa,MAAM,CACtD,CACF,CAGO,SAASE,CAAAA,CAAiBC,CAAAA,CAA4B,CAC3D,OAAOA,CAAAA,CAAO,MAAA,CAAQ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ope } from '../../core/attribute-scope';\nimport { getDisplayAttribute } from '../../core/get-display-attribute';\nimport type { Attribute, Entity } from '../../core/types';\n\n/**\n * Pure helpers of the Graph app: the GraphQL queries that fetch records with\n * their relationships, and the mapping of their results to the nodes and\n * edges the canvas draws. No React, no sigma, so the rules are unit-testable.\n */\n\n/** Related records fetched per relationship attribute in one go. */\nexport const EXPAND_PAGE = 25;\n/** Records loaded when starting from an entity. */\nexport const SAMPLE_LIMIT = 25;\n/** Nodes a canvas holds at most; later additions are dropped with a notice. */\nexport const MAX_NODES = 2000;\n/** Attributes shown in the inspector at most. */\nexport const DETAIL_ATTRIBUTE_LIMIT = 12;\n\n/** Entities whose nodes are never drawn: assets are media, not records. */\nconst HIDDEN_ENTITIES = new Set(['_asset']);\n\n/**\n * Categorical palette, one hue per entity in schema order (light and dark\n * surfaces step the same hues). The first eight are the validated dataviz\n * palette; the next four were checked with its script so adjacent pairs\n * stay apart under colour-blindness simulation and no pair on either\n * surface comes closer than the reference palette's own closest pair.\n * Projects with more entities than hues reuse them.\n */\nexport const GRAPH_PALETTE = {\n light: [\n '#2a78d6',\n '#eb6834',\n '#1baf7a',\n '#eda100',\n '#e87ba4',\n '#008300',\n '#6250d6',\n '#e34948',\n '#0e9aa7',\n '#6b8e23',\n '#9c27b0',\n '#a05a2c',\n ],\n dark: [\n '#3987e5',\n '#d95926',\n '#199e70',\n '#c98500',\n '#d55181',\n '#008300',\n '#9085e9',\n '#e66767',\n '#1a9fb0',\n '#6f8a28',\n '#c058d6',\n '#a35226',\n ],\n} as const;\n\nexport interface GraphNode {\n key: string;\n entity: string;\n id: string;\n label: string;\n}\n\nexport interface GraphEdge {\n key: string;\n source: string;\n target: string;\n /** The relationship attribute on the source node's entity. */\n sourceAttribute: string;\n /** The mirror attribute on the target node's entity. */\n targetAttribute: string;\n}\n\n/** Related records per relationship attribute, keyed by node, as the API counted them. */\nexport type GraphCounts = { [nodeKey: string]: { [attribute: string]: number } };\n\nexport interface GraphData {\n nodes: GraphNode[];\n edges: GraphEdge[];\n counts: GraphCounts;\n}\n\nexport type GraphRecord = { _id: string; [key: string]: unknown };\n\ntype ConnectionCount = { aggregate?: { count?: { nodes?: number } } };\n\nexport function nodeKey(entity: string, id: string): string {\n return `${entity}:${id}`;\n}\n\n/** Relationship attributes of an entity that point at drawable entities. */\nexport function getRelationshipAttributes(entity: Entity): Attribute[] {\n return entity.attributes.filter(\n (attribute) =>\n getAttributeScope(attribute) === 'relationship' &&\n attribute.relationship !== undefined &&\n !HIDDEN_ENTITIES.has(attribute.relationship.entity)\n );\n}\n\n/** Entities worth starting from: at least one drawable relationship. */\nexport function getGraphEntities(schema: Entity[]): Entity[] {\n return schema.filter((entity) => !HIDDEN_ENTITIES.has(entity.name) && getRelationshipAttributes(entity).length > 0);\n}\n\nexport function getEntity(schema: Entity[], name: string): Entity | undefined {\n return find<Entity>(propEq(name, 'name'))(schema);\n}\n\nexport function getEntityLabel(entity: Entity): string {\n return entity.menu?.label ?? entity.plural;\n}\n\n/** Colour per entity name, assigned in schema order and never re-cycled on filter. */\nexport function getEntityColors(schema: Entity[], theme: 'light' | 'dark'): { [entity: string]: string } {\n const palette = GRAPH_PALETTE[theme];\n\n return Object.fromEntries(\n schema.filter((entity) => !HIDDEN_ENTITIES.has(entity.name)).map((entity, index) => [entity.name, palette[index % palette.length]])\n );\n}\n\n/**\n * Selection of the display attribute: a scalar for global attributes, the\n * current scope's value for local ones. Relationship display attributes fall\n * back to the id.\n */\nexport function getDisplaySelection(entity: Entity | undefined, scope: string): string {\n const display = getDisplayAttribute(entity);\n\n if (!display) {\n return '';\n }\n\n const scopeType = getAttributeScope(display);\n\n if (scopeType === 'global') {\n return display.name;\n }\n\n if (scopeType === 'local') {\n return `${display.name} { ${getScopeFields(scope)} }`;\n }\n\n return '';\n}\n\n/** The scope value and the default one to fall back on, as the Desk queries select them. */\nexport function getScopeFields(scope: string): string {\n return scope === 'default' ? 'default' : `default ${scope}`;\n}\n\nfunction getRelatedSelection(attribute: Attribute, schema: Entity[], scope: string, args: string): string {\n const relatedEntity = getEntity(schema, attribute.relationship?.entity ?? '');\n\n return `${attribute.name}${args} { _id ${getDisplaySelection(relatedEntity, scope)} }`;\n}\n\nfunction getCountSelection(attribute: Attribute): string {\n return `${attribute.name}Connection { aggregate { count { nodes } } }`;\n}\n\n/** Records a one-hop load covers at most; more records come without their relationships. */\nexport const EXPAND_HOP_MAX_RECORDS = 5;\n\n/**\n * Records by id or a sample of them; with `expand`, each comes with the first\n * page of every drawable relationship. Totals are left to the inspector:\n * counting every relationship of every record is what makes a load slow.\n */\nexport function buildRecordsQuery({\n entity,\n schema,\n scope,\n expand,\n}: {\n entity: Entity;\n schema: Entity[];\n scope: string;\n expand: boolean;\n}): string {\n const relationships = expand\n ? getRelationshipAttributes(entity).map((attribute) =>\n getRelatedSelection(attribute, schema, scope, `(limit: ${EXPAND_PAGE})`)\n )\n : [];\n\n return `query GraphRecords($where: ${entity.name}Where, $limit: Int) {\n ${entity.plural}(where: $where, limit: $limit) {\n _id\n ${getDisplaySelection(entity, scope)}\n ${relationships.join('\\n ')}\n }\n}`;\n}\n\n/** One more page of a single relationship of one record. */\nexport function buildExpandQuery({\n entity,\n schema,\n scope,\n attribute,\n}: {\n entity: Entity;\n schema: Entity[];\n scope: string;\n attribute: Attribute;\n}): string {\n return `query GraphExpand($id: ID!, $offset: Int, $limit: Int) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n ${getRelatedSelection(attribute, schema, scope, '(limit: $limit, offset: $offset)')}\n }\n}`;\n}\n\n/** The total per drawable relationship of one record. */\nexport function buildCountsQuery({ entity }: { entity: Entity }): string {\n return `query GraphCounts($id: ID!) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n ${getRelationshipAttributes(entity).map(getCountSelection).join('\\n ')}\n }\n}`;\n}\n\n/** Attributes the inspector lists: visible scalars, global or in the current scope; rich text is skipped. */\nexport function getDetailAttributes(entity: Entity): Attribute[] {\n return entity.attributes\n .filter((attribute) => {\n const scopeType = getAttributeScope(attribute);\n\n return (\n !attribute.hidden &&\n attribute.dataType !== 'asset' &&\n attribute.inputType !== 'editor' &&\n (scopeType === 'global' || scopeType === 'local')\n );\n })\n .slice(0, DETAIL_ATTRIBUTE_LIMIT);\n}\n\n/** The scalar values of one record for the inspector. */\nexport function buildDetailsQuery({ entity, scope }: { entity: Entity; scope: string }): string {\n const fields = getDetailAttributes(entity).map((attribute) =>\n getAttributeScope(attribute) === 'local' ? `${attribute.name} { ${getScopeFields(scope)} }` : attribute.name\n );\n\n return `query GraphDetails($id: ID!) {\n ${entity.plural}(where: { _id: { eq: $id } }) {\n _id\n _updatedAt\n ${fields.join('\\n ')}\n }\n}`;\n}\n\n/** Entities whose count-store total the API exposes (not space-bound). */\nexport function getTotalEntities(entities: Entity[]): Entity[] {\n return entities.filter((entity) => (entity.spaces?.length ?? 0) === 0);\n}\n\nexport function buildTotalsQuery(entities: Entity[]): string {\n return `query GraphTotals {\\n ${getTotalEntities(entities)\n .map((entity) => `${entity.plural}Total`)\n .join('\\n ')}\\n}`;\n}\n\n/** A scalar as the inspector shows it: the scope value of a local attribute, else the value itself. */\nexport function formatDetailValue(value: unknown, scope: string): string {\n if (value === null || value === undefined) {\n return '';\n }\n\n if (Array.isArray(value)) {\n const [first] = value as { [key: string]: unknown }[];\n\n return formatDetailValue(first?.[scope] ?? first?.default, scope);\n }\n\n if (typeof value === 'object') {\n return JSON.stringify(value);\n }\n\n return String(value);\n}\n\n/** The caption of a record: its display value in the scope, else in the default scope, else its id. */\nexport function captionOf(record: GraphRecord, entity: Entity | undefined, scope: string): string {\n const display = getDisplayAttribute(entity);\n const value = display ? record[display.name] : undefined;\n\n if (typeof value === 'string' || typeof value === 'number') {\n return String(value);\n }\n\n if (Array.isArray(value)) {\n const [first] = value as { [key: string]: unknown }[];\n const scoped = first?.[scope] ?? first?.default;\n\n if (typeof scoped === 'string' || typeof scoped === 'number') {\n return String(scoped);\n }\n }\n\n return record._id;\n}\n\n/**\n * The edge between two nodes for a relationship: one Neo4j relationship per\n * entity pair, so the key is the same whichever side it was fetched from.\n */\nexport function edgeOf(source: GraphNode, target: GraphNode, attribute: Attribute): GraphEdge {\n const sourceAttribute = attribute.name;\n const targetAttribute = attribute.relationship?.field ?? attribute.name;\n const [left] = [source.key, target.key].sort();\n const leftAttribute = left === source.key ? sourceAttribute : targetAttribute;\n const right = left === source.key ? target.key : source.key;\n\n return { key: `${left}|${right}|${leftAttribute}`, source: source.key, target: target.key, sourceAttribute, targetAttribute };\n}\n\n/**\n * Nodes and edges from records of an entity; the related records under each\n * relationship attribute become nodes too, and `xConnection` aggregates\n * become counts.\n */\nexport function graphFromRecords({\n records,\n entity,\n schema,\n scope,\n}: {\n records: GraphRecord[];\n entity: Entity;\n schema: Entity[];\n scope: string;\n}): GraphData {\n const nodes = new Map<string, GraphNode>();\n const edges = new Map<string, GraphEdge>();\n const counts: GraphCounts = {};\n const relationships = getRelationshipAttributes(entity);\n\n records.forEach((record) => {\n const source: GraphNode = {\n key: nodeKey(entity.name, record._id),\n entity: entity.name,\n id: record._id,\n label: captionOf(record, entity, scope),\n };\n nodes.set(source.key, source);\n\n relationships.forEach((attribute) => {\n const relatedEntityName = attribute.relationship?.entity ?? '';\n const relatedEntity = getEntity(schema, relatedEntityName);\n const relatedRecords = record[attribute.name];\n const connection = record[`${attribute.name}Connection`] as ConnectionCount | undefined;\n const total = connection?.aggregate?.count?.nodes;\n\n if (typeof total === 'number') {\n counts[source.key] = { ...counts[source.key], [attribute.name]: total };\n }\n\n if (!Array.isArray(relatedRecords)) {\n return;\n }\n\n (relatedRecords as GraphRecord[]).forEach((relatedRecord) => {\n const target: GraphNode = {\n key: nodeKey(relatedEntityName, relatedRecord._id),\n entity: relatedEntityName,\n id: relatedRecord._id,\n label: captionOf(relatedRecord, relatedEntity, scope),\n };\n\n if (!nodes.has(target.key)) {\n nodes.set(target.key, target);\n }\n\n if (target.key !== source.key) {\n const edge = edgeOf(source, target, attribute);\n\n if (!edges.has(edge.key)) {\n edges.set(edge.key, edge);\n }\n }\n });\n });\n });\n\n return { nodes: [...nodes.values()], edges: [...edges.values()], counts };\n}\n\n/** How many related records each record carries per relationship, to continue paging from. */\nexport function fetchedFromRecords(records: GraphRecord[], entity: Entity): GraphCounts {\n const fetched: GraphCounts = {};\n\n records.forEach((record) => {\n getRelationshipAttributes(entity).forEach((attribute) => {\n const related = record[attribute.name];\n\n if (Array.isArray(related)) {\n const key = nodeKey(entity.name, record._id);\n fetched[key] = { ...fetched[key], [attribute.name]: related.length };\n }\n });\n });\n\n return fetched;\n}\n\n/** The Graph app route for an entity, optionally for given records. */\nexport function graphPath(projectId: string, { entity, ids }: { entity: string; ids?: string[] }): string {\n const params = new URLSearchParams({ entity });\n\n if (ids && ids.length > 0) {\n params.set('ids', ids.join(','));\n }\n\n return `/${projectId}/graph?${params.toString()}`;\n}\n\nexport function parseGraphParams(search: string): { entity: string; ids: string[] } | null {\n const params = new URLSearchParams(search);\n const entity = params.get('entity');\n\n if (!entity) {\n return null;\n }\n\n const ids = (params.get('ids') ?? '')\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean);\n\n return { entity, ids };\n}\n"]}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import'./index.css';import {g,d as d$1}from'./chunk-
|
|
2
|
-
export{x as a,d as b,f as c,Fe as d,Xe as e,qe as f};//# sourceMappingURL=chunk-
|
|
3
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {g,d as d$1}from'./chunk-JIB4PRLH.js';import {b as b$1}from'./chunk-U45E5X3H.js';import {createContext,lazy,Suspense,useMemo,useContext}from'react';import {Navigate,useParams}from'react-router-dom';import {Bot,Layout,FileStack,BookOpenText,Waypoints,SquarePlay}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import w,{mutate}from'swr';var d={name:"_asset",plural:"_assets",display:"originalFilename",menu:{hidden:true},attributes:[{name:"path",label:"Asset",scope:"global",options:{size:140},dataType:"string",inputType:"text",previewType:"assetPreviewField",defaultValue:""},{name:"originalFilename",label:"Filename",scope:"global",options:{size:320},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"size",label:"Size",scope:"global",options:{size:120},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"width",label:"Width",scope:"global",options:{size:90},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"height",label:"Height",scope:"global",options:{size:100},dataType:"int",inputType:"text",previewType:"text",defaultValue:""},{name:"mimeType",label:"Mime Type",scope:"global",options:{size:160},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"lqip",label:"lqip",scope:"global",hidden:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"url",label:"URL",scope:"global",hidden:true,readOnly:true,dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"tags",label:"Tags",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",previewType:"tags",options:{size:300},relationship:{mode:"multiple",field:"name",entity:"_tag"}}]};var f={name:"_tag",plural:"_tags",display:"name",menu:{hidden:true},attributes:[{name:"name",label:"Tag Name",scope:"global",options:{size:220},dataType:"string",inputType:"text",previewType:"text",defaultValue:""},{name:"_updatedAt",label:"Updated At",scope:"global",options:{size:220},readOnly:true,hidden:true,dataType:"datetime",inputType:"datetime",previewType:"datetime",defaultValue:""},{name:"assets",label:"Assets",scope:"relationship",dataType:"string",inputType:"relationship",defaultValue:"",relationship:{mode:"multiple",field:"originalFilename",entity:"_asset"}}]};function x(){let{resolvedTheme:e}=b$1();return jsx("div",{className:"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background",children:jsxs("div",{className:"fk:flex fk:flex-col fk:items-center",children:[e==="dark"?jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"#020817"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"white"})]}):jsxs("svg",{className:"fk:h-8 fk:w-8 fk:animate-bounce",fill:"none",viewBox:"0 0 48 48",xmlns:"http://www.w3.org/2000/svg",children:[jsx("path",{d:"M7 8H41V40H7V8Z",fill:"white"}),jsx("path",{d:"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z",fill:"#020817"})]}),jsx("div",{className:"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse",children:"Loading..."})]})})}var _=Navigate;function o(e){let t=lazy(e);return jsx(Suspense,{fallback:jsx(x,{}),children:jsx(t,{})})}var J=o(()=>import('./root-X3V4NC2D.js').then(e=>({default:e.Root}))),X=o(()=>import('./list-LMIKCT2W.js').then(e=>({default:e.List}))),q=o(()=>import('./edit-entity-PVT34FD7.js').then(e=>({default:e.EditEntity}))),K=o(()=>import('./root-VL4EM2IS.js').then(e=>({default:e.Root}))),G=o(()=>import('./root-GYJGAS22.js').then(e=>({default:e.Root}))),$=o(()=>import('./list-FQZII7QD.js').then(e=>({default:e.List}))),Q=o(()=>import('./source-PGSWL4DQ.js').then(e=>({default:e.Source}))),Y=o(()=>import('./root-YDHREGTF.js').then(e=>({default:e.Root}))),ee=o(()=>import('./root-ZYUSZZWR.js').then(e=>({default:e.Root}))),te=o(()=>import('./root-OSXC52GL.js').then(e=>({default:e.Root}))),oe=o(()=>import('./plugin-pages-4HTADSK3.js').then(e=>({default:e.PluginsPage}))),ne=o(()=>import('./plugin-pages-4HTADSK3.js').then(e=>({default:e.InstalledPluginsPage}))),ae=o(()=>import('./plugin-pages-4HTADSK3.js').then(e=>({default:e.PluginDetailPage}))),T=o(()=>import('./chat-page-WLKJ3QNZ.js').then(e=>({default:e.AgentChatPage}))),ie=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.AutomationsPage}))),re=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.RunHistoryPage}))),se=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.ApprovalsPage}))),pe=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.ActivityPage}))),ce=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.ActivityItemPage}))),le=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.CreateAutomationPage}))),me=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.AutomationDetailPage}))),ue=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.RunsPage}))),de=o(()=>import('./pages-NKE7FV34.js').then(e=>({default:e.RunDetailPage}))),fe=o(()=>import('./skills-pages-Q4YSUQVZ.js').then(e=>({default:e.SkillsPage}))),ge=o(()=>import('./skills-pages-Q4YSUQVZ.js').then(e=>({default:e.CreateSkillPage}))),he=o(()=>import('./skills-pages-Q4YSUQVZ.js').then(e=>({default:e.SkillDetailPage}))),l=[{name:"ai",icon:jsx(Bot,{strokeWidth:1.5}),title:"AI",component:te,routes:[{path:"plugins",component:oe},{path:"plugins/installed",component:ne},{path:"plugins/:pluginId",component:ae},{component:jsx(_,{replace:true,to:"agent"}),path:""},{component:T,path:"agent"},{component:T,path:"agent/chats/:chatId"},{component:ie,path:"automations"},{component:re,path:"runs"},{component:se,path:"approvals"},{component:pe,path:"activity"},{component:ce,path:"activity/:itemId"},{component:le,path:"automations/new"},{component:me,path:"automations/:automationId"},{component:ue,path:"automations/:automationId/runs"},{component:de,path:"automations/:automationId/runs/:runId"},{component:fe,path:"skills"},{component:ge,path:"skills/new"},{component:he,path:"skills/:skillId"}]},{name:"desk",icon:jsx(Layout,{strokeWidth:1.5}),title:"Desk",component:J,routes:[{path:"list/:entity",component:X,children:[{path:"edit/:id",component:q}]}]},{name:"asset-manager",icon:jsx(FileStack,{strokeWidth:1.5}),title:"Asset Manager",component:K,routes:[]},{name:"knowledge",icon:jsx(BookOpenText,{strokeWidth:1.5}),title:"Knowledge",component:G,routes:[{component:$,path:""},{component:Q,path:":sourceId"}]},{name:"graph",icon:jsx(Waypoints,{strokeWidth:1.5}),title:"Graph",component:Y,routes:[]},{name:"explorer",icon:jsx(SquarePlay,{strokeWidth:1.5}),title:"Explorer",component:ee,routes:[]}];async function C(e){try{let t=await fetch(d$1(e).schema,{credentials:"include",mode:"cors"});if(!t.ok){let a=t.statusText||`Request failed with status ${String(t.status)}`;try{let i=await t.json();a=i.error??i.message??a;}catch{}return {ok:!1,projectId:e,error:{status:t.status,message:a}}}let n=await t.json();return {ok:!0,project:{...n,projectId:n.projectId||e}}}catch(t){return {ok:false,projectId:e,error:{status:0,message:t instanceof Error?t.message:"Network error"}}}}function b(e,t){let n=[],a={};for(let i of e??[])i.ok?n.push(i.project):a[i.projectId]=i.error;return {projects:n,errors:a,isLoading:t}}function L(e,t){let n=t&&e.length>0?["project-schemas",t,...e]:null,{data:a,isLoading:i}=w(n,()=>Promise.all(e.map(p=>C(p))),{revalidateOnFocus:false,revalidateOnReconnect:false});return b(a,!!n&&(i||a===void 0))}function Pe(e,t){return b(e?[e]:void 0,t)}function A(e,t){let n=t&&e?["project-schema",t,e]:null,{data:a,isLoading:i}=w(n,()=>C(e??""),{revalidateOnFocus:false,revalidateOnReconnect:false});return Pe(a,!!n&&(i||a===void 0))}function Se(e,t){return Array.isArray(e)&&(e[0]==="project-schema"||e[0]==="project-schemas")&&e.slice(2).includes(t)}function Fe(e){return mutate(t=>Se(t,e))}var R=createContext({mode:"projects",apps:l,contributions:{apps:l},currentProjectId:void 0,currentProject:void 0,currentProjectSchema:[],projects:[],projectIds:[],projectSummaries:[],schemaErrors:{},isLoadingSchemas:false});function xe(e){return [...e.filter(n=>n.name!==d.name&&n.name!==f.name),d,f]}function Xe({projectIds:e,projectSummaries:t=[],mode:n="projects",userId:a,children:i}){let{projectId:p}=useParams(),[,I]=g(),h=I.user?.id??a,V=L(n==="projects"?e:[],h),O=A(n==="hosted"&&p&&e.includes(p)?p:void 0,h),{projects:y,errors:P,isLoading:S}=n==="hosted"?O:V,m=useMemo(()=>e.map(s=>y.find(u=>u.projectId===s)).filter(s=>s!==void 0).map(s=>({...s,schema:xe(s.schema)})),[y,e]),H=useMemo(()=>{let s=m.find(u=>u.projectId===p);return {mode:n,apps:l,contributions:{apps:l},currentProjectId:p,currentProject:s,currentProjectSchema:s?.schema??[],projects:m,projectIds:e,projectSummaries:t,schemaErrors:P,isLoadingSchemas:S}},[p,P,S,n,e,t,m]);return jsx(R.Provider,{value:H,children:i})}function qe(){return useContext(R)}
|
|
2
|
+
export{x as a,d as b,f as c,Fe as d,Xe as e,qe as f};//# sourceMappingURL=chunk-6AI7322C.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-6AI7322C.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"uXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,QAAA,CACV,SAAA,CAAW,OACX,WAAA,CAAa,mBAAA,CACb,YAAA,CAAc,EAChB,CAAA,CACA,CACE,KAAM,kBAAA,CACN,KAAA,CAAO,WACP,KAAA,CAAO,QAAA,CACP,QAAS,CACP,IAAA,CAAM,GACR,CAAA,CACA,QAAA,CAAU,QAAA,CACV,UAAW,MAAA,CACX,WAAA,CAAa,OACb,YAAA,CAAc,EAChB,EACA,CACE,IAAA,CAAM,MAAA,CACN,KAAA,CAAO,MAAA,CACP,KAAA,CAAO,SACP,OAAA,CAAS,CACP,KAAM,GACR,CAAA,CACA,SAAU,KAAA,CACV,SAAA,CAAW,MAAA,CACX,WAAA,CAAa,MAAA,CACb,YAAA,CAAc,EAChB,CAAA,CAC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CAAWsB,CAAAA,CAAMjB,EAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOtD,GAAAA,CAACoE,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOkB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-B7QMGBK5.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/entities/assets-schema.ts","../src/entities/tags-schema.ts","../src/ui/components/loading.tsx","../src/core/apps/built-in-apps.tsx","../src/core/config/use-project-schemas.ts","../src/core/config/config-context.tsx"],"names":["assetSchema","tagSchema","Loading","resolvedTheme","useTheme","jsx","jsxs","NavigateCompat","Navigate","lazyElement","loader","Component","lazy","Suspense","deskRoot","m","deskList","deskEditEntity","assetManagerRoot","knowledgeRoot","knowledgeList","knowledgeSource","graphRoot","explorerRoot","aiRoot","aiPluginsPage","aiInstalledPluginsPage","aiPluginDetailPage","aiAgentChatPage","aiAutomationsPage","aiRunHistoryPage","aiApprovalsPage","aiActivityPage","aiActivityItemPage","aiCreateAutomationPage","aiAutomationDetailPage","aiRunsPage","aiRunDetailPage","aiSkillsPage","aiCreateSkillPage","aiSkillDetailPage","builtInApps","BotIcon","LayoutIcon","FileStackIcon","BookOpenTextIcon","WaypointsIcon","SquarePlayIcon","fetchProjectSchema","projectId","response","apiPaths","message","body","project","error","toProjectSchemasState","outcomes","isLoading","projects","errors","outcome","useProjectSchemas","projectIds","userId","key","data","useSWR","toProjectSchemaState","useProjectSchema","isProjectSchemaKey","revalidateProjectSchema","mutate","ConfigContext","createContext","upsertReservedEntities","schema","entity","ConfigProvider","projectSummaries","mode","children","currentProjectId","useParams","auth","useAuth","schemaUserId","allSchemas","currentSchema","loadedProjects","useMemo","value","currentProject","useConfig","useContext"],"mappings":"uXAEO,IAAMA,CAAAA,CAAsB,CACjC,IAAA,CAAM,QAAA,CACN,OAAQ,SAAA,CACR,OAAA,CAAS,kBAAA,CACT,IAAA,CAAM,CACJ,MAAA,CAAQ,IACV,CAAA,CACA,UAAA,CAAY,CACV,CACE,IAAA,CAAM,OACN,KAAA,CAAO,OAAA,CACP,KAAA,CAAO,QAAA,CACP,OAAA,CAAS,CACP,K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AuB,IAAM,CACzC,IAAME,CAAAA,CAAiBjC,CAAAA,CAAS,IAAA,CAAML,GAAYA,CAAAA,CAAQ,SAAA,GAAc4B,CAAgB,CAAA,CAExF,OAAO,CACL,IAAA,CAAAF,CAAAA,CACA,IAAA,CAAMvC,CAAAA,CACN,aAAA,CAAe,CAAE,KAAMA,CAAY,CAAA,CACnC,iBAAAyC,CAAAA,CACA,cAAA,CAAAU,EACA,oBAAA,CAAsBA,CAAAA,EAAgB,MAAA,EAAU,EAAC,CACjD,QAAA,CAAAjC,EACA,UAAA,CAAAI,CAAAA,CACA,iBAAAgB,CAAAA,CACA,YAAA,CAAcnB,EACd,gBAAA,CAAkBF,CACpB,CACF,CAAA,CAAG,CAACwB,CAAAA,CAAkBtB,EAAQF,CAAAA,CAAWsB,CAAAA,CAAMjB,EAAYgB,CAAAA,CAAkBpB,CAAQ,CAAC,CAAA,CAEtF,OAAOtD,GAAAA,CAACoE,CAAAA,CAAc,QAAA,CAAd,CAAuB,MAAOkB,CAAAA,CAAQ,QAAA,CAAAV,CAAAA,CAAS,CACzD,CAEO,SAASY,IAA2B,CACzC,OAAOC,UAAAA,CAAWrB,CAAa,CACjC","file":"chunk-6AI7322C.js","sourcesContent":["import type { Entity } from '../core/types';\n\nexport const assetSchema: Entity = {\n name: '_asset',\n plural: '_assets',\n display: 'originalFilename',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'path',\n label: 'Asset',\n scope: 'global',\n options: {\n size: 140,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'assetPreviewField',\n defaultValue: '',\n },\n {\n name: 'originalFilename',\n label: 'Filename',\n scope: 'global',\n options: {\n size: 320,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'size',\n label: 'Size',\n scope: 'global',\n options: {\n size: 120,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'width',\n label: 'Width',\n scope: 'global',\n options: {\n size: 90,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'height',\n label: 'Height',\n scope: 'global',\n options: {\n size: 100,\n },\n dataType: 'int',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'mimeType',\n label: 'Mime Type',\n scope: 'global',\n options: {\n size: 160,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'lqip',\n label: 'lqip',\n scope: 'global',\n hidden: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: 'url',\n label: 'URL',\n scope: 'global',\n hidden: true,\n readOnly: true,\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'tags',\n label: 'Tags',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n previewType: 'tags',\n options: {\n size: 300,\n },\n relationship: {\n mode: 'multiple',\n field: 'name',\n entity: '_tag',\n },\n },\n ],\n};\n","import type { Entity } from '../core/types';\n\nexport const tagSchema: Entity = {\n name: '_tag',\n plural: '_tags',\n display: 'name',\n menu: {\n hidden: true,\n },\n attributes: [\n {\n name: 'name',\n label: 'Tag Name',\n scope: 'global',\n options: {\n size: 220,\n },\n dataType: 'string',\n inputType: 'text',\n previewType: 'text',\n defaultValue: '',\n },\n {\n name: '_updatedAt',\n label: 'Updated At',\n scope: 'global',\n options: {\n size: 220,\n },\n readOnly: true,\n hidden: true,\n dataType: 'datetime',\n inputType: 'datetime',\n previewType: 'datetime',\n defaultValue: '',\n },\n {\n name: 'assets',\n label: 'Assets',\n scope: 'relationship',\n dataType: 'string',\n inputType: 'relationship',\n defaultValue: '',\n relationship: {\n mode: 'multiple',\n field: 'originalFilename',\n entity: '_asset',\n },\n },\n ],\n};\n","import type { JSX } from 'react';\nimport { useTheme } from '../theme-context';\n\nexport function Loading(): JSX.Element {\n const { resolvedTheme } = useTheme();\n\n return (\n <div className=\"fk:flex fk:w-full fk:h-full fk:justify-center fk:items-center fk:bg-background\">\n <div className=\"fk:flex fk:flex-col fk:items-center\">\n {resolvedTheme === 'dark' ? (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"#020817\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"white\"\n />\n </svg>\n ) : (\n <svg\n className=\"fk:h-8 fk:w-8 fk:animate-bounce\"\n fill=\"none\"\n viewBox=\"0 0 48 48\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path d=\"M7 8H41V40H7V8Z\" fill=\"white\" />\n <path\n d=\"M24 0C42 0 48 6 48 24C48 42 42 48 24 48C6 48 0 42 0 24C0 6 6 0 24 0ZM17.7494 9.52381H8.7619L19.2833 23.8313L8.7619 38.7078H17.7494L21.0499 33.6639V14.2549L17.7494 9.52381ZM38.9577 9.52381H29.9542L26.2857 14.8229V33.0406L29.9542 38.7078H38.9577L28.3908 23.8313L38.9577 9.52381Z\"\n fill=\"#020817\"\n />\n </svg>\n )}\n <div className=\"fk:text-foreground fk:text-center fk:mt-4 fk:animate-pulse\">Loading...</div>\n </div>\n </div>\n );\n}\n","import { lazy, Suspense } from 'react';\nimport type { ComponentType, JSX } from 'react';\nimport {\n BookOpenText as BookOpenTextIcon,\n Bot as BotIcon,\n FileStack as FileStackIcon,\n Layout as LayoutIcon,\n SquarePlay as SquarePlayIcon,\n Waypoints as WaypointsIcon,\n} from 'lucide-react';\nimport { Navigate } from 'react-router-dom';\nimport { Loading } from '../../ui/components/loading';\nimport type { AppOptions } from '../config/types';\n\nconst NavigateCompat = Navigate as unknown as ComponentType<{\n replace?: boolean;\n to: string;\n}>;\n\n/**\n * Wraps a lazily imported component in Suspense so each built-in app (and each of its routes)\n * is only downloaded when it is first rendered.\n */\nfunction lazyElement(loader: () => Promise<{ default: ComponentType }>): JSX.Element {\n const Component = lazy(loader);\n\n return (\n <Suspense fallback={<Loading />}>\n <Component />\n </Suspense>\n );\n}\n\n// Desk\nconst deskRoot = lazyElement(() => import('../../apps/desk/root').then((m) => ({ default: m.Root })));\nconst deskList = lazyElement(() => import('../../apps/desk/list').then((m) => ({ default: m.List })));\nconst deskEditEntity = lazyElement(() =>\n import('../../apps/desk/edit-entity').then((m) => ({ default: m.EditEntity }))\n);\n\n// Asset Manager\nconst assetManagerRoot = lazyElement(() => import('../../apps/asset-manager/root').then((m) => ({ default: m.Root })));\n\n// Knowledge\nconst knowledgeRoot = lazyElement(() => import('../../apps/knowledge/root').then((m) => ({ default: m.Root })));\nconst knowledgeList = lazyElement(() => import('../../apps/knowledge/list').then((m) => ({ default: m.List })));\nconst knowledgeSource = lazyElement(() => import('../../apps/knowledge/source').then((m) => ({ default: m.Source })));\n\n// Graph\nconst graphRoot = lazyElement(() => import('../../apps/graph/root').then((m) => ({ default: m.Root })));\n\n// Explorer\nconst explorerRoot = lazyElement(() => import('../../apps/explorer/root').then((m) => ({ default: m.Root })));\n\n// AI\nconst aiRoot = lazyElement(() => import('../../apps/ai/root').then((m) => ({ default: m.Root })));\nconst aiPluginsPage = lazyElement(() => import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginsPage })));\nconst aiInstalledPluginsPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.InstalledPluginsPage }))\n);\nconst aiPluginDetailPage = lazyElement(() =>\n import('../../apps/ai/plugin-pages').then((m) => ({ default: m.PluginDetailPage }))\n);\nconst aiAgentChatPage = lazyElement(() =>\n import('../../apps/ai/agent/chat-page').then((m) => ({ default: m.AgentChatPage }))\n);\nconst aiAutomationsPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationsPage }))\n);\nconst aiRunHistoryPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunHistoryPage })));\nconst aiApprovalsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ApprovalsPage })));\nconst aiActivityPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.ActivityPage })));\nconst aiActivityItemPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.ActivityItemPage }))\n);\nconst aiCreateAutomationPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.CreateAutomationPage }))\n);\nconst aiAutomationDetailPage = lazyElement(() =>\n import('../../apps/ai/pages').then((m) => ({ default: m.AutomationDetailPage }))\n);\nconst aiRunsPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunsPage })));\nconst aiRunDetailPage = lazyElement(() => import('../../apps/ai/pages').then((m) => ({ default: m.RunDetailPage })));\nconst aiSkillsPage = lazyElement(() => import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillsPage })));\nconst aiCreateSkillPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.CreateSkillPage }))\n);\nconst aiSkillDetailPage = lazyElement(() =>\n import('../../apps/ai/skills-pages').then((m) => ({ default: m.SkillDetailPage }))\n);\n\nexport const builtInApps: AppOptions[] = [\n {\n name: 'ai',\n icon: <BotIcon strokeWidth={1.5} />,\n title: 'AI',\n component: aiRoot,\n routes: [\n { path: 'plugins', component: aiPluginsPage },\n { path: 'plugins/installed', component: aiInstalledPluginsPage },\n { path: 'plugins/:pluginId', component: aiPluginDetailPage },\n {\n component: <NavigateCompat replace to=\"agent\" />,\n path: '',\n },\n {\n component: aiAgentChatPage,\n path: 'agent',\n },\n {\n component: aiAgentChatPage,\n path: 'agent/chats/:chatId',\n },\n {\n component: aiAutomationsPage,\n path: 'automations',\n },\n {\n component: aiRunHistoryPage,\n path: 'runs',\n },\n {\n component: aiApprovalsPage,\n path: 'approvals',\n },\n {\n component: aiActivityPage,\n path: 'activity',\n },\n {\n component: aiActivityItemPage,\n path: 'activity/:itemId',\n },\n {\n component: aiCreateAutomationPage,\n path: 'automations/new',\n },\n {\n component: aiAutomationDetailPage,\n path: 'automations/:automationId',\n },\n {\n component: aiRunsPage,\n path: 'automations/:automationId/runs',\n },\n {\n component: aiRunDetailPage,\n path: 'automations/:automationId/runs/:runId',\n },\n {\n component: aiSkillsPage,\n path: 'skills',\n },\n {\n component: aiCreateSkillPage,\n path: 'skills/new',\n },\n {\n component: aiSkillDetailPage,\n path: 'skills/:skillId',\n },\n ],\n },\n {\n name: 'desk',\n icon: <LayoutIcon strokeWidth={1.5} />,\n title: 'Desk',\n component: deskRoot,\n routes: [\n {\n path: 'list/:entity',\n component: deskList,\n children: [\n {\n path: 'edit/:id',\n component: deskEditEntity, // Not used, left here as an example of how to nest routes in apps\n },\n ],\n },\n ],\n },\n {\n name: 'asset-manager',\n icon: <FileStackIcon strokeWidth={1.5} />,\n title: 'Asset Manager',\n component: assetManagerRoot,\n routes: [],\n },\n {\n name: 'knowledge',\n icon: <BookOpenTextIcon strokeWidth={1.5} />,\n title: 'Knowledge',\n component: knowledgeRoot,\n routes: [\n {\n component: knowledgeList,\n path: '',\n },\n {\n component: knowledgeSource,\n path: ':sourceId',\n },\n ],\n },\n {\n name: 'graph',\n icon: <WaypointsIcon strokeWidth={1.5} />,\n title: 'Graph',\n component: graphRoot,\n routes: [],\n },\n {\n name: 'explorer',\n icon: <SquarePlayIcon strokeWidth={1.5} />,\n title: 'Explorer',\n component: explorerRoot,\n routes: [],\n },\n];\n","'use client';\n\nimport useSWR, { mutate } from 'swr';\nimport { apiPaths } from '../api-paths';\nimport type { ProjectSchemaError, ProjectUiConfig } from './types';\n\nexport type ProjectSchemasState = {\n projects: ProjectUiConfig[];\n errors: { [projectId: string]: ProjectSchemaError };\n isLoading: boolean;\n};\n\ntype FetchOutcome = { ok: true; project: ProjectUiConfig } | { ok: false; projectId: string; error: ProjectSchemaError };\n\nasync function fetchProjectSchema(projectId: string): Promise<FetchOutcome> {\n try {\n const response = await fetch(apiPaths(projectId).schema, { credentials: 'include', mode: 'cors' });\n\n if (!response.ok) {\n let message = response.statusText || `Request failed with status ${String(response.status)}`;\n\n try {\n const body = (await response.json()) as { error?: string; message?: string };\n message = body.error ?? body.message ?? message;\n } catch {\n // keep the status text\n }\n\n return { ok: false, projectId, error: { status: response.status, message } };\n }\n\n const project = (await response.json()) as ProjectUiConfig;\n\n return { ok: true, project: { ...project, projectId: project.projectId || projectId } };\n } catch (error) {\n return {\n ok: false,\n projectId,\n error: { status: 0, message: error instanceof Error ? error.message : 'Network error' },\n };\n }\n}\n\nexport function toProjectSchemasState(outcomes: FetchOutcome[] | undefined, isLoading: boolean): ProjectSchemasState {\n const projects: ProjectUiConfig[] = [];\n const errors: { [projectId: string]: ProjectSchemaError } = {};\n\n for (const outcome of outcomes ?? []) {\n if (outcome.ok) {\n projects.push(outcome.project);\n } else {\n errors[outcome.projectId] = outcome.error;\n }\n }\n\n return { projects, errors, isLoading };\n}\n\n/**\n * Loads the deployed schema of every project the Studio can open. Fetching\n * starts once the user is known (the endpoint needs a session) and the result\n * is kept for the lifetime of the page: schemas only change on deploy.\n */\nexport function useProjectSchemas(projectIds: string[], userId: string | undefined): ProjectSchemasState {\n const key = userId && projectIds.length > 0 ? ['project-schemas', userId, ...projectIds] : null;\n const { data, isLoading } = useSWR(key, () => Promise.all(projectIds.map((projectId) => fetchProjectSchema(projectId))), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemasState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** State of a single project's schema, in the same shape as the multi-project hook. */\nexport function toProjectSchemaState(outcome: FetchOutcome | undefined, isLoading: boolean): ProjectSchemasState {\n return toProjectSchemasState(outcome ? [outcome] : undefined, isLoading);\n}\n\n/**\n * Hosted mode: loads only the project currently open. Each project has its own\n * SWR key, so switching back to a project reuses the schema already fetched.\n */\nexport function useProjectSchema(projectId: string | undefined, userId: string | undefined): ProjectSchemasState {\n const key = userId && projectId ? ['project-schema', userId, projectId] : null;\n const { data, isLoading } = useSWR(key, () => fetchProjectSchema(projectId ?? ''), {\n revalidateOnFocus: false,\n revalidateOnReconnect: false,\n });\n\n return toProjectSchemaState(data, Boolean(key) && (isLoading || data === undefined));\n}\n\n/** True for the SWR keys that hold `projectId`'s schema (single- and multi-project hooks). */\nexport function isProjectSchemaKey(key: unknown, projectId: string): boolean {\n return (\n Array.isArray(key) &&\n (key[0] === 'project-schema' || key[0] === 'project-schemas') &&\n key.slice(2).includes(projectId)\n );\n}\n\n/** Refetches the deployed schema of `projectId`, e.g. after the agent deployed a schema change. */\nexport function revalidateProjectSchema(projectId: string): Promise<unknown> {\n return mutate((key) => isProjectSchemaKey(key, projectId));\n}\n","'use client';\n\nimport { createContext, useContext, useMemo } from 'react';\nimport type { JSX } from 'react';\nimport { useParams } from 'react-router-dom';\nimport { useAuth } from '../../auth/auth-context';\nimport { assetSchema } from '../../entities/assets-schema';\nimport { tagSchema } from '../../entities/tags-schema';\nimport { builtInApps } from '../apps/built-in-apps';\nimport type { AppOptions, ProjectSchemaError, ProjectSummary, ProjectUiConfig, StudioMode } from './types';\nimport type { Entity } from '../types';\nimport { useProjectSchema, useProjectSchemas } from './use-project-schemas';\n\nexport interface ConfigContext {\n /** `projects` when the host passed `projectIds`, `hosted` when the Studio listed the user's projects itself. */\n mode: StudioMode;\n /** The Studio apps shown in the app bar, in order. */\n apps: AppOptions[];\n /** Kept for callers that read `contributions.apps`; same list as `apps`. */\n contributions: {\n apps: AppOptions[];\n };\n currentProjectId?: string;\n /** The project named by the `:projectId` route param, once its schema has loaded. */\n currentProject?: ProjectUiConfig;\n currentProjectSchema: Entity[];\n /** Projects whose schema loaded, in `projectIds` order. */\n projects: ProjectUiConfig[];\n /** Every project id the Studio can open, loaded or not. */\n projectIds: string[];\n /** Hosted mode: name, avatar, role and team of each project, known before any schema loads. */\n projectSummaries: ProjectSummary[];\n /** Per project id: why its schema could not be loaded. */\n schemaErrors: { [projectId: string]: ProjectSchemaError };\n isLoadingSchemas: boolean;\n}\n\nconst ConfigContext = createContext<ConfigContext>({\n mode: 'projects',\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId: undefined,\n currentProject: undefined,\n currentProjectSchema: [],\n projects: [],\n projectIds: [],\n projectSummaries: [],\n schemaErrors: {},\n isLoadingSchemas: false,\n});\n\n/** Appends the reserved asset and tag entities to a deployed schema. */\nexport function upsertReservedEntities(schema: Entity[]): Entity[] {\n const withoutReserved = schema.filter((entity) => entity.name !== assetSchema.name && entity.name !== tagSchema.name);\n\n return [...withoutReserved, assetSchema, tagSchema];\n}\n\nexport function ConfigProvider({\n projectIds,\n projectSummaries = [],\n mode = 'projects',\n userId,\n children,\n}: {\n projectIds: string[];\n projectSummaries?: ProjectSummary[];\n mode?: StudioMode;\n /** Hosted mode: the signed-in user's id, known before the per-project `/users/me` call. */\n userId?: string;\n children: React.ReactNode;\n}): JSX.Element {\n /**\n * Getting the projectId from the URL via react-router-dom's useParams hook triggers a rerender of this Context\n * every time the URL changes.\n */\n const { projectId: currentProjectId } = useParams<{ projectId: string }>();\n const [, auth] = useAuth();\n const schemaUserId = auth.user?.id ?? userId;\n // Project mode loads every project up front (short, host-defined list); hosted mode only the one open.\n const allSchemas = useProjectSchemas(mode === 'projects' ? projectIds : [], schemaUserId);\n const currentSchema = useProjectSchema(\n mode === 'hosted' && currentProjectId && projectIds.includes(currentProjectId) ? currentProjectId : undefined,\n schemaUserId\n );\n const { projects: loadedProjects, errors, isLoading } = mode === 'hosted' ? currentSchema : allSchemas;\n const projects = useMemo(\n () =>\n projectIds\n .map((projectId) => loadedProjects.find((project) => project.projectId === projectId))\n .filter((project): project is ProjectUiConfig => project !== undefined)\n .map((project) => ({ ...project, schema: upsertReservedEntities(project.schema) })),\n [loadedProjects, projectIds]\n );\n\n const value = useMemo<ConfigContext>(() => {\n const currentProject = projects.find((project) => project.projectId === currentProjectId);\n\n return {\n mode,\n apps: builtInApps,\n contributions: { apps: builtInApps },\n currentProjectId,\n currentProject,\n currentProjectSchema: currentProject?.schema ?? [],\n projects,\n projectIds,\n projectSummaries,\n schemaErrors: errors,\n isLoadingSchemas: isLoading,\n };\n }, [currentProjectId, errors, isLoading, mode, projectIds, projectSummaries, projects]);\n\n return <ConfigContext.Provider value={value}>{children}</ConfigContext.Provider>;\n}\n\nexport function useConfig(): ConfigContext {\n return useContext(ConfigContext);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import'./index.css';import {g,f as f$1}from'./chunk-
|
|
2
|
-
//# sourceMappingURL=chunk-
|
|
1
|
+
import'./index.css';import {g,f as f$1}from'./chunk-SY67F62K.js';import {b}from'./chunk-5CVDMZUI.js';import {a,b as b$1,c,e}from'./chunk-USNXQOMJ.js';import {b as b$2}from'./chunk-6NRQMG26.js';import {useEffect}from'react';import {BellIcon}from'lucide-react';import {Link}from'react-router-dom';import A from'swr';import {jsx,jsxs}from'react/jsx-runtime';function T(t){let{data:i}=A(t?g(t).activitySummary():null,f$1,{refreshInterval:3e4});return i}function f(t){return t>99?"99+":t.toString()}function $({projectId:t}){let i=T(t),e$1=i?.needsActionCount??0,r=i?.unreadCount??0;useEffect(()=>{let n=b();if(n)return n.setBadgeCount(e$1),()=>{n.setBadgeCount(0);}},[e$1]);let s=e$1>0?`Activity: ${f(e$1)} waiting for you`:r>0?`Activity: ${f(r)} unread`:"Activity";return jsx(a,{children:jsxs(b$1,{children:[jsx(c,{asChild:true,children:jsx(b$2,{asChild:true,"aria-label":s,className:"fk:relative fk:h-8 fk:w-8 fk:rounded-full",size:"icon",variant:"ghost",children:jsxs(Link,{to:`/${t}/ai/activity`,children:[jsx(BellIcon,{className:"fk:size-4"}),e$1>0?jsx("span",{className:"fk:absolute fk:-right-1 fk:-top-1 fk:flex fk:h-4 fk:min-w-4 fk:items-center fk:justify-center fk:rounded-full fk:bg-amber-500 fk:px-1 fk:text-[0.625rem] fk:font-semibold fk:leading-none fk:text-white",children:f(e$1)}):r>0?jsx("span",{className:"fk:absolute fk:right-1 fk:top-1 fk:size-2 fk:rounded-full fk:bg-success"}):null]})})}),jsx(e,{children:s})]})})}export{T as a,$ as b};//# sourceMappingURL=chunk-7ERLYAPR.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-7ERLYAPR.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/apps/ai/activity-nav-button.tsx"],"names":["useActivitySummary","projectId","data","useSWR","paths","fetcher","formatCount","count","ActivityNavButton","summary","needsAction","unread","useEffect","desktop","getDesktop","label","jsx","TooltipProvider","jsxs","Tooltip","TooltipTrigger","Button","Link","BellIcon","TooltipContent"],"mappings":"mWAeO,SAASA,CAAAA,CAAmBC,EAA4D,CAC7F,GAAM,CAAE,IAAA,CAAAC,CAAK,EAAIC,CAAAA,CAAwBF,CAAAA,CAAYG,EAAMH,CAAS,CAAA,CAAE,iBAAgB,CAAI,IAAA,CAAMI,IAAS,CACvG,eAAA,CAAiB,GACnB,CAAC,CAAA,CAED,OAAOH,CACT,CAEA,SAASI,EAAYC,CAAAA,CAAuB,CAC1C,OAAOA,CAAAA,CAAQ,EAAA,CAAK,MAAQA,CAAAA,CAAM,QAAA,EACpC,CAGO,SAASC,EAAkB,CAAE,SAAA,CAAAP,CAAU,CAAA,CAAuC,CACnF,IAAMQ,CAAAA,CAAUT,CAAAA,CAAmBC,CAAS,CAAA,CACtCS,GAAAA,CAAcD,GAAS,gBAAA,EAAoB,CAAA,CAC3CE,EA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file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/apps/ai/activity-nav-button.tsx"],"names":["useActivitySummary","projectId","data","useSWR","paths","fetcher","formatCount","count","ActivityNavButton","summary","needsAction","unread","useEffect","desktop","getDesktop","label","jsx","TooltipProvider","jsxs","Tooltip","TooltipTrigger","Button","Link","BellIcon","TooltipContent"],"mappings":"mWAeO,SAASA,CAAAA,CAAmBC,EAA4D,CAC7F,GAAM,CAAE,IAAA,CAAAC,CAAK,EAAIC,CAAAA,CAAwBF,CAAAA,CAAYG,EAAMH,CAAS,CAAA,CAAE,iBAAgB,CAAI,IAAA,CAAMI,IAAS,CACvG,eAAA,CAAiB,GACnB,CAAC,CAAA,CAED,OAAOH,CACT,CAEA,SAASI,EAAYC,CAAAA,CAAuB,CAC1C,OAAOA,CAAAA,CAAQ,EAAA,CAAK,MAAQA,CAAAA,CAAM,QAAA,EACpC,CAGO,SAASC,EAAkB,CAAE,SAAA,CAAAP,CAAU,CAAA,CAAuC,CACnF,IAAMQ,CAAAA,CAAUT,CAAAA,CAAmBC,CAAS,CAAA,CACtCS,GAAAA,CAAcD,GAAS,gBAAA,EAAoB,CAAA,CAC3CE,EAASF,CAAAA,EAAS,WAAA,EAAe,EAGvCG,SAAAA,CAAU,IAAM,CACd,IAAMC,CAAAA,CAAUC,GAAW,CAE3B,GAAKD,EAIL,OAAAA,CAAAA,CAAQ,cAAcH,GAAW,CAAA,CAE1B,IAAM,CACXG,CAAAA,CAAQ,aAAA,CAAc,CAAC,EACzB,CACF,EAAG,CAACH,GAAW,CAAC,CAAA,CAEhB,IAAMK,EACJL,GAAAA,CAAc,CAAA,CACV,aAAaJ,CAAAA,CAAYI,GAAW,CAAC,CAAA,gBAAA,CAAA,CACrCC,CAAAA,CAAS,EACP,CAAA,UAAA,EAAaL,CAAAA,CAAYK,CAAM,CAAC,CAAA,OAAA,CAAA,CAChC,WAER,OACEK,GAAAA,CAACC,EAAA,CACC,QAAA,CAAAC,KAACC,GAAAA,CAAA,CACC,UAAAH,GAAAA,CAACI,CAAAA,CAAA,CAAe,OAAA,CAAO,IAAA,CACrB,SAAAJ,GAAAA,CAACK,GAAAA,CAAA,CAAO,OAAA,CAAO,IAAA,CAAC,YAAA,CAAYN,CAAAA,CAAO,SAAA,CAAU,2CAAA,CAA4C,KAAK,MAAA,CAAO,OAAA,CAAQ,QAC3G,QAAA,CAAAG,IAAAA,CAACI,KAAA,CAAK,EAAA,CAAI,IAAIrB,CAAS,CAAA,YAAA,CAAA,CACrB,UAAAe,GAAAA,CAACO,QAAAA,CAAA,CAAS,SAAA,CAAU,WAAA,CAAY,EAC/Bb,GAAAA,CAAc,CAAA,CACbM,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,yMAAA,CACb,SAAAV,CAAAA,CAAYI,GAAW,EAC1B,CAAA,CACEC,CAAAA,CAAS,EACXK,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,yEAAA,CAA0E,CAAA,CACxF,MACN,CAAA,CACF,CAAA,CACF,EACAA,GAAAA,CAACQ,CAAAA,CAAA,CAAgB,QAAA,CAAAT,CAAAA,CAAM,CAAA,CAAA,CACzB,CAAA,CACF,CAEJ","file":"chunk-7ERLYAPR.js","sourcesContent":["import { useEffect } from 'react';\nimport type { JSX } from 'react';\nimport { BellIcon } from 'lucide-react';\nimport { Link } from 'react-router-dom';\nimport useSWR from 'swr';\nimport { Button } from '../../ui/primitives/button';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../ui/primitives/tooltip';\nimport { getDesktop } from '../../core/desktop';\nimport { fetcher, paths } from './api';\nimport type { ActivitySummary } from './types';\n\n/**\n * The project's Activity badge counts. `ActivityNotifier` refreshes the same\n * SWR key on every poll, so every reader stays in sync with one request.\n */\nexport function useActivitySummary(projectId: string | undefined): ActivitySummary | undefined {\n const { data } = useSWR<ActivitySummary>(projectId ? paths(projectId).activitySummary() : null, fetcher, {\n refreshInterval: 30_000,\n });\n\n return data;\n}\n\nfunction formatCount(count: number): string {\n return count > 99 ? '99+' : count.toString();\n}\n\n/** Navbar shortcut to Activity, so pending items are visible from every app. */\nexport function ActivityNavButton({ projectId }: { projectId: string }): JSX.Element {\n const summary = useActivitySummary(projectId);\n const needsAction = summary?.needsActionCount ?? 0;\n const unread = summary?.unreadCount ?? 0;\n // The desktop app shows what waits for you on its dock or taskbar icon;\n // leaving the project or signing out clears it.\n useEffect(() => {\n const desktop = getDesktop();\n\n if (!desktop) {\n return;\n }\n\n desktop.setBadgeCount(needsAction);\n\n return () => {\n desktop.setBadgeCount(0);\n };\n }, [needsAction]);\n\n const label =\n needsAction > 0\n ? `Activity: ${formatCount(needsAction)} waiting for you`\n : unread > 0\n ? `Activity: ${formatCount(unread)} unread`\n : 'Activity';\n\n return (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <Button asChild aria-label={label} className=\"fk:relative fk:h-8 fk:w-8 fk:rounded-full\" size=\"icon\" variant=\"ghost\">\n <Link to={`/${projectId}/ai/activity`}>\n <BellIcon className=\"fk:size-4\" />\n {needsAction > 0 ? (\n <span className=\"fk:absolute fk:-right-1 fk:-top-1 fk:flex fk:h-4 fk:min-w-4 fk:items-center fk:justify-center fk:rounded-full fk:bg-amber-500 fk:px-1 fk:text-[0.625rem] fk:font-semibold fk:leading-none fk:text-white\">\n {formatCount(needsAction)}\n </span>\n ) : unread > 0 ? (\n <span className=\"fk:absolute fk:right-1 fk:top-1 fk:size-2 fk:rounded-full fk:bg-success\" />\n ) : null}\n </Link>\n </Button>\n </TooltipTrigger>\n <TooltipContent>{label}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import'./index.css';import {a as a$1}from'./chunk-HKN6BX5U.js';var l=20*1024*1024,L=200,k=20,d=["pdf","docx","pptx","md","markdown","txt","html","htm"],P=d.map(e=>`.${e}`).join(","),p="PDF, Word, PowerPoint, Markdown, text or HTML",w=new Set(d);function m(e){let t=/\.([a-z0-9]{1,8})$/i.exec(e.trim());return t?t[1].toLowerCase():null}function T(e){let t=m(e.name);return !t||!w.has(t)?`${e.name} is not a supported document. Add ${p} files.`:e.size<=0?`${e.name} is empty.`:e.size>l?`${e.name} is larger than ${K(l)}.`:null}function K(e){return e<1024?`${String(e)} B`:e<1024*1024?`${(e/1024).toFixed(e<10*1024?1:0)} KB`:`${(e/(1024*1024)).toFixed(e<10*1024*1024?1:0)} MB`}function I(e){let t=e.trim();if(!t)return {error:"Enter the address of a public page."};let n;try{n=new URL(/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?t:`https://${t}`);}catch{return {error:"Enter a valid address, for example https://example.com/handbook"}}return n.protocol!=="https:"?{error:"The address must use HTTPS."}:n.username||n.password?{error:"The address cannot include credentials."}:(n.hash="",{url:n.toString()})}var f={icon:"html",label:"Web page"},g={icon:"txt",label:"Text"},x={"application/pdf":{icon:"pdf",label:"PDF"},"application/vnd.openxmlformats-officedocument.wordprocessingml.document":{icon:"docx",label:"Word"},"application/vnd.openxmlformats-officedocument.presentationml.presentation":{icon:"pptx",label:"PowerPoint"},"text/markdown":{icon:"document",label:"Markdown"},"text/html":{icon:"html",label:"HTML"},"text/plain":g};function b(e){return e.kind==="url"?f:x[e.mimeType]??g}function A(e){return b(e).label}function u(e){return !!(e&&(e.state==="queued"||e.state==="extracting"||e.state==="embedding"||e.state==="publishing"))}function _(e,t){return e.status==="processing"||u(t)}function S(e){let{progress:t}=e;switch(e.state){case "queued":return "Waiting to be processed";case "extracting":return "Reading the document";case "embedding":return t?.passageCount?`Indexing passages (${String(t.embeddedCount??0)} of ${String(t.passageCount)})`:"Indexing passages";case "publishing":return "Publishing";default:return t?.message??e.state}}function $(e,t){let n=e.currentVersion,r=n?.status==="published",o=n?.passageCount??0,i=`${String(o)} ${o===1?"passage":"passages"}`;return u(t)?{label:r?"Re-indexing":"Indexing",detail:S(t),tone:"busy"}:e.status==="failed"||!r&&(t?.state==="failed"||n?.status==="failed")?{label:"Failed",detail:t?.error?.message??n?.error??"Indexing failed",tone:"error"}:e.status==="processing"||!r?{label:"Indexing",detail:"Waiting to be processed",tone:"busy"}:t?.state==="failed"?{label:"Ready",detail:`${i} \xB7 the last re-index failed: ${t.error?.message??"unknown error"}`,tone:"ready"}:n&&n.warnings.length>0?{label:"Ready",detail:`${i} \xB7 indexed with warnings`,tone:"ready"}:{label:"Ready",detail:i,tone:"ready"}}function F(e){let t=[];return e.page!==void 0&&t.push(`p. ${String(e.page)}`),e.slide!==void 0&&t.push(`slide ${String(e.slide)}`),e.headingPath&&e.headingPath.length>0&&t.push(e.headingPath.join(" \u203A ")),t.join(" \xB7 ")}function M(e){let[,t]=/^[A-Z_]+:\s*(.*)$/.exec(e)??[],n=t??e;return n.charAt(0).toUpperCase()+n.slice(1)}function R(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function W(e,t){return `/${encodeURIComponent(e)}/knowledge/${encodeURIComponent(t)}`}function C(e,t){let n=t?.trim()||(e.title??"").trim();return n||(e.recordId.length>12?`${e.recordId.slice(0,8)}\u2026`:e.recordId)}function G(e){let t=new Map;for(let n of e){let r=t.get(n.entityPlural);r||(r={entity:n.entity,entityPlural:n.entityPlural,links:[]},t.set(n.entityPlural,r)),r.links.push(n);}return [...t.values()]}function J(e,t){let n=new Set(t);return e.filter(r=>!n.has(r.id)).sort((r,o)=>+(o.status==="ready")-+(r.status==="ready"))}function h(e){return !e.startsWith("_")}function N(e,t){return e.find(n=>n.name===t)}function a(e){return e.menu?.label?.trim()||e.plural}function O(e,t){let n=new Set([...t].map(r=>r.entity));return e.filter(r=>h(r.name)&&!n.has(r.name)).sort((r,o)=>a(r).localeCompare(a(o)))}var c="flexkit-knowledge:viewMode";function V(){try{return a$1()?.getItem(c)==="grid"?"grid":"list"}catch{return "list"}}function D(e){try{a$1()?.setItem(c,e);}catch{}}
|
|
2
|
+
export{L as a,k as b,P as c,p as d,T as e,K as f,I as g,b as h,A as i,_ as j,$ as k,F as l,M as m,R as n,W as o,C as p,G as q,J as r,h as s,N as t,a as u,O as v,V as w,D as x};//# sourceMappingURL=chunk-7KLXWCDS.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-7KLXWCDS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/apps/knowledge/knowledge.ts"],"names":["KNOWLEDGE_MAX_FILE_BYTES","KNOWLEDGE_MAX_TITLE_LENGTH","KNOWLEDGE_PASSAGES_PAGE_SIZE","KNOWLEDGE_EXTENSIONS","KNOWLEDGE_ACCEPT","extension","KNOWLEDGE_FORMATS_LABEL","KNOWLEDGE_EXTENSION_SET","getExtension","filename","match","getKnowledgeFileProblem","file","formatFileSize","bytes","parseKnowledgeUrl","value","trimmed","url","WEB_PAGE_FORMAT","TEXT_FORMAT","KNOWLEDGE_FORMATS","getKnowledgeFormat","source","getKnowledgeKindLabel","isKnowledgeJobActive","job","isKnowledgeSourceBusy","describeJobPhase","progress","summarizeKnowledgeStatus","version","published","passages","readyDetail","formatKnowledgeLocator","locator","parts","formatKnowledgeWarning","warning","captured","text","toggleSpaceCode","current","code","entry","getKnowledgeSourcePath","projectId","sourceId","getKnowledgeLinkLabel","link","resolved","groupKnowledgeLinks","links","groups","group","getAttachableSources","sources","attachedIds","attached","a","b","isKnowledgeLinkableEntity","entityName","findEntityByName","schema","entity","getEntityLinkLabel","getLinkableEntities","linked","taken","VIEW_MODE_STORAGE_KEY","getStoredKnowledgeViewMode","getLocalStorage","setStoredKnowledgeViewMode","mode"],"mappings":"+DA6KO,IAAMA,CAAAA,CAA2B,GAAK,IAAA,CAAO,IAAA,CAEvCC,EAA6B,GAAA,CAG7BC,CAAAA,CAA+B,EAAA,CAEtCC,CAAAA,CAAuB,CAAC,KAAA,CAAO,OAAQ,MAAA,CAAQ,IAAA,CAAM,UAAA,CAAY,KAAA,CAAO,MAAA,CAAQ,KAAK,EAG9EC,CAAAA,CAAmBD,CAAAA,CAAqB,GAAA,CAAKE,CAAAA,EAAc,CAAA,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EAAO,IAAA,CAAMC,CAAAA,EAAWA,EAAO,IAAA,GAASH,CAAU,CAC3D,CAGO,SAASI,CAAAA,CAAmBD,CAAAA,CAA+D,CAChG,OAAOA,EAAO,IAAA,EAAM,KAAA,EAAO,IAAA,EAAK,EAAKA,CAAAA,CAAO,MAC9C,CAOO,SAASE,CAAAA,CACdH,CAAAA,CACAI,CAAAA,CACK,CACL,IAAMC,EAAQ,IAAI,GAAA,CAAI,CAAC,GAAGD,CAAM,EAAE,GAAA,CAAKnB,CAAAA,EAASA,CAAAA,CAAK,MAAM,CAAC,CAAA,CAE5D,OAAOe,CAAAA,CACJ,MAAA,CAAQC,CAAAA,EAAWJ,CAAAA,CAA0BI,CAAAA,CAAO,IAAI,GAAK,CAACI,CAAAA,CAAM,GAAA,CAAIJ,CAAAA,CAAO,IAAI,CAAC,EACpF,IAAA,CAAK,CAACN,EAAGC,CAAAA,GAAMM,CAAAA,CAAmBP,CAAC,CAAA,CAAE,aAAA,CAAcO,CAAAA,CAAmBN,CAAC,CAAC,CAAC,CAC9E,CAIA,IAAMU,CAAAA,CAAwB,4BAAA,CAGvB,SAASC,CAAAA,EAAgD,CAC9D,GAAI,CACF,OAAOC,GAAAA,EAAgB,EAAG,OAAA,CAAQF,CAAqB,CAAA,GAAM,MAAA,CAAS,OAAS,MACjF,CAAA,KAAQ,CACN,OAAO,MACT,CACF,CAEO,SAASG,CAAAA,CAA2BC,EAA+B,CACxE,GAAI,CACFF,GAAAA,EAAgB,EAAG,OAAA,CAAQF,EAAuBI,CAAI,EACxD,CAAA,KAAQ,CAER,CACF","file":"chunk-7KLXWCDS.js","sourcesContent":["import { getLocalStorage } from '../../core/local-storage';\n\n/**\n * Types and pure helpers of the Knowledge section: documents the team adds\n * so the agent can search and cite them. Everything here runs without React\n * so the list and detail pages stay thin and the rules are unit-tested.\n */\n\nexport type KnowledgeSourceKind = 'upload' | 'url';\n\nexport type KnowledgeSourceStatus = 'processing' | 'ready' | 'failed';\n\nexport type KnowledgeVersionStatus = 'processing' | 'published' | 'retired' | 'failed';\n\nexport type KnowledgeJobState =\n | 'queued'\n | 'extracting'\n | 'embedding'\n | 'publishing'\n | 'completed'\n | 'failed'\n | 'cancelled';\n\nexport interface KnowledgeLocator {\n page?: number;\n slide?: number;\n headingPath?: string[];\n charStart: number;\n charEnd: number;\n}\n\nexport interface KnowledgeVersion {\n id: string;\n status: KnowledgeVersionStatus;\n sha256: string | null;\n extractionVersion: number;\n passageCount: number;\n warnings: string[];\n error: string | null;\n publishedAt: string | null;\n createdAt: string;\n}\n\nexport interface KnowledgeSource {\n id: string;\n title: string;\n kind: KnowledgeSourceKind;\n originUrl: string | null;\n mimeType: string;\n path: string | null;\n size: number | null;\n sha256: string | null;\n /** Space codes that may read the source; empty means every project member. */\n spaces: string[];\n agentVisible: boolean;\n status: KnowledgeSourceStatus;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n /** The published version, or the newest one while the first ingestion runs. */\n currentVersion: KnowledgeVersion | null;\n /** The opening of the document's text, carried by listings for the grid's cards. */\n preview?: string | null;\n /** When the list was searched: whether the title or the content matched. */\n matchedIn?: 'title' | 'content' | null;\n}\n\nexport interface KnowledgeJobProgress {\n phase: KnowledgeJobState;\n message?: string;\n passageCount?: number;\n embeddedCount?: number;\n warnings?: string[];\n}\n\nexport interface KnowledgeJobError {\n code: string;\n message: string;\n hint?: string;\n}\n\nexport interface KnowledgeJob {\n id: string;\n sourceId: string;\n versionId: string;\n state: KnowledgeJobState;\n progress: KnowledgeJobProgress | null;\n error: KnowledgeJobError | null;\n createdAt: string;\n updatedAt: string;\n startedAt: string | null;\n completedAt: string | null;\n}\n\nexport interface KnowledgePassage {\n id: string;\n order: number;\n text: string;\n locator: KnowledgeLocator;\n}\n\nexport interface KnowledgeSourcesList {\n count: number;\n hasMore: boolean;\n sources: KnowledgeSource[];\n}\n\nexport interface KnowledgeSourceDetail {\n job: KnowledgeJob | null;\n source: KnowledgeSource;\n}\n\nexport interface KnowledgePassagesPage {\n passages: KnowledgePassage[];\n source: { id: string; title: string };\n total: number;\n version: { id: string; passageCount: number };\n}\n\n/** A record a document is attached to, as the platform lists it. */\nexport interface KnowledgeLink {\n entity: string;\n entityPlural: string;\n recordId: string;\n /** The record's display value when the platform could read it; null when the Studio must resolve it. */\n title: string | null;\n createdAt: string;\n}\n\n/** An entity type a document applies to: every record of the type inherits it. */\nexport interface KnowledgeEntityLink {\n entity: string;\n entityPlural: string;\n}\n\nexport interface KnowledgeLinksList {\n links: KnowledgeLink[];\n entities: KnowledgeEntityLink[];\n}\n\nexport interface KnowledgeRecordSources {\n /** Attached to the record itself. */\n sources: KnowledgeSource[];\n /** Attached to the record's entity type (and not to the record). */\n inherited: KnowledgeSource[];\n}\n\nexport interface KnowledgeEntitySources {\n sources: KnowledgeSource[];\n}\n\nexport interface KnowledgeRecordRef {\n entity: string;\n recordId: string;\n}\n\n/** What a document is attached to: a record, or every record of the entity when `recordId` is absent. */\nexport interface KnowledgeLinkTarget {\n entity: string;\n recordId?: string;\n}\n\nexport interface KnowledgeSourcePatch {\n agentVisible?: boolean;\n spaces?: string[];\n title?: string;\n}\n\n/** What registering a document returns: queued for indexing, or already present. */\nexport type RegisterKnowledgeSourceResult =\n | { duplicate: true; source: KnowledgeSource }\n | { duplicate?: false; job: KnowledgeJob; source: KnowledgeSource; version: KnowledgeVersion };\n\nexport const KNOWLEDGE_MAX_FILE_BYTES = 20 * 1024 * 1024;\n\nexport const KNOWLEDGE_MAX_TITLE_LENGTH = 200;\n\n/** Passages the API returns per page of a source. */\nexport const KNOWLEDGE_PASSAGES_PAGE_SIZE = 20;\n\nconst KNOWLEDGE_EXTENSIONS = ['pdf', 'docx', 'pptx', 'md', 'markdown', 'txt', 'html', 'htm'] as const;\n\n/** Value of the file input's `accept` attribute. */\nexport const KNOWLEDGE_ACCEPT = KNOWLEDGE_EXTENSIONS.map((extension) => `.${extension}`).join(',');\n\nexport const KNOWLEDGE_FORMATS_LABEL = 'PDF, Word, PowerPoint, Markdown, text or HTML';\n\nconst KNOWLEDGE_EXTENSION_SET: ReadonlySet<string> = new Set(KNOWLEDGE_EXTENSIONS);\n\nfunction getExtension(filename: string): string | null {\n const match = /\\.([a-z0-9]{1,8})$/i.exec(filename.trim());\n\n return match ? match[1]!.toLowerCase() : null;\n}\n\n/** Why a file cannot be added, or null when it can; mirrors the server rules so the user hears it before uploading. */\nexport function getKnowledgeFileProblem(file: { name: string; size: number }): string | null {\n const extension = getExtension(file.name);\n\n if (!extension || !KNOWLEDGE_EXTENSION_SET.has(extension)) {\n return `${file.name} is not a supported document. Add ${KNOWLEDGE_FORMATS_LABEL} files.`;\n }\n\n if (file.size <= 0) {\n return `${file.name} is empty.`;\n }\n\n if (file.size > KNOWLEDGE_MAX_FILE_BYTES) {\n return `${file.name} is larger than ${formatFileSize(KNOWLEDGE_MAX_FILE_BYTES)}.`;\n }\n\n return null;\n}\n\nexport function formatFileSize(bytes: number): string {\n if (bytes < 1024) {\n return `${String(bytes)} B`;\n }\n\n if (bytes < 1024 * 1024) {\n return `${(bytes / 1024).toFixed(bytes < 10 * 1024 ? 1 : 0)} KB`;\n }\n\n return `${(bytes / (1024 * 1024)).toFixed(bytes < 10 * 1024 * 1024 ? 1 : 0)} MB`;\n}\n\n/** A public page address the server will accept: https, no credentials, hash dropped. */\nexport function parseKnowledgeUrl(value: string): { error: string } | { url: string } {\n const trimmed = value.trim();\n\n if (!trimmed) {\n return { error: 'Enter the address of a public page.' };\n }\n\n let url: URL;\n\n try {\n url = new URL(/^[a-z][a-z0-9+.-]*:\\/\\//i.test(trimmed) ? trimmed : `https://${trimmed}`);\n } catch {\n return { error: 'Enter a valid address, for example https://example.com/handbook' };\n }\n\n if (url.protocol !== 'https:') {\n return { error: 'The address must use HTTPS.' };\n }\n\n if (url.username || url.password) {\n return { error: 'The address cannot include credentials.' };\n }\n\n url.hash = '';\n\n return { url: url.toString() };\n}\n\n/** The Untitled UI file icon drawn for a format (see `KnowledgeTypeIcon`). */\nexport type KnowledgeFileIcon = 'pdf' | 'docx' | 'pptx' | 'document' | 'txt' | 'html';\n\nexport interface KnowledgeFormat {\n /** How people call the format: \"PDF\", \"Word\", \"Web page\". */\n label: string;\n icon: KnowledgeFileIcon;\n}\n\nconst WEB_PAGE_FORMAT: KnowledgeFormat = { icon: 'html', label: 'Web page' };\nconst TEXT_FORMAT: KnowledgeFormat = { icon: 'txt', label: 'Text' };\n\n/** The formats the platform indexes, by media type; anything else it accepts reads as text. */\nexport const KNOWLEDGE_FORMATS: { readonly [mimeType: string]: KnowledgeFormat } = {\n 'application/pdf': { icon: 'pdf', label: 'PDF' },\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': { icon: 'docx', label: 'Word' },\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': { icon: 'pptx', label: 'PowerPoint' },\n 'text/markdown': { icon: 'document', label: 'Markdown' },\n 'text/html': { icon: 'html', label: 'HTML' },\n 'text/plain': TEXT_FORMAT,\n};\n\n/** The format of a document: a web page by its kind, else by its media type. */\nexport function getKnowledgeFormat(source: Pick<KnowledgeSource, 'kind' | 'mimeType'>): KnowledgeFormat {\n if (source.kind === 'url') {\n return WEB_PAGE_FORMAT;\n }\n\n return KNOWLEDGE_FORMATS[source.mimeType] ?? TEXT_FORMAT;\n}\n\nexport function getKnowledgeKindLabel(source: Pick<KnowledgeSource, 'kind' | 'mimeType'>): string {\n return getKnowledgeFormat(source).label;\n}\n\nexport type KnowledgeStatusTone = 'muted' | 'ready' | 'busy' | 'error';\n\nexport interface KnowledgeStatusSummary {\n /** Short badge text. */\n label: string;\n /** One line under the title. */\n detail: string;\n tone: KnowledgeStatusTone;\n}\n\nexport function isKnowledgeJobActive(job: KnowledgeJob | null | undefined): boolean {\n return Boolean(\n job &&\n (job.state === 'queued' || job.state === 'extracting' || job.state === 'embedding' || job.state === 'publishing')\n );\n}\n\n/** Whether the source changes on its own right now, so the page should poll. */\nexport function isKnowledgeSourceBusy(source: Pick<KnowledgeSource, 'status'>, job?: KnowledgeJob | null): boolean {\n return source.status === 'processing' || isKnowledgeJobActive(job);\n}\n\nfunction describeJobPhase(job: KnowledgeJob): string {\n const { progress } = job;\n\n switch (job.state) {\n case 'queued':\n return 'Waiting to be processed';\n case 'extracting':\n return 'Reading the document';\n case 'embedding': {\n if (progress?.passageCount) {\n return `Indexing passages (${String(progress.embeddedCount ?? 0)} of ${String(progress.passageCount)})`;\n }\n\n return 'Indexing passages';\n }\n case 'publishing':\n return 'Publishing';\n default:\n return progress?.message ?? job.state;\n }\n}\n\n/**\n * One status for the list row and the detail header. A source keeps serving\n * its published version while a re-index runs or fails, so the badge speaks\n * about the document, and the detail line about what is happening to it.\n */\nexport function summarizeKnowledgeStatus(source: KnowledgeSource, job?: KnowledgeJob | null): KnowledgeStatusSummary {\n const version = source.currentVersion;\n const published = version?.status === 'published';\n const passages = version?.passageCount ?? 0;\n const readyDetail = `${String(passages)} ${passages === 1 ? 'passage' : 'passages'}`;\n\n if (isKnowledgeJobActive(job)) {\n return {\n label: published ? 'Re-indexing' : 'Indexing',\n detail: describeJobPhase(job!),\n tone: 'busy',\n };\n }\n\n if (source.status === 'failed' || (!published && (job?.state === 'failed' || version?.status === 'failed'))) {\n const message = job?.error?.message ?? version?.error ?? 'Indexing failed';\n\n return { label: 'Failed', detail: message, tone: 'error' };\n }\n\n if (source.status === 'processing' || !published) {\n return { label: 'Indexing', detail: 'Waiting to be processed', tone: 'busy' };\n }\n\n if (job?.state === 'failed') {\n return {\n label: 'Ready',\n detail: `${readyDetail} · the last re-index failed: ${job.error?.message ?? 'unknown error'}`,\n tone: 'ready',\n };\n }\n\n if (version && version.warnings.length > 0) {\n return { label: 'Ready', detail: `${readyDetail} · indexed with warnings`, tone: 'ready' };\n }\n\n return { label: 'Ready', detail: readyDetail, tone: 'ready' };\n}\n\n/** Where a passage sits, the way a citation reads: \"p. 3 · Returns › Window\". */\nexport function formatKnowledgeLocator(locator: KnowledgeLocator): string {\n const parts: string[] = [];\n\n if (locator.page !== undefined) {\n parts.push(`p. ${String(locator.page)}`);\n }\n\n if (locator.slide !== undefined) {\n parts.push(`slide ${String(locator.slide)}`);\n }\n\n if (locator.headingPath && locator.headingPath.length > 0) {\n parts.push(locator.headingPath.join(' › '));\n }\n\n return parts.join(' · ');\n}\n\n/** Splits a stored warning such as \"TEXT_TRUNCATED: only the first…\" into readable text. */\nexport function formatKnowledgeWarning(warning: string): string {\n const [, captured] = /^[A-Z_]+:\\s*(.*)$/.exec(warning) ?? [];\n const text = captured ?? warning;\n\n return text.charAt(0).toUpperCase() + text.slice(1);\n}\n\n/** The spaces a source will carry after toggling one; empty means every member. */\nexport function toggleSpaceCode(current: string[], code: string): string[] {\n return current.includes(code) ? current.filter((entry) => entry !== code) : [...current, code];\n}\n\n/** The document page in the Knowledge app; absolute so it works from any app. */\nexport function getKnowledgeSourcePath(projectId: string, sourceId: string): string {\n return `/${encodeURIComponent(projectId)}/knowledge/${encodeURIComponent(sourceId)}`;\n}\n\n/**\n * What a linked record is called: the label the Studio resolved from the\n * record itself, else what the platform could read, else a shortened id so\n * the row still identifies the record.\n */\nexport function getKnowledgeLinkLabel(\n link: Pick<KnowledgeLink, 'recordId' | 'title'>,\n resolved?: string | null\n): string {\n const text = resolved?.trim() || (link.title ?? '').trim();\n\n if (text) {\n return text;\n }\n\n return link.recordId.length > 12 ? `${link.recordId.slice(0, 8)}…` : link.recordId;\n}\n\nexport interface KnowledgeLinkGroup {\n entity: string;\n entityPlural: string;\n links: KnowledgeLink[];\n}\n\n/** Links grouped per entity in first-seen order, so each group resolves its labels with one query. */\nexport function groupKnowledgeLinks(links: KnowledgeLink[]): KnowledgeLinkGroup[] {\n const groups = new Map<string, KnowledgeLinkGroup>();\n\n for (const link of links) {\n let group = groups.get(link.entityPlural);\n\n if (!group) {\n group = { entity: link.entity, entityPlural: link.entityPlural, links: [] };\n groups.set(link.entityPlural, group);\n }\n\n group.links.push(link);\n }\n\n return [...groups.values()];\n}\n\n/** The documents a picker may still attach to a record: the ones not attached yet, usable ones first. */\nexport function getAttachableSources(sources: KnowledgeSource[], attachedIds: Iterable<string>): KnowledgeSource[] {\n const attached = new Set(attachedIds);\n\n return sources\n .filter((source) => !attached.has(source.id))\n .sort((a, b) => Number(b.status === 'ready') - Number(a.status === 'ready'));\n}\n\n/** Whether documents may be attached to the entity: built-in ones (assets, tags) are not something a document is about. */\nexport function isKnowledgeLinkableEntity(entityName: string): boolean {\n return !entityName.startsWith('_');\n}\n\n/** The deployed entity with this name, if the Studio knows it. */\nexport function findEntityByName<T extends { name: string }>(schema: T[], entityName: string): T | undefined {\n return schema.find((entity) => entity.name === entityName);\n}\n\n/** How an entity type is called in the Knowledge views: its sidebar label, else its plural. */\nexport function getEntityLinkLabel(entity: { menu?: { label?: string }; plural: string }): string {\n return entity.menu?.label?.trim() || entity.plural;\n}\n\n/**\n * The entity types a document can still be attached to: the project's own\n * entities (built-in ones such as assets and tags are not something a\n * document is about) minus the ones already linked, by label.\n */\nexport function getLinkableEntities<T extends { menu?: { label?: string }; name: string; plural: string }>(\n schema: T[],\n linked: Iterable<Pick<KnowledgeEntityLink, 'entity'>>\n): T[] {\n const taken = new Set([...linked].map((link) => link.entity));\n\n return schema\n .filter((entity) => isKnowledgeLinkableEntity(entity.name) && !taken.has(entity.name))\n .sort((a, b) => getEntityLinkLabel(a).localeCompare(getEntityLinkLabel(b)));\n}\n\nexport type KnowledgeViewMode = 'list' | 'grid';\n\nconst VIEW_MODE_STORAGE_KEY = 'flexkit-knowledge:viewMode';\n\n/** The list is the default; the choice is remembered per browser, like the asset manager's. */\nexport function getStoredKnowledgeViewMode(): KnowledgeViewMode {\n try {\n return getLocalStorage()?.getItem(VIEW_MODE_STORAGE_KEY) === 'grid' ? 'grid' : 'list';\n } catch {\n return 'list';\n }\n}\n\nexport function setStoredKnowledgeViewMode(mode: KnowledgeViewMode): void {\n try {\n getLocalStorage()?.setItem(VIEW_MODE_STORAGE_KEY, mode);\n } catch {\n // Private mode or blocked storage: the choice lasts for the session only.\n }\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import'./index.css';import {f as f$1}from'./chunk-6AI7322C.js';import {ApolloClient,InMemoryCache,defaultDataIdFromObject,from,HttpLink}from'@apollo/client';import {ApolloProvider}from'@apollo/client/react';import {ErrorLink}from'@apollo/client/link/error';import {ServerError,CombinedGraphQLErrors,CombinedProtocolErrors}from'@apollo/client/errors';import {createContext,useContext,useState,useMemo,useReducer}from'react';import {jsx}from'react/jsx-runtime';import {uniqBy,props}from'ramda';function A(r){return r?"cause"in r:false}function f(r){if(!r)return null;if(ServerError.is(r))return r;if(A(r)){let e=r.cause;if(ServerError.is(e))return e}return null}function L(r){if(!r||typeof r!="object")return null;let{message:e}=r;return typeof e=="string"?e:null}function d(r){if(!r)return null;try{return JSON.parse(r)}catch{return null}}function k(r){if(!r)return null;let e=C(r).filter(t=>!I(t));return e.length===0?null:["The deployed schema is out of sync with your local Flexkit schema.","Run `flexkit deploy` using the CLI to apply your latest schema changes.",...e.map(t=>`- ${t}`)].join(`
|
|
2
|
+
`)}function er(r,e){return r?C(r).some(t=>t.includes(`Cannot query field "${e}"`)):false}function C(r){if(CombinedGraphQLErrors.is(r))return r.errors.filter(y).map(({message:o})=>o);let e=L(r);if(e&&a(e))return [e];let t=f(r);if(t?.statusCode!==400)return [];let n=d(t.bodyText)??P(t)??b(r);return n?Array.isArray(n.errors)?n.errors.filter(y).map(o=>o.message):typeof n.message=="string"&&a(n.message)?[n.message]:typeof n.error=="string"&&a(n.error)?[n.error]:[]:[]}function P(r){let{result:e}=r;return !e||typeof e!="object"?null:e}function b(r){if(!A(r))return null;let{cause:e}=r,t=L(e);if(t&&a(t))return {message:t};if(!e||typeof e!="object")return null;let{result:n}=e;return n&&typeof n=="object"?n:null}function y(r){if(!r||typeof r!="object")return false;let{extensions:e,message:t}=r;return e?.code==="GRAPHQL_VALIDATION_FAILED"&&typeof t=="string"?true:typeof t=="string"&&a(t)}function a(r){return r.startsWith("Cannot query field ")||r.startsWith("Unknown type ")||r.startsWith('Cannot query field "')||r.includes("GRAPHQL_VALIDATION_FAILED")}function I(r){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(r)}var U=ApolloProvider,v=createContext(void 0);function pr(){let r=useContext(v);if(!r)throw new Error("useGraphQLError must be used within GraphQLProvider");return r}var fr={userQuery:true};function H(r){return new ErrorLink(({error:e,operation:t})=>{if(t.getContext().userQuery===true)return;let n=k(e);if(n){r(n);return}CombinedGraphQLErrors.is(e)?e.errors.forEach(({message:s,locations:i,path:c})=>{console.warn(`[GraphQL error]: Message: ${s}, Location: ${i}, Path: ${c}`);}):CombinedProtocolErrors.is(e)&&e.errors.forEach(({message:s,extensions:i})=>{console.warn(`[Protocol error]: Message: ${s}, Extensions: ${JSON.stringify(i)}`);});let o=f(e);if(o?.statusCode===400){let s=d(o.bodyText),i=null;if(s&&typeof s=="object"){let{error:c,errors:g,message:E}=s;if(typeof E=="string")i=E;else if(Array.isArray(g)){let[p]=g;if(p&&typeof p.message=="string"){let{message:D}=p;i=D;}}else typeof c=="string"?i=c:i=JSON.stringify(s);}else i=o.bodyText;r(i??"There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.");}if(o){console.warn(`[Network error]: ${o.message}`);return}e&&console.warn(`[Network error]: ${e.message}`);})}function z(r,e){return from([H(e),new HttpLink({uri:`/api/flexkit/${r}/graphql`})])}function Z(r,e){return new ApolloClient({link:z(r??"",e),cache:new InMemoryCache({dataIdFromObject:t=>t._id?t._id:defaultDataIdFromObject(t)})})}function dr({children:r}){let{currentProjectId:e}=f$1(),[t,n]=useState(null),o=useMemo(()=>({schemaErrorMessage:t,setSchemaErrorMessage:n}),[t]),s=useMemo(()=>Z(e,n),[e]);return jsx(v.Provider,{value:o,children:jsx(U,{client:s,children:r})})}var G=createContext([]),M=createContext(()=>{});function K(r,e){let t=e.type;switch(e._id||(e._id=Date.now().toString()),t){case "DeleteEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "AddEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditEntity":return uniqBy(props(["type","_id"]),[...r,e]);case "EditRelationship":return uniqBy(props(["type","_id"]),[...r,e]);case "AlertDialog":return uniqBy(props(["type","_id"]),[...r,e]);case "Dismiss":return r.filter(n=>n._id!==e._id);default:throw Error(`Unknown action: ${t}`)}}function yr({children:r}){let[e,t]=useReducer(K,[]);return jsx(G.Provider,{value:e,children:jsx(M.Provider,{value:t,children:r})})}function Ar(){return useContext(G)}function Lr(){return useContext(M)}export{f as a,d as b,k as c,er as d,pr as e,fr as f,dr as g,yr as h,Ar as i,Lr as j};//# sourceMappingURL=chunk-BM7INZL3.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-BM7INZL3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graphql-client/error-utils.ts","../src/graphql-client/graphql-context.tsx","../src/entities/actions-context.tsx"],"names":["hasCause","error","getServerError","ServerError","possibleServerError","getErrorMessage","message","parseErrorBody","bodyText","getGraphQLSchemaMismatchMessage","messages","getGraphQLValidationMessages","isMissingCountStoreFieldMessage","isMissingGraphQLFieldError","fieldName","CombinedGraphQLErrors","isSchemaValidationError","directMessage","isSchemaValidationMessage","serverError","responseBody","getServerErrorResult","getErrorCauseResponse","item","result","cause","causeMessage","extensions","ApolloProviderCompat","ApolloProvider","GraphQLErrorContext","createContext","useGraphQLError","ctx","useContext","USER_QUERY_CONTEXT","createErrorLink","setSchemaErrorMessage","ErrorLink","operation","schemaMismatchMessage","locations","path","CombinedProtocolErrors","responseError","errors","responseMessage","firstError","firstErrorMessage","additiveLink","currentProjectId","from","HttpLink","client","ApolloClient","InMemoryCache","responseObject","defaultDataIdFromObject","GraphQLProvider","children","useConfig","schemaErrorMessage","useState","useMemo","apolloClient","jsx","ActionsContext","EntityDispatchContext","actionsReducer","actions","action","actionType","uniqBy","props","ActionsProvider","entityActions","dispatchEntityActions","useReducer","useActions","useDispatch"],"mappings":"4eAsBA,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AAA,CAC9B,QAAA,CAAAV,IAACE,CAAAA,CAAsB,QAAA,CAAtB,CAA+B,KAAA,CAAOS,CAAAA,CAAwB,SAAAjB,CAAAA,CAAS,CAAA,CAC1E,CAEJ,CAEA,SAASmB,EAAAA,EAAuB,CAC9B,OAAO5C,UAAAA,CAAWgC,CAAc,CAClC,CAEA,SAASa,IAAgC,CACvC,OAAO7C,UAAAA,CAAWiC,CAAqB,CACzC","file":"chunk-BM7INZL3.js","sourcesContent":["import type { ErrorLike } from '@apollo/client';\nimport { CombinedGraphQLErrors, ServerError } from '@apollo/client/errors';\n\ntype ErrorWithCause = ErrorLike & { cause?: unknown };\ntype ErrorWithMessage = {\n message?: unknown;\n};\ntype ServerErrorWithResult = ServerError & {\n result?: unknown;\n};\ntype GraphQLErrorResponse = {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n};\ntype GraphQLErrorItem = {\n extensions?: {\n code?: unknown;\n };\n message?: unknown;\n};\n\nfunction hasCause(error: ErrorLike): error is ErrorWithCause {\n if (!error) {\n return false;\n }\n\n return 'cause' in (error as ErrorWithCause);\n}\n\nexport function getServerError(error?: ErrorLike): ServerError | null {\n if (!error) {\n return null;\n }\n\n if (ServerError.is(error)) {\n return error;\n }\n\n if (hasCause(error)) {\n const possibleServerError = error.cause;\n\n if (ServerError.is(possibleServerError)) {\n return possibleServerError;\n }\n }\n\n return null;\n}\n\nfunction getErrorMessage(error: unknown): string | null {\n if (!error || typeof error !== 'object') {\n return null;\n }\n\n const { message } = error as ErrorWithMessage;\n\n return typeof message === 'string' ? message : null;\n}\n\nexport function parseErrorBody<T>(bodyText: string | undefined): T | null {\n if (!bodyText) {\n return null;\n }\n\n try {\n return JSON.parse(bodyText) as T;\n } catch {\n return null;\n }\n}\n\nexport function getGraphQLSchemaMismatchMessage(error?: ErrorLike): string | null {\n if (!error) {\n return null;\n }\n\n const messages = getGraphQLValidationMessages(error).filter((message) => !isMissingCountStoreFieldMessage(message));\n\n if (messages.length === 0) {\n return null;\n }\n\n return [\n 'The deployed schema is out of sync with your local Flexkit schema.',\n 'Run `flexkit deploy` using the CLI to apply your latest schema changes.',\n ...messages.map((message) => `- ${message}`),\n ].join('\\n');\n}\n\nexport function isMissingGraphQLFieldError(error: ErrorLike | undefined, fieldName: string): boolean {\n if (!error) {\n return false;\n }\n\n return getGraphQLValidationMessages(error).some((message) => {\n return message.includes(`Cannot query field \"${fieldName}\"`);\n });\n}\n\nfunction getGraphQLValidationMessages(error: ErrorLike): string[] {\n if (CombinedGraphQLErrors.is(error)) {\n return error.errors.filter(isSchemaValidationError).map(({ message }) => message);\n }\n\n const directMessage = getErrorMessage(error);\n\n if (directMessage && isSchemaValidationMessage(directMessage)) {\n return [directMessage];\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode !== 400) {\n return [];\n }\n\n const responseBody =\n parseErrorBody<GraphQLErrorResponse>(serverError.bodyText) ??\n getServerErrorResult(serverError) ??\n getErrorCauseResponse(error);\n\n if (!responseBody) {\n return [];\n }\n\n if (Array.isArray(responseBody.errors)) {\n return responseBody.errors.filter(isSchemaValidationError).map((item) => item.message);\n }\n\n if (typeof responseBody.message === 'string' && isSchemaValidationMessage(responseBody.message)) {\n return [responseBody.message];\n }\n\n if (typeof responseBody.error === 'string' && isSchemaValidationMessage(responseBody.error)) {\n return [responseBody.error];\n }\n\n return [];\n}\n\nfunction getServerErrorResult(serverError: ServerError): GraphQLErrorResponse | null {\n const { result } = serverError as ServerErrorWithResult;\n\n if (!result || typeof result !== 'object') {\n return null;\n }\n\n return result as GraphQLErrorResponse;\n}\n\nfunction getErrorCauseResponse(error: ErrorLike): GraphQLErrorResponse | null {\n if (!hasCause(error)) {\n return null;\n }\n\n const { cause } = error;\n const causeMessage = getErrorMessage(cause);\n\n if (causeMessage && isSchemaValidationMessage(causeMessage)) {\n return { message: causeMessage };\n }\n\n if (!cause || typeof cause !== 'object') {\n return null;\n }\n\n const { result } = cause as { result?: unknown };\n\n if (result && typeof result === 'object') {\n return result as GraphQLErrorResponse;\n }\n\n return null;\n}\n\nfunction isSchemaValidationError(error: unknown): error is GraphQLErrorItem & { message: string } {\n if (!error || typeof error !== 'object') {\n return false;\n }\n\n const { extensions, message } = error as GraphQLErrorItem;\n const code = extensions?.code;\n\n if (code === 'GRAPHQL_VALIDATION_FAILED' && typeof message === 'string') {\n return true;\n }\n\n return typeof message === 'string' && isSchemaValidationMessage(message);\n}\n\nfunction isSchemaValidationMessage(message: string): boolean {\n return (\n message.startsWith('Cannot query field ') ||\n message.startsWith('Unknown type ') ||\n message.startsWith('Cannot query field \"') ||\n message.includes('GRAPHQL_VALIDATION_FAILED')\n );\n}\n\nfunction isMissingCountStoreFieldMessage(message: string): boolean {\n return /Cannot query field \"[_A-Za-z][_0-9A-Za-z]*Total\" on type \"Query\"/.test(message);\n}\n","'use client';\n\nimport type { JSX } from 'react';\nimport { ApolloClient, InMemoryCache, defaultDataIdFromObject, from, HttpLink } from '@apollo/client';\nimport type { ApolloLink } from '@apollo/client';\nimport { ApolloProvider } from '@apollo/client/react';\nimport { ErrorLink } from '@apollo/client/link/error';\nimport { CombinedGraphQLErrors, CombinedProtocolErrors } from '@apollo/client/errors';\nimport { getGraphQLSchemaMismatchMessage, getServerError, parseErrorBody } from './error-utils';\nimport { useConfig } from '../core/config/config-context';\nimport React, { createContext, useContext, useMemo, useState } from 'react';\n\nconst ApolloProviderCompat = ApolloProvider as unknown as React.ComponentType<{\n children?: React.ReactNode;\n client: ApolloClient;\n}>;\n\ntype GraphQLErrorContextValue = {\n schemaErrorMessage: string | null;\n setSchemaErrorMessage: React.Dispatch<React.SetStateAction<string | null>>;\n};\n\nconst GraphQLErrorContext = createContext<GraphQLErrorContextValue | undefined>(undefined);\n\nfunction useGraphQLError(): GraphQLErrorContextValue {\n const ctx = useContext(GraphQLErrorContext);\n\n if (!ctx) {\n throw new Error('useGraphQLError must be used within GraphQLProvider');\n }\n\n return ctx;\n}\n\n/**\n * Context flag for operations the user writes themselves (the Graph app's\n * Query view): any error there, a mismatch or a 400, is a typo, not a\n * deployment that drifted from the local schema, so it must not raise the\n * schema banner. The caller shows the error itself.\n */\nexport const USER_QUERY_CONTEXT = { userQuery: true } as const;\n\nfunction createErrorLink(setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return new ErrorLink(({ error, operation }) => {\n if (operation.getContext().userQuery === true) {\n return;\n }\n\n const schemaMismatchMessage = getGraphQLSchemaMismatchMessage(error);\n\n if (schemaMismatchMessage) {\n setSchemaErrorMessage(schemaMismatchMessage);\n\n return;\n }\n\n if (CombinedGraphQLErrors.is(error)) {\n error.errors.forEach(({ message, locations, path }) => {\n console.warn(`[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`);\n });\n } else if (CombinedProtocolErrors.is(error)) {\n error.errors.forEach(({ message, extensions }) => {\n console.warn(`[Protocol error]: Message: ${message}, Extensions: ${JSON.stringify(extensions)}`);\n });\n }\n\n const serverError = getServerError(error);\n\n if (serverError?.statusCode === 400) {\n const responseBody = parseErrorBody<Record<string, unknown>>(serverError.bodyText);\n let message: string | null = null;\n\n if (responseBody && typeof responseBody === 'object') {\n const {\n error: responseError,\n errors,\n message: responseMessage,\n } = responseBody as {\n error?: unknown;\n errors?: unknown;\n message?: unknown;\n };\n\n if (typeof responseMessage === 'string') {\n message = responseMessage;\n } else if (Array.isArray(errors)) {\n const [firstError] = errors as { message?: unknown }[];\n\n if (firstError && typeof firstError.message === 'string') {\n const { message: firstErrorMessage } = firstError;\n message = firstErrorMessage;\n }\n } else if (typeof responseError === 'string') {\n message = responseError;\n } else {\n message = JSON.stringify(responseBody);\n }\n } else {\n message = serverError.bodyText;\n }\n\n setSchemaErrorMessage(\n message ?? 'There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.'\n );\n }\n\n if (serverError) {\n console.warn(`[Network error]: ${serverError.message}`);\n\n return;\n }\n\n if (error) {\n console.warn(`[Network error]: ${error.message}`);\n }\n });\n}\n\nfunction additiveLink(currentProjectId: string, setSchemaErrorMessage: (msg: string | null) => void): ApolloLink {\n return from([\n createErrorLink(setSchemaErrorMessage),\n new HttpLink({ uri: `/api/flexkit/${currentProjectId}/graphql` }),\n ]);\n}\n\nfunction client(\n currentProjectId: string | undefined,\n setSchemaErrorMessage: (msg: string | null) => void\n): ApolloClient {\n return new ApolloClient({\n link: additiveLink(currentProjectId ?? '', setSchemaErrorMessage),\n cache: new InMemoryCache({\n dataIdFromObject: (responseObject) => {\n return responseObject._id ? (responseObject._id as string) : defaultDataIdFromObject(responseObject);\n },\n }),\n });\n}\n\nexport function GraphQLProvider({ children }: { children: React.ReactNode }): JSX.Element {\n const { currentProjectId } = useConfig();\n const [schemaErrorMessage, setSchemaErrorMessage] = useState<string | null>(null);\n const ctx = useMemo(() => ({ schemaErrorMessage, setSchemaErrorMessage }), [schemaErrorMessage]);\n const apolloClient = useMemo(() => client(currentProjectId, setSchemaErrorMessage), [currentProjectId]);\n\n return (\n <GraphQLErrorContext.Provider value={ctx}>\n <ApolloProviderCompat client={apolloClient}>{children}</ApolloProviderCompat>\n </GraphQLErrorContext.Provider>\n );\n}\n\nexport { useGraphQLError };\n","'use client';\n\nimport { createContext, useContext, useReducer } from 'react';\nimport type { Dispatch, JSX, ReactNode } from 'react';\nimport { props, uniqBy } from 'ramda';\nimport type {\n Action,\n ActionAddEntity,\n ActionAlertDialog,\n ActionDeleteEntity,\n ActionEditEntity,\n ActionEditRelationship,\n} from './types';\n\nconst ActionsContext = createContext<Action[] | []>([]);\nconst EntityDispatchContext = createContext<Dispatch<Action>>(() => undefined);\n\nfunction actionsReducer(actions: Action[], action: Action): Action[] {\n const actionType = action.type;\n\n if (!action._id) {\n action._id = Date.now().toString();\n }\n\n switch (actionType) {\n case 'DeleteEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionDeleteEntity[]), action]);\n }\n case 'AddEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAddEntity[]), action]);\n }\n case 'EditEntity': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditEntity[]), action]);\n }\n case 'EditRelationship': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionEditRelationship[]), action]);\n }\n case 'AlertDialog': {\n return uniqBy(props(['type' as string, '_id']), [...(actions as ActionAlertDialog[]), action]);\n }\n case 'Dismiss': {\n return actions.filter((item) => item._id !== action._id);\n }\n default: {\n throw Error(`Unknown action: ${actionType as string}`);\n }\n }\n}\n\nfunction ActionsProvider({ children }: { children: ReactNode }): JSX.Element {\n const [entityActions, dispatchEntityActions] = useReducer(actionsReducer, []);\n\n return (\n <ActionsContext.Provider value={entityActions}>\n <EntityDispatchContext.Provider value={dispatchEntityActions}>{children}</EntityDispatchContext.Provider>\n </ActionsContext.Provider>\n );\n}\n\nfunction useActions(): Action[] {\n return useContext(ActionsContext);\n}\n\nfunction useDispatch(): Dispatch<Action> {\n return useContext(EntityDispatchContext);\n}\n\nexport { ActionsProvider, useActions, useDispatch };\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import'./index.css';import {a as a$1}from'./chunk-HKN6BX5U.js';var a="flexkit:agent:draft:",g="new";function n(){return a$1()}function f(t,r){return `${a}${t}:${r??g}`}function m(t,r=n()){try{return r?.getItem(t)??""}catch{return ""}}function s(t,r,e=n()){try{r.trim().length===0?e?.removeItem(t):e?.setItem(t,r);}catch{}}export{f as a,m as b,s as c};//# sourceMappingURL=chunk-ELOJGLAR.js.map
|
|
2
|
+
//# sourceMappingURL=chunk-ELOJGLAR.js.map
|