@flexkit/studio 0.2.19 → 0.2.21
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/chat-page-QKSMDM7A.js +4 -0
- package/dist/chat-page-QKSMDM7A.js.map +1 -0
- package/dist/chunk-3TAYSYYW.js +7 -0
- package/dist/{chunk-XNHSHVG2.js.map → chunk-3TAYSYYW.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-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-4IEOAKKK.js → chunk-7KRDPQXX.js} +2 -2
- package/dist/{chunk-4IEOAKKK.js.map → chunk-7KRDPQXX.js.map} +1 -1
- package/dist/{chunk-HCJAM5LG.js → chunk-AFLZA2R5.js} +2 -2
- package/dist/{chunk-HCJAM5LG.js.map → chunk-AFLZA2R5.js.map} +1 -1
- package/dist/chunk-AHR2EZGG.js +4 -0
- package/dist/{chunk-VMWUMFUL.js.map → chunk-AHR2EZGG.js.map} +1 -1
- package/dist/chunk-BXUW6OXZ.js +2 -0
- package/dist/{chunk-ZKA2HKNI.js.map → chunk-BXUW6OXZ.js.map} +1 -1
- package/dist/chunk-DZS344SD.js +378 -0
- package/dist/chunk-DZS344SD.js.map +1 -0
- package/dist/chunk-ELOJGLAR.js +2 -0
- package/dist/chunk-ELOJGLAR.js.map +1 -0
- package/dist/chunk-HKN6BX5U.js +2 -0
- package/dist/chunk-HKN6BX5U.js.map +1 -0
- package/dist/{chunk-DFLAX7EE.js → chunk-I4INIJFN.js} +2 -2
- package/dist/{chunk-DFLAX7EE.js.map → chunk-I4INIJFN.js.map} +1 -1
- package/dist/{chunk-QWQHXMXW.js → chunk-MJICM7YP.js} +2 -2
- package/dist/{chunk-QWQHXMXW.js.map → chunk-MJICM7YP.js.map} +1 -1
- package/dist/chunk-MLHXPTBT.js +2 -0
- package/dist/chunk-MLHXPTBT.js.map +1 -0
- package/dist/{chunk-H2RWSC56.js → chunk-PLZUH56T.js} +3 -3
- package/dist/{chunk-H2RWSC56.js.map → chunk-PLZUH56T.js.map} +1 -1
- 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-DHVKE36X.js → chunk-SY67F62K.js} +3 -3
- package/dist/{chunk-DHVKE36X.js.map → chunk-SY67F62K.js.map} +1 -1
- package/dist/chunk-T2DOW23R.js +3 -0
- package/dist/chunk-T2DOW23R.js.map +1 -0
- package/dist/{chunk-6RRB47OZ.js → chunk-YBLY77TV.js} +5 -5
- package/dist/{chunk-6RRB47OZ.js.map → chunk-YBLY77TV.js.map} +1 -1
- package/dist/{chunk-V6RB45UU.js → chunk-YJM2RPTA.js} +2 -2
- package/dist/{chunk-V6RB45UU.js.map → chunk-YJM2RPTA.js.map} +1 -1
- package/dist/{entry-3JSFO4OU.js → entry-BKWT63OH.js} +2 -2
- package/dist/{entry-3JSFO4OU.js.map → entry-BKWT63OH.js.map} +1 -1
- package/dist/index.css +24 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/list-F2MN4VI4.js +3 -0
- package/dist/{list-SY3L2ACH.js.map → list-F2MN4VI4.js.map} +1 -1
- package/dist/list-RFIARR7J.js +2 -0
- package/dist/{list-Z2C74QDN.js.map → list-RFIARR7J.js.map} +1 -1
- package/dist/{pages-INCA54HE.js → pages-6YG37BSV.js} +3 -3
- package/dist/{pages-INCA54HE.js.map → pages-6YG37BSV.js.map} +1 -1
- package/dist/plugin-pages-R5QCB5GZ.js +2 -0
- package/dist/{plugin-pages-WO3MCJKC.js.map → plugin-pages-R5QCB5GZ.js.map} +1 -1
- package/dist/record-links-BACU2DWS.js +2 -0
- package/dist/{record-links-CTB4SC4J.js.map → record-links-BACU2DWS.js.map} +1 -1
- package/dist/root-6FML7PJC.js +23 -0
- package/dist/{root-DOOWSYWY.js.map → root-6FML7PJC.js.map} +1 -1
- package/dist/{root-XHXX3SZG.js → root-FCO3MQTE.js} +3 -3
- package/dist/{root-XHXX3SZG.js.map → root-FCO3MQTE.js.map} +1 -1
- package/dist/{root-JA2LFGNX.js → root-MQ5FZRMQ.js} +2 -2
- package/dist/{root-JA2LFGNX.js.map → root-MQ5FZRMQ.js.map} +1 -1
- package/dist/root-MTJAYVPT.js +14 -0
- package/dist/root-MTJAYVPT.js.map +1 -0
- package/dist/{root-6MSWGFZX.js → root-U4QMDA3Q.js} +2 -2
- package/dist/{root-6MSWGFZX.js.map → root-U4QMDA3Q.js.map} +1 -1
- package/dist/root-UCQDMHDV.js +2 -0
- package/dist/{root-OGX4DUTM.js.map → root-UCQDMHDV.js.map} +1 -1
- package/dist/{search-Z4M4R4NJ.js → search-7DVZZIZ6.js} +2 -2
- package/dist/{search-Z4M4R4NJ.js.map → search-7DVZZIZ6.js.map} +1 -1
- package/dist/skills-pages-EPIBHZVO.js +2 -0
- package/dist/skills-pages-EPIBHZVO.js.map +1 -0
- package/dist/source-F6B2UBWX.js +2 -0
- package/dist/{source-5J56KIFA.js.map → source-F6B2UBWX.js.map} +1 -1
- package/package.json +4 -1
- package/dist/activity-nav-button-V5DFHADL.js +0 -2
- package/dist/chat-page-LAK4TFN4.js +0 -4
- package/dist/chat-page-LAK4TFN4.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-OOYCTZ3C.js +0 -379
- package/dist/chunk-OOYCTZ3C.js.map +0 -1
- package/dist/chunk-VMWUMFUL.js +0 -4
- package/dist/chunk-XNHSHVG2.js +0 -7
- package/dist/chunk-ZKA2HKNI.js +0 -2
- package/dist/list-SY3L2ACH.js +0 -3
- package/dist/list-Z2C74QDN.js +0 -2
- package/dist/plugin-pages-WO3MCJKC.js +0 -2
- package/dist/record-links-CTB4SC4J.js +0 -2
- package/dist/root-B4D3C37Q.js +0 -2
- package/dist/root-B4D3C37Q.js.map +0 -1
- package/dist/root-DOOWSYWY.js +0 -23
- package/dist/root-OGX4DUTM.js +0 -2
- package/dist/skills-pages-TP2XQPCQ.js +0 -2
- package/dist/skills-pages-TP2XQPCQ.js.map +0 -1
- package/dist/source-5J56KIFA.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/core/local-storage.ts","../src/apps/knowledge/knowledge.ts"],"names":["getLocalStorage","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","setStoredKnowledgeViewMode","mode"],"mappings":"oBAKO,SAASA,CAAAA,EAAkC,CAChD,GAAI,CACF,OAAO,OAAO,YAAA,CAAiB,GAAA,CAAc,IAAA,CAAO,YACtD,CAAA,KAAQ,CACN,OAAO,IACT,CACF,CCkKO,IAAMC,CAAAA,CAA2B,GAAK,IAAA,CAAO,IAAA,CAEvCC,CAAAA,CAA6B,GAAA,CAG7BC,CAAAA,CAA+B,EAAA,CAEtCC,EAAuB,CAAC,KAAA,CAAO,MAAA,CAAQ,MAAA,CAAQ,IAAA,CAAM,UAAA,CAAY,MAAO,MAAA,CAAQ,KAAK,CAAA,CAG9EC,CAAAA,CAAmBD,CAAAA,CAAqB,GAAA,CAAKE,GAAc,CAAA,CAAA,EAAIA,CAAS,CAAA,CAAE,CAAA,CAAE,IAAA,CAAK,GAAG,EAEpFC,CAAAA,CAA0B,+CAAA,CAEjCC,CAAAA,CAA+C,IAAI,GAAA,CAAIJ,CAAoB,EAEjF,SAASK,CAAAA,CAAaC,EAAiC,CACrD,IAAMC,EAAQ,qBAAA,CAAsB,IAAA,CAAKD,CAAAA,CAAS,IAAA,EAAM,CAAA,CAExD,OAAOC,CAAAA,CAAQA,CAAAA,CAAM,CAAC,CAAA,CAAG,WAAA,EAAY,CAAI,IAC3C,CAGO,SAASC,CAAAA,CAAwBC,CAAAA,CAAqD,CAC3F,IAAMP,EAAYG,CAAAA,CAAaI,CAAAA,CAAK,IAAI,CAAA,CAExC,OAAI,CAACP,GAAa,CAACE,CAAAA,CAAwB,GAAA,CAAIF,CAAS,CAAA,CAC/C,CAAA,EAAGO,EAAK,IAAI,CAAA,kCAAA,EAAqCN,CAAuB,CAAA,OAAA,CAAA,CAG7EM,CAAAA,CAAK,IAAA,EAAQ,EACR,CAAA,EAAGA,CAAAA,CAAK,IAAI,CAAA,UAAA,CAAA,CAGjBA,CA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E,aAAA,CAAcO,CAAAA,CAAmBN,CAAC,CAAC,CAAC,CAC9E,CAIA,IAAMU,CAAAA,CAAwB,4BAAA,CAGvB,SAASC,GAAgD,CAC9D,GAAI,CACF,OAAOzE,CAAAA,EAAgB,EAAG,QAAQwE,CAAqB,CAAA,GAAM,MAAA,CAAS,MAAA,CAAS,MACjF,CAAA,KAAQ,CACN,OAAO,MACT,CACF,CAEO,SAASE,CAAAA,CAA2BC,EAA+B,CACxE,GAAI,CACF3E,CAAAA,EAAgB,EAAG,OAAA,CAAQwE,EAAuBG,CAAI,EACxD,CAAA,KAAQ,CAER,CACF","file":"chunk-A7XHA2P6.js","sourcesContent":["/**\n * The browser's local storage, or null where there is none or touching it\n * throws (server rendering, a sandboxed frame, blocked site data). Callers\n * still wrap each read and write, since storage can fail per call.\n */\nexport function getLocalStorage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n return null;\n }\n}\n","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"]}
|
package/dist/chunk-BMO7JFAX.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {createContext,useReducer,useContext}from'react';import {uniqBy,props}from'ramda';import {jsx}from'react/jsx-runtime';var d=createContext([]),A=createContext(()=>{});function u(i,t){let o=t.type;switch(t._id||(t._id=Date.now().toString()),o){case "DeleteEntity":return uniqBy(props(["type","_id"]),[...i,t]);case "AddEntity":return uniqBy(props(["type","_id"]),[...i,t]);case "EditEntity":return uniqBy(props(["type","_id"]),[...i,t]);case "EditRelationship":return uniqBy(props(["type","_id"]),[...i,t]);case "AlertDialog":return uniqBy(props(["type","_id"]),[...i,t]);case "Dismiss":return i.filter(a=>a._id!==t._id);default:throw Error(`Unknown action: ${o}`)}}function l({children:i}){let[t,o]=useReducer(u,[]);return jsx(d.Provider,{value:t,children:jsx(A.Provider,{value:o,children:i})})}function D(){return useContext(d)}function h(){return useContext(A)}export{l as a,D as b,h as c};//# sourceMappingURL=chunk-BMO7JFAX.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-BMO7JFAX.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/entities/actions-context.tsx"],"names":["ActionsContext","createContext","EntityDispatchContext","actionsReducer","actions","action","actionType","uniqBy","props","item","ActionsProvider","children","entityActions","dispatchEntityActions","useReducer","jsx","useActions","useContext","useDispatch"],"mappings":"iJAcA,IAAMA,CAAAA,CAAiBC,aAAAA,CAA6B,EAAE,CAAA,CAChDC,CAAAA,CAAwBD,cAAgC,IAAG,CAAA,CAAY,EAE7E,SAASE,CAAAA,CAAeC,EAAmBC,CAAAA,CAA0B,CACnE,IAAMC,CAAAA,CAAaD,CAAAA,CAAO,KAM1B,OAJKA,CAAAA,CAAO,MACVA,CAAAA,CAAO,GAAA,CAAM,KAAK,GAAA,EAAI,CAAE,QAAA,EAAS,CAAA,CAG3BC,CAAAA,EACN,KAAK,cAAA,CACH,OAAOC,OAAOC,KAAAA,CAAM,CAAC,OAAkB,KAAK,CAAC,EAAG,CAAC,GAAIJ,EAAkCC,CAAM,CAAC,EAEhG,KAAK,WAAA,CACH,OAAOE,MAAAA,CAAOC,KAAAA,CAAM,CAAC,MAAA,CAAkB,KAAK,CAAC,EAAG,CAAC,GAAIJ,EAA+BC,CAAM,CAAC,EAE7F,KAAK,YAAA,CACH,OAAOE,MAAAA,CAAOC,KAAAA,CAAM,CAAC,OAAkB,KAAK,CAAC,EAAG,CAAC,GAAIJ,EAAgCC,CAAM,CAAC,CAAA,CAE9F,KAAK,kBAAA,CACH,OAAOE,OAAOC,KAAAA,CAAM,CAAC,OAAkB,KAAK,CAAC,EAAG,CAAC,GAAIJ,EAAsCC,CAAM,CAAC,EAEpG,KAAK,aAAA,CACH,OAAOE,MAAAA,CAAOC,KAAAA,CAAM,CAAC,MAAA,CAAkB,KAAK,CAAC,CAAA,CAAG,CAAC,GAAIJ,EAAiCC,CAAM,CAAC,EAE/F,KAAK,SAAA,CACH,OAAOD,CAAAA,CAAQ,MAAA,CAAQK,GAASA,CAAAA,CAAK,GAAA,GAAQJ,EAAO,GAAG,CAAA,CAEzD,QACE,MAAM,KAAA,CAAM,mBAAmBC,CAAoB,CAAA,CAAE,CAEzD,CACF,CAEA,SAASI,EAAgB,CAAE,QAAA,CAAAC,CAAS,CAAA,CAAyC,CAC3E,GAAM,CAACC,CAAAA,CAAeC,CAAqB,CAAA,CAAIC,UAAAA,CAAWX,EAAgB,EAAE,EAE5E,OACEY,GAAAA,CAACf,EAAe,QAAA,CAAf,CAAwB,KAAA,CAAOY,CAAAA,CAC9B,QAAA,CAAAG,GAAAA,CAACb,EAAsB,QAAA,CAAtB,CAA+B,MAAOW,CAAAA,CAAwB,QAAA,CAAAF,EAAS,CAAA,CAC1E,CAEJ,CAEA,SAASK,CAAAA,EAAuB,CAC9B,OAAOC,UAAAA,CAAWjB,CAAc,CAClC,CAEA,SAASkB,GAAgC,CACvC,OAAOD,UAAAA,CAAWf,CAAqB,CACzC","file":"chunk-BMO7JFAX.js","sourcesContent":["'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"]}
|
package/dist/chunk-OOYCTZ3C.js
DELETED
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import'./index.css';import {a}from'./chunk-YDVO6XWD.js';import {a as a$1}from'./chunk-ERDARDGB.js';import {b,f,c}from'./chunk-H2RWSC56.js';import {find,propEq,omit,pick,toPairs,uniq,uniqBy,prop}from'ramda';import {gql,NetworkStatus,ApolloClient,InMemoryCache,defaultDataIdFromObject,from,HttpLink}from'@apollo/client';import {ApolloProvider,useQuery}from'@apollo/client/react';import {ErrorLink}from'@apollo/client/link/error';import {ServerError,CombinedGraphQLErrors,CombinedProtocolErrors}from'@apollo/client/errors';import {createContext,useContext,useState,useMemo,useRef,useEffect,useCallback}from'react';import {jsx}from'react/jsx-runtime';var Wt=25,Ln=3,Pt=3,wn=["id","string"],Cn=["date","datetime","duration","time"],St=`_id
|
|
2
|
-
originalFilename
|
|
3
|
-
mimeType
|
|
4
|
-
path
|
|
5
|
-
url
|
|
6
|
-
size
|
|
7
|
-
height
|
|
8
|
-
width
|
|
9
|
-
lqip`,Rt=`_id
|
|
10
|
-
originalFilename
|
|
11
|
-
mimeType
|
|
12
|
-
path
|
|
13
|
-
url
|
|
14
|
-
size
|
|
15
|
-
height
|
|
16
|
-
width`,In=`_id
|
|
17
|
-
path
|
|
18
|
-
url`;function Y(t){return t?a(t)==="relationship"&&t.relationship?.mode==="multiple"&&t.relationship.entity==="_asset":false}function _t(t,n){return !t||!Y(t)?false:n?.name!==c.name||t.name!=="assets"}function ft(t){return t?.dataType==="asset"||t?.inputType==="asset"}function zt(t){let n=t,e=n?.edges??[],r=n?.aggregate?.count?.nodes??e.length;return e.reduce((i,s,o)=>(s.node&&i.push({...s.node,sortOrder:s.properties?.sortOrder??o,totalCount:r}),i),[]).sort((i,s)=>(i.sortOrder??Number.MAX_SAFE_INTEGER)-(s.sortOrder??Number.MAX_SAFE_INTEGER))}function Mn(t){return t.reduce((n,e,r)=>e._id?{...n,[e._id]:e.sortOrder??r}:n,{})}function U(t){return Array.isArray(t)?t[0]??null:t??null}function Qn(t,n){return n?In:t?St:Rt}function Jt(t,n=true,e=true,r=Wt,i=false){let s=n?` properties {
|
|
19
|
-
sortOrder
|
|
20
|
-
}
|
|
21
|
-
`:"",o=Qn(e,i),a=n?`(first: ${r}, sort: [{ edge: { sortOrder: ASC } }])`:`(first: ${r})`;return ` ${t}Connection${a} {
|
|
22
|
-
aggregate {
|
|
23
|
-
count {
|
|
24
|
-
nodes
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
edges {
|
|
28
|
-
`+s+` node {
|
|
29
|
-
${o}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
`}function Nt(t){return t?.aggregate?.count?.nodes??0}function Kt(t,n){let e=t[`${n}Total`];return typeof e=="number"?e:Nt(t[`${n}Connection`])}function Lt(t,n=""){return ` ${t}Connection${n} {
|
|
34
|
-
aggregate {
|
|
35
|
-
count {
|
|
36
|
-
nodes
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
`}function On(t,n,e){return n?e==="total"?` ${t}Total
|
|
41
|
-
`:Lt(t,"(where: $where)"):""}function kn(t,n,e,r=false){if(!t)return "";let i=n==="default"?"":`${n}
|
|
42
|
-
`;if(ft(t))return r?` ${t.name} {
|
|
43
|
-
_id
|
|
44
|
-
path
|
|
45
|
-
url
|
|
46
|
-
}
|
|
47
|
-
`:` ${t.name} {
|
|
48
|
-
${St}
|
|
49
|
-
}
|
|
50
|
-
`;if(a(t)==="local")return ` ${t.name} {
|
|
51
|
-
_id
|
|
52
|
-
default
|
|
53
|
-
${i}}
|
|
54
|
-
`;if(a(t)==="relationship"){let s=t.relationship?.field;if(!s)return ` ${t.name}
|
|
55
|
-
`;let o=find(propEq(t.relationship?.entity,"name"))(e),a$1=find(propEq(s,"name"))(o?.attributes??[]),u=a$1&&a(a$1)==="local"?`{
|
|
56
|
-
_id
|
|
57
|
-
default
|
|
58
|
-
${i}}
|
|
59
|
-
`:"";return t.relationship?.mode==="single"?` ${t.name} {
|
|
60
|
-
${s} ${u}}
|
|
61
|
-
`:` ${t.name} (limit: 3, offset: 0) {
|
|
62
|
-
${s} ${u}}
|
|
63
|
-
`}return ` ${t.name}
|
|
64
|
-
`}function Fn(t,n,e){return t?.attributes.reduce((r,i)=>{let s=n==="default"?"":`${n}
|
|
65
|
-
`;if(ft(i))return `${r}
|
|
66
|
-
${i.name} {
|
|
67
|
-
${Rt}
|
|
68
|
-
}
|
|
69
|
-
`;if(a(i)==="local")return `${r}
|
|
70
|
-
${i.name} {
|
|
71
|
-
_id
|
|
72
|
-
default
|
|
73
|
-
${s}
|
|
74
|
-
}
|
|
75
|
-
`;if(a(i)==="relationship"){let o=find(propEq(i.relationship?.entity,"name"))(e),a$1=find(propEq(i.relationship?.field,"name"))(o?.attributes??[]),u=a(a$1)==="local"?`{
|
|
76
|
-
_id
|
|
77
|
-
default
|
|
78
|
-
${s}}
|
|
79
|
-
`:"";if(i.relationship?.mode==="single")return `${r}
|
|
80
|
-
${i.name} {
|
|
81
|
-
${i.relationship.field} ${u}}
|
|
82
|
-
`;if(i.relationship?.field)return `${r}
|
|
83
|
-
${i.name} (limit: ${Pt}, offset: 0) {
|
|
84
|
-
${i.relationship.field} ${u}}
|
|
85
|
-
`}return `${r}
|
|
86
|
-
${i.name}
|
|
87
|
-
`},"")??""}function Tn(t){let n={};for(let e of t)n[e.name]=e;return n}function At(t){return t?t.name==="url"?true:!(t.hidden===true||t.name==="lqip"):false}function Le(t,n){if(!Array.isArray(t)||t.length===0)return;let[e]=t;if(!e||typeof e!="object")return;let[r]=Object.keys(e);if(!r||["_id","_createdAt","_updatedAt"].includes(r))return;let i=n?.attributes.find(s=>s.name===r);if(!(!i||a(i)!=="global"||i.dataType==="asset"))return {NOT:{[r]:{eq:null}}}}function pt(t,n,e,r){let i=r?.selection??"full",s=i==="display"?"list":i,o=r?.includeCount??true,a$2=r?.countMode??"aggregate",u="(where: $where, limit: $limit, offset: $offset, sort: $sort)",l=D(e,t),c=l?.name??t,d=a$1(l),f=i==="display"?d?[d]:[]:l?.attributes??[],g=Tn(f),h=`$where: ${c}Where, $limit: Int, $offset: Int, $sort: [${c}Sort!]`,y=r?.operationName??`Get${q(t)}`;if(!l)throw new Error(`Entity '${c}' not found in the schema`);if(f.length===0)throw new Error(`Entity '${c}' has no attributes defined in the schema`);let E=I("global",f).filter($=>$==="_updatedAt"?false:s==="list"?i==="display"||At(g[$]):true).join(`
|
|
88
|
-
`),p=tt(f).filter($=>s!=="list"||i==="display"||At(g[$])),m=I(["local"],f).filter($=>s!=="list"?true:i==="display"||At(g[$])),A=m.reduce(($,_)=>`${$}
|
|
89
|
-
${_} {
|
|
90
|
-
_id
|
|
91
|
-
default
|
|
92
|
-
}
|
|
93
|
-
`,""),O=m.reduce(($,_)=>`${$}
|
|
94
|
-
${_} {
|
|
95
|
-
_id
|
|
96
|
-
default
|
|
97
|
-
${n}
|
|
98
|
-
}
|
|
99
|
-
`,""),M=n==="default"?A:O,b=`_id
|
|
100
|
-
path
|
|
101
|
-
url`;s!=="list"&&(b=`_id
|
|
102
|
-
originalFilename
|
|
103
|
-
mimeType
|
|
104
|
-
path
|
|
105
|
-
url
|
|
106
|
-
size
|
|
107
|
-
height
|
|
108
|
-
width
|
|
109
|
-
lqip`);let F=p.reduce(($,_)=>`${$}
|
|
110
|
-
${_} {
|
|
111
|
-
${b}
|
|
112
|
-
}
|
|
113
|
-
`,""),B=f.filter($=>a($)==="relationship").reduce(($,_)=>{if(s==="list"&&i!=="display"&&_.hidden===true)return $;if(Y(_))return `${$}
|
|
114
|
-
${Jt(_.name,_t(_,l),s!=="list",s==="list"?Ln:Wt,s==="list")}`;let T=find(propEq(_.relationship?.entity,"name"))(e);if(s==="list"){let ut=a$1(T),lt=kn(ut,n,e,true),at=_.relationship?.mode==="single"?1:3;return `${$}
|
|
115
|
-
${_.name} (limit: ${at}, offset: 0) {
|
|
116
|
-
_id
|
|
117
|
-
${lt} }
|
|
118
|
-
`}let G=Fn(T,n,e);return `${Lt(_.name).trim()}${$}
|
|
119
|
-
${_.name} (limit: 25, offset: 0) { _id ${G}}
|
|
120
|
-
`},"");return {queryEntityName:t,query:`query ${y}(${h}) {
|
|
121
|
-
`+On(t,o,a$2)+` ${t}${u} {
|
|
122
|
-
_id
|
|
123
|
-
_updatedAt
|
|
124
|
-
${E} ${M} ${F} ${B}}
|
|
125
|
-
}
|
|
126
|
-
`}}function Ht(t,n,e,r){let s=D(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Kt(e,t),a$2=e[t],u=(c,d)=>{let f=d.name;return c.slice(0,3).map(g=>{if(a(d)!=="local")return g[f];let h=U(g[f]);return h?.[n]??h?.default}).join(", ")},l=a$2.map(c=>{let{_id:d}=c,f=typeof c._updatedAt=="string"?c._updatedAt:"",g=I("global",s).filter(p=>p!=="_updatedAt").reduce((p,m)=>({...p,[m]:c[m]}),{}),h=I("local",s).reduce((p,m)=>{let A=U(c[m]);return {...p,[m]:A?.[n]?A[n]:A?.default}},{}),y=tt(s).reduce((p,m)=>({...p,[m]:U(c[m])}),{}),E=I(["relationship"],s).reduce((p,m)=>{let A=find(propEq(m,"name"))(s),O=A.relationship?.entity??"",M=find(propEq(O,"name"))(r),b=a$1(M),F=c[m];if(Y(A)){let T=zt(c[`${m}Connection`]);return {...p,[m]:T}}if(!b)throw new Error(`There is an error in the schema for the relationship attribute "${m}"`);let J=b.name,B=a(b);if(A.relationship?.mode==="multiple"){let T=Array.isArray(F)?F:[];return {...p,[m]:u(T,b)}}let $=U(F);if(B==="global")return {...p,[m]:$?.[J]};let _=U($?.[J]);return {...p,[m]:_?.[n]??_?.default}},{});return {_id:d,...g,...h,...y,...E,_updatedAt:f}});return {count:o,results:l}}function Xt(t,n,e,r){let s=D(r,t)?.attributes??[];if(s.length===0)return {count:0,results:[]};let o=Kt(e,t),u=e[t].map(l=>{let c=I("global",s).reduce((h,y)=>({...h,[y]:{value:l[y],disabled:false,scope:"default",_id:""}}),{}),d=I("local",s).reduce((h,y)=>{let E=find(propEq(y,"name"))(s),p=U(l[y]);return {...h,[y]:{value:p?xn(p,n):null,disabled:!!(p&&p[n]===null&&a(E)==="local"&&n!=="default"),scope:n,_id:p?p._id:null}}},{}),f=tt(s).reduce((h,y)=>({...h,[y]:{value:U(l[y]),disabled:false,scope:"default",_id:""}}),{}),g=I(["relationship"],s).reduce((h,y)=>{let E=find(propEq(y,"name"))(s),p=l[y],m=E.relationship?.mode==="single"?U(p):p,A=m?._id,O=Nt(l[`${y}Connection`]);if(Y(E)){let M=zt(l[`${y}Connection`]);return {...h,[y]:{count:O,_id:A,knownAssetSortOrders:Mn(M),value:M,disabled:false,scope:n}}}return {...h,[y]:{count:O,_id:A,value:m,disabled:false,scope:n}}},{});return {...c,...d,...f,...g}});return {count:o,results:u}}function xn(t,n){return Array.isArray(t)?t.reduce((e,r)=>{if(r[n]??r.default){let i={_id:r._id,disabled:r.scope===null&&n!=="default",scope:n,value:r[n]??r.default};e.push(i);}return e},[]):t[n]??t.default??null}function we(t,n,e,r,i,s,o){let a=D(r,t),u=a?.name??t,l=a?.attributes??[],c=nt(t);if(l.length===0)return "";let d=Zt(l,s),f=Yt(l,d),g=Gn(n,l,d,e),h=vn(l,i,d),y=jn(l,i,d),E=t,p=o?.responseFields??nn(r,t,e);return `mutation ${`Update${q(t)}`}($where: ${u}Where) {
|
|
127
|
-
update${c}(
|
|
128
|
-
where: $where
|
|
129
|
-
update: {${f}${g}${h}${y}
|
|
130
|
-
}
|
|
131
|
-
) {
|
|
132
|
-
${E} {
|
|
133
|
-
_id
|
|
134
|
-
${p} }
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
`}function Zt(t,n){let e=t.filter(i=>i.readOnly===true).map(i=>i.name),r=omit(e,n);return pick(t.map(i=>i.name),r)}function I(t,n){return Array.isArray(t)?t.reduce((r,i)=>r.concat(I(i,n)),[]):n.filter(r=>a(r)===t&&r.inputType!=="asset").map(r=>r.name)}function tt(t){return t.filter(ft).map(e=>e.name)}function Yt(t,n,e="update"){let r=pick(I("global",t),n);return toPairs(r).reduce((s,[o,a])=>{let u=find(propEq(o,"name"))(t),l=Array.isArray(a?.value)?null:a?.value??null,c=wt(u.dataType,l);return e==="create"&&(c===null||c==="")?s:e==="update"?`${s}
|
|
138
|
-
${o}: { set: ${c} }`:`${s}
|
|
139
|
-
${o}: ${c}`},"")}function bt(t){return !t?._id||!t.path?"":t._id}function vn(t,n,e){let r=pick(tt(t),e);return toPairs(r).reduce((o,[a,u])=>{let l=bt(u.value),c=bt(n[a]?.value);if(l===c)return o;let d=c?` {
|
|
140
|
-
disconnect: [{
|
|
141
|
-
where: {
|
|
142
|
-
node: {
|
|
143
|
-
_id: { eq: ${C(c)} }
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}]
|
|
147
|
-
}
|
|
148
|
-
`:"",f=l?` {
|
|
149
|
-
connect: [{
|
|
150
|
-
where: {
|
|
151
|
-
node: {
|
|
152
|
-
_id: { eq: ${C(l)} }
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}]
|
|
156
|
-
}
|
|
157
|
-
`:"";return `${o}
|
|
158
|
-
${a}: [
|
|
159
|
-
${d}${f} ]`},"")}function qn(t,n){let e=pick(tt(t),n);return toPairs(e).reduce((s,[o,a])=>{let u=bt(a.value);return u?`${s}
|
|
160
|
-
${o}: {
|
|
161
|
-
connect: [{
|
|
162
|
-
where: {
|
|
163
|
-
node: {
|
|
164
|
-
_id: { eq: ${C(u)} }
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}]
|
|
168
|
-
}`:s},"")}function Gn(t,n,e,r){let i=pick(I("local",n),e);return toPairs(i).reduce((a,[u,l])=>{let c=find(propEq(u,"name"))(n),{dataType:d}=c,f=l.disabled||Array.isArray(l.value)?"null":wt(d,l.value);return l._id?`${a}
|
|
169
|
-
${u}: [{
|
|
170
|
-
update: {
|
|
171
|
-
node: {
|
|
172
|
-
${r}: { set: ${f} }
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}]`:l.disabled||Array.isArray(l.value)||l.value===void 0||l.value===null||l.value===""||f===null||f===""?a:`${a}
|
|
176
|
-
${u}: [{
|
|
177
|
-
create: {
|
|
178
|
-
node: {
|
|
179
|
-
_id: ${C(`${t}:${u}`)}
|
|
180
|
-
_type: "${d}"
|
|
181
|
-
${r}: ${f}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}]`},"")}function jn(t,n,e){let r=pick(I("relationship",t),e);return toPairs(r).reduce((o,[a,u])=>{let l=find(propEq(a,"name"))(t),{inputType:c,relationship:d}=l;if(c==="relationship"&&d?.mode==="single"){let f=n[a]._id??"",g=u._id??"";if(f===g)return o;let h=f?` {
|
|
185
|
-
disconnect: [{
|
|
186
|
-
where: {
|
|
187
|
-
node: {
|
|
188
|
-
_id: { eq: ${C(f)} }
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}]
|
|
192
|
-
}
|
|
193
|
-
`:"",y=g?` {
|
|
194
|
-
connect: [{
|
|
195
|
-
where: {
|
|
196
|
-
node: {
|
|
197
|
-
_id: { eq: ${C(g)} }
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}]
|
|
201
|
-
}
|
|
202
|
-
`:"";return `${o}
|
|
203
|
-
${a}: [
|
|
204
|
-
${h}${y} ]`}if(c==="relationship"&&d?.mode==="multiple"){if(d.entity==="_asset")return `${o}${Dn(a,n[a],u)}`;let f=uniq(u.relationships?.disconnect??[]).filter(Boolean),h=(u.relationships?.connect??[]).map(p=>C(p._id)).join(", "),y=f.length?` {
|
|
205
|
-
disconnect: [
|
|
206
|
-
${f.map(p=>` {
|
|
207
|
-
where: {
|
|
208
|
-
node: {
|
|
209
|
-
_id: { eq: ${C(p)} }
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
`).join("")} ]
|
|
214
|
-
}
|
|
215
|
-
`:"",E=h?` {
|
|
216
|
-
connect: [{
|
|
217
|
-
where: {
|
|
218
|
-
node: {
|
|
219
|
-
_id: { in: [${h}] }
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
}]
|
|
223
|
-
}
|
|
224
|
-
`:"";return !y&&!E?o:`${o}
|
|
225
|
-
${a}: [
|
|
226
|
-
${y}${E} ]`}return `${o}
|
|
227
|
-
`},"")}function Dn(t,n,e){let i=(e.relationships?.connect??[]).map((g,h)=>({...g,sortOrder:g.sortOrder??h})),s=i.map(g=>g._id),o={...Vn(n),...n?.knownAssetSortOrders??{},...e.knownAssetSortOrders??{}},a=uniq(e.relationships?.disconnect??[]).filter(g=>g&&!s.includes(g)),u=i.filter(g=>o[g._id]===void 0),l=i.filter(g=>{let h=o[g._id];return h!==void 0&&h!==g.sortOrder}),c=Un(a),d=Bn(u),f=Wn(l);return !c&&!d&&!f?"":`
|
|
228
|
-
${t}: [
|
|
229
|
-
${c}${d}${f} ]`}function Vn(t){let n=t?.value;return Array.isArray(n)?n.reduce((e,r,i)=>{if(typeof r!="object"||!r||!("_id"in r))return e;let{_id:s}=r;if(typeof s!="string"||s.length===0)return e;let o="sortOrder"in r&&typeof r.sortOrder=="number"?r.sortOrder:i;return {...e,[s]:o}},{}):{}}function Un(t){return t.length===0?"":` {
|
|
230
|
-
disconnect: [
|
|
231
|
-
${t.reduce((e,r)=>`${e} {
|
|
232
|
-
where: { node: { _id: { eq: ${C(r)} } } }
|
|
233
|
-
}
|
|
234
|
-
`,"")} ]
|
|
235
|
-
}
|
|
236
|
-
`}function Bn(t){return t.length===0?"":` {
|
|
237
|
-
connect: [
|
|
238
|
-
${tn(t)} ]
|
|
239
|
-
}
|
|
240
|
-
`}function tn(t){return t.reduce((n,e,r)=>{let i=e.sortOrder??r;return `${n} {
|
|
241
|
-
where: { node: { _id: { eq: ${C(e._id)} } } }
|
|
242
|
-
edge: { sortOrder: ${i} }
|
|
243
|
-
}
|
|
244
|
-
`},"")}function Wn(t){return t.length===0?"":t.reduce((e,r,i)=>{let s=r.sortOrder??i;return `${e} {
|
|
245
|
-
update: {
|
|
246
|
-
where: { node: { _id: { eq: ${C(r._id)} } } }
|
|
247
|
-
edge: { sortOrder: { set: ${s} } }
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
`},"")}function wt(t,n){return Cn.includes(t)?n?.toString()?C(n.toString()):null:wn.includes(t)?n==null?null:C(n.toString()):n==null||n===""?null:n.toString()}function C(t){return JSON.stringify(t)}function nn(t,n,e){let r=D(t,n),i=r?.attributes??[],s=I("global",i),o=I("local",i),a$1=I("relationship",i),u=s.reduce((l,c)=>`${l}${c}
|
|
251
|
-
`,"");return u+=o.reduce((l,c)=>`${l} ${c} {
|
|
252
|
-
_id
|
|
253
|
-
${e}
|
|
254
|
-
}
|
|
255
|
-
`,""),u+=a$1.reduce((l,c)=>{let d=find(propEq(c,"name"))(i),f=d?.relationship?.mode??"single";if(Y(d))return `${l}${Jt(c,_t(d,r))}`;let g=d?.relationship?.entity??"",y=find(propEq(g,"name"))(t)?.attributes??[],E=d?.relationship?.field??"[invalid_relationship_field_name_in_schema]",p=find(propEq(E,"name"))(y),m=a(p),A="";if(f==="single"&&(m==="global"&&(A=` ${c} {
|
|
256
|
-
_id
|
|
257
|
-
${E}
|
|
258
|
-
}
|
|
259
|
-
`),m==="local"&&(A=` ${c} {
|
|
260
|
-
_id
|
|
261
|
-
${E} {
|
|
262
|
-
_id
|
|
263
|
-
default
|
|
264
|
-
${e}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
`)),f==="multiple"&&y.length){let O=y.reduce((M,b)=>{if(a(b)==="local")return `${M} ${b.name} {
|
|
268
|
-
_id
|
|
269
|
-
default
|
|
270
|
-
${e}
|
|
271
|
-
}
|
|
272
|
-
`;if(a(b)==="relationship"){let F=e==="default"?"":`${e}
|
|
273
|
-
`,J=find(propEq(b.relationship?.entity,"name"))(t),B=find(propEq(b.relationship?.field,"name"))(J?.attributes??[]),$=a(B)==="local"?`{
|
|
274
|
-
_id
|
|
275
|
-
default
|
|
276
|
-
${F}}
|
|
277
|
-
`:"";if(b.relationship?.mode==="single")return `${M} ${b.name} {
|
|
278
|
-
${b.relationship.field} ${$}}
|
|
279
|
-
`;if(b.relationship?.field)return `${M} ${b.name} (limit: ${Pt}, offset: 0) {
|
|
280
|
-
${b.relationship.field} ${$}}
|
|
281
|
-
`}return ft(b)?`${M} ${b.name} {
|
|
282
|
-
${Rt}
|
|
283
|
-
}
|
|
284
|
-
`:`${M} ${b.name}
|
|
285
|
-
`},"");A=Lt(c)+` ${c} (limit: 25, offset: 0) {
|
|
286
|
-
${O} }
|
|
287
|
-
`;}return `${l}${A}`},""),u}function Ce(t,n,e){let r=typeof e=="string"?[e]:[...e],i=find(propEq(t,"name"))(n),s=i?.attributes??[],o=nt(i?.plural??""),a=Pn(s,r),u=`Delete${q(i?.plural??t)}`;return t==="_asset"?`mutation ${u}($where: ${t}Where) {
|
|
288
|
-
delete_assets(
|
|
289
|
-
where: $where
|
|
290
|
-
) {
|
|
291
|
-
nodesDeleted
|
|
292
|
-
relationshipsDeleted
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
`:`mutation ${u}($where: ${t}Where) {
|
|
296
|
-
delete${o}(
|
|
297
|
-
where: $where
|
|
298
|
-
${a?` delete: {
|
|
299
|
-
${a}
|
|
300
|
-
}
|
|
301
|
-
`:""} ) {
|
|
302
|
-
nodesDeleted
|
|
303
|
-
relationshipsDeleted
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
`}function Ie(t){let n=typeof t=="string"?[t]:[...t];return n.length===1?{_id:{eq:n[0]}}:{_id:{in:n}}}function Pn(t,n){return I("local",t).reduce((i,s)=>{let o=n.map(u=>C(`${u}:${s}`)).join(", "),a=n.length===1?`_id: { eq: ${o} }`:`_id: { in: [${o}] }`;return `${i}
|
|
307
|
-
${s}: [{
|
|
308
|
-
where: {
|
|
309
|
-
node: {
|
|
310
|
-
${a}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}]`},"")}function Me(t,n,e,r,i){let s=D(n,t),o=s?.attributes??[],a=nt(s?.plural??"");if(o.length===0)return "";let u=Zt(o,e),l=Yt(o,u,"create"),c=zn(o,u,"default",r),d=qn(o,u),f=Jn(o,u),g=t,h=nn(n,g,"default");return `mutation ${`Create${q(t)}`} {
|
|
314
|
-
create${a}(
|
|
315
|
-
input: [{
|
|
316
|
-
_id: ${C(r)} ${l} ${c}
|
|
317
|
-
${d}
|
|
318
|
-
${f}
|
|
319
|
-
}]
|
|
320
|
-
) {
|
|
321
|
-
${g} {
|
|
322
|
-
_id
|
|
323
|
-
${h} }
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
`}function zn(t,n,e,r){let i=pick(I("local",t),n);return toPairs(i).reduce((a,[u,l])=>{if(l?.value===void 0||l.value===null||l.value==="")return a;let c=find(propEq(u,"name"))(t),d=Array.isArray(l.value)?"null":wt(c.dataType,l.value);return `${a}
|
|
327
|
-
${u}: {
|
|
328
|
-
create: [{
|
|
329
|
-
node: {
|
|
330
|
-
_id: ${C(`${r}:${u}`)}
|
|
331
|
-
_type: "${c.dataType}"
|
|
332
|
-
${e}: ${d}
|
|
333
|
-
}
|
|
334
|
-
}]
|
|
335
|
-
}`},"")}function Jn(t,n){let e=pick(I("relationship",t),n);return toPairs(e).reduce((s,[o,a])=>{let u=find(propEq(o,"name"))(t),{inputType:l,relationship:c}=u;if(l==="relationship"&&c?.mode==="single"){if(!a._id)return s;let g=`connect: [{
|
|
336
|
-
where: {
|
|
337
|
-
node: {
|
|
338
|
-
_id: { eq: ${C(a._id)} }
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}]
|
|
342
|
-
`;return `${s}
|
|
343
|
-
${o}: {
|
|
344
|
-
${g} }`}let d=l==="relationship"&&c?.mode==="multiple",f=Array.isArray(a.relationships?.connect)&&a.relationships.connect.length>0;if(d&&f){let g=a.relationships?.connect??[];if(c?.entity==="_asset"){let E=tn(g.map((p,m)=>({...p,sortOrder:p.sortOrder??m})));return `${s}
|
|
345
|
-
${o}: {
|
|
346
|
-
connect: [
|
|
347
|
-
${E} ]
|
|
348
|
-
}`}let h=g.map(E=>C(E._id)).join(", "),y=h?`connect: {
|
|
349
|
-
where: {
|
|
350
|
-
node: {
|
|
351
|
-
_id: { in: [${h}] }
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
`:"";return `${s}
|
|
356
|
-
${o}: {
|
|
357
|
-
${y} }`}return `${s}
|
|
358
|
-
`},"")}function Qe({relatedEntityName:t,scope:n,schema:e}){let i=find(propEq(t,"name"))(e)?.plural??"";return i?pt(i,n,e,{selection:"list",operationName:`GetRelated${q(i)}`}):{queryEntityName:"",query:""}}function Oe({attributeName:t,entityName:n,entityNamePlural:e,schema:r}){let i=D(r,e),s=find(propEq(t,"name"))(i?.attributes??[]),o=_t(s,i),a=o?` properties {
|
|
359
|
-
sortOrder
|
|
360
|
-
}
|
|
361
|
-
`:"",u=o?"(first: $first, sort: [{ edge: { sortOrder: ASC } }])":"(first: $first)",l=`Get${q(n)}AssetConnection`;return {queryEntityName:e,query:`query ${l}($where: ${n}Where, $first: Int) {
|
|
362
|
-
${e}(where: $where) {
|
|
363
|
-
${t}Connection${u} {
|
|
364
|
-
aggregate {
|
|
365
|
-
count {
|
|
366
|
-
nodes
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
edges {
|
|
370
|
-
`+a+` node {
|
|
371
|
-
${St}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
`}}var nt=t=>t.charAt(0).toUpperCase()+t.slice(1);function q(t){let n=t.split(/[^0-9A-Za-z]+/).filter(Boolean).map(nt).join("");return n?/^[A-Za-z_]/.test(n)?n:`Entity${n}`:"Entity"}function D(t,n){return n==="_assets"?b:find(propEq(n,"plural"))(t)}function ke(t,n,e){if(!t||typeof t!="object")return {};let r=D(e,n);if(!r)return {};let i=`update${nt(n)}`,s=t[i];if(!s||typeof s!="object")return {};let o=s[n],a$1=Array.isArray(o)?o[0]:void 0;return !a$1||typeof a$1!="object"?{}:r.attributes.reduce((u,l)=>{if(a(l)!=="local")return u;let d=U(a$1[l.name])?._id;return typeof d!="string"||d.length===0?u:{...u,[l.name]:d}},{})}function sn(t){return t?"cause"in t:false}function rt(t){if(!t)return null;if(ServerError.is(t))return t;if(sn(t)){let n=t.cause;if(ServerError.is(n))return n}return null}function on(t){if(!t||typeof t!="object")return null;let{message:n}=t;return typeof n=="string"?n:null}function it(t){if(!t)return null;try{return JSON.parse(t)}catch{return null}}function gt(t){if(!t)return null;let n=ln(t).filter(e=>!Xn(e));return n.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.",...n.map(e=>`- ${e}`)].join(`
|
|
378
|
-
`)}function un(t,n){return t?ln(t).some(e=>e.includes(`Cannot query field "${n}"`)):false}function ln(t){if(CombinedGraphQLErrors.is(t))return t.errors.filter(rn).map(({message:i})=>i);let n=on(t);if(n&&et(n))return [n];let e=rt(t);if(e?.statusCode!==400)return [];let r=it(e.bodyText)??Kn(e)??Hn(t);return r?Array.isArray(r.errors)?r.errors.filter(rn).map(i=>i.message):typeof r.message=="string"&&et(r.message)?[r.message]:typeof r.error=="string"&&et(r.error)?[r.error]:[]:[]}function Kn(t){let{result:n}=t;return !n||typeof n!="object"?null:n}function Hn(t){if(!sn(t))return null;let{cause:n}=t,e=on(n);if(e&&et(e))return {message:e};if(!n||typeof n!="object")return null;let{result:r}=n;return r&&typeof r=="object"?r:null}function rn(t){if(!t||typeof t!="object")return false;let{extensions:n,message:e}=t;return n?.code==="GRAPHQL_VALIDATION_FAILED"&&typeof e=="string"?true:typeof e=="string"&&et(e)}function et(t){return t.startsWith("Cannot query field ")||t.startsWith("Unknown type ")||t.startsWith('Cannot query field "')||t.includes("GRAPHQL_VALIDATION_FAILED")}function Xn(t){return /Cannot query field "[_A-Za-z][_0-9A-Za-z]*Total" on type "Query"/.test(t)}var ce=ApolloProvider,dn=createContext(void 0);function fn(){let t=useContext(dn);if(!t)throw new Error("useGraphQLError must be used within GraphQLProvider");return t}function de(t){return new ErrorLink(({error:n})=>{let e=gt(n);if(e){t(e);return}CombinedGraphQLErrors.is(n)?n.errors.forEach(({message:i,locations:s,path:o})=>{console.warn(`[GraphQL error]: Message: ${i}, Location: ${s}, Path: ${o}`);}):CombinedProtocolErrors.is(n)&&n.errors.forEach(({message:i,extensions:s})=>{console.warn(`[Protocol error]: Message: ${i}, Extensions: ${JSON.stringify(s)}`);});let r=rt(n);if(r?.statusCode===400){let i=it(r.bodyText),s=null;if(i&&typeof i=="object"){let{error:o,errors:a,message:u}=i;if(typeof u=="string")s=u;else if(Array.isArray(a)){let[l]=a;if(l&&typeof l.message=="string"){let{message:c}=l;s=c;}}else typeof o=="string"?s=o:s=JSON.stringify(i);}else s=r.bodyText;t(s??"There is an error in the deployed Flexkit schema. Fix flexkit.config.ts and run flexkit deploy.");}if(r){console.warn(`[Network error]: ${r.message}`);return}n&&console.warn(`[Network error]: ${n.message}`);})}function fe(t,n){return from([de(n),new HttpLink({uri:`/api/flexkit/${t}/graphql`})])}function pe(t,n){return new ApolloClient({link:fe(t??"",n),cache:new InMemoryCache({dataIdFromObject:e=>e._id?e._id:defaultDataIdFromObject(e)})})}function We({children:t}){let{currentProjectId:n}=f(),[e,r]=useState(null),i=useMemo(()=>({schemaErrorMessage:e,setSchemaErrorMessage:r}),[e]),s=useMemo(()=>pe(n,r),[n]);return jsx(dn.Provider,{value:i,children:jsx(ce,{client:s,children:t})})}var yt=null,Ct=new Set,pn=[],It=new Set,Mt=new Set,Qt=new Set;function Ke(t,n){if(t==="_asset"||t==="_assets")return `Get${q(b.plural)}`;let e=n.find(s=>s.plural===t),r=n.find(s=>s.name===t),i=e?.plural??r?.plural??t;return `Get${q(i)}`}function gn(t){return It.add(t),()=>{It.delete(t);}}function yn(t){return Mt.add(t),()=>{Mt.delete(t);}}function mn(t){return Qt.add(t),()=>{Qt.delete(t);}}function He(t,n,e){let r=new Set(e.filter(Boolean));if(r.size>0)for(let i of Mt)i(n,r);return ge(t,n)}function Xe(t,n){let e=n.filter(r=>!!r._id);if(e.length!==0)for(let r of Qt)r(t,e);}function ge(t,n){return Ct.add(n),new Promise((e,r)=>{pn.push({resolve:e,reject:r}),yt&&clearTimeout(yt),yt=setTimeout(()=>{let i=new Set(Ct),s=pn.splice(0);Ct.clear(),yt=null,Promise.all([...It].map(o=>Promise.resolve(o(i)))).then(()=>{for(let{resolve:o}of s)o();}).catch(o=>{console.error("Error refreshing entity lists:",o);for(let{reject:a}of s)a(o);});},50);})}function ur({entityNamePlural:t,schema:n,scope:e,variables:r,isForm:i,selection:s="full",includeCount:o=true}){let[a,u]=useState({count:0,results:[]}),[l,c]=useState(false),[d,f]=useState(false),[g,h]=useState(null),y=useRef(false),E=useRef(false),p=useRef(0),m=useRef(null),A=useRef(null),O=`${t}Total`,M=D(n,t),F=r?.where===void 0&&(M?.spaces?.length??0)===0&&(g?.field!==O||g.schema!==n)?"total":"aggregate",J=useMemo(()=>gql(pt(t,e,n,{selection:s,countMode:F,includeCount:o}).query),[t,e,n,s,F,o]),B=useMemo(()=>gql(pt(t,e,n,{selection:s,includeCount:false}).query),[t,e,n,s]),{schemaErrorMessage:$,setSchemaErrorMessage:_}=fn(),{loading:T,data:G,fetchMore:ut,refetch:lt,error:at,networkStatus:X}=useQuery(J,{variables:r,notifyOnNetworkStatusChange:true}),kt=useRef(ut),$t=useRef(lt),Ft=useRef(B),Tt=useRef(X),xt=useRef(r);kt.current=ut,$t.current=lt,Ft.current=B,xt.current=r;let Et=o&&un(at,O),vt=F==="total"&&Et,W=Et?void 0:at,Z=Et&&!G?.[t],qt=rt(W),N=gt(W),{isProjectDisabled:An,isProjectReadOnly:bn}=(()=>{if(qt?.statusCode===403){let L=it(qt.bodyText);if(L&&typeof L.code=="string"){if(L.code==="PROJECT_PAUSED")return {isProjectDisabled:true,isProjectReadOnly:false};if(L.code==="READ_ONLY_MODE")return {isProjectDisabled:false,isProjectReadOnly:true}}return {isProjectDisabled:true,isProjectReadOnly:false}}return {isProjectDisabled:false,isProjectReadOnly:false}})();useEffect(()=>{vt&&h({field:O,schema:n});},[n,vt,O]);let Sn=useCallback(L=>{if(y.current||E.current)return;y.current=true,c(true);let{limit:x}=L.variables,v=p.current;kt.current({...L,query:Ft.current,variables:{...xt.current,...L.variables,offset:v,limit:x}}).then(({data:K})=>{let k=ot({data:K,entityNamePlural:t,isForm:i,schema:n,scope:e}),j=k.results.length;p.current=v+(j===0?0:Math.min(j,x)),u(Q=>{let P=uniqBy(prop("_id"),[...Q.results,...k.results]);return P.length===Q.results.length?{count:Q.results.length,results:Q.results}:{count:k.count||Q.count,results:P}});}).catch(K=>{console.error("Error fetching more data:",K);}).finally(()=>{y.current=false,c(false);});},[t,i,n,e]),Rn=useCallback(L=>{if(E.current)return Promise.resolve();let x=L?.preserve===true;return E.current=true,y.current=false,c(false),x||(m.current=null,A.current=null,p.current=0,f(true),u({count:0,results:[]})),$t.current().then(({data:v})=>{let K=JSON.stringify({entityNamePlural:t,scope:e,selection:s,includeCount:o,variables:r}),k=ot({data:v,entityNamePlural:t,isForm:i,schema:n,scope:e});m.current=K,A.current=null,p.current=ht(r)+k.results.length,u(k);}).catch(v=>{console.error("Error reloading data:",v);}).finally(()=>{E.current=false,f(false);})},[t,i,n,e,s,o,r]);return useEffect(()=>{if(N){_(N);return}G&&$&&!W&&_(null);},[G,W,$,N,_]),useEffect(()=>{if(W||N||Z)return;let L=JSON.stringify({entityNamePlural:t,scope:e,selection:s,includeCount:o,variables:r});if(m.current===L)return;if(T&&A.current!==L){A.current=L,p.current=0,u({count:0,results:[]});return}if(T)return;let x=ot({data:G,entityNamePlural:t,isForm:i,schema:n,scope:e});m.current=L,A.current=null,p.current=ht(r)+x.results.length,u(x);},[G,W,t,i,T,Z,n,N,e,s,o,r]),useEffect(()=>{let L=Tt.current;if(Tt.current=X,W||N||E.current||Z||L!==NetworkStatus.refetch||X!==NetworkStatus.ready||!G)return;let x=JSON.stringify({entityNamePlural:t,scope:e,selection:s,includeCount:o,variables:r}),v=ot({data:G,entityNamePlural:t,isForm:i,schema:n,scope:e});m.current=x,A.current=null,p.current=ht(r)+v.results.length,u(v);},[G,W,t,i,Z,X,n,N,e,s,o,r]),useEffect(()=>{if(i)return;let L=`Get${q(t)}`,x=gn(k=>{if(!(!k.has(L)||y.current||E.current))return $t.current().then(({data:j})=>{let Q=JSON.stringify({entityNamePlural:t,scope:e,selection:s,includeCount:o,variables:r}),P=ot({data:j,entityNamePlural:t,isForm:i,schema:n,scope:e});m.current=Q,A.current=null,p.current=ht(r)+P.results.length,u(P);}).catch(j=>{console.error("Error soft-refreshing entity list:",j);})}),v=yn((k,j)=>{k===L&&u(Q=>{let P=Q.results.filter(jt=>{let Dt=typeof jt._id=="string"?jt._id:void 0;return !Dt||!j.has(Dt)}),Gt=Q.results.length-P.length;return Gt===0?Q:{count:Math.max(0,Q.count-Gt),results:P}});}),K=mn((k,j)=>{k===L&&u(Q=>$e(Q,j,r?.sort));});return ()=>{x(),v(),K();}},[t,i,n,e,s,o,r]),{isLoading:T&&X!==NetworkStatus.refetch||d||Z,isLoadingMore:l,fetchMore:Sn,reload:Rn,count:a.count,data:a.results,isProjectDisabled:An,isProjectReadOnly:bn,schemaErrorMessage:$}}function ht(t){let n=t?.offset;return typeof n=="number"&&Number.isFinite(n)?n:0}function ot(t){let n=t.entityNamePlural;return t.data?.[n]?t.isForm?Xt(t.entityNamePlural,t.scope,t.data,t.schema):Ht(t.entityNamePlural,t.scope,t.data,t.schema):{count:0,results:[]}}function $e(t,n,e){let r=new Map(n.map(o=>[o._id,o])),i=false,s=t.results.map(o=>{let a=typeof o._id=="string"?o._id:void 0;if(!a)return o;let u=r.get(a);return u?(i=true,{...o,...u.attributes}):o});return i?{count:t.count,results:Ee(s,e)}:t}function Ee(t,n){if(!Array.isArray(n)||n.length===0)return t;let[e]=n;if(!e||typeof e!="object")return t;let[r]=Object.entries(e),[i,s]=r??[];if(!i||s!=="ASC"&&s!=="DESC")return t;let o=s==="DESC"?-1:1;return [...t].sort((a,u)=>{let l=a[i],c=u[i],d=typeof l=="string"?l:"",f=typeof c=="string"?c:"";return d.localeCompare(f)*o})}export{Wt as a,zt as b,Mn as c,Le as d,pt as e,Ht as f,we as g,Ce as h,Ie as i,Me as j,Qe as k,Oe as l,D as m,ke as n,rt as o,it as p,Ke as q,He as r,Xe as s,ge as t,fn as u,We as v,ur as w};//# sourceMappingURL=chunk-OOYCTZ3C.js.map
|
|
379
|
-
//# sourceMappingURL=chunk-OOYCTZ3C.js.map
|