polen 0.10.0 → 0.11.0-next.10
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/build/api/api.d.ts +1 -0
- package/build/api/api.d.ts.map +1 -1
- package/build/api/api.js +1 -0
- package/build/api/api.js.map +1 -1
- package/build/api/config/configurator.d.ts +55 -26
- package/build/api/config/configurator.d.ts.map +1 -1
- package/build/api/config/configurator.js +27 -9
- package/build/api/config/configurator.js.map +1 -1
- package/build/api/config/merge.d.ts.map +1 -1
- package/build/api/config/merge.js +0 -11
- package/build/api/config/merge.js.map +1 -1
- package/build/api/content/metadata.d.ts +8 -2
- package/build/api/content/metadata.d.ts.map +1 -1
- package/build/api/content/metadata.js +1 -1
- package/build/api/content/metadata.js.map +1 -1
- package/build/api/schema/data-sources/data-sources.d.ts +1 -0
- package/build/api/schema/data-sources/data-sources.d.ts.map +1 -1
- package/build/api/schema/data-sources/data-sources.js +1 -0
- package/build/api/schema/data-sources/data-sources.js.map +1 -1
- package/build/api/schema/data-sources/introspection/introspection.d.ts +83 -0
- package/build/api/schema/data-sources/introspection/introspection.d.ts.map +1 -0
- package/build/api/schema/data-sources/introspection/introspection.js +110 -0
- package/build/api/schema/data-sources/introspection/introspection.js.map +1 -0
- package/build/api/schema/data-sources/memory/memory.d.ts +2 -2
- package/build/api/schema/data-sources/memory/memory.d.ts.map +1 -1
- package/build/api/schema/data-sources/memory/memory.js +1 -3
- package/build/api/schema/data-sources/memory/memory.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts +7 -3
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js +15 -11
- package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts +16 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-directory/schema-directory.js +26 -7
- package/build/api/schema/data-sources/schema-directory/schema-directory.js.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts +7 -2
- package/build/api/schema/data-sources/schema-file/schema-file.d.ts.map +1 -1
- package/build/api/schema/data-sources/schema-file/schema-file.js +13 -5
- package/build/api/schema/data-sources/schema-file/schema-file.js.map +1 -1
- package/build/api/schema/metadata.d.ts +16 -0
- package/build/api/schema/metadata.d.ts.map +1 -0
- package/build/api/schema/metadata.js +19 -0
- package/build/api/schema/metadata.js.map +1 -0
- package/build/api/schema/read.d.ts +85 -11
- package/build/api/schema/read.d.ts.map +1 -1
- package/build/api/schema/read.js +15 -6
- package/build/api/schema/read.js.map +1 -1
- package/build/api/schema/schema.d.ts +33 -2
- package/build/api/schema/schema.d.ts.map +1 -1
- package/build/api/schema/schema.js +42 -0
- package/build/api/schema/schema.js.map +1 -1
- package/build/api/schema-source/index.d.ts +2 -0
- package/build/api/schema-source/index.d.ts.map +1 -0
- package/build/api/schema-source/index.js +2 -0
- package/build/api/schema-source/index.js.map +1 -0
- package/build/api/schema-source/schema-source.d.ts +33 -0
- package/build/api/schema-source/schema-source.d.ts.map +1 -0
- package/build/api/schema-source/schema-source.js +137 -0
- package/build/api/schema-source/schema-source.js.map +1 -0
- package/build/api/static/manifest.d.ts +1 -2
- package/build/api/static/manifest.d.ts.map +1 -1
- package/build/api/static/manifest.js +1 -1
- package/build/api/static/manifest.js.map +1 -1
- package/build/api/vite/plugins/build.d.ts.map +1 -1
- package/build/api/vite/plugins/build.js +3 -0
- package/build/api/vite/plugins/build.js.map +1 -1
- package/build/api/vite/plugins/core.d.ts +1 -0
- package/build/api/vite/plugins/core.d.ts.map +1 -1
- package/build/api/vite/plugins/core.js +25 -22
- package/build/api/vite/plugins/core.js.map +1 -1
- package/build/api/vite/plugins/main.d.ts.map +1 -1
- package/build/api/vite/plugins/main.js +1 -8
- package/build/api/vite/plugins/main.js.map +1 -1
- package/build/api/vite/plugins/schema-assets.d.ts +22 -0
- package/build/api/vite/plugins/schema-assets.d.ts.map +1 -0
- package/build/api/vite/plugins/schema-assets.js +310 -0
- package/build/api/vite/plugins/schema-assets.js.map +1 -0
- package/build/api/vite/plugins/serve.d.ts.map +1 -1
- package/build/api/vite/plugins/serve.js +11 -0
- package/build/api/vite/plugins/serve.js.map +1 -1
- package/build/cli/commands/open.js +1 -1
- package/build/cli/commands/open.js.map +1 -1
- package/build/lib/grafaid/schema/schema.d.ts +1 -1
- package/build/lib/grafaid/schema/schema.d.ts.map +1 -1
- package/build/lib/grafaid/schema/schema.js +1 -1
- package/build/lib/grafaid/schema/schema.js.map +1 -1
- package/build/lib/graphql-change/change-groups.d.ts +2 -0
- package/build/lib/graphql-change/change-groups.d.ts.map +1 -1
- package/build/lib/graphql-change/change-groups.js +54 -0
- package/build/lib/graphql-change/change-groups.js.map +1 -1
- package/build/lib/kit-temp.d.ts +9 -0
- package/build/lib/kit-temp.d.ts.map +1 -1
- package/build/lib/kit-temp.js +14 -2
- package/build/lib/kit-temp.js.map +1 -1
- package/build/lib/path-map/path-map.d.ts.map +1 -1
- package/build/lib/path-map/path-map.js +3 -1
- package/build/lib/path-map/path-map.js.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.d.ts +5 -3
- package/build/lib/react-router-aid/react-router-aid.d.ts.map +1 -1
- package/build/lib/react-router-aid/react-router-aid.js +7 -4
- package/build/lib/react-router-aid/react-router-aid.js.map +1 -1
- package/build/project-data.d.ts +3 -11
- package/build/project-data.d.ts.map +1 -1
- package/build/template/components/Changelog.d.ts +3 -3
- package/build/template/components/Changelog.d.ts.map +1 -1
- package/build/template/components/Changelog.js +8 -84
- package/build/template/components/Changelog.js.map +1 -1
- package/build/template/components/CodeBlock.d.ts +2 -0
- package/build/template/components/CodeBlock.d.ts.map +1 -1
- package/build/template/components/CodeBlock.js +1 -4
- package/build/template/components/CodeBlock.js.map +1 -1
- package/build/template/components/ComponentDispatch.d.ts +34 -0
- package/build/template/components/ComponentDispatch.d.ts.map +1 -0
- package/build/template/components/ComponentDispatch.js +33 -0
- package/build/template/components/ComponentDispatch.js.map +1 -0
- package/build/template/components/ReferenceLink.d.ts +19 -0
- package/build/template/components/ReferenceLink.d.ts.map +1 -0
- package/build/template/components/ReferenceLink.js +19 -0
- package/build/template/components/ReferenceLink.js.map +1 -0
- package/build/template/components/TypeAnnotation.d.ts.map +1 -1
- package/build/template/components/TypeAnnotation.js +3 -3
- package/build/template/components/TypeAnnotation.js.map +1 -1
- package/build/template/components/TypeFieldsLinkList.d.ts.map +1 -1
- package/build/template/components/TypeFieldsLinkList.js +4 -4
- package/build/template/components/TypeFieldsLinkList.js.map +1 -1
- package/build/template/components/TypeIndex.js +2 -2
- package/build/template/components/TypeIndex.js.map +1 -1
- package/build/template/components/VersionSelector.d.ts +7 -0
- package/build/template/components/VersionSelector.d.ts.map +1 -0
- package/build/template/components/VersionSelector.js +30 -0
- package/build/template/components/VersionSelector.js.map +1 -0
- package/build/template/components/graphql/type-link.d.ts.map +1 -1
- package/build/template/components/graphql/type-link.js +2 -2
- package/build/template/components/graphql/type-link.js.map +1 -1
- package/build/template/hooks/useVersionPath.d.ts +6 -0
- package/build/template/hooks/useVersionPath.d.ts.map +1 -0
- package/build/template/hooks/useVersionPath.js +10 -0
- package/build/template/hooks/useVersionPath.js.map +1 -0
- package/build/template/layouts/ChangelogLayout.d.ts.map +1 -0
- package/build/template/{components → layouts}/ChangelogLayout.js +1 -1
- package/build/template/layouts/ChangelogLayout.js.map +1 -0
- package/build/template/layouts/index.d.ts +1 -0
- package/build/template/layouts/index.d.ts.map +1 -1
- package/build/template/layouts/index.js +1 -0
- package/build/template/layouts/index.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +8 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -0
- package/build/template/lib/fetch-text.js +14 -0
- package/build/template/lib/fetch-text.js.map +1 -0
- package/build/template/lib/polen-url.d.ts +14 -0
- package/build/template/lib/polen-url.d.ts.map +1 -1
- package/build/template/lib/polen-url.js +16 -0
- package/build/template/lib/polen-url.js.map +1 -1
- package/build/template/lib/schema-utils/constants.d.ts +5 -0
- package/build/template/lib/schema-utils/constants.d.ts.map +1 -0
- package/build/template/lib/schema-utils/constants.js +5 -0
- package/build/template/lib/schema-utils/constants.js.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts +15 -0
- package/build/template/lib/schema-utils/schema-utils.d.ts.map +1 -0
- package/build/template/lib/schema-utils/schema-utils.js +37 -0
- package/build/template/lib/schema-utils/schema-utils.js.map +1 -0
- package/build/template/routes/changelog.d.ts +4 -3
- package/build/template/routes/changelog.d.ts.map +1 -1
- package/build/template/routes/changelog.js +15 -9
- package/build/template/routes/changelog.js.map +1 -1
- package/build/template/routes/index.js +2 -2
- package/build/template/routes/index.js.map +1 -1
- package/build/template/routes/pages.d.ts +10 -0
- package/build/template/routes/pages.d.ts.map +1 -0
- package/build/template/routes/pages.js +76 -0
- package/build/template/routes/pages.js.map +1 -0
- package/build/template/routes/reference.d.ts +35 -6
- package/build/template/routes/reference.d.ts.map +1 -1
- package/build/template/routes/reference.js +97 -14
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.d.ts.map +1 -1
- package/build/template/routes/root.js +11 -75
- package/build/template/routes/root.js.map +1 -1
- package/build/template/server/app.d.ts +22 -1
- package/build/template/server/app.d.ts.map +1 -1
- package/build/template/server/app.js +19 -9
- package/build/template/server/app.js.map +1 -1
- package/build/template/server/main.js +9 -1
- package/build/template/server/main.js.map +1 -1
- package/build/template/server/ssg/generate.js +2 -2
- package/build/template/server/ssg/generate.js.map +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts +1 -1
- package/build/template/server/ssg/get-route-paths.d.ts.map +1 -1
- package/build/template/server/ssg/get-route-paths.js +90 -27
- package/build/template/server/ssg/get-route-paths.js.map +1 -1
- package/build/template/sources/schema-source.d.ts +15 -0
- package/build/template/sources/schema-source.d.ts.map +1 -0
- package/build/template/sources/schema-source.js +64 -0
- package/build/template/sources/schema-source.js.map +1 -0
- package/package.json +16 -17
- package/src/api/api.ts +1 -0
- package/src/api/config/configurator.ts +86 -36
- package/src/api/config/merge.ts +0 -16
- package/src/api/content/metadata.ts +1 -1
- package/src/api/schema/data-sources/data-sources.ts +1 -0
- package/src/api/schema/data-sources/introspection/introspection.ts +213 -0
- package/src/api/schema/data-sources/memory/memory.ts +3 -5
- package/src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts +29 -13
- package/src/api/schema/data-sources/schema-directory/schema-directory.ts +56 -16
- package/src/api/schema/data-sources/schema-file/schema-file.ts +16 -7
- package/src/api/schema/metadata.ts +23 -0
- package/src/api/schema/read.ts +109 -18
- package/src/api/schema/schema.ts +62 -2
- package/src/api/schema-source/index.ts +1 -0
- package/src/api/schema-source/schema-source.ts +189 -0
- package/src/api/static/manifest.ts +1 -1
- package/src/api/vite/plugins/build.ts +3 -0
- package/src/api/vite/plugins/core.ts +27 -22
- package/src/api/vite/plugins/main.ts +1 -9
- package/src/api/vite/plugins/schema-assets.ts +364 -0
- package/src/api/vite/plugins/serve.ts +15 -8
- package/src/cli/commands/open.ts +1 -1
- package/src/lib/grafaid/schema/schema.ts +1 -0
- package/src/lib/graphql-change/change-groups.ts +57 -0
- package/src/lib/kit-temp.ts +15 -2
- package/src/lib/mask/$.test.ts +3 -3
- package/src/lib/path-map/$.test.ts +22 -19
- package/src/lib/path-map/path-map.ts +3 -1
- package/src/lib/react-router-aid/react-router-aid.ts +12 -6
- package/src/project-data.ts +3 -11
- package/src/template/components/Changelog.tsx +16 -67
- package/src/template/components/CodeBlock.tsx +3 -5
- package/src/template/components/ComponentDispatch.tsx +42 -0
- package/src/template/components/ReferenceLink.tsx +34 -0
- package/src/template/components/TypeAnnotation.tsx +5 -7
- package/src/template/components/TypeFieldsLinkList.tsx +20 -23
- package/src/template/components/TypeIndex.tsx +10 -12
- package/src/template/components/VersionSelector.tsx +50 -0
- package/src/template/components/graphql/type-link.tsx +4 -3
- package/src/template/hooks/useVersionPath.ts +10 -0
- package/src/template/{components → layouts}/ChangelogLayout.tsx +1 -1
- package/src/template/layouts/index.ts +1 -0
- package/src/template/lib/fetch-text.ts +13 -0
- package/src/template/lib/polen-url.ts +20 -0
- package/src/template/lib/schema-utils/constants.ts +4 -0
- package/src/template/lib/schema-utils/schema-utils.ts +42 -0
- package/src/template/routes/changelog.tsx +19 -10
- package/src/template/routes/index.tsx +2 -2
- package/src/template/routes/pages.tsx +109 -0
- package/src/template/routes/reference.tsx +112 -12
- package/src/template/routes/root.tsx +11 -112
- package/src/template/server/app.ts +47 -14
- package/src/template/server/main.ts +9 -1
- package/src/template/server/ssg/generate.ts +2 -2
- package/src/template/server/ssg/get-route-paths.test.ts +132 -0
- package/src/template/server/ssg/get-route-paths.ts +91 -27
- package/src/template/sources/schema-source.ts +69 -0
- package/build/lib/graphql-document/$$.d.ts +0 -5
- package/build/lib/graphql-document/$$.d.ts.map +0 -1
- package/build/lib/graphql-document/$$.js +0 -5
- package/build/lib/graphql-document/$$.js.map +0 -1
- package/build/lib/graphql-document/$.d.ts +0 -2
- package/build/lib/graphql-document/$.d.ts.map +0 -1
- package/build/lib/graphql-document/$.js +0 -2
- package/build/lib/graphql-document/$.js.map +0 -1
- package/build/lib/graphql-document/analysis.d.ts +0 -44
- package/build/lib/graphql-document/analysis.d.ts.map +0 -1
- package/build/lib/graphql-document/analysis.js +0 -361
- package/build/lib/graphql-document/analysis.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts +0 -38
- package/build/lib/graphql-document/components/GraphQLDocument.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocument.js +0 -151
- package/build/lib/graphql-document/components/GraphQLDocument.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts +0 -7
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js +0 -27
- package/build/lib/graphql-document/components/GraphQLDocumentWithSchema.js.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts +0 -33
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.d.ts.map +0 -1
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js +0 -50
- package/build/lib/graphql-document/components/GraphQLIdentifierPopover.js.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.d.ts +0 -39
- package/build/lib/graphql-document/components/IdentifierLink.d.ts.map +0 -1
- package/build/lib/graphql-document/components/IdentifierLink.js +0 -75
- package/build/lib/graphql-document/components/IdentifierLink.js.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts +0 -5
- package/build/lib/graphql-document/components/graphql-document-styles.d.ts.map +0 -1
- package/build/lib/graphql-document/components/graphql-document-styles.js +0 -144
- package/build/lib/graphql-document/components/graphql-document-styles.js.map +0 -1
- package/build/lib/graphql-document/components/index.d.ts +0 -5
- package/build/lib/graphql-document/components/index.d.ts.map +0 -1
- package/build/lib/graphql-document/components/index.js +0 -5
- package/build/lib/graphql-document/components/index.js.map +0 -1
- package/build/lib/graphql-document/example.d.ts +0 -25
- package/build/lib/graphql-document/example.d.ts.map +0 -1
- package/build/lib/graphql-document/example.js +0 -140
- package/build/lib/graphql-document/example.js.map +0 -1
- package/build/lib/graphql-document/graphql-document.d.ts +0 -35
- package/build/lib/graphql-document/graphql-document.d.ts.map +0 -1
- package/build/lib/graphql-document/graphql-document.js +0 -36
- package/build/lib/graphql-document/graphql-document.js.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts +0 -43
- package/build/lib/graphql-document/hooks/use-tooltip-state.d.ts.map +0 -1
- package/build/lib/graphql-document/hooks/use-tooltip-state.js +0 -132
- package/build/lib/graphql-document/hooks/use-tooltip-state.js.map +0 -1
- package/build/lib/graphql-document/positioning-simple.d.ts +0 -63
- package/build/lib/graphql-document/positioning-simple.d.ts.map +0 -1
- package/build/lib/graphql-document/positioning-simple.js +0 -185
- package/build/lib/graphql-document/positioning-simple.js.map +0 -1
- package/build/lib/graphql-document/schema-context.d.ts +0 -8
- package/build/lib/graphql-document/schema-context.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-context.js +0 -11
- package/build/lib/graphql-document/schema-context.js.map +0 -1
- package/build/lib/graphql-document/schema-integration.d.ts +0 -135
- package/build/lib/graphql-document/schema-integration.d.ts.map +0 -1
- package/build/lib/graphql-document/schema-integration.js +0 -328
- package/build/lib/graphql-document/schema-integration.js.map +0 -1
- package/build/lib/graphql-document/types.d.ts +0 -117
- package/build/lib/graphql-document/types.d.ts.map +0 -1
- package/build/lib/graphql-document/types.js +0 -2
- package/build/lib/graphql-document/types.js.map +0 -1
- package/build/template/components/ChangelogLayout.d.ts.map +0 -1
- package/build/template/components/ChangelogLayout.js.map +0 -1
- package/build/template/components/CodeHikePre.d.ts +0 -16
- package/build/template/components/CodeHikePre.d.ts.map +0 -1
- package/build/template/components/CodeHikePre.js +0 -37
- package/build/template/components/CodeHikePre.js.map +0 -1
- package/build/template/routes/reference.$type.$field.d.ts +0 -5
- package/build/template/routes/reference.$type.$field.d.ts.map +0 -1
- package/build/template/routes/reference.$type.$field.js +0 -31
- package/build/template/routes/reference.$type.$field.js.map +0 -1
- package/build/template/routes/reference.$type.d.ts +0 -5
- package/build/template/routes/reference.$type.d.ts.map +0 -1
- package/build/template/routes/reference.$type.js +0 -23
- package/build/template/routes/reference.$type.js.map +0 -1
- package/src/lib/graphql-document/$$.ts +0 -4
- package/src/lib/graphql-document/$.test.ts +0 -132
- package/src/lib/graphql-document/$.ts +0 -1
- package/src/lib/graphql-document/README.md +0 -102
- package/src/lib/graphql-document/analysis.ts +0 -415
- package/src/lib/graphql-document/components/GraphQLDocument.tsx +0 -265
- package/src/lib/graphql-document/components/GraphQLDocument.unit.test.ts +0 -188
- package/src/lib/graphql-document/components/GraphQLDocumentWithSchema.tsx +0 -46
- package/src/lib/graphql-document/components/GraphQLIdentifierPopover.tsx +0 -199
- package/src/lib/graphql-document/components/IdentifierLink.tsx +0 -160
- package/src/lib/graphql-document/components/graphql-document-styles.ts +0 -144
- package/src/lib/graphql-document/components/index.ts +0 -4
- package/src/lib/graphql-document/demo.md +0 -155
- package/src/lib/graphql-document/example.ts +0 -163
- package/src/lib/graphql-document/graphql-document.ts +0 -37
- package/src/lib/graphql-document/hooks/use-tooltip-state.test.ts +0 -76
- package/src/lib/graphql-document/hooks/use-tooltip-state.ts +0 -191
- package/src/lib/graphql-document/positioning-simple.test.ts +0 -248
- package/src/lib/graphql-document/positioning-simple.ts +0 -260
- package/src/lib/graphql-document/schema-context.tsx +0 -20
- package/src/lib/graphql-document/schema-integration.test.ts +0 -365
- package/src/lib/graphql-document/schema-integration.ts +0 -488
- package/src/lib/graphql-document/types.ts +0 -129
- package/src/template/components/CodeHikePre.tsx +0 -51
- package/src/template/routes/reference.$type.$field.tsx +0 -34
- package/src/template/routes/reference.$type.tsx +0 -27
- /package/build/template/{components → layouts}/ChangelogLayout.d.ts +0 -0
@@ -1,9 +1,13 @@
|
|
1
|
-
export type Expression =
|
1
|
+
export type Expression = ExpressionVersioned | ExpressionSingle;
|
2
2
|
export declare const parseOrThrow: (fileNameOrSerializedExpression: string) => Expression;
|
3
3
|
export declare const parse: (fileName: string) => null | Expression;
|
4
|
-
export interface
|
5
|
-
type: `
|
4
|
+
export interface ExpressionVersioned {
|
5
|
+
type: `FileNameExpressionVersioned`;
|
6
6
|
date: Date;
|
7
7
|
filePath: string;
|
8
8
|
}
|
9
|
+
export interface ExpressionSingle {
|
10
|
+
type: `FileNameExpressionSingle`;
|
11
|
+
filePath: string;
|
12
|
+
}
|
9
13
|
//# sourceMappingURL=file-name-expression.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-name-expression.d.ts","sourceRoot":"","sources":["../../../../../../src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,
|
1
|
+
{"version":3,"file":"file-name-expression.d.ts","sourceRoot":"","sources":["../../../../../../src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,UAAU,GAAG,mBAAmB,GAAG,gBAAgB,CAAA;AAE/D,eAAO,MAAM,YAAY,GAAI,gCAAgC,MAAM,KAAG,UAKrE,CAAA;AAED,eAAO,MAAM,KAAK,GAAI,UAAU,MAAM,KAAG,IAAI,GAAG,UAgB/C,CAAA;AAID,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,6BAA6B,CAAA;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,QAAQ,EAAE,MAAM,CAAA;CACjB;AAoBD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,0BAA0B,CAAA;IAChC,QAAQ,EAAE,MAAM,CAAA;CACjB"}
|
package/build/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.js
CHANGED
@@ -11,25 +11,29 @@ export const parse = (fileName) => {
|
|
11
11
|
throw new Error(`If file name is provided, must be .graphql. Got: ${fileName}`);
|
12
12
|
}
|
13
13
|
const serializedExpression = path.name;
|
14
|
-
const
|
15
|
-
if (
|
16
|
-
return { ...
|
17
|
-
|
18
|
-
|
14
|
+
const versioned = parseExpressionVersionedSerialized(serializedExpression);
|
15
|
+
if (versioned)
|
16
|
+
return { ...versioned, filePath: fileName, type: `FileNameExpressionVersioned` };
|
17
|
+
const single = parseExpressionSingleSerialized(serializedExpression);
|
18
|
+
if (single)
|
19
|
+
return { ...single, filePath: fileName, type: `FileNameExpressionSingle` };
|
19
20
|
return null;
|
20
21
|
};
|
21
|
-
const
|
22
|
-
const match =
|
22
|
+
const parseExpressionVersionedSerialized = (serializedExpression) => {
|
23
|
+
const match = expressionVersionedSerializedPattern.exec(serializedExpression);
|
23
24
|
if (!match)
|
24
25
|
return null;
|
25
26
|
const { year, month, day } = match.groups;
|
26
27
|
const date = new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
|
27
28
|
return { date };
|
28
29
|
};
|
29
|
-
const
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
const expressionVersionedSerializedPattern = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})$/;
|
31
|
+
const parseExpressionSingleSerialized = (serializedExpression) => {
|
32
|
+
if (serializedExpression === `schema`) {
|
33
|
+
return {};
|
34
|
+
}
|
35
|
+
return null;
|
36
|
+
};
|
33
37
|
// ----
|
34
38
|
// export interface ExpressionLatest {
|
35
39
|
// type: `FileNameExpressionLatest`
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file-name-expression.js","sourceRoot":"","sources":["../../../../../../src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAItC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,8BAAsC,EAAc,EAAE;IACjF,MAAM,MAAM,GAAG,KAAK,CAAC,8BAA8B,CAAC,CAAA;IACpD,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,8BAA8B,EAAE,CAAC,CAAA;IAEhG,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAqB,EAAE;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,IAAI,CAAC,GAAG,KAAK,UAAU,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CACb,oDAAoD,QAAQ,EAAE,CAC/D,CAAA;IACH,CAAC;IACD,MAAM,oBAAoB,GAAG,IAAI,CAAC,IAAI,CAAA;IAEtC,MAAM,
|
1
|
+
{"version":3,"file":"file-name-expression.js","sourceRoot":"","sources":["../../../../../../src/api/schema/data-sources/schema-directory/file-name-expression/file-name-expression.ts"],"names":[],"mappings":"AAAA,OAAO,EA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AAsD,CAAA;IACzF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;IACzE,OAAO,EAAE,IAAI,EAAE,CAAA;AACjB,CAAC,CAAA;AAED,MAAM,oCAAoC,GAAG,gDAAgD,CAAA;AAa7F,MAAM,+BAA+B,GAAG,CACtC,oBAA4B,EACjB,EAAE;IACb,IAAI,oBAAoB,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,EAAE,CAAA;IACX,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC,CAAA;AAED,OAAO;AAEP,sCAAsC;AACtC,qCAAqC;AACrC,qBAAqB;AACrB,IAAI;AAEJ,yFAAyF;AACzF,qDAAqD;AACrD,gBAAgB;AAChB,IAAI;AAEJ,kGAAkG;AAClG,0DAA0D;AAC1D,IAAI"}
|
@@ -1,14 +1,18 @@
|
|
1
|
-
import type {
|
1
|
+
import type { NonEmptyChangeSets } from '../../schema.js';
|
2
2
|
/**
|
3
|
-
* Configuration for loading
|
3
|
+
* Configuration for loading schema(s) from a directory.
|
4
4
|
*
|
5
|
-
*
|
5
|
+
* Supports two modes:
|
6
|
+
* 1. Multiple versioned schemas with date prefixes (enables changelog feature)
|
7
|
+
* 2. Single schema file named 'schema.graphql' (non-versioned, like file data source)
|
6
8
|
*/
|
7
9
|
export interface ConfigInput {
|
8
10
|
/**
|
9
|
-
* Path to the directory containing
|
11
|
+
* Path to the directory containing schema files.
|
10
12
|
*
|
11
|
-
*
|
13
|
+
* Supports two patterns:
|
14
|
+
* 1. Multiple versioned files with ISO date prefixes: `YYYY-MM-DD.graphql`
|
15
|
+
* 2. Single file named: `schema.graphql`
|
12
16
|
*
|
13
17
|
* @default './schema'
|
14
18
|
*
|
@@ -21,12 +25,17 @@ export interface ConfigInput {
|
|
21
25
|
* path: './graphql/versions'
|
22
26
|
* ```
|
23
27
|
*
|
24
|
-
* Directory structure
|
28
|
+
* Directory structure examples:
|
25
29
|
* ```
|
30
|
+
* // Versioned schemas (enables changelog)
|
26
31
|
* schema/
|
27
32
|
* 2024-01-15.graphql
|
28
33
|
* 2024-03-20.graphql
|
29
34
|
* 2024-06-10.graphql
|
35
|
+
*
|
36
|
+
* // Single schema (non-versioned)
|
37
|
+
* schema/
|
38
|
+
* schema.graphql
|
30
39
|
* ```
|
31
40
|
*/
|
32
41
|
path?: string;
|
@@ -36,5 +45,5 @@ export interface Config {
|
|
36
45
|
path: string;
|
37
46
|
}
|
38
47
|
export declare const normalizeConfig: (configInput: ConfigInput) => Config;
|
39
|
-
export declare const readOrThrow: (configInput: ConfigInput) => Promise<null |
|
48
|
+
export declare const readOrThrow: (configInput: ConfigInput) => Promise<null | NonEmptyChangeSets>;
|
40
49
|
//# sourceMappingURL=schema-directory.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema-directory.d.ts","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-directory/schema-directory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"schema-directory.d.ts","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-directory/schema-directory.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAWzD;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,eAAe,GAAI,aAAa,WAAW,KAAG,MAO1D,CAAA;AAED,eAAO,MAAM,WAAW,GAAU,aAAa,WAAW,KAAG,OAAO,CAAC,IAAI,GAAG,kBAAkB,CA8C7F,CAAA"}
|
@@ -3,6 +3,7 @@ import { GraphqlChange } from '#lib/graphql-change/index';
|
|
3
3
|
import { debugPolen } from '#singletons/debug';
|
4
4
|
import { Arr, Path } from '@wollybeard/kit';
|
5
5
|
import { glob } from 'tinyglobby';
|
6
|
+
import { readSingleSchemaFile } from '../schema-file/schema-file.js';
|
6
7
|
import { FileNameExpression } from './file-name-expression/index.js';
|
7
8
|
// const debug = debugPolen.sub([`schema`, `data-source-schema-directory`])
|
8
9
|
const debug = debugPolen.sub(`schema:data-source-schema-directory`);
|
@@ -31,7 +32,28 @@ export const readOrThrow = async (configInput) => {
|
|
31
32
|
}
|
32
33
|
const fileNameExpressions = Arr.map(filePaths, FileNameExpression.parseOrThrow);
|
33
34
|
debug(`parsed file names`, fileNameExpressions);
|
34
|
-
|
35
|
+
// Separate versioned (dated) and single schema files
|
36
|
+
const versionedExpressions = fileNameExpressions.filter((expr) => expr.type === `FileNameExpressionVersioned`);
|
37
|
+
const singleExpressions = fileNameExpressions.filter((expr) => expr.type === `FileNameExpressionSingle`);
|
38
|
+
// If we have versioned files, use them (versioned takes precedence)
|
39
|
+
if (Arr.isntEmpty(versionedExpressions)) {
|
40
|
+
return await readVersionedSchemas(versionedExpressions);
|
41
|
+
}
|
42
|
+
// If we have a single schema file, use it
|
43
|
+
if (Arr.isntEmpty(singleExpressions)) {
|
44
|
+
if (singleExpressions.length > 1) {
|
45
|
+
throw new Error(`Multiple single schema files found, expected exactly one: ${singleExpressions.map(e => e.filePath).join(', ')}`);
|
46
|
+
}
|
47
|
+
return await readSingleSchemaFile(singleExpressions[0].filePath);
|
48
|
+
}
|
49
|
+
// Should not happen since we already checked for empty filePaths
|
50
|
+
throw new Error(`No schema files found despite non-empty file paths`);
|
51
|
+
};
|
52
|
+
/**
|
53
|
+
* Read multiple versioned schema files and create changesets
|
54
|
+
*/
|
55
|
+
const readVersionedSchemas = async (versionedExpressions) => {
|
56
|
+
const versions = await Promise.all(Arr.map(versionedExpressions, async (fileNameExpression) => {
|
35
57
|
const schemaFile = await Grafaid.Schema.read(fileNameExpression.filePath);
|
36
58
|
// Should never happen since these paths come from the glob.
|
37
59
|
if (!schemaFile)
|
@@ -41,7 +63,7 @@ export const readOrThrow = async (configInput) => {
|
|
41
63
|
schema: schemaFile.content,
|
42
64
|
};
|
43
65
|
}));
|
44
|
-
debug(`read schemas`);
|
66
|
+
debug(`read versioned schemas`);
|
45
67
|
versions.sort((a, b) => a.date.getTime() - b.date.getTime());
|
46
68
|
const changesets = await Promise.all(Arr.map(versions, async (version, index) => {
|
47
69
|
const current = version;
|
@@ -60,10 +82,7 @@ export const readOrThrow = async (configInput) => {
|
|
60
82
|
};
|
61
83
|
}));
|
62
84
|
changesets.reverse();
|
63
|
-
|
64
|
-
|
65
|
-
};
|
66
|
-
debug(`computed schema`);
|
67
|
-
return schema;
|
85
|
+
debug(`computed versioned schema`);
|
86
|
+
return changesets;
|
68
87
|
};
|
69
88
|
//# sourceMappingURL=schema-directory.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema-directory.js","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-directory/schema-directory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAA;AAEpE,2EAA2E;AAC3E,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAA;AAEnE,MAAM,YAAY,GAAG;IACnB,eAAe,EAAE,UAAU;CAC5B,CAAA;
|
1
|
+
{"version":3,"file":"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AAM;YACN,KAAK;YACL,OAAO;SACR,CAAA;IACH,CAAC,CAAC,CACH,CAAA;IAED,UAAU,CAAC,OAAO,EAAE,CAAA;IAEpB,KAAK,CAAC,2BAA2B,CAAC,CAAA;IAClC,OAAO,UAAgC,CAAA;AACzC,CAAC,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type {
|
1
|
+
import type { NonEmptyChangeSets } from '../../schema.js';
|
2
2
|
/**
|
3
3
|
* Configuration for loading schema from a single SDL file.
|
4
4
|
*/
|
@@ -26,5 +26,10 @@ export interface Config {
|
|
26
26
|
path: string;
|
27
27
|
}
|
28
28
|
export declare const normalizeConfig: (configInput: ConfigInput) => Config;
|
29
|
-
export declare const readOrThrow: (configInput: ConfigInput) => Promise<null |
|
29
|
+
export declare const readOrThrow: (configInput: ConfigInput) => Promise<null | NonEmptyChangeSets>;
|
30
|
+
/**
|
31
|
+
* Create a single changeset from a schema file path.
|
32
|
+
* This is the core logic for handling single (unversioned) schemas.
|
33
|
+
*/
|
34
|
+
export declare const readSingleSchemaFile: (filePath: string) => Promise<NonEmptyChangeSets>;
|
30
35
|
//# sourceMappingURL=schema-file.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema-file.d.ts","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-file/schema-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,
|
1
|
+
{"version":3,"file":"schema-file.d.ts","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-file/schema-file.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAMzD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;OAeG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAA;CACb;AAED,eAAO,MAAM,eAAe,GAAI,aAAa,WAAW,KAAG,MAM1D,CAAA;AAED,eAAO,MAAM,WAAW,GACtB,aAAa,WAAW,KACvB,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAOnC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,kBAAkB,CAsBvF,CAAA"}
|
@@ -15,22 +15,30 @@ export const readOrThrow = async (configInput) => {
|
|
15
15
|
const schemaFile = await Grafaid.Schema.read(config.path);
|
16
16
|
if (!schemaFile)
|
17
17
|
return null;
|
18
|
-
|
18
|
+
return await readSingleSchemaFile(config.path);
|
19
|
+
};
|
20
|
+
/**
|
21
|
+
* Create a single changeset from a schema file path.
|
22
|
+
* This is the core logic for handling single (unversioned) schemas.
|
23
|
+
*/
|
24
|
+
export const readSingleSchemaFile = async (filePath) => {
|
25
|
+
const schemaFile = await Grafaid.Schema.read(filePath);
|
26
|
+
if (!schemaFile)
|
27
|
+
throw new Error(`Failed to read schema file: ${filePath}`);
|
28
|
+
const date = new Date(); // Generate date here for unversioned schema
|
19
29
|
const after = schemaFile.content;
|
20
30
|
const before = Grafaid.Schema.empty;
|
21
31
|
const changes = await GraphqlChange.calcChangeset({
|
22
32
|
before,
|
23
33
|
after,
|
24
34
|
});
|
25
|
-
const
|
35
|
+
const changeset = {
|
26
36
|
date,
|
27
37
|
after,
|
28
38
|
before,
|
29
39
|
changes,
|
30
40
|
};
|
31
|
-
const schema =
|
32
|
-
versions: [schemaVersion],
|
33
|
-
};
|
41
|
+
const schema = [changeset];
|
34
42
|
return schema;
|
35
43
|
};
|
36
44
|
//# sourceMappingURL=schema-file.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema-file.js","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-file/schema-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGtC,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,kBAAkB;CAC/B,CAAA;AA8BD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAwB,EAAU,EAAE;IAClE,MAAM,MAAM,GAAW;QACrB,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,IAAI,YAAY,CAAC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC;KAChG,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,WAAwB,
|
1
|
+
{"version":3,"file":"schema-file.js","sourceRoot":"","sources":["../../../../../src/api/schema/data-sources/schema-file/schema-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAGtC,MAAM,YAAY,GAAG;IACnB,UAAU,EAAE,kBAAkB;CAC/B,CAAA;AA8BD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAwB,EAAU,EAAE;IAClE,MAAM,MAAM,GAAW;QACrB,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,IAAI,IAAI,YAAY,CAAC,UAAU,EAAE,WAAW,CAAC,WAAW,CAAC;KAChG,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,WAAwB,EACY,EAAE;IACtC,MAAM,MAAM,GAAG,eAAe,CAAC,WAAW,CAAC,CAAA;IAE3C,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACzD,IAAI,CAAC,UAAU;QAAE,OAAO,IAAI,CAAA;IAE5B,OAAO,MAAM,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;AAChD,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EAAE,QAAgB,EAA+B,EAAE;IAC1F,MAAM,UAAU,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtD,IAAI,CAAC,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAA;IAE3E,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAA,CAAC,4CAA4C;IACpE,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAA;IAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAA;IACnC,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC;QAChD,MAAM;QACN,KAAK;KACN,CAAC,CAAA;IAEF,MAAM,SAAS,GAA+B;QAC5C,IAAI;QACJ,KAAK;QACL,MAAM;QACN,OAAO;KACR,CAAA;IAED,MAAM,MAAM,GAAuB,CAAC,SAAS,CAAC,CAAA;IAE9C,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { z } from 'zod';
|
2
|
+
export declare const SchemaMetadataSchema: z.ZodObject<{
|
3
|
+
/** Whether a schema is present in the project */
|
4
|
+
hasSchema: z.ZodBoolean;
|
5
|
+
/** Array of available version identifiers */
|
6
|
+
versions: z.ZodArray<z.ZodString, "many">;
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
8
|
+
hasSchema: boolean;
|
9
|
+
versions: string[];
|
10
|
+
}, {
|
11
|
+
hasSchema: boolean;
|
12
|
+
versions: string[];
|
13
|
+
}>;
|
14
|
+
export type SchemaMetadata = z.infer<typeof SchemaMetadataSchema>;
|
15
|
+
export declare const getMetadata: (path: string) => Promise<SchemaMetadata>;
|
16
|
+
//# sourceMappingURL=metadata.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/api/schema/metadata.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,oBAAoB;IAC/B,iDAAiD;;IAEjD,6CAA6C;;;;;;;;EAE7C,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,cAAc,CAUtE,CAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Fs } from '@wollybeard/kit';
|
2
|
+
import { z } from 'zod';
|
3
|
+
export const SchemaMetadataSchema = z.object({
|
4
|
+
/** Whether a schema is present in the project */
|
5
|
+
hasSchema: z.boolean(),
|
6
|
+
/** Array of available version identifiers */
|
7
|
+
versions: z.array(z.string()),
|
8
|
+
});
|
9
|
+
export const getMetadata = async (path) => {
|
10
|
+
const result = await Fs.readJson(path);
|
11
|
+
if (!result) {
|
12
|
+
return {
|
13
|
+
hasSchema: false,
|
14
|
+
versions: [],
|
15
|
+
};
|
16
|
+
}
|
17
|
+
return SchemaMetadataSchema.parse(result);
|
18
|
+
};
|
19
|
+
//# sourceMappingURL=metadata.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../src/api/schema/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,iDAAiD;IACjD,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;IACtB,6CAA6C;IAC7C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAA;AAIF,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAE,IAAY,EAA2B,EAAE;IACzE,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACtC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO;YACL,SAAS,EAAE,KAAK;YAChB,QAAQ,EAAE,EAAE;SACb,CAAA;IACH,CAAC;IAED,OAAO,oBAAoB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AAC3C,CAAC,CAAA"}
|
@@ -1,36 +1,94 @@
|
|
1
1
|
import { Arr } from '@wollybeard/kit';
|
2
2
|
import * as DataSources from './data-sources/data-sources.js';
|
3
|
-
import type {
|
4
|
-
export type DataSourceType = `file` | `directory` | `memory` | `data`;
|
3
|
+
import type { NonEmptyChangeSets } from './schema.js';
|
4
|
+
export type DataSourceType = `file` | `directory` | `memory` | `data` | `introspection` | `introspectionFile` | `introspectionAuto`;
|
5
|
+
/**
|
6
|
+
* Result of schema reading with provenance tracking for file watching and debugging.
|
7
|
+
*/
|
8
|
+
export interface SchemaReadResult {
|
9
|
+
data: NonEmptyChangeSets | null;
|
10
|
+
source: {
|
11
|
+
type: DataSourceType;
|
12
|
+
/**
|
13
|
+
* Recreate the schema data and file after it has been deleted.
|
14
|
+
*
|
15
|
+
* This function re-fetches data from the original source and recreates
|
16
|
+
* the schema file on disk. Only called by file watchers after deletion.
|
17
|
+
*
|
18
|
+
* @returns Promise resolving to the recreated schema data, or null if recreation fails
|
19
|
+
*/
|
20
|
+
reCreate?: () => Promise<NonEmptyChangeSets | null>;
|
21
|
+
};
|
22
|
+
}
|
5
23
|
/**
|
6
24
|
* Schema configuration for Polen.
|
25
|
+
*
|
26
|
+
* Polen supports multiple ways to load your GraphQL schema, from simple files
|
27
|
+
* to dynamic introspection. Configure which sources to use and in what order.
|
28
|
+
*
|
29
|
+
* @example
|
30
|
+
* ```ts
|
31
|
+
* // Load from a file (default)
|
32
|
+
* schema: {} // Looks for schema.graphql
|
33
|
+
*
|
34
|
+
* // Load via introspection
|
35
|
+
* schema: {
|
36
|
+
* dataSources: {
|
37
|
+
* introspection: {
|
38
|
+
* url: 'https://api.example.com/graphql',
|
39
|
+
* headers: { 'Authorization': 'Bearer token' }
|
40
|
+
* }
|
41
|
+
* }
|
42
|
+
* }
|
43
|
+
*
|
44
|
+
* // Try multiple sources in order
|
45
|
+
* schema: {
|
46
|
+
* useDataSources: ['introspection', 'file'],
|
47
|
+
* dataSources: {
|
48
|
+
* introspection: { url: 'https://api.example.com/graphql' },
|
49
|
+
* file: { path: './fallback-schema.graphql' }
|
50
|
+
* }
|
51
|
+
* }
|
52
|
+
* ```
|
7
53
|
*/
|
8
54
|
export interface Config {
|
9
55
|
/**
|
10
56
|
* Whether to enable schema loading.
|
11
57
|
*
|
12
|
-
* Set to `false` to disable schema features entirely.
|
58
|
+
* Set to `false` to disable schema features entirely. This removes
|
59
|
+
* the Reference and Changelog pages from your portal.
|
60
|
+
*
|
61
|
+
* @default true
|
13
62
|
*
|
14
|
-
* @
|
63
|
+
* @example
|
64
|
+
* ```ts
|
65
|
+
* // Disable schema features
|
66
|
+
* schema: { enabled: false }
|
67
|
+
* ```
|
15
68
|
*/
|
16
69
|
enabled?: boolean;
|
17
70
|
/**
|
18
71
|
* Which data sources to use for loading schemas.
|
19
72
|
*
|
20
|
-
* - `file` - Load from a single SDL file
|
21
|
-
* - `directory` - Load multiple SDL files from a directory
|
73
|
+
* - `file` - Load from a single SDL file (default: `./schema.graphql`)
|
74
|
+
* - `directory` - Load multiple SDL files from a directory (default: `./schema/`)
|
22
75
|
* - `memory` - Use schemas defined in configuration
|
23
76
|
* - `data` - Use a pre-built schema object
|
77
|
+
* - `introspection` - Load schema via GraphQL introspection
|
24
78
|
*
|
25
|
-
* If not specified, Polen
|
79
|
+
* If not specified, Polen tries all sources in this order:
|
80
|
+
* 1. `data` 2. `directory` 3. `file` 4. `memory` 5. `introspection`
|
26
81
|
*
|
27
82
|
* @example
|
28
83
|
* ```ts
|
29
84
|
* // Use only file source
|
30
85
|
* useDataSources: 'file'
|
31
86
|
*
|
32
|
-
* // Try multiple sources
|
33
|
-
* useDataSources: ['
|
87
|
+
* // Try multiple sources in custom order
|
88
|
+
* useDataSources: ['introspection', 'file']
|
89
|
+
*
|
90
|
+
* // Default behavior (try all sources)
|
91
|
+
* // useDataSources: undefined
|
34
92
|
* ```
|
35
93
|
*/
|
36
94
|
useDataSources?: Arr.Maybe<DataSourceType>;
|
@@ -53,9 +111,25 @@ export interface Config {
|
|
53
111
|
/**
|
54
112
|
* Pre-built schema object to use directly.
|
55
113
|
*/
|
56
|
-
data?:
|
114
|
+
data?: NonEmptyChangeSets;
|
115
|
+
/**
|
116
|
+
* Configuration for loading schema via GraphQL introspection.
|
117
|
+
*
|
118
|
+
* Introspection fetches your schema directly from a running GraphQL endpoint.
|
119
|
+
* The schema is saved to `schema.introspection.json` in your project root.
|
120
|
+
* Delete this file to force a fresh introspection on the next build.
|
121
|
+
*
|
122
|
+
* @example
|
123
|
+
* ```ts
|
124
|
+
* introspection: {
|
125
|
+
* url: 'https://api.example.com/graphql',
|
126
|
+
* headers: { 'Authorization': 'Bearer token' }
|
127
|
+
* }
|
128
|
+
* ```
|
129
|
+
*/
|
130
|
+
introspection?: DataSources.Introspection.ConfigInput;
|
57
131
|
};
|
58
132
|
projectRoot: string;
|
59
133
|
}
|
60
|
-
export declare const readOrThrow: (config: Config) => Promise<
|
134
|
+
export declare const readOrThrow: (config: Config) => Promise<SchemaReadResult>;
|
61
135
|
//# sourceMappingURL=read.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/api/schema/read.ts"],"names":[],"mappings":"AAAA,OA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A;KACtD,CAAA;IACD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,eAAO,MAAM,WAAW,GACtB,QAAQ,MAAM,KACb,OAAO,CAAC,gBAAgB,CAiD1B,CAAA"}
|
package/build/api/schema/read.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
import { Arr } from '@wollybeard/kit';
|
1
|
+
import { Arr, Fs, Path } from '@wollybeard/kit';
|
2
2
|
import * as DataSources from './data-sources/data-sources.js';
|
3
3
|
export const readOrThrow = async (config) => {
|
4
4
|
if (config.enabled === false) {
|
5
|
-
return null;
|
5
|
+
return { data: null, source: { type: 'data' } };
|
6
6
|
}
|
7
7
|
const useDataSources = config.useDataSources ? Arr.sure(config.useDataSources) : null;
|
8
8
|
const usingDataSource = (dataSource) => useDataSources === null || useDataSources.includes(dataSource);
|
9
9
|
if (usingDataSource(`data`) && config.dataSources?.data) {
|
10
|
-
return config.dataSources.data;
|
10
|
+
return { data: config.dataSources.data, source: { type: 'data' } };
|
11
11
|
}
|
12
12
|
if (usingDataSource(`directory`)) {
|
13
13
|
const directoryConfig = {
|
@@ -16,7 +16,7 @@ export const readOrThrow = async (config) => {
|
|
16
16
|
};
|
17
17
|
const result = await DataSources.SchemaDirectory.readOrThrow(directoryConfig);
|
18
18
|
if (result)
|
19
|
-
return result;
|
19
|
+
return { data: result, source: { type: 'directory' } };
|
20
20
|
}
|
21
21
|
if (usingDataSource(`file`)) {
|
22
22
|
const fileConfig = {
|
@@ -25,7 +25,7 @@ export const readOrThrow = async (config) => {
|
|
25
25
|
};
|
26
26
|
const result = await DataSources.SchemaFile.readOrThrow(fileConfig);
|
27
27
|
if (result)
|
28
|
-
return result;
|
28
|
+
return { data: result, source: { type: 'file' } };
|
29
29
|
}
|
30
30
|
if (usingDataSource(`memory`) && config.dataSources?.memory) {
|
31
31
|
const memoryConfig = {
|
@@ -34,8 +34,17 @@ export const readOrThrow = async (config) => {
|
|
34
34
|
};
|
35
35
|
const result = await DataSources.Memory.read(memoryConfig);
|
36
36
|
if (result)
|
37
|
+
return { data: result, source: { type: 'memory' } };
|
38
|
+
}
|
39
|
+
if (usingDataSource(`introspection`) && config.dataSources?.introspection) {
|
40
|
+
const introspectionConfig = {
|
41
|
+
projectRoot: config.projectRoot,
|
42
|
+
...config.dataSources.introspection,
|
43
|
+
};
|
44
|
+
const result = await DataSources.Introspection.readOrThrow(introspectionConfig);
|
45
|
+
if (result.data)
|
37
46
|
return result;
|
38
47
|
}
|
39
|
-
return null;
|
48
|
+
return { data: null, source: { type: 'data' } };
|
40
49
|
};
|
41
50
|
//# sourceMappingURL=read.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/api/schema/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAA;
|
1
|
+
{"version":3,"file":"read.js","sourceRoot":"","sources":["../../../src/api/schema/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AA+I7D,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAC9B,MAAc,EACa,EAAE;IAC7B,IAAI,MAAM,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;IACjD,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACrF,MAAM,eAAe,GAAG,CAAC,UAA0B,EAAE,EAAE,CAAC,cAAc,KAAK,IAAI,IAAI,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;IAEtH,IAAI,eAAe,CAA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1D,IAAI,MAAM;YAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAA;IACjE,CAAC;IAED,IAAI,eAAe,CAAC,eAAe,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,aAAa,EAAE,CAAC;QAC1E,MAAM,mBAAmB,GAAG;YAC1B,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa;SACpC,CAAA;QACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAA;QAC/E,IAAI,MAAM,CAAC,IAAI;YAAE,OAAO,MAAM,CAAA;IAChC,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;AACjD,CAAC,CAAA"}
|
@@ -1,7 +1,38 @@
|
|
1
1
|
import type { GraphqlChangeset } from '#lib/graphql-changeset/index';
|
2
2
|
export * as DataSources from './data-sources/data-sources.js';
|
3
3
|
export * from './read.js';
|
4
|
-
export
|
5
|
-
|
4
|
+
export * from './metadata.js';
|
5
|
+
export type ChangeSets = GraphqlChangeset.ChangeSet[];
|
6
|
+
export type NonEmptyChangeSets = [GraphqlChangeset.ChangeSet, ...GraphqlChangeset.ChangeSet[]];
|
7
|
+
/**
|
8
|
+
* Changelog data structure for JSON serialization
|
9
|
+
*/
|
10
|
+
export interface ChangelogData {
|
11
|
+
changes: GraphqlChangeset.ChangeSet['changes'];
|
12
|
+
date: string;
|
6
13
|
}
|
14
|
+
/**
|
15
|
+
* Constants for schema versioning
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* The version identifier for the latest schema
|
19
|
+
*/
|
20
|
+
export declare const VERSION_LATEST = "latest";
|
21
|
+
/**
|
22
|
+
* Fallback version name when date parsing fails
|
23
|
+
*/
|
24
|
+
export declare const VERSION_UNKNOWN_FALLBACK = "unknown";
|
25
|
+
/**
|
26
|
+
* Convert a date to a version string in YYYY-MM-DD format
|
27
|
+
*/
|
28
|
+
export declare const dateToVersionString: (date: Date) => string;
|
29
|
+
/**
|
30
|
+
* Determine if a version at the given index should have a changelog file.
|
31
|
+
* Only non-oldest versions get changelog files.
|
32
|
+
*/
|
33
|
+
export declare const shouldVersionHaveChangelog: (versionIndex: number, totalVersions: number) => boolean;
|
34
|
+
/**
|
35
|
+
* Convert a version string back to a Date
|
36
|
+
*/
|
37
|
+
export declare const versionStringToDate: (version: string) => Date;
|
7
38
|
//# sourceMappingURL=schema.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,cAAc,eAAe,CAAA;AAE7B,MAAM,MAAM,UAAU,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAA;AAErD,MAAM,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,SAAS,EAAE,GAAG,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAA;AAE9F;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAC9C,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;GAEG;AAEH;;GAEG;AACH,eAAO,MAAM,cAAc,WAAW,CAAA;AAEtC;;GAEG;AACH,eAAO,MAAM,wBAAwB,YAAY,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,MAAM,IAAI,KAAG,MAEhD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,GAAI,cAAc,MAAM,EAAE,eAAe,MAAM,KAAG,OAExF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,IAgBrD,CAAA"}
|
@@ -1,3 +1,45 @@
|
|
1
1
|
export * as DataSources from './data-sources/data-sources.js';
|
2
2
|
export * from './read.js';
|
3
|
+
export * from './metadata.js';
|
4
|
+
/**
|
5
|
+
* Constants for schema versioning
|
6
|
+
*/
|
7
|
+
/**
|
8
|
+
* The version identifier for the latest schema
|
9
|
+
*/
|
10
|
+
export const VERSION_LATEST = `latest`;
|
11
|
+
/**
|
12
|
+
* Fallback version name when date parsing fails
|
13
|
+
*/
|
14
|
+
export const VERSION_UNKNOWN_FALLBACK = `unknown`;
|
15
|
+
/**
|
16
|
+
* Convert a date to a version string in YYYY-MM-DD format
|
17
|
+
*/
|
18
|
+
export const dateToVersionString = (date) => {
|
19
|
+
return date.toLocaleDateString('en-CA');
|
20
|
+
};
|
21
|
+
/**
|
22
|
+
* Determine if a version at the given index should have a changelog file.
|
23
|
+
* Only non-oldest versions get changelog files.
|
24
|
+
*/
|
25
|
+
export const shouldVersionHaveChangelog = (versionIndex, totalVersions) => {
|
26
|
+
return versionIndex < totalVersions - 1;
|
27
|
+
};
|
28
|
+
/**
|
29
|
+
* Convert a version string back to a Date
|
30
|
+
*/
|
31
|
+
export const versionStringToDate = (version) => {
|
32
|
+
if (version === VERSION_LATEST) {
|
33
|
+
return new Date();
|
34
|
+
}
|
35
|
+
// Use modern date parsing - the version string should be in YYYY-MM-DD format
|
36
|
+
// which is ISO 8601 compatible
|
37
|
+
const parsedDate = new Date(version + 'T00:00:00Z');
|
38
|
+
// Check if the date is valid
|
39
|
+
if (!isNaN(parsedDate.getTime())) {
|
40
|
+
return parsedDate;
|
41
|
+
}
|
42
|
+
// Throw error for invalid dates instead of silently defaulting
|
43
|
+
throw new Error(`Invalid version string: ${version}`);
|
44
|
+
};
|
3
45
|
//# sourceMappingURL=schema.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA"}
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/schema/schema.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,WAAW,MAAM,gCAAgC,CAAA;AAE7D,cAAc,WAAW,CAAA;AAEzB,cAAc,eAAe,CAAA;AAc7B;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAA;AAEtC;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,SAAS,CAAA;AAEjD;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAU,EAAU,EAAE;IACxD,OAAO,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACzC,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,YAAoB,EAAE,aAAqB,EAAW,EAAE;IACjG,OAAO,YAAY,GAAG,aAAa,GAAG,CAAC,CAAA;AACzC,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAQ,EAAE;IAC3D,IAAI,OAAO,KAAK,cAAc,EAAE,CAAC;QAC/B,OAAO,IAAI,IAAI,EAAE,CAAA;IACnB,CAAC;IAED,8EAA8E;IAC9E,+BAA+B;IAC/B,MAAM,UAAU,GAAG,IAAI,IAAI,CAAC,OAAO,GAAG,YAAY,CAAC,CAAA;IAEnD,6BAA6B;IAC7B,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QACjC,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,+DAA+D;IAC/D,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,EAAE,CAAC,CAAA;AACvD,CAAC,CAAA"}
|