@aws/nx-plugin 1.0.0-rc.98 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-THIRD-PARTY +11686 -23398
- package/README.md +18 -0
- package/generators.json +7 -0
- package/migrations.json +34 -1
- package/package.json +6 -6
- package/src/agentcore-gateway/schema.json +1 -0
- package/src/agentcore-harness/generator.d.ts +1 -1
- package/src/connection/scaffold-catalog.d.ts +4 -0
- package/src/connection/scaffold-catalog.js +3 -6
- package/src/connection/scaffold-catalog.js.map +1 -1
- package/src/infra/app/generator.d.ts +1 -1
- package/src/init/generator.d.ts +1 -1
- package/src/mcp-server/guide-pipeline.d.ts +2 -1
- package/src/mcp-server/guide-pipeline.js +6 -0
- package/src/mcp-server/guide-pipeline.js.map +1 -1
- package/src/mcp-server/mdx-ast.d.ts +7 -0
- package/src/mcp-server/mdx-ast.js +15 -0
- package/src/mcp-server/mdx-ast.js.map +1 -1
- package/src/mcp-server/schema-registry.d.ts +2 -2
- package/src/mcp-server/schema-registry.js +2 -2
- package/src/mcp-server/schema-registry.js.map +1 -1
- package/src/open-api/py-client/__snapshots__/generator.additional-properties.spec.ts.snap +34 -0
- package/src/open-api/py-client/__snapshots__/generator.arrays.spec.ts.snap +1750 -0
- package/src/open-api/py-client/__snapshots__/generator.complex-types.spec.ts.snap +82 -0
- package/src/open-api/py-client/__snapshots__/generator.composite-types.spec.ts.snap +447 -0
- package/src/open-api/py-client/__snapshots__/generator.duplicate-types.spec.ts.snap +404 -0
- package/src/open-api/py-client/__snapshots__/generator.errors.spec.ts.snap +430 -0
- package/src/open-api/py-client/__snapshots__/generator.fast-api.spec.ts.snap +447 -0
- package/src/open-api/py-client/__snapshots__/generator.petstore.spec.ts.snap +3488 -0
- package/src/open-api/py-client/__snapshots__/generator.primitive-types.spec.ts.snap +1444 -0
- package/src/open-api/py-client/__snapshots__/generator.request.spec.ts.snap +390 -0
- package/src/open-api/py-client/__snapshots__/generator.reserved-keywords.spec.ts.snap +364 -0
- package/src/open-api/py-client/__snapshots__/generator.response.spec.ts.snap +739 -0
- package/src/open-api/py-client/__snapshots__/generator.streaming.spec.ts.snap +384 -0
- package/src/open-api/py-client/__snapshots__/generator.tags.spec.ts.snap +414 -0
- package/src/open-api/py-client/files/client/__clientModuleName__.py.template +1076 -0
- package/src/open-api/py-client/files/shared/__init__.py.template +28 -0
- package/src/open-api/py-client/files/shared/errors.py.template +37 -0
- package/src/open-api/py-client/files/shared/types.py.template +319 -0
- package/src/open-api/py-client/generator.d.ts +53 -0
- package/src/open-api/py-client/generator.js +119 -0
- package/src/open-api/py-client/generator.js.map +1 -0
- package/src/open-api/py-client/schema.d.js +6 -0
- package/src/open-api/py-client/schema.d.js.map +1 -0
- package/src/open-api/py-client/schema.d.ts +12 -0
- package/src/open-api/py-client/schema.json +28 -0
- package/src/open-api/py-client/vessel-registry-spec.json +2716 -0
- package/src/open-api/ts-client/__snapshots__/generator.edge-cases.spec.ts.snap +274 -0
- package/src/open-api/ts-client/petstore-spec.d.ts +6 -0
- package/src/open-api/ts-client/petstore-spec.js +1275 -0
- package/src/open-api/ts-client/petstore-spec.js.map +1 -0
- package/src/open-api/ts-hooks/generator.spec.tsx +1 -1
- package/src/open-api/utils/codegen-data/languages.d.ts +68 -2
- package/src/open-api/utils/codegen-data/languages.js +433 -21
- package/src/open-api/utils/codegen-data/languages.js.map +1 -1
- package/src/open-api/utils/codegen-data/types.d.ts +187 -0
- package/src/open-api/utils/codegen-data/types.js +10 -1
- package/src/open-api/utils/codegen-data/types.js.map +1 -1
- package/src/open-api/utils/codegen-data.d.ts +40 -1
- package/src/open-api/utils/codegen-data.js +622 -17
- package/src/open-api/utils/codegen-data.js.map +1 -1
- package/src/open-api/utils/normalise.js +175 -41
- package/src/open-api/utils/normalise.js.map +1 -1
- package/src/open-api/utils/parser.js +1 -1
- package/src/open-api/utils/parser.js.map +1 -1
- package/src/preset/__snapshots__/generator.spec.ts.snap +3 -3
- package/src/preset/generator.d.ts +1 -1
- package/src/py/agent/gateway-connection/generator.js +0 -3
- package/src/py/agent/gateway-connection/generator.js.map +1 -1
- package/src/py/agent/react-connection/generator.d.ts +1 -1
- package/src/py/agent/schema.json +2 -0
- package/src/py/fast-api/react/generator.d.ts +1 -1
- package/src/py/mcp-server/schema.json +1 -0
- package/src/sdk/open-api.d.ts +2 -0
- package/src/sdk/open-api.js +1 -0
- package/src/sdk/open-api.js.map +1 -1
- package/src/smithy/project/generator.d.ts +1 -1
- package/src/smithy/react-connection/generator.d.ts +1 -1
- package/src/terraform/project/generator.d.ts +1 -1
- package/src/trpc/react/generator.d.ts +1 -1
- package/src/ts/agent/a2a-connection/generator.d.ts +1 -1
- package/src/ts/agent/gateway-connection/generator.d.ts +1 -1
- package/src/ts/agent/gateway-connection/generator.js +0 -3
- package/src/ts/agent/gateway-connection/generator.js.map +1 -1
- package/src/ts/agent/mcp-connection/generator.d.ts +1 -1
- package/src/ts/agent/react-connection/generator.d.ts +1 -1
- package/src/ts/agent/schema.json +1 -0
- package/src/ts/api/schema.json +2 -0
- package/src/ts/astro-docs/generator.d.ts +1 -1
- package/src/ts/dcr-proxy/generator.d.ts +1 -1
- package/src/ts/dynamodb/generator.d.ts +1 -1
- package/src/ts/lambda-function/generator.d.ts +1 -1
- package/src/ts/lib/generator.d.ts +1 -1
- package/src/ts/mcp-server/schema.json +1 -0
- package/src/ts/nx-generator/__snapshots__/generator.spec.ts.snap +1 -1
- package/src/ts/nx-generator/files/nx-plugin-for-aws/generator/generator.spec.ts.template +1 -1
- package/src/ts/nx-generator/generator.d.ts +1 -1
- package/src/ts/nx-migration/generator.d.ts +1 -1
- package/src/ts/nx-plugin/generator.d.ts +1 -1
- package/src/ts/rdb/generator.d.ts +1 -1
- package/src/ts/react-website/agui/generator.d.ts +1 -1
- package/src/ts/react-website/app/__snapshots__/generator.spec.ts.snap +10 -10
- package/src/ts/react-website/app/schema.json +1 -0
- package/src/ts/website/app/schema.json +1 -0
- package/src/utils/metrics-assertions.d.ts +18 -0
- package/src/utils/metrics-assertions.js +42 -0
- package/src/utils/metrics-assertions.js.map +1 -0
- package/src/utils/test/python-dependencies.d.ts +8 -0
- package/src/utils/test/python-dependencies.js +14 -0
- package/src/utils/test/python-dependencies.js.map +1 -0
- package/src/utils/test/python-worker/worker.py +703 -0
- package/src/utils/test/warm-python-cache.d.ts +18 -0
- package/src/utils/test/warm-python-cache.js +46 -0
- package/src/utils/test/warm-python-cache.js.map +1 -0
- package/src/utils/versions.d.ts +10 -9
- package/src/utils/versions.js +9 -8
- package/src/utils/versions.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/mdx-ast.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport yaml from 'js-yaml';\nimport type { Root, RootContent, Yaml } from 'mdast';\nimport type {\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n} from 'mdast-util-mdx-jsx';\nimport { parseWhenExpression } from './option-filter.js';\n\nexport type JsxParent = Root | MdxJsxFlowElement | MdxJsxTextElement;\nexport type JsxElement = MdxJsxFlowElement | MdxJsxTextElement;\n\nexport const isJsxElement = (node: RootContent): node is JsxElement =>\n node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement';\n\nconst findAttr = (\n node: JsxElement,\n name: string,\n): MdxJsxAttribute | undefined =>\n node.attributes.find(\n (a): a is MdxJsxAttribute =>\n a.type === 'mdxJsxAttribute' && a.name === name,\n );\n\nexport const readStringAttr = (\n node: JsxElement,\n name: string,\n): string | undefined => {\n const attr = findAttr(node, name);\n return typeof attr?.value === 'string' ? attr.value : undefined;\n};\n\nexport const readExpressionAttr = (\n node: JsxElement,\n name: string,\n): string | undefined => {\n const attr = findAttr(node, name);\n if (attr && typeof attr.value === 'object' && attr.value !== null) {\n return (attr.value as MdxJsxAttributeValueExpression).value;\n }\n return undefined;\n};\n\nexport const readEstreeAttr = (\n node: JsxElement,\n name: string,\n): unknown | undefined => {\n const attr = findAttr(node, name);\n if (attr && typeof attr.value === 'object' && attr.value !== null) {\n return (attr.value as MdxJsxAttributeValueExpression).data?.estree;\n }\n return undefined;\n};\n\nexport const hasBareAttr = (node: JsxElement, name: string): boolean =>\n node.attributes.some((a) => a.type === 'mdxJsxAttribute' && a.name === name);\n\n/** Walk every JSX element in the subtree, pre-order. */\nexport const walkJsx = (\n parent: JsxParent,\n visit: (node: JsxElement, parent: JsxParent) => void,\n): void => {\n const children = parent.children as RootContent[];\n for (const child of children) {\n if (!isJsxElement(child)) continue;\n visit(child, parent);\n walkJsx(child, visit);\n }\n};\n\n/**\n * Every option key referenced by `<OptionFilter when>` or\n * `<TabItem _filter>` in the subtree. Malformed predicates are skipped.\n */\nexport const collectFilterableKeysFromJsx = (tree: Root): Set<string> => {\n const keys = new Set<string>();\n walkJsx(tree, (node) => {\n const attrName =\n node.name === 'OptionFilter'\n ? 'when'\n : node.name === 'TabItem'\n ? '_filter'\n : undefined;\n if (!attrName) return;\n const estree = readEstreeAttr(node, attrName);\n if (!estree) return;\n try {\n for (const key of Object.keys(parseWhenExpression(estree as never))) {\n keys.add(key);\n }\n } catch {\n // Malformed / partially-typed — skip.\n }\n });\n return keys;\n};\n\n/**\n * Parse the leading `---…---` YAML frontmatter from an mdast Root produced\n * with `remark-frontmatter`. Returns `{ data, bodyOffset }` where\n * `bodyOffset` is the character index after the closing `---` — slice the\n * original source from it to get the body without re-stringifying the tree.\n */\nexport const extractFrontmatter = (\n tree: Root,\n): { data: Record<string, unknown>; bodyOffset: number } => {\n const node = tree.children.find((c): c is Yaml => c.type === 'yaml');\n if (!node) return { data: {}, bodyOffset: 0 };\n let parsed: unknown;\n try {\n parsed = yaml.load(node.value);\n } catch {\n return { data: {}, bodyOffset: node.position?.end.offset ?? 0 };\n }\n const data =\n parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n return { data, bodyOffset: node.position?.end.offset ?? 0 };\n};\n"],"names":["yaml","parseWhenExpression","isJsxElement","node","type","findAttr","name","attributes","find","a","readStringAttr","attr","value","undefined","readExpressionAttr","readEstreeAttr","data","estree","hasBareAttr","some","walkJsx","parent","visit","children","child","collectFilterableKeysFromJsx","tree","keys","Set","attrName","key","Object","add","extractFrontmatter","c","bodyOffset","parsed","load","position","end","offset","Array","isArray"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,UAAU,UAAU;AAQ3B,SAASC,mBAAmB,QAAQ,qBAAqB;AAKzD,OAAO,MAAMC,eAAe,CAACC,OAC3BA,KAAKC,IAAI,KAAK,uBAAuBD,KAAKC,IAAI,KAAK,oBAAoB;AAEzE,MAAMC,WAAW,CACfF,MACAG,OAEAH,KAAKI,UAAU,CAACC,IAAI,CAClB,CAACC,IACCA,EAAEL,IAAI,KAAK,qBAAqBK,EAAEH,IAAI,KAAKA;AAGjD,OAAO,MAAMI,iBAAiB,CAC5BP,MACAG;IAEA,MAAMK,OAAON,SAASF,MAAMG;IAC5B,OAAO,OAAOK,MAAMC,UAAU,WAAWD,KAAKC,KAAK,GAAGC;AACxD,EAAE;AAEF,OAAO,MAAMC,qBAAqB,CAChCX,MACAG;IAEA,MAAMK,OAAON,SAASF,MAAMG;IAC5B,IAAIK,QAAQ,OAAOA,KAAKC,KAAK,KAAK,YAAYD,KAAKC,KAAK,KAAK,MAAM;QACjE,OAAO,AAACD,KAAKC,KAAK,CAAoCA,KAAK;IAC7D;IACA,OAAOC;AACT,EAAE;AAEF,OAAO,MAAME,iBAAiB,CAC5BZ,MACAG;IAEA,MAAMK,OAAON,SAASF,MAAMG;IAC5B,IAAIK,QAAQ,OAAOA,KAAKC,KAAK,KAAK,YAAYD,KAAKC,KAAK,KAAK,MAAM;QACjE,OAAO,AAACD,KAAKC,KAAK,CAAoCI,IAAI,EAAEC;IAC9D;IACA,OAA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MAAMxB,OACJoB,UAAU,OAAOA,WAAW,YAAY,CAACK,MAAMC,OAAO,CAACN,UAClDA,SACD,CAAC;IACP,OAAO;QAAEpB;QAAMmB,YAAYhC,KAAKmC,QAAQ,EAAEC,IAAIC,UAAU;IAAE;AAC5D,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/mdx-ast.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport yaml from 'js-yaml';\nimport type { Root, RootContent, Yaml } from 'mdast';\nimport type {\n MdxJsxAttribute,\n MdxJsxAttributeValueExpression,\n MdxJsxFlowElement,\n MdxJsxTextElement,\n} from 'mdast-util-mdx-jsx';\nimport { parseWhenExpression } from './option-filter.js';\n\nexport type JsxParent = Root | MdxJsxFlowElement | MdxJsxTextElement;\nexport type JsxElement = MdxJsxFlowElement | MdxJsxTextElement;\n\nexport const isJsxElement = (node: RootContent): node is JsxElement =>\n node.type === 'mdxJsxFlowElement' || node.type === 'mdxJsxTextElement';\n\nconst findAttr = (\n node: JsxElement,\n name: string,\n): MdxJsxAttribute | undefined =>\n node.attributes.find(\n (a): a is MdxJsxAttribute =>\n a.type === 'mdxJsxAttribute' && a.name === name,\n );\n\nexport const readStringAttr = (\n node: JsxElement,\n name: string,\n): string | undefined => {\n const attr = findAttr(node, name);\n return typeof attr?.value === 'string' ? attr.value : undefined;\n};\n\nexport const readExpressionAttr = (\n node: JsxElement,\n name: string,\n): string | undefined => {\n const attr = findAttr(node, name);\n if (attr && typeof attr.value === 'object' && attr.value !== null) {\n return (attr.value as MdxJsxAttributeValueExpression).value;\n }\n return undefined;\n};\n\nexport const readEstreeAttr = (\n node: JsxElement,\n name: string,\n): unknown | undefined => {\n const attr = findAttr(node, name);\n if (attr && typeof attr.value === 'object' && attr.value !== null) {\n return (attr.value as MdxJsxAttributeValueExpression).data?.estree;\n }\n return undefined;\n};\n\nexport const hasBareAttr = (node: JsxElement, name: string): boolean =>\n node.attributes.some((a) => a.type === 'mdxJsxAttribute' && a.name === name);\n\n/** Walk every JSX element in the subtree, pre-order. */\nexport const walkJsx = (\n parent: JsxParent,\n visit: (node: JsxElement, parent: JsxParent) => void,\n): void => {\n const children = parent.children as RootContent[];\n for (const child of children) {\n if (!isJsxElement(child)) continue;\n visit(child, parent);\n walkJsx(child, visit);\n }\n};\n\n/**\n * Every option key referenced by `<OptionFilter when>` or\n * `<TabItem _filter>` in the subtree. Malformed predicates are skipped.\n */\nexport const collectFilterableKeysFromJsx = (tree: Root): Set<string> => {\n const keys = new Set<string>();\n walkJsx(tree, (node) => {\n const attrName =\n node.name === 'OptionFilter'\n ? 'when'\n : node.name === 'TabItem'\n ? '_filter'\n : undefined;\n if (!attrName) return;\n const estree = readEstreeAttr(node, attrName);\n if (!estree) return;\n try {\n for (const key of Object.keys(parseWhenExpression(estree as never))) {\n keys.add(key);\n }\n } catch {\n // Malformed / partially-typed — skip.\n }\n });\n return keys;\n};\n\n/**\n * Parse the leading `---…---` YAML frontmatter from an mdast Root produced\n * with `remark-frontmatter`. Returns `{ data, bodyOffset }` where\n * `bodyOffset` is the character index after the closing `---` — slice the\n * original source from it to get the body without re-stringifying the tree.\n */\nexport const extractFrontmatter = (\n tree: Root,\n): { data: Record<string, unknown>; bodyOffset: number } => {\n const node = tree.children.find((c): c is Yaml => c.type === 'yaml');\n if (!node) return { data: {}, bodyOffset: 0 };\n let parsed: unknown;\n try {\n parsed = yaml.load(node.value);\n } catch {\n return { data: {}, bodyOffset: node.position?.end.offset ?? 0 };\n }\n const data =\n parsed && typeof parsed === 'object' && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n return { data, bodyOffset: node.position?.end.offset ?? 0 };\n};\n\n/**\n * Remove the frontmatter and every ESM `import`/`export` statement from an MDX\n * source, leaving the content behind. The statements are located through the\n * parsed tree, so `import` and `export` lines that appear inside code samples\n * or template literals are kept — they are content, not preamble.\n */\nexport const stripFrontmatterAndEsm = (raw: string, tree: Root): string => {\n const cuts = tree.children\n .filter((c) => c.type === 'yaml' || c.type === 'mdxjsEsm')\n .map((c) => c.position)\n .filter(\n (p): p is NonNullable<typeof p> =>\n p?.start.offset !== undefined && p?.end.offset !== undefined,\n );\n let result = '';\n let cursor = 0;\n for (const { start, end } of cuts) {\n result += raw.slice(cursor, start.offset);\n cursor = end.offset!;\n }\n return (result + raw.slice(cursor)).trim();\n};\n"],"names":["yaml","parseWhenExpression","isJsxElement","node","type","findAttr","name","attributes","find","a","readStringAttr","attr","value","undefined","readExpressionAttr","readEstreeAttr","data","estree","hasBareAttr","some","walkJsx","parent","visit","children","child","collectFilterableKeysFromJsx","tree","keys","Set","attrName","key","Object","add","extractFrontmatter","c","bodyOffset","parsed","load","position","end","offset","Array","isArray","stripFrontmatterAndEsm","raw","cuts","filter","map","p","start","result","cursor","slice","trim"],"mappings":"AAAA;;;CAGC,GAED,OAAOA,UAAU,UAAU;AAQ3B,SAASC,mBAAmB,QAAQ,qBAAqB;AAKzD,OAAO,MAAMC,eAAe,CAACC,OAC3BA,KAAKC,IAAI,KAAK,uBAAuBD,KAAKC,IAAI,KAAK,oBAAoB;AAEzE,MAAMC,WAAW,CACfF,MACAG,OAEAH,KAAKI,UAAU,CAACC,IAAI,CAClB,CAACC,IACCA,EAAEL,IAAI,KAAK,qBAAqBK,EAAEH,IAAI,KAAKA;AAGjD,OAAO,MAAMI,iBAAiB,CAC5BP,MACAG;IAEA,MAAMK,OAAON,SAASF,MAAMG;IAC5B,OAAO,OAAOK,MAAMC,UAAU,WAAWD,KAAKC,KAAK,GAAGC;AACxD,EAAE;AAEF,OAAO,MAAMC,qBAAqB,CAChCX,MACAG;IAEA,MAAMK,OAAON,SAASF,MAAMG;IAC5B,IAAIK,QAAQ,OAAOA,KAAKC,KAAK,KAAK,YAAYD,KAAKC,KAAK,KAAK,MAAM;QACjE,OAAO,AAACD,KAAKC,KAAK,CAAoCA,KAAK;IAC7D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D,MAAM,OAAO;QAAEa,MAAM,CAAC;QAAGmB,YAAY;IAAE;IAC5C,IAAIC;IACJ,IAAI;QACFA,SAASpC,KAAKqC,IAAI,CAAClC,KAAKS,KAAK;IAC/B,EAAE,OAAM;QACN,OAAO;YAAEI,MAAM,CAAC;YAAGmB,YAAYhC,KAAKmC,QAAQ,EAAEC,IAAIC,UAAU;QAAE;IAChE;IACA,MAAMxB,OACJoB,UAAU,OAAOA,WAAW,YAAY,CAACK,MAAMC,OAAO,CAACN,UAClDA,SACD,CAAC;IACP,OAAO;QAAEpB;QAAMmB,YAAYhC,KAAKmC,QAAQ,EAAEC,IAAIC,UAAU;IAAE;AAC5D,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMG,yBAAyB,CAACC,KAAalB;IAClD,MAAMmB,OAAOnB,KAAKH,QAAQ,CACvBuB,MAAM,CAAC,CAACZ,IAAMA,EAAE9B,IAAI,KAAK,UAAU8B,EAAE9B,IAAI,KAAK,YAC9C2C,GAAG,CAAC,CAACb,IAAMA,EAAEI,QAAQ,EACrBQ,MAAM,CACL,CAACE,IACCA,GAAGC,MAAMT,WAAW3B,aAAamC,GAAGT,IAAIC,WAAW3B;IAEzD,IAAIqC,SAAS;IACb,IAAIC,SAAS;IACb,KAAK,MAAM,EAAEF,KAAK,EAAEV,GAAG,EAAE,IAAIM,KAAM;QACjCK,UAAUN,IAAIQ,KAAK,CAACD,QAAQF,MAAMT,MAAM;QACxCW,SAASZ,IAAIC,MAAM;IACrB;IACA,OAAO,AAACU,CAAAA,SAASN,IAAIQ,KAAK,CAACD,OAAM,EAAGE,IAAI;AAC1C,EAAE"}
|
|
@@ -23,13 +23,13 @@ export declare const filterableValuesForProperty: (prop: SchemaProperty) => stri
|
|
|
23
23
|
/**
|
|
24
24
|
* Pull out every filterable property (enum or boolean valued) as a
|
|
25
25
|
* `FilterableOption`. Shared between the MCP server (deriving options from a
|
|
26
|
-
* generator's schema) and the docs
|
|
26
|
+
* generator's schema) and the docs site (mapping user-referenced keys
|
|
27
27
|
* onto their values).
|
|
28
28
|
*/
|
|
29
29
|
export declare const filterableOptionsFromSchema: (schema: GeneratorSchema | undefined) => FilterableOption[];
|
|
30
30
|
/**
|
|
31
31
|
* Locate the monorepo's `packages/nx-plugin/generators.json` by walking
|
|
32
|
-
* upward from the caller's directory. Used by the docs
|
|
32
|
+
* upward from the caller's directory. Used by the docs site and
|
|
33
33
|
* remark-option-filter; the MCP server resolves schema paths per-generator
|
|
34
34
|
* via `NxGeneratorInfo.resolvedSchemaPath` instead.
|
|
35
35
|
*/
|
|
@@ -21,7 +21,7 @@ import path from "node:path";
|
|
|
21
21
|
/**
|
|
22
22
|
* Pull out every filterable property (enum or boolean valued) as a
|
|
23
23
|
* `FilterableOption`. Shared between the MCP server (deriving options from a
|
|
24
|
-
* generator's schema) and the docs
|
|
24
|
+
* generator's schema) and the docs site (mapping user-referenced keys
|
|
25
25
|
* onto their values).
|
|
26
26
|
*/ export const filterableOptionsFromSchema = (schema)=>{
|
|
27
27
|
const props = schema?.properties ?? {};
|
|
@@ -40,7 +40,7 @@ import path from "node:path";
|
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
42
42
|
* Locate the monorepo's `packages/nx-plugin/generators.json` by walking
|
|
43
|
-
* upward from the caller's directory. Used by the docs
|
|
43
|
+
* upward from the caller's directory. Used by the docs site and
|
|
44
44
|
* remark-option-filter; the MCP server resolves schema paths per-generator
|
|
45
45
|
* via `NxGeneratorInfo.resolvedSchemaPath` instead.
|
|
46
46
|
*/ export const resolveGeneratorsJson = (fromDir)=>{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/schema-registry.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/** A JSON-schema property narrowed to the bits we care about. */\ninterface SchemaProperty {\n type?: string;\n enum?: unknown[];\n default?: unknown;\n description?: string;\n}\n\nexport interface GeneratorSchema {\n properties?: Record<string, SchemaProperty>;\n required?: string[];\n}\n\nexport interface FilterableOption {\n key: string;\n enum: string[];\n default?: string;\n description?: string;\n}\n\ninterface GeneratorsJson {\n generators: Record<string, { schema: string }>;\n}\n\n/**\n * The values an option can be filtered on: its enum values, or true/false\n * for booleans. Returns undefined for non-filterable options.\n */\nexport const filterableValuesForProperty = (\n prop: SchemaProperty,\n): string[] | undefined => {\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n return prop.enum.map((v) => String(v));\n }\n if (prop.type === 'boolean') {\n return ['true', 'false'];\n }\n return undefined;\n};\n\n/**\n * Pull out every filterable property (enum or boolean valued) as a\n * `FilterableOption`. Shared between the MCP server (deriving options from a\n * generator's schema) and the docs
|
|
1
|
+
{"version":3,"sources":["../../../../../packages/nx-plugin/src/mcp-server/schema-registry.ts"],"sourcesContent":["/**\n * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * SPDX-License-Identifier: Apache-2.0\n */\nimport fs from 'node:fs';\nimport path from 'node:path';\n\n/** A JSON-schema property narrowed to the bits we care about. */\ninterface SchemaProperty {\n type?: string;\n enum?: unknown[];\n default?: unknown;\n description?: string;\n}\n\nexport interface GeneratorSchema {\n properties?: Record<string, SchemaProperty>;\n required?: string[];\n}\n\nexport interface FilterableOption {\n key: string;\n enum: string[];\n default?: string;\n description?: string;\n}\n\ninterface GeneratorsJson {\n generators: Record<string, { schema: string }>;\n}\n\n/**\n * The values an option can be filtered on: its enum values, or true/false\n * for booleans. Returns undefined for non-filterable options.\n */\nexport const filterableValuesForProperty = (\n prop: SchemaProperty,\n): string[] | undefined => {\n if (Array.isArray(prop.enum) && prop.enum.length > 0) {\n return prop.enum.map((v) => String(v));\n }\n if (prop.type === 'boolean') {\n return ['true', 'false'];\n }\n return undefined;\n};\n\n/**\n * Pull out every filterable property (enum or boolean valued) as a\n * `FilterableOption`. Shared between the MCP server (deriving options from a\n * generator's schema) and the docs site (mapping user-referenced keys\n * onto their values).\n */\nexport const filterableOptionsFromSchema = (\n schema: GeneratorSchema | undefined,\n): FilterableOption[] => {\n const props = schema?.properties ?? {};\n const out: FilterableOption[] = [];\n for (const [key, prop] of Object.entries(props)) {\n const values = filterableValuesForProperty(prop);\n if (!values) continue;\n out.push({\n key,\n enum: values,\n default: prop.default !== undefined ? String(prop.default) : undefined,\n description: prop.description,\n });\n }\n return out;\n};\n\n/**\n * Locate the monorepo's `packages/nx-plugin/generators.json` by walking\n * upward from the caller's directory. Used by the docs site and\n * remark-option-filter; the MCP server resolves schema paths per-generator\n * via `NxGeneratorInfo.resolvedSchemaPath` instead.\n */\nexport const resolveGeneratorsJson = (fromDir: string): string | undefined => {\n let dir = fromDir;\n while (true) {\n const candidate = path.join(\n dir,\n 'packages',\n 'nx-plugin',\n 'generators.json',\n );\n if (fs.existsSync(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) return undefined;\n dir = parent;\n }\n};\n\n/**\n * Resolve a generator's schema path against a `generators.json` registry,\n * parse the schema file, and cache the result per-process.\n */\nexport const createSchemaLookup = (generatorsJsonPath: string) => {\n const packageDir = path.dirname(generatorsJsonPath);\n let registry: GeneratorsJson | undefined;\n const cache = new Map<string, GeneratorSchema>();\n\n const loadRegistry = (): GeneratorsJson => {\n if (!registry) {\n registry = JSON.parse(\n fs.readFileSync(generatorsJsonPath, 'utf-8'),\n ) as GeneratorsJson;\n }\n return registry;\n };\n\n return (generatorId: string): GeneratorSchema => {\n const cached = cache.get(generatorId);\n if (cached) return cached;\n const entry = loadRegistry().generators[generatorId];\n if (!entry) {\n throw new Error(`Unknown generator id '${generatorId}'`);\n }\n const schema = JSON.parse(\n fs.readFileSync(path.resolve(packageDir, entry.schema), 'utf-8'),\n ) as GeneratorSchema;\n cache.set(generatorId, schema);\n return schema;\n };\n};\n"],"names":["fs","path","filterableValuesForProperty","prop","Array","isArray","enum","length","map","v","String","type","undefined","filterableOptionsFromSchema","schema","props","properties","out","key","Object","entries","values","push","default","description","resolveGeneratorsJson","fromDir","dir","candidate","join","existsSync","parent","dirname","createSchemaLookup","generatorsJsonPath","packageDir","registry","cache","Map","loadRegistry","JSON","parse","readFileSync","generatorId","cached","get","entry","generators","Error","resolve","set"],"mappings":"AAAA;;;CAGC,GACD,OAAOA,QAAQ,UAAU;AACzB,OAAOC,UAAU,YAAY;AA0B7B;;;CAGC,GACD,OAAO,MAAMC,8BAA8B,CACzCC;IAEA,IAAIC,MAAMC,OAAO,CAACF,KAAKG,IAAI,KAAKH,KAAKG,IAAI,CAACC,MAAM,GAAG,GAAG;QACpD,OAAOJ,KAAKG,IAAI,CAACE,GAAG,CAAC,CAACC,IAAMC,OAAOD;IACrC;IACA,IAAIN,KAAKQ,IAAI,KAAK,WAAW;QAC3B,OAAO;YAAC;YAAQ;SAAQ;IAC1B;IACA,OAAOC;AACT,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMC,8BAA8B,CACzCC;IAEA,MAAMC,QAAQD,QAAQE,cAAc,CAAC;IACrC,MAAMC,MAA0B,EAAE;IAClC,KAAK,MAAM,CAACC,KAAKf,KAAK,IAAIgB,OAAOC,OAAO,CAACL,OAAQ;QAC/C,MAAMM,SAASnB,4BAA4BC;QAC3C,IAAI,CAACkB,QAAQ;QACbJ,IAAIK,IAAI,CAAC;YACPJ;YACAZ,MAAMe;YACNE,SAASpB,KAAKoB,OAAO,KAAKX,YAAYF,OAAOP,KAAKoB,OAAO,IAAIX;YAC7DY,aAAarB,KAAKqB,WAAW;QAC/B;IACF;IACA,OAAOP;AACT,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMQ,wBAAwB,CAACC;IACpC,IAAIC,MAAMD;IACV,MAAO,KAAM;QACX,MAAME,YAAY3B,KAAK4B,IAAI,CACzBF,KACA,YACA,aACA;QAEF,IAAI3B,GAAG8B,UAAU,CAACF,YAAY,OAAOA;QACrC,MAAMG,SAAS9B,KAAK+B,OAAO,CAACL;QAC5B,IAAII,WAAWJ,KAAK,OAAOf;QAC3Be,MAAMI;IACR;AACF,EAAE;AAEF;;;CAGC,GACD,OAAO,MAAME,qBAAqB,CAACC;IACjC,MAAMC,aAAalC,KAAK+B,OAAO,CAACE;IAChC,IAAIE;IACJ,MAAMC,QAAQ,IAAIC;IAElB,MAAMC,eAAe;QACnB,IAAI,CAACH,UAAU;YACbA,WAAWI,KAAKC,KAAK,CACnBzC,GAAG0C,YAAY,CAACR,oBAAoB;QAExC;QACA,OAAOE;IACT;IAEA,OAAO,CAACO;QACN,MAAMC,SAASP,MAAMQ,GAAG,CAACF;QACzB,IAAIC,QAAQ,OAAOA;QACnB,MAAME,QAAQP,eAAeQ,UAAU,CAACJ,YAAY;QACpD,IAAI,CAACG,OAAO;YACV,MAAM,IAAIE,MAAM,CAAC,sBAAsB,EAAEL,YAAY,CAAC,CAAC;QACzD;QACA,MAAM7B,SAAS0B,KAAKC,KAAK,CACvBzC,GAAG0C,YAAY,CAACzC,KAAKgD,OAAO,CAACd,YAAYW,MAAMhC,MAAM,GAAG;QAE1DuB,MAAMa,GAAG,CAACP,aAAa7B;QACvB,OAAOA;IACT;AACF,EAAE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`openApiPyClientGenerator - additional properties > should emit dict[str, T] for plain additionalProperties objects > types.py 1`] = `
|
|
4
|
+
""""Types for TestApi — AUTO-GENERATED, do not edit."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Never
|
|
9
|
+
|
|
10
|
+
Counts200Response = dict[str, int]
|
|
11
|
+
|
|
12
|
+
CountsError = Never
|
|
13
|
+
"
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
exports[`openApiPyClientGenerator - additional properties > should handle object models with a mixture of properties and additionalProperties > types.py 1`] = `
|
|
17
|
+
""""Types for TestApi — AUTO-GENERATED, do not edit."""
|
|
18
|
+
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
from typing import Never
|
|
22
|
+
|
|
23
|
+
from pydantic import BaseModel, ConfigDict
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Mixed(BaseModel):
|
|
27
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
28
|
+
|
|
29
|
+
id: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
MixedError = Never
|
|
33
|
+
"
|
|
34
|
+
`;
|