diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index a132e788ccb..8545ce7cc92 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -27,7 +27,7 @@ jobs: id: download-artifacts uses: dawidd6/action-download-artifact@v3 with: - github_token: ${{secrets.GITHUB_TOKEN}} + github_token: ${{ secrets.GITHUB_TOKEN }} run_id: ${{ github.event.workflow_run.id }} name: .+\.diff$ name_is_regexp: true @@ -37,7 +37,7 @@ jobs: - uses: marocchino/action-workflow_run-status@54b6e87d6cb552fc5f36dbe9a722a6048725917a if: steps.download-artifacts.outputs.found_artifact == 'true' with: - github_token: ${{secrets.GITHUB_TOKEN}} + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Token check if: steps.download-artifacts.outputs.found_artifact == 'true' @@ -50,11 +50,33 @@ jobs: It requires private repo read/write permissions." >> $GITHUB_STEP_SUMMARY exit 1 fi + + - name: Find associated pull request + id: pr + uses: actions/github-script@v7 + with: + script: | + const mainRepo = context.payload.workflow_run.repository.full_name; + const headBranch = context.payload.workflow_run.head_branch; + console.log(`Searching for pull request in ${mainRepo} with head branch ${headBranch}`); + + const response = await github.rest.search.issuesAndPullRequests({ + q: `repo:${mainRepo} is:pr is:open head:${headBranch}`, + per_page: 1, + }); + const prs = response.data.items; + if (prs.length < 1) { + throw new Error('No pull request found for the commit'); + } + const prNumber = prs[0].number; + console.log(`Pull request number is ${prNumber}`); + return prNumber; - name: Unstable mutation comment if: steps.download-artifacts.outputs.found_artifact == 'true' && startsWith(github.event.workflow_run.head_commit.message, format('chore{0} self mutation', ':')) uses: thollander/actions-comment-pull-request@v2 with: + pr_number: ${{ steps.pr.outputs.result }} mode: recreate message: | ### :x: Unstable Self-Mutation :x: @@ -74,8 +96,7 @@ jobs: - name: Disable Git Hooks if: steps.download-artifacts.outputs.found_artifact == 'true' - run: | - git config --global core.hooksPath /dev/null + run: git config --global core.hooksPath /dev/null - name: Update PR Branch uses: actions/github-script@v7 @@ -84,27 +105,13 @@ jobs: with: github-token: ${{ secrets.MUTATION_TOKEN }} script: | - // use API to get the PR data since we can't rely on the context across forks - let head = context.payload.workflow_run.head_branch; - if (`${context.repo.owner}/${context.repo.repo}` !== context.payload.workflow_run.head_repository.full_name) { - if (context.payload.workflow_run.head_repository.name === context.repo.repo) { - // head is in the short form since the repo name is the same - head = `${context.payload.workflow_run.head_repository.owner.login}:${head}`; - } else { - head = `${context.payload.workflow_run.head_repository.full_name}:${head}`; - } - } - - const pulls = await github.rest.pulls.list({ - per_page: 1, + const prContextData = await github.rest.pulls.get({ owner: context.repo.owner, repo: context.repo.repo, - head, + pull_number: ${{ steps.pr.outputs.result }} }); - - const prContextData = pulls.data[0]; - const prNumber = prContextData.number; - const originalSha = prContextData.head.sha; + const prNumber = prContextData.data.number; + const originalSha = prContextData.data.head.sha; try { console.log("Updating PR branch"); @@ -135,8 +142,6 @@ jobs: console.warn(error); } - return prNumber; - - name: Checkout Workflow Branch if: steps.download-artifacts.outputs.found_artifact == 'true' uses: actions/checkout@v4 @@ -179,11 +184,9 @@ jobs: with: github-token: ${{ secrets.MUTATION_TOKEN }} script: | - const prNumber = ${{ steps.branch-update.outputs.result }}; - await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: prNumber, + issue_number: ${{ steps.pr.outputs.result }}, labels: ["⚠️ pr/review-mutation"] }); diff --git a/README.md b/README.md index f0497d5fb1c..0412b9ce122 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ - [![Register](https://github.com/winglang/wing/assets/66887028/5647156b-3823-4ae3-939c-6e7d4405cc60)](https://wingla.ng/wing-cloud-early-access) -
diff --git a/apps/wing-console/console/app/test/cloud.api/index.test.ts b/apps/wing-console/console/app/test/cloud.api/index.test.ts index 20d179cb369..b3dccf278e0 100644 --- a/apps/wing-console/console/app/test/cloud.api/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.api/index.test.ts @@ -10,7 +10,7 @@ const runApiTest = async ( route: string, response: string, ) => { - await getResourceNode(page, "root/Default/cloud.Api").click(); + await getResourceNode(page, "root/Default/Api").click(); await page.getByTestId("cloud.api:method-toggle").click(); await page.getByTestId(`cloud.api:method-entry-${method}`).click(); diff --git a/apps/wing-console/console/app/test/cloud.bucket/index.test.ts b/apps/wing-console/console/app/test/cloud.bucket/index.test.ts index 00319a10dfc..877c90f9650 100644 --- a/apps/wing-console/console/app/test/cloud.bucket/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.bucket/index.test.ts @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { test.skip("opens file preview", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Bucket").click(); + await getResourceNode(page, "root/Default/Bucket").click(); await page.getByTestId("cloud.bucket:files-entry-test.txt").click(); @@ -15,7 +15,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("deletes a file", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Bucket").click(); + await getResourceNode(page, "root/Default/Bucket").click(); const file = page.getByTestId("cloud.bucket:files-entry-test.txt"); diff --git a/apps/wing-console/console/app/test/cloud.counter/index.test.ts b/apps/wing-console/console/app/test/cloud.counter/index.test.ts index 6530273fc6e..4b5794832a9 100644 --- a/apps/wing-console/console/app/test/cloud.counter/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.counter/index.test.ts @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { test.skip("increase counter", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Counter").click(); + await getResourceNode(page, "root/Default/Counter").click(); const currentValue = page.getByTestId("cloud.counter:current-value"); @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("decreases counter", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Counter").click(); + await getResourceNode(page, "root/Default/Counter").click(); const currentValue = page.getByTestId("cloud.counter:current-value"); @@ -29,7 +29,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("resets counter", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Counter").click(); + await getResourceNode(page, "root/Default/Counter").click(); const currentValue = page.getByTestId("cloud.counter:current-value"); diff --git a/apps/wing-console/console/app/test/cloud.function/index.test.ts b/apps/wing-console/console/app/test/cloud.function/index.test.ts index 4d4eb58c372..976fba5249d 100644 --- a/apps/wing-console/console/app/test/cloud.function/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.function/index.test.ts @@ -4,8 +4,8 @@ import { describe } from "../describe.js"; import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { - test("executes function and shows response", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Function").click(); + test.skip("executes function and shows response", async ({ page }) => { + await getResourceNode(page, "root/Default/Function").click(); await page.getByTestId("cloud.function:invoke").click(); diff --git a/apps/wing-console/console/app/test/cloud.queue/index.test.ts b/apps/wing-console/console/app/test/cloud.queue/index.test.ts index 8b6e61657b8..5038b00eaac 100644 --- a/apps/wing-console/console/app/test/cloud.queue/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.queue/index.test.ts @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { test.skip("pushes message", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Queue").click(); + await getResourceNode(page, "root/Default/Queue").click(); await page.getByTestId("cloud.queue:message").fill("Hello world!"); @@ -17,7 +17,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("purges message", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Queue").click(); + await getResourceNode(page, "root/Default/Queue").click(); await page.getByTestId("cloud.queue:message").fill("Hello world!"); diff --git a/apps/wing-console/console/app/test/cloud.topic/index.test.ts b/apps/wing-console/console/app/test/cloud.topic/index.test.ts index ae2cc972c23..3c14826abb5 100644 --- a/apps/wing-console/console/app/test/cloud.topic/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.topic/index.test.ts @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { test.skip("publishes message", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Topic").click(); + await getResourceNode(page, "root/Default/Topic").click(); await page.getByTestId("cloud.topic:message").fill("Hello world!"); diff --git a/apps/wing-console/console/app/test/cloud.website/index.test.ts b/apps/wing-console/console/app/test/cloud.website/index.test.ts index d90947e498e..ac1857f991d 100644 --- a/apps/wing-console/console/app/test/cloud.website/index.test.ts +++ b/apps/wing-console/console/app/test/cloud.website/index.test.ts @@ -5,7 +5,7 @@ import { getResourceNode } from "../helpers.js"; describe(`${__dirname}/main.w`, () => { test.skip("open website", async ({ page }) => { - await getResourceNode(page, "root/Default/cloud.Website").click(); + await getResourceNode(page, "root/Default/Website").click(); // not working when app mode is not "local" // const url = await page.getByTestId("cloud.website:url").inputValue(); diff --git a/apps/wing-console/console/app/test/ex.dynamodb-table/index.test.ts b/apps/wing-console/console/app/test/ex.dynamodb-table/index.test.ts index bae5d2a5691..6d935bc2fb0 100644 --- a/apps/wing-console/console/app/test/ex.dynamodb-table/index.test.ts +++ b/apps/wing-console/console/app/test/ex.dynamodb-table/index.test.ts @@ -16,13 +16,13 @@ const addRow = async (page: Page, data?: Record) => { describe(`${__dirname}/main.w`, () => { test.skip("adds new item", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.DynamodbTable").click(); + await getResourceNode(page, "root/Default/DynamodbTable").click(); await addRow(page, { id: "1", key1: "value1", key2: "value2" }); }); test.skip("removes row", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.DynamodbTable").click(); + await getResourceNode(page, "root/Default/DynamodbTable").click(); await addRow(page, { id: "1", key1: "value1", key2: "value2" }); diff --git a/apps/wing-console/console/app/test/ex.redis/index.test.ts b/apps/wing-console/console/app/test/ex.redis/index.test.ts index 1d1325d353d..c289842664b 100644 --- a/apps/wing-console/console/app/test/ex.redis/index.test.ts +++ b/apps/wing-console/console/app/test/ex.redis/index.test.ts @@ -22,7 +22,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("opens redis help", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.Redis").click(); + await getResourceNode(page, "root/Default/Redis").click(); const input = page.getByTestId("ex.redis:input"); @@ -40,7 +40,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("navigates history", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.Redis").click(); + await getResourceNode(page, "root/Default/Redis").click(); const input = page.getByTestId("ex.redis:input"); diff --git a/apps/wing-console/console/app/test/ex.table/index.test.ts b/apps/wing-console/console/app/test/ex.table/index.test.ts index 71f7fa440f9..2158c9031ee 100644 --- a/apps/wing-console/console/app/test/ex.table/index.test.ts +++ b/apps/wing-console/console/app/test/ex.table/index.test.ts @@ -30,13 +30,13 @@ const addRow = async ( describe(`${__dirname}/main.w`, () => { test.skip("adds new row", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.Table").click(); + await getResourceNode(page, "root/Default/Table").click(); await addRow(page, "Hello World!"); }); test.skip("edits row", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.Table").click(); + await getResourceNode(page, "root/Default/Table").click(); const rowId = "Hello World!"; @@ -55,7 +55,7 @@ describe(`${__dirname}/main.w`, () => { }); test.skip("removes row", async ({ page }) => { - await getResourceNode(page, "root/Default/ex.Table").click(); + await getResourceNode(page, "root/Default/Table").click(); const rowId = "Hello World!"; diff --git a/apps/wing-console/console/app/test/health/health.test.ts b/apps/wing-console/console/app/test/health/health.test.ts new file mode 100644 index 00000000000..3926dec0934 --- /dev/null +++ b/apps/wing-console/console/app/test/health/health.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from "@playwright/test"; + +import { describe } from "../describe.js"; + +describe(`${__dirname}/main.w`, () => { + test("Health check", async ({ page }) => { + const appState = page.getByTestId("app-state"); + await expect(appState).toContainText("success"); + }); +}); diff --git a/apps/wing-console/console/app/test/health/main.w b/apps/wing-console/console/app/test/health/main.w new file mode 100644 index 00000000000..6758e443e08 --- /dev/null +++ b/apps/wing-console/console/app/test/health/main.w @@ -0,0 +1,2 @@ +bring cloud; + diff --git a/apps/wing-console/console/design-system/src/attribute.tsx b/apps/wing-console/console/design-system/src/attribute.tsx index cba70ad5fb6..e9a933aa880 100644 --- a/apps/wing-console/console/design-system/src/attribute.tsx +++ b/apps/wing-console/console/design-system/src/attribute.tsx @@ -13,6 +13,7 @@ interface AttributeProps { noLeftPadding?: boolean; centerLabel?: boolean; dataTestId?: string; + className?: string; } export const Attribute = ({ @@ -24,6 +25,7 @@ export const Attribute = ({ noLeftPadding = false, centerLabel = true, dataTestId, + className, }: PropsWithChildren) => { const { theme } = useTheme(); const id = useId(); @@ -33,6 +35,7 @@ export const Attribute = ({ "flex flex-row", !noLeftPadding && "pl-4", centerLabel && "items-center", + className, )} >
- - -
-
- +
+
+ +
-
- {metadata.data && ( - - )} + {metadata.data && ( + + )} - {selectedEdgeId && edgeMetadata.data && ( - - )} -
- + {selectedEdgeId && edgeMetadata.data && ( + + )} +
+
+ )} diff --git a/apps/wing-console/console/ui/src/layout/layout-provider.tsx b/apps/wing-console/console/ui/src/layout/layout-provider.tsx index c963df9754b..54e507309fc 100644 --- a/apps/wing-console/console/ui/src/layout/layout-provider.tsx +++ b/apps/wing-console/console/ui/src/layout/layout-provider.tsx @@ -9,6 +9,7 @@ export enum LayoutType { Tutorial, Vscode, WingCloud, + Map, } export const LayoutContext = createContext(LayoutType.Default); @@ -94,6 +95,23 @@ export function LayoutProvider({ }; break; } + case LayoutType.Map: { + layoutConfig = { + leftPanel: { + hide: true, + }, + bottomPanel: { + hide: true, + }, + statusBar: { + hide: true, + }, + rightPanel: { + hide: true, + }, + }; + break; + } } return ( diff --git a/apps/wing-console/console/ui/src/layout/status-bar.tsx b/apps/wing-console/console/ui/src/layout/status-bar.tsx index 37ba4691d49..6624783b36f 100644 --- a/apps/wing-console/console/ui/src/layout/status-bar.tsx +++ b/apps/wing-console/console/ui/src/layout/status-bar.tsx @@ -52,6 +52,7 @@ export const StatusBar = ({ Status: { const endpointListQuery = trpc["endpoint.list"].useQuery(); useEffect(() => { - return setEndpointList(endpointListQuery.data || []); + return setEndpointList(endpointListQuery.data ?? []); }, [endpointListQuery.data]); + const exposeEndpointMutation = trpc["endpoint.expose"].useMutation(); + const exposeEndpoint = (resourcePath: string) => { + exposeEndpointMutation.mutate({ resourcePath }); + setTimeout(endpointListQuery.refetch); + }; + + const hideEndpointMutation = trpc["endpoint.hide"].useMutation(); + const hideEndpoint = (resourcePath: string) => { + hideEndpointMutation.mutate({ resourcePath }); + setTimeout(endpointListQuery.refetch); + }; + + const getEndpoint = useCallback( + (resourcePath: string) => { + return endpointList.find((endpoint) => endpoint.id === resourcePath); + }, + [endpointList], + ); + return { + getEndpoint, endpointList, + exposeEndpoint, + hideEndpoint, }; }; diff --git a/apps/wing-console/console/ui/src/services/use-explorer.tsx b/apps/wing-console/console/ui/src/services/use-explorer.tsx index 7051395d2c3..53ba21ec623 100644 --- a/apps/wing-console/console/ui/src/services/use-explorer.tsx +++ b/apps/wing-console/console/ui/src/services/use-explorer.tsx @@ -18,6 +18,7 @@ const createTreeMenuItemFromExplorerTreeItem = ( resourceType={item.type} resourcePath={item.id} className="w-4 h-4" + color={item.display?.color} /> ) : undefined, children: item.childItems?.map((item) => diff --git a/apps/wing-console/console/ui/src/shared/endpoint-item.ts b/apps/wing-console/console/ui/src/shared/endpoint-item.ts index 7e4d86f7bf9..9bc7a5f0cee 100644 --- a/apps/wing-console/console/ui/src/shared/endpoint-item.ts +++ b/apps/wing-console/console/ui/src/shared/endpoint-item.ts @@ -1,5 +1,10 @@ +export type EndpointExposeStatus = "connected" | "disconnected" | "connecting"; + export interface EndpointItem { id: string; label: string; url: string; + localUrl: string; + browserSupport: boolean; + exposeStatus: EndpointExposeStatus; } diff --git a/apps/wing-console/console/ui/src/ui/edge-metadata.tsx b/apps/wing-console/console/ui/src/ui/edge-metadata.tsx index 49f9427eea8..eea537edac3 100644 --- a/apps/wing-console/console/ui/src/ui/edge-metadata.tsx +++ b/apps/wing-console/console/ui/src/ui/edge-metadata.tsx @@ -109,6 +109,7 @@ export const EdgeMetadata = ({ className="w-4 h-4" resourceType={source.type} resourcePath={source.path} + color={source.display?.color} />
{source.id}
@@ -132,6 +133,7 @@ export const EdgeMetadata = ({ className="w-4 h-4" resourceType={target.type} resourcePath={target.path} + color={target.display?.color} />
{target.id}
diff --git a/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx b/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx index 10357ccbfd3..22f4f150133 100644 --- a/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx +++ b/apps/wing-console/console/ui/src/ui/elk-map-nodes.tsx @@ -1,49 +1,65 @@ import type { IconComponent } from "@wingconsole/design-system"; import { useTheme } from "@wingconsole/design-system"; +import type { Colors } from "@wingconsole/design-system/src/utils/colors"; import type { BaseResourceSchema, NodeDisplay } from "@wingconsole/server"; import classNames from "classnames"; import type { PropsWithChildren } from "react"; import { memo, useMemo } from "react"; +const colorSet: Record = { + orange: "bg-orange-500 dark:bg-orange-600", + sky: "bg-sky-500 dark:bg-sky-600", + emerald: "bg-emerald-500 dark:bg-emerald-600", + lime: "bg-lime-500 dark:bg-lime-600", + pink: "bg-pink-500 dark:bg-pink-600", + amber: "bg-amber-500 dark:bg-amber-600", + cyan: "bg-cyan-500 dark:bg-cyan-600", + purple: "bg-purple-500 dark:bg-purple-600", + red: "bg-red-700 dark:bg-red-600", + violet: "bg-violet-500 dark:bg-violet-600", + slate: "bg-slate-400 dark:bg-slate-600", +}; + const getResourceBackgroudColor = ( resourceType: BaseResourceSchema["type"] | undefined, + color: Colors = "slate", ) => { switch (resourceType) { case "@winglang/sdk.cloud.Bucket": { - return "bg-orange-500 dark:bg-orange-600"; + return colorSet.orange; } case "@winglang/sdk.cloud.Function": { - return "bg-sky-500 dark:bg-sky-600"; + return colorSet.sky; } case "@winglang/sdk.cloud.Queue": { - return "bg-emerald-500 dark:bg-emerald-600"; + return colorSet.emerald; } case "@winglang/sdk.cloud.Counter": { - return "bg-lime-500 dark:bg-lime-600"; + return colorSet.lime; } case "@winglang/sdk.cloud.Topic": { - return "bg-pink-500 dark:bg-pink-600"; + return colorSet.pink; } case "@winglang/sdk.cloud.Api": { - return "bg-amber-500 dark:bg-amber-600"; + return colorSet.amber; } case "@winglang/sdk.ex.Table": { - return "bg-cyan-500 dark:bg-cyan-600"; + return colorSet.cyan; } case "@winglang/sdk.cloud.Schedule": { - return "bg-purple-500 dark:bg-purple-600"; + return colorSet.purple; } case "@winglang/sdk.ex.Redis": { - return "bg-red-700 dark:bg-red-600"; + return colorSet.red; } case "@winglang/sdk.cloud.Website": { - return "bg-violet-500 dark:bg-violet-600"; + return colorSet.violet; } case "@winglang/sdk.ex.ReactApp": { - return "bg-sky-500 dark:bg-sky-600"; + return colorSet.sky; } default: { - return "bg-slate-400 dark:bg-slate-600"; + return colorSet[color] ?? colorSet.slate; } } }; @@ -79,8 +95,8 @@ export const ContainerNode = memo( }: PropsWithChildren) => { const { theme } = useTheme(); const bgColor = useMemo( - () => getResourceBackgroudColor(resourceType), - [resourceType], + () => getResourceBackgroudColor(resourceType, display?.color as Colors), + [resourceType, display?.color], ); const compilerNamed = useMemo(() => { diff --git a/apps/wing-console/console/ui/src/ui/endpoint-interaction.tsx b/apps/wing-console/console/ui/src/ui/endpoint-interaction.tsx new file mode 100644 index 00000000000..1c75481b6d2 --- /dev/null +++ b/apps/wing-console/console/ui/src/ui/endpoint-interaction.tsx @@ -0,0 +1,85 @@ +import { useTheme, Button, Attribute } from "@wingconsole/design-system"; +import classNames from "classnames"; +import { useId, useMemo } from "react"; + +import type { EndpointItem } from "../shared/endpoint-item.js"; + +export interface EndpointInteractionProps { + endpoint: EndpointItem | undefined; + exposeEndpoint: () => void; + hideEndpoint: () => void; +} + +export const EndpointInteraction = ({ + endpoint, + exposeEndpoint, + hideEndpoint, +}: EndpointInteractionProps) => { + const { theme } = useTheme(); + + const toggleId = useId(); + const publicUrl = useMemo(() => { + if (!endpoint) { + return ""; + } + + if (endpoint.exposeStatus === "connected") { + return endpoint.url; + } + + return ""; + }, [endpoint]); + + return ( +
+
+ + + + +
+ + + {(endpoint?.exposeStatus === "disconnected" || + endpoint?.exposeStatus === "connecting") && ( + + )} + + {endpoint?.exposeStatus === "connected" && ( + + )} +
+
+
+ ); +}; diff --git a/apps/wing-console/console/ui/src/ui/endpoint-tree.tsx b/apps/wing-console/console/ui/src/ui/endpoint-tree.tsx index 193d35b3e06..4346dcbc443 100644 --- a/apps/wing-console/console/ui/src/ui/endpoint-tree.tsx +++ b/apps/wing-console/console/ui/src/ui/endpoint-tree.tsx @@ -1,4 +1,9 @@ -import { GlobeAltIcon, LinkIcon } from "@heroicons/react/24/outline"; +import { + GlobeAltIcon, + LinkIcon, + ShareIcon, + EyeSlashIcon, +} from "@heroicons/react/24/outline"; import { ScrollableArea, Toolbar, @@ -14,9 +19,15 @@ import { NoEndpoints } from "./no-endpoints.js"; export interface EndpointTreeProps { endpointList: EndpointItem[]; + exposeEndpoint: (resourcePath: string) => void; + hideEndpoint: (resourcePath: string) => void; } -export const EndpointTree = ({ endpointList }: EndpointTreeProps) => { +export const EndpointTree = ({ + endpointList, + exposeEndpoint, + hideEndpoint, +}: EndpointTreeProps) => { const { theme } = useTheme(); return ( @@ -69,6 +80,37 @@ export const EndpointTree = ({ endpointList }: EndpointTreeProps) => { )} } + secondaryLabel={ + <> + {endpoint.exposeStatus !== "connected" && ( + { + exposeEndpoint(endpoint.id); + }} + /> + )} + {endpoint.exposeStatus === "connected" && ( + { + hideEndpoint(endpoint.id); + }} + /> + )} + + } /> ))} diff --git a/apps/wing-console/console/ui/src/ui/explorer.tsx b/apps/wing-console/console/ui/src/ui/explorer.tsx index 334046ff37d..0018818af70 100644 --- a/apps/wing-console/console/ui/src/ui/explorer.tsx +++ b/apps/wing-console/console/ui/src/ui/explorer.tsx @@ -44,7 +44,7 @@ const createTreeMenuItemFromExplorerTreeItem = ( resourceType={item.type} resourcePath={item.label} className="w-4 h-4" - // darkenOnGroupHover + color={item.display?.color} /> ) : undefined, children: item.childItems?.map((item) => diff --git a/apps/wing-console/console/ui/src/ui/resource-metadata.tsx b/apps/wing-console/console/ui/src/ui/resource-metadata.tsx index b64dbac250e..b2ab592d0e4 100644 --- a/apps/wing-console/console/ui/src/ui/resource-metadata.tsx +++ b/apps/wing-console/console/ui/src/ui/resource-metadata.tsx @@ -125,6 +125,7 @@ interface Relationship { id: string; path: string; type: string; + display?: NodeDisplay; } export interface MetadataNode { @@ -252,6 +253,7 @@ export const ResourceMetadata = memo( resourceType={relationship.type} resourcePath={relationship.path} className="w-4 h-4" + color={relationship.display?.color} /> ), })), @@ -269,6 +271,7 @@ export const ResourceMetadata = memo( resourceType={relationship.type} resourcePath={relationship.path} className="w-4 h-4" + color={relationship.display?.color} /> ), })), @@ -309,6 +312,7 @@ export const ResourceMetadata = memo( className="w-6 h-6" resourceType={node.type} resourcePath={node.path} + color={node.display?.color} /> @@ -322,7 +326,7 @@ export const ResourceMetadata = memo( {resourceUI.data && resourceUI.data.length > 0 && ( toggleInspectorSection("resourceUI")} headingClassName="pl-2" diff --git a/apps/wing/src/commands/init.ts b/apps/wing/src/commands/init.ts index 1c0bda96905..1d2d212a928 100644 --- a/apps/wing/src/commands/init.ts +++ b/apps/wing/src/commands/init.ts @@ -2,7 +2,7 @@ // to avoid a conflict with the "new" keyword in JavaScript import { exec } from "child_process"; import { existsSync, constants } from "fs"; -import { copyFile, mkdir, readFile, readdir, writeFile } from "fs/promises"; +import { cp, mkdir, readFile, readdir, writeFile } from "fs/promises"; import { join, relative } from "path"; import { promisify } from "util"; import chalk from "chalk"; @@ -179,7 +179,7 @@ export async function init(template: string, options: InitOptions = {}): Promise console.log(`Created a new ${chalk.cyan(template)} project in the current directory! 🎉`); console.log(); - console.log("Not sure where to get started? Try running:"); + console.log("Not sure where to get started? In your Wing application folder, try running:"); console.log(); console.log(" wing compile - build your project"); console.log(" wing it - simulate your app in the Wing Console"); @@ -202,7 +202,7 @@ async function copyFiles(src: string, dest: string): Promise { // Copy all files const files = await getFiles(src); for (const file of files) { - await copyFile(join(src, file), join(dest, file)); + await cp(join(src, file), join(dest, file)); } } diff --git a/apps/wing/src/commands/test/test.test.ts b/apps/wing/src/commands/test/test.test.ts index f6432aa9845..a350bb2181a 100644 --- a/apps/wing/src/commands/test/test.test.ts +++ b/apps/wing/src/commands/test/test.test.ts @@ -406,7 +406,7 @@ const EXAMPLE_TEST_RESULTS: Array = [ { data: { message: "Get (key=file.txt).", status: "failure", error: {} }, type: TraceType.RESOURCE, - sourcePath: "root/env0/MyProcessor/cloud.Bucket", + sourcePath: "root/env0/MyProcessor/Bucket", sourceType: "@winglang/sdk.cloud.Bucket", timestamp: "2023-05-15T16:20:47.388Z", }, @@ -439,13 +439,13 @@ const BUCKET_TEST_RESULT = [ { data: { message: "Put (key=test1.txt).", status: "success" }, type: "resource", - sourcePath: "root/env0/cloud.Bucket", + sourcePath: "root/env0/Bucket", sourceType: "@winglang/sdk.cloud.Bucket", }, { data: { message: "Get (key=test1.txt).", status: "success", result: '"Foo"' }, type: "resource", - sourcePath: "root/env0/cloud.Bucket", + sourcePath: "root/env0/Bucket", sourceType: "@winglang/sdk.cloud.Bucket", }, { @@ -471,7 +471,7 @@ const OUTPUT_FILE = { status: "success", }, type: "resource", - sourcePath: "root/env0/cloud.Bucket", + sourcePath: "root/env0/Bucket", sourceType: "@winglang/sdk.cloud.Bucket", }, { @@ -481,7 +481,7 @@ const OUTPUT_FILE = { result: '"Foo"', }, type: "resource", - sourcePath: "root/env0/cloud.Bucket", + sourcePath: "root/env0/Bucket", sourceType: "@winglang/sdk.cloud.Bucket", }, { diff --git a/apps/wingcli-v2/src/main.rs b/apps/wingcli-v2/src/main.rs index ecbf9f121e0..9302dc2cdc2 100644 --- a/apps/wingcli-v2/src/main.rs +++ b/apps/wingcli-v2/src/main.rs @@ -145,6 +145,8 @@ fn run_javascript_node(source_file: &Utf8Path, target_dir: &Utf8Path, target: Ta command.env("WING_PLATFORMS", target.to_string()); command.env("WING_SOURCE_DIR", source_dir); command.env("WING_SYNTH_DIR", target_dir); + + tracing::info!("Running command: {:?}", command); let status = command.status()?; if !status.success() { return Err("Node.js failed".into()); diff --git a/docs/docs/02-concepts/03-platforms.md b/docs/docs/02-concepts/03-platforms.md index 7a3f9108706..aa5ab0f2144 100644 --- a/docs/docs/02-concepts/03-platforms.md +++ b/docs/docs/02-concepts/03-platforms.md @@ -7,8 +7,6 @@ keywords: [platforms, targets, target, platform, aws, gcp, azure, sim, terraform When working with the Wing programming language, an integral part of the compilation process is the use of platform. In essence, platform specify how and where your application is deployed. They determine both the cloud environment and the provisioning engine that the code will be deployed with. -## Platforms - You can view the list of available builtin platform with the `wing compile --help` command. Here is an example of the output: ```sh @@ -40,6 +38,29 @@ The order in which platforms are evaluated is important. The first platform in the list is the primary platform, it is responsible for providing the Wing compiler with the base App that will be used to determine how resources are created, as well it will also lay the ground work for what target the rest of the platforms will need to be compatible with. +#### Implicit Platforms + +Additionally, you can use naming conventions to implicitly define platforms that should be used. These platform files can be located in the root of your project or in a library that your project uses. The naming convention is as follows: +```sh +wplatform.js +*.wplatform.js +``` + +For example, if you have a file named `custom.wplatform.js` in the root of your project, it will automatically be added to the list of platforms to be used when compiling your application. Its also important to note that implicit platforms are always loaded after the platforms specified in the `--platform` option. + +The use of implicit platforms can be beneficial when writing a Wing library that requires a specific platform to be used. For example, if you are writing a library that requires a specific parameter to be passed to the platform, you can use an implicit platform to ensure that the parameter is always provided. + +For example, if your library structure looks like this: + +```sh +my-library/ + lib.w + custom.wplatform.js +``` + +Then the custom platform can define any required parameters that the library needs to function properly. (see [Defining Custom Platform Parameters](#defining-custom-platform-parameters) for more information on how to define custom platform parameters) + + ### Provisioning Engines Provisioning is the process of setting up and creating infrastructure, and the provisioning engine is the driver behind this deployment. Common engines used in the Wing compilation process include Terraform and AWS CDK, with support for more planned ([tracking issue](https://github.com/winglang/wing/issues/2066)). @@ -83,11 +104,17 @@ Though this may be a bit verbose. As an alternative you can use a values file. V Here is an example of using a `wing.toml` file to provide the same parameters as above: ```toml -[tf-aws] -vpc = "existing" -vpcId = "vpc-1234567890" -privateSubnetId = "subnet-1234567890" -publicSubnetId = "subnet-1234567890" +[ tf-aws ] +# vpc can be set to "new" or "existing" +vpc = "new" +# vpc_lambda will ensure that lambda functions are created within the vpc on the private subnet +vpc_lambda = true +# vpc_api_gateway will ensure that the api gateway is created within the vpc on the private subnet +vpc_api_gateway = true +# The following parameters will be required if using "existing" vpc +# vpc_id = "vpc-123xyz" +# private_subnet_ids = ["subnet-123xyz"] +# public_subnet_ids = ["subnet-123xyz"] ``` #### Target-specific code diff --git a/docs/docs/04-standard-library/cloud/function.md b/docs/docs/04-standard-library/cloud/function.md index 1bee51ef7b6..67935a2a23d 100644 --- a/docs/docs/04-standard-library/cloud/function.md +++ b/docs/docs/04-standard-library/cloud/function.md @@ -56,12 +56,12 @@ new cloud.Function(inflight () => { ## Function container reuse -Most cloud providers will opportunistically reuse the function's container in additional invocations. It is possible -to leverage this behavior to cache objects across function executions using `inflight new` and inflight fields. +Most cloud providers will opportunistically reuse the function's container in additional invocations. +It is possible to leverage this behavior to cache objects across function executions using `inflight new` and inflight fields. The following example reads the `bigdata.json` file once and reuses it every time `query()` is called. -```js +```ts playground bring cloud; let big = new cloud.Bucket(); @@ -95,6 +95,14 @@ new cloud.Function(inflight () => { The sim implementation of `cloud.Function` runs the inflight code as a JavaScript function. +By default, a maximum of 10 workers can be processing requests sent to a `cloud.Function` concurrently, but this number can be adjusted with the `concurrency` property: + +```ts playground +new cloud.Function(inflight () => { + // ... code that shouldn't run concurrently ... +}, concurrency: 1); +``` + ### AWS (`tf-aws` and `awscdk`) The AWS implementation of `cloud.Function` uses [AWS Lambda](https://aws.amazon.com/lambda/). @@ -325,6 +333,7 @@ let FunctionProps = cloud.FunctionProps{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -332,6 +341,19 @@ let FunctionProps = cloud.FunctionProps{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/cloud/on-deploy.md b/docs/docs/04-standard-library/cloud/on-deploy.md index 01e9f366986..cc9dcff725a 100644 --- a/docs/docs/04-standard-library/cloud/on-deploy.md +++ b/docs/docs/04-standard-library/cloud/on-deploy.md @@ -175,6 +175,7 @@ let OnDeployProps = cloud.OnDeployProps{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -184,6 +185,19 @@ let OnDeployProps = cloud.OnDeployProps{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/cloud/queue.md b/docs/docs/04-standard-library/cloud/queue.md index 9f2bd038fc9..43437098810 100644 --- a/docs/docs/04-standard-library/cloud/queue.md +++ b/docs/docs/04-standard-library/cloud/queue.md @@ -309,6 +309,7 @@ let QueueSetConsumerOptions = cloud.QueueSetConsumerOptions{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -317,6 +318,19 @@ let QueueSetConsumerOptions = cloud.QueueSetConsumerOptions{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/cloud/schedule.md b/docs/docs/04-standard-library/cloud/schedule.md index 18c450e8e7f..766c745eb03 100644 --- a/docs/docs/04-standard-library/cloud/schedule.md +++ b/docs/docs/04-standard-library/cloud/schedule.md @@ -192,6 +192,7 @@ let ScheduleOnTickOptions = cloud.ScheduleOnTickOptions{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -199,6 +200,19 @@ let ScheduleOnTickOptions = cloud.ScheduleOnTickOptions{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/cloud/service.md b/docs/docs/04-standard-library/cloud/service.md index 32c1bb3f280..7e46f047c35 100644 --- a/docs/docs/04-standard-library/cloud/service.md +++ b/docs/docs/04-standard-library/cloud/service.md @@ -314,6 +314,7 @@ let ServiceOnStartOptions = cloud.ServiceOnStartOptions{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -321,6 +322,19 @@ let ServiceOnStartOptions = cloud.ServiceOnStartOptions{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/cloud/topic.md b/docs/docs/04-standard-library/cloud/topic.md index 1c8aa979ce5..74e3342b164 100644 --- a/docs/docs/04-standard-library/cloud/topic.md +++ b/docs/docs/04-standard-library/cloud/topic.md @@ -256,6 +256,7 @@ let TopicOnMessageOptions = cloud.TopicOnMessageOptions{ ... }; | **Name** | **Type** | **Description** | | --- | --- | --- | +| concurrency | num | The maximum concurrent invocations that can run at one time. | | env | MutMap<str> | Environment variables to pass to the function. | | logRetentionDays | num | Specifies the number of days that function logs will be kept. | | memory | num | The amount of memory to allocate to the function, in MB. | @@ -263,6 +264,19 @@ let TopicOnMessageOptions = cloud.TopicOnMessageOptions{ ... }; --- +##### `concurrency`Optional + +```wing +concurrency: num; +``` + +- *Type:* num +- *Default:* platform specific limits (100 on the simulator) + +The maximum concurrent invocations that can run at one time. + +--- + ##### `env`Optional ```wing diff --git a/docs/docs/04-standard-library/std/node.md b/docs/docs/04-standard-library/std/node.md index 14832603a3a..86b8067d357 100644 --- a/docs/docs/04-standard-library/std/node.md +++ b/docs/docs/04-standard-library/std/node.md @@ -269,6 +269,7 @@ Invokes the `validate()` method on all validations added through | root | constructs.IConstruct | Returns the root of the construct tree (the `cloud.App` object). | | scopes | MutArray<constructs.IConstruct> | All parent scopes of this construct. | | scope | constructs.IConstruct | Returns the scope in which this construct is defined. | +| color | str | The color of the construct for display purposes. | | defaultChild | constructs.IConstruct | Returns the child construct that has the id `Default` or `Resource"`. | | description | str | Description of the construct for display purposes. | | hidden | bool | Whether the construct should be hidden by default in tree visualizations. | @@ -438,6 +439,31 @@ The value is `undefined` at the root of the construct scope tree. --- +##### `color`Optional + +```wing +color: str; +``` + +- *Type:* str + +The color of the construct for display purposes. + +Supported colors are: +- orange +- sky +- emerald +- lime +- pink +- amber +- cyan +- purple +- red +- violet +- slate + +--- + ##### `defaultChild`Optional ```wing diff --git a/docs/docs/055-platforms/_category_.yml b/docs/docs/055-platforms/_category_.yml new file mode 100644 index 00000000000..3e7b49bbf48 --- /dev/null +++ b/docs/docs/055-platforms/_category_.yml @@ -0,0 +1,6 @@ +label: Platforms +collapsible: true +collapsed: true +link: + type: generated-index + title: Platforms diff --git a/docs/docs/055-platforms/awscdk.md b/docs/docs/055-platforms/awscdk.md new file mode 100644 index 00000000000..d73b2dbe838 --- /dev/null +++ b/docs/docs/055-platforms/awscdk.md @@ -0,0 +1,78 @@ +--- +title: AWS CDK +id: awscdk +sidebar_label: awscdk +description: AWS CDK platform +keywords: [Wing reference, Wing language, language, Wing language spec, Wing programming language, aws, awscdk, amazon web services, cloudformation] +--- + +The `@winglang/platform-awscdk` [platform](../02-concepts/03-platforms.md) compiles your program for the AWS CDK (CloudFormation). + +## Usage + +You will need to install the `@winglang/platform-awscdk` library in order to use this platform. + +```sh +$ npm i @winglang/platform-awscdk +``` + +This platform requires the environment variable `CDK_STACK_NAME` to be set to the name of the CDK +stack to synthesize. + +```sh +$ export CDK_STACK_NAME="my-project" +$ wing compile --platform @winglang/platform-awscdk [entrypoint] +``` + +## Parameters + +The `CDK_STACK_NAME` environment variable specifies the name of the CDK stack to synthesize. + +## Output + +The output includes both a AWS-CDK configuration file (under `target/.awscdk`) and +JavaScript bundles that include inflight code that executes on compute platforms such as AWS Lambda. + +## Deployment + +To deploy your app, you will first need to install the [AWS CDK +CLI](https://docs.aws.amazon.com/cdk/v2/guide/cli.html). + +If not previously done, you will need to bootstrap your environment (account/region): + +```sh +$ cd bootstrap --app target/app.awscdk +``` + +And then you can deploy: + +```sh +$ cdk deploy --app target/app.awscdk +``` + +## Customizations + +### Custom CDK Stack + +The `App` class has a `stackFactory` property that can be used to customize how the root CDK stack +is created. + +To use this, create a custom platform like this: + +```js +import { App } from "@winglang/platform-awscdk"; +import { platform } from "@winglang/sdk"; + +export class Platform implements platform.IPlatform { + public readonly target = "awscdk"; + public newApp?(appProps: any): any { + return new App({ + ...appProps, + stackFactory: (app: cdk.App, stackName: string) => { + // customize here! + return new cdk.Stack(app, stackName); + } + }); + } +} +``` diff --git a/docs/docs/055-platforms/sim.md b/docs/docs/055-platforms/sim.md new file mode 100644 index 00000000000..8131ab66e4e --- /dev/null +++ b/docs/docs/055-platforms/sim.md @@ -0,0 +1,35 @@ +--- +title: Wing Cloud Simulator +id: sim +sidebar_label: sim +description: Simulator Platform +keywords: [Wing reference, Wing language, language, Wing language spec, Wing programming language, simulator, sim, wing simulator] +--- + +The Wing Cloud Simulator is a tool for running Wing applications on a single host. It offers a +simple localhost implementation of all the resources of the Wing Cloud Library to allow developers +to develop and functionally test cloud applications without having to deploy to the cloud. + +The `sim` [platform](../02-concepts/03-platforms.md) compiles your program so it can run in the +Wing Cloud Simulator. + +## Usage + +```sh +$ wing compile [entrypoint] --platform sim +``` + +## Parameters + +No parameters. + +## Output + +The output will be found under `target/.wsim`. + +## Deployment + +The Wing Simulator can be used in one of these methods: + +* Interactively through the [Wing Console](/docs/start-here/local) +* Using the `wing run|it target/.wsim` command through the Wing CLI. diff --git a/docs/docs/055-platforms/tf-aws.md b/docs/docs/055-platforms/tf-aws.md new file mode 100644 index 00000000000..d09ddfb7484 --- /dev/null +++ b/docs/docs/055-platforms/tf-aws.md @@ -0,0 +1,47 @@ +--- +title: Terraform/AWS +id: tf-aws +sidebar_label: tf-aws +description: Terraform/AWS platform +keywords: [Wing reference, Wing language, language, Wing language spec, Wing programming language, cli, terraform, aws, tf-aws, tfaws, amazon web services, platform] +--- + +The `tf-gcp` [platform](../02-concepts/03-platforms.md) compiles your program for Terraform and run on AWS. + +## Usage + +```sh +$ wing compile --platform tf-aws [entrypoint] +``` + +## Parameters + +The `tf-aws` platform supports the following parameters (in `wing.toml`): + +* `vpc` - Determine whether to create a new VPC or use an existing one. Allowed values: `"new"` or `"existing"`. +* `private_subnet_ids` (array of strings) - If using an existing VPC, provide the private subnet IDs. +* `public_subnet_ids` (array of strings) - If using an existing VPC, provide the public subnet IDs. +* `vpc_api_gateway` (boolean) - Whether Api gateways should be deployed in a VPC. +* `vpc_lambda` (boolean) - Whether Lambda functions should be deployed in a VPC. + +Example `wing.toml`: + +```toml +[ tf-aws ] +vpc = "new" +vpc_lambda = true +vpc_api_gateway = true +vpc_id = "vpc-123xyz" +private_subnet_ids = ["subnet-123xyz"] +public_subnet_ids = ["subnet-123xyz"] +``` + + +## Output + +The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and +JavaScript bundles that include inflight code that executes on compute platform such as AWS Lambda. + +## Deployment + +You can deploy your stack to AWS using Terraform ([instructions](/docs/start-here/aws)). diff --git a/docs/docs/055-platforms/tf-azure.md b/docs/docs/055-platforms/tf-azure.md new file mode 100644 index 00000000000..c9ed4a6f11d --- /dev/null +++ b/docs/docs/055-platforms/tf-azure.md @@ -0,0 +1,28 @@ +--- +title: Terraform/Azure +id: tf-azure +sidebar_label: tf-azure +description: Terraform/Azure platform +keywords: [Wing reference, Wing language, language, Wing language spec, Wing programming language, cli, terraform, tf-azure, azure, microsoft azure, platform] +--- + +The `tf-azure` [platform](../02-concepts/03-platforms.md) compiles your program for Terraform and run on Azure. + +## Usage + +```sh +$ export AZURE_LOCATION="East US" +$ wing compile [entrypoint] --platform tf-azure +``` + +## Parameters + +The environment variable `AZURE_LOCATION` is required and indicates the [deployment +location](https://github.com/claranet/terraform-azurerm-regions/blob/master/REGIONS.md) of your +stack. + +## Output + +The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and +JavaScript bundles that include inflight code that executes on compute platform such as Azure +Functions. diff --git a/docs/docs/055-platforms/tf-gcp.md b/docs/docs/055-platforms/tf-gcp.md new file mode 100644 index 00000000000..4c11fc555ab --- /dev/null +++ b/docs/docs/055-platforms/tf-gcp.md @@ -0,0 +1,29 @@ +--- +title: Terraform/GCP +id: tf-gcp +sidebar_label: tf-gcp +description: Terraform/GCP platform +keywords: [Wing reference, Wing language, language, Wing language spec, Wing programming language, cli, terraform, tf-gcp, gcp, google cloud platform, platform] +--- + +The `tf-gcp` [platform](../02-concepts/03-platforms.md) compiles your program for Terraform and run on Google Cloud Platform. + +## Usage + +```sh +$ export GOOGLE_PROJECT_ID="my-project" +$ export GOOGLE_STORAGE_LOCATION="US" +$ wing compile [entrypoint] --platform tf-gcp +``` + +## Parameters + +The environment variable `GOOGLE_STORAGE_LOCATION` is required and indicates the [deployment +location](https://cloud.google.com/storage/docs/locations) of all storage +resources (such as buckets and queues). + +The environment variable `GOOGLE_PROJECT_ID` is required and indicates +the project ID of your stack. + +The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and +JavaScript bundles that include inflight code that executes on compute platform such as Google Cloud Functions. diff --git a/docs/docs/06-tools/01-cli.md b/docs/docs/06-tools/01-cli.md index d27cf9ab216..1abbbf6712e 100644 --- a/docs/docs/06-tools/01-cli.md +++ b/docs/docs/06-tools/01-cli.md @@ -70,108 +70,16 @@ By default, `wing compile` will look for exactly one file named `main.w` or endi ::: -The --platform option specifies the target platform to compile for. The default platform is `sim`. -The following platforms are built-in: +The --platform option (or `-t`) specifies the target platform to compile for. The default platform +is `sim`. -* `sim` - [Wing Simulator](#sim-target) -* `tf-aws` - Terraform/AWS -* `tf-azure` - Terraform/Azure -* `tf-gcp` - Terraform/Google Cloud Platform +You can use one of the built-in platform providers: -### `sim` Platform - -The Wing program is going to be compiled for the Wing simulator (`.wsim`). - -Usage: - -```sh -$ wing compile [entrypoint] --platform sim -``` - -The output will be found under `target/.wsim` and can be opened in two ways: - -* Interactively through the [Wing Console](/docs/start-here/local) -* Using the `wing run|it target/.wsim` command through the Wing CLI. - - -### `tf-aws` Platform - -Compiles your program for Terraform and run on AWS. - -Usage: - -```sh -$ wing compile [entrypoint] --platform tf-aws -``` - -The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and -JavaScript bundles that include inflight code that executes on compute platform such as AWS Lambda. - -You can deploy your stack to AWS using Terraform ([instructions](/docs/start-here/aws)). - - - -### `tf-azure` Platform - -Compiles your program for Terraform and run on Azure. - -Usage: - -```sh -$ export AZURE_LOCATION="East US" -$ wing compile [entrypoint] --platform tf-azure -``` - -The variable `AZURE_LOCATION` is required and indicates the [deployment -location](https://github.com/claranet/terraform-azurerm-regions/blob/master/REGIONS.md) of your -stack. - -The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and -JavaScript bundles that include inflight code that executes on compute platform such as Azure -Functions. - -### `tf-gcp` Platform - -Compiles your program for Terraform and run on Google Cloud Platform. - -Usage: - -```sh -$ export GOOGLE_PROJECT_ID="my-project" -$ export GOOGLE_STORAGE_LOCATION="US" -$ wing compile [entrypoint] --platform tf-gcp -``` - -The variable `GOOGLE_STORAGE_LOCATION` is required and indicates the [deployment -location](https://cloud.google.com/storage/docs/locations) of all storage -resources (such as buckets and queues). The variable `GOOGLE_PROJECT_ID` is required and indicates -the project ID of your stack. - -The output includes both a Terraform configuration file (under `target/cdktf.out/stacks/root`) and -JavaScript bundles that include inflight code that executes on compute platform such as Google Cloud Functions. - - -### `awscdk` Platform - -Compiles your program for AWS CDK with CloudFormation to run on AWS. - -Usage: - -```sh -# npm init is only needed if you don't already have a package.json file -$ npm init -y -$ npm i @winglang/platform-awscdk -$ export CDK_STACK_NAME="my-project" -$ wing compile --platform @winglang/platform-awscdk [entrypoint] -``` - -The output includes both a AWS-CDK configuration file (under `target/.awscdk`) and -JavaScript bundles that include inflight code that executes on compute platforms such as AWS Lambda. - -You can deploy your stack to AWS by installing the [AWS CDK Toolkit](https://docs.aws.amazon.com/cdk/v2/guide/cli.html) and running: -```sh -$ cdk deploy --app target/app.awscdk -``` +* [Wing Cloud Simulator](../055-platforms/sim.md) - `sim` +* [Terraform/AWS](../055-platforms/tf-aws.md) - `tf-aws` +* [Terraform/Azure](../055-platforms/tf-azure.md) - `tf-azure` +* [Terraform/GCP](../055-platforms/tf-gcp.md) - `tf-gcp` +* [AWS CDK](../055-platforms/awscdk.md) - `@winglang/platform-awscdk` ## Test: `wing test` diff --git a/docs/docs/08-guides/03-react-vite-websockets.md b/docs/docs/08-guides/03-react-vite-websockets.md index 2f0878708a2..5e0f3eb20a8 100644 --- a/docs/docs/08-guides/03-react-vite-websockets.md +++ b/docs/docs/08-guides/03-react-vite-websockets.md @@ -6,215 +6,356 @@ keywords: [Websockets, React, Vite, Local, Wing] # React, Vite & WebSockets -In this guide, we will build a simple React web application with a Wing backend. +In this guide, we will build a simple web application with React for our frontend and Wing for our backend. +We will develop and test our application using the Wing Simulator and deploy it to AWS using [Terraform](https://www.terraform.io/). -The webapp will have a counter that can be incremented by clicking on it. This counter will increment a distributed counter deployed via the Wing backend. We will also demonstrate how to use websockets in order to get real-time updates from the backend every time the counter is updated from any other webpage. +Our application will have a counter that can be incremented by clicking on it. This counter will be +synchronized in real-time across all users via a distributed cloud counter and WebSockets. -## Prerequisites +> 🚧 Wing is still under active development, so don't be (too) surprised if you run into issues or bugs +> along the way. You are invited to [join the Wing Slack](https://t.winglang.io/slack) to say hi, ask questions +> and help your fellow Wingnuts. + +## How to use this guide? -- Node.js v20 or later. -- Wing supports two popular IDEs with syntax highlighting, completions, go-to-definition and an embedded Wing Simulator: +This guide is written as a tutorial and intended to be followed step-by-step. At the end of each step, you should be able to find the +full source code in a collapsable section. +You can also find the entire project in [GitHub](https://github.com/winglang/guide-react-vite-websockets). + +## Prerequisites + +- [Node.js](https://nodejs.org/en) v20 or later. +- IDE support (syntax highlighting, code completions and more): - [VSCode](https://marketplace.visualstudio.com/items?itemName=Monada.vscode-wing) - Official extension - - [IntelliJ](https://plugins.jetbrains.com/plugin/22353-wing) - Community extension + - [IntelliJ](https://plugins.jetbrains.com/plugin/22353-wing) - Community-supported ## Step 1 - Installation & Scaffolding -In this step, we will be creating our project. +In this step, we will create our project. ### Creating a React App with Vite -1. Create the root project folder: - ```sh - mkdir ~/shared-counter - cd ~/shared-counter - ``` -2. Create a new React app using Vite under the frontend folder: - ```sh - npm create vite frontend -- --template react-ts - ``` -3. Run your React app and ensure it works: - ```sh - cd frontend - npm install - npm run dev - ``` -> The result should be a very simple webpage that runs locally and works without any backend (note the counter is not shared between tabs). +1. Create our project folder: + + ```sh + mkdir ~/shared-counter + cd ~/shared-counter + ``` + +2. Create a new React app using Vite under the `frontend` directory: + + ```sh + npm create -y vite frontend -- --template react-ts + ``` + +3. Let's ensure your new frontend works: + + ```sh + cd frontend + npm install + npm run dev + ``` + + > The result should be a very simple webpage that runs locally and works without a backend. If you + > open multiple browser tabs you'll see that the counter is not synchronized. 4. Press Ctrl-C to return to the CLI prompt. ### Creating a Wing backend +Now, we will create our backend for our app: + 1. Install Wing: - ```sh - npm install -g winglang - # Verify installation - wing -V - ``` + + ```sh + npm install -g winglang + wing -V # should be >= 0.60.1 + ``` + 2. Create a `backend` directory under the project root: - ```sh - mkdir ~/shared-counter/backend - cd ~/shared-counter/backend - ``` + + ```sh + mkdir ~/shared-counter/backend + cd ~/shared-counter/backend + ``` + 3. Generate a new empty Wing project: - ```sh - wing new empty - ``` -> This will generate three files: `package.json`, `package-lock.json` and `main.w` file with a simple hello-world `Cloud.Function` -4. Run this project inside Wing Simulator -```sh -wing run main.w -``` -> The result should be a page that displays a single `Cloud.Function`; if you invoke it, it should show `hello, world` in the response section. -5. Invoke the cloud.Function to see that response. + ```sh + wing new empty + ``` + + > This will generate three files: `package.json`, `package-lock.json` and `main.w` file with a + > simple "hello world" program + +4. Let's run our new application in the Wing Simulator: + + ```sh + wing it + ``` + + > The Wing Simulator will be opened in your browser and will show a map of your app with a single + > function. + > + > ![image](https://github.com/winglang/wing/assets/598796/1ba40358-e833-4583-9c14-2efd160ffdc6) + +5. Now, let's invoke our function from the interaction panel and check out the result. + + > ![image](https://github.com/winglang/wing/assets/598796/42c7820f-09ec-4fa2-abc6-18a717d60ab9) + 6. Ctrl-C to go back to CLI prompt. ## Step 2 - Hello `@winglibs/vite` -In the previous step, we used `npm run dev` to start the local web server. +In the previous step, we used `npm run dev` to start the local web server. In this step, we will install the `@winglibs/vite` package responsible for starting the dev server. -We will also pass information from the backend to the frontend. +We will also learn how to send static data from your backend to your frontend application. ### Install and use `@winglibs/vite` -Open VScode / Intellij on the project directory. +1. Install `@winglibs/vite`: + ```sh + cd ~/shared-counter/backend + npm i @winglibs/vite + ``` -1. Install `@winglibs/vite`: - ```sh - cd ~/shared-counter/backend - npm i -s @winglibs/vite - ``` -2. Clear `backend/main.w` from existing code, and add the following code to bring and instantiate Vite in `backend/main.w`: - ```ts - bring vite; - - new vite.Vite( - root:"../frontend" - ); - ``` -3. Run this project inside the Wing Simulator: - ```sh - wing run main.w - ``` -> You should have two web pages open: one for the React web application and another for the Wing Simulator. +2. Open up your IDE within the project root: + + ```sh + cd ~/shared-counter + code . + ``` +3. Clear `backend/main.w` from existing code, and add the following code to bring and instantiate + Vite in `backend/main.w`: + + ```ts + bring vite; + + new vite.Vite( + root: "../frontend" + ); + ``` + +3. Open the Wing Simulator again: + + ```sh + cd ~/shared-counter/backend + wing it + ``` + + > You'll notice you both the Wing Simulator and your Vite application opened. + > + > ![image](https://github.com/winglang/wing/assets/598796/6c9961bc-ac13-4ea2-a3f4-fc1e2a6543e4) + > + > You'll also notice that your Wing application has a Vite resource: + > + > ![image](https://github.com/winglang/wing/assets/598796/cbab9eab-2b9d-4523-b39d-e1fade8571c3) +` ### Sending data to your Vite app using `publicEnv` -Now that our backend has instantiated the Vite resource, -let's explore how to pass constant data from the backend to the frontend. +Now that our backend has a Vite resource, let's explore how to send static data from the backend to +the frontend. -1. Use `publicEnv` to pass the `title` from the backend to the frontend, as shown in `backend/main.w`: - ```ts - bring vite; - - new vite.Vite( - root:"../frontend", - publicEnv: { - title: "Wing + Vite + React" - } - ); - ``` -2. Notice that the React webpage now has `window.wing.env` containing this title. -You can verify it by opening javascript console under developer tools and running `console.log(window.wing.env);` -4. Use `window.wing.env.title` in `frontend/src/App.tsx`. Look for `

Vite + React

` and replace it with `

{window.wing.env.title}

`. -5. Upon saving both the Wing file and the TypeScript file, you should see the new title. +1. Edit your `backend/main.w` and add the `TITLE` environment variable to `publicEnv`: + + ```ts + bring vite; + + new vite.Vite( + root: "../frontend", + publicEnv: { + TITLE: "Wing + Vite + React" + } + ); + ``` + +2. Your web app can now access this environment variable through `window.wing.env`. You can verify + this by opening the JavaScript console under Developer Tools and running + `console.log(window.wing.env);` + + > ![image](https://github.com/winglang/wing/assets/598796/cda270e1-5b7b-402f-b533-68be131b5075) + +3. Add this line at the top of `frontend/src/App.tsx`: + + ```ts + import "../.winglibs/wing-env.d.ts" + ``` + +4. Edit `frontend/src/App.tsx` and use replace: + + ```tsx +

Vite + React

+ ``` + + with: + + ```ts +

{window.wing.env.TITLE}

+ ``` + +5. Upon saving both `main.w` and `App.tsx`, you should see the new title pop up! + + > ![image](https://github.com/winglang/wing/assets/598796/e6e5e8d9-52fc-4fdf-a600-ba00271b6ef6) ## Step 3 - Adding a counter -Now that we understand how to pass information from the backend to the frontend, we will create a backend API endpoint and provide the frontend code with a URL. +Now that we understand how to send static information from the backend to the frontend, we will create a backend API endpoint and provide the frontend code with its URL. On the frontend, we will switch from using a local counter to a backend-based counter. ### Creating a counter and read/update API routes 1. Instantiate a `cloud.Api` in `backend/main.w` by adding the following code: -```ts + + ```ts + bring vite; + bring cloud; + + let api = new cloud.Api(cors: true); + + new vite.Vite( + root: "../frontend", + publicEnv: { + TITLE: "Wing + Vite + React", + API_URL: api.url + } + ); + ``` + + > Notice that we added a new environment variable called `API_URL` to our frontend application + > which points to the URL of our API endpoint. + +2. Now, let's create a `cloud.Counter`: + + ```ts + let counter = new cloud.Counter(); + ``` + +3. Add the following routes: + + - `GET /counter` will retrieve the counter value using `counter.peek()`: + + ```ts + api.get("/counter", inflight () => { + return { + body: "{counter.peek()}" + }; + }); + ``` + + - `POST /counter` will increment the counter using `counter.inc()`: + + ```ts + api.post("/counter", inflight () => { + let prev = counter.inc(); + return { + body: "{prev + 1}" + }; + }); + ``` + +4. Jump over to the Wing Simulator to see that these routes work as expected. + + > You can click on the API and use the interaction panel to test your endpoints, you can also + > examine the counter value and even modify it. + > + > ![image](https://github.com/winglang/wing/assets/598796/90fc5b61-610c-460d-8da1-4a4d23525f2a) + +--- + +
+main.w + +```js bring vite; bring cloud; let api = new cloud.Api(cors: true); +let counter = new cloud.Counter(); + +api.get("/counter", inflight () => { + return { + body: "{counter.peek()}" + }; +}); + +api.post("/counter", inflight () => { + let prev = counter.inc(); + return { + body: "{prev + 1}" + }; +}); new vite.Vite( root: "../frontend", publicEnv: { - title: "Wing + Vite + React", + TITLE: "Wing + Vite + React", API_URL: api.url } -); +); ``` -Notice that we added a new environment variable called `API_URL` to our frontend application which points to the URL of our API endpoint. -2. Now, let's also instantiate a `cloud.Counter`: - -```ts -let counter = new cloud.Counter(); -``` -3. Add the following routes: - - A `GET /counter` for retrieving the counter value (using `counter.peek()`) - ```ts - api.get("/counter", inflight () => { - return { - status: 200, - body: "{counter.peek()}" - }; - }); - ``` - - A `POST /counter` for incrementing the counter (using `counter.inc()`) - ```ts - api.post("/counter", inflight () => { - let oldValue = counter.inc(); - return { - status: 200, - body: "{oldValue + 1}" - }; - }); - ``` -4. Experiment with the Wing Simulator to see that these routes work as expected. +
-> You can click on the API and use the right side panel to test the endpoints, -you can also examine the Counter value or even modify it. ### Edit `App.tsx` to call our backend + Let's modify our frontend code to fetch and update the counter value using the routes defined above. +1. First, store the `API_URL` in a const at the top of `frontend/src/App.tsx`: + ```ts + const API_URL = window.wing.env.API_URL; + ``` -1. First, store the `API_URL` in some variable in `frontend/src/App.tsx`: -```ts -const API_URL = window.wing.env.API_URL; -``` 2. Then, let's use React hooks to update the counter data: -- Add the import statement for `useEffect`: -```ts -import { useState, useEffect } from 'react'; -``` -- Add the code inside `function App` -```ts -// function App() { -// ... - const [count, setCount] = useState("NA") - const incrementCount = async () => { - const response = await fetch(`${API_URL}/counter`, { - method: "POST" - }); - setCount(await response.text()); - } - const getCount = async () => { - const response = await fetch(`${API_URL}/counter`); - setCount(await response.text()); - } - useEffect(() => { - getCount(); -}, []); -``` -3. Now, let's trigger the `incrementCount` function when the user clicks to increment the counter: -```ts -

@@ -266,147 +411,182 @@ function App() { export default App; ``` -4. Once you save the code, you can examine both the webpage and the Simulator to see how the counter gets incremented. -## Step 4 - Create a broadcasting service using `@winglibs/websockets` + + +## Step 4 - Synchronize browsers using `@winglibs/websockets` -In the current implementation when we open two browser side by side, we only -see the counter latest value upon refresh. In this step we will be deploying a broadcasting service -that utilize a websocket server on the backend, and connecting to that websocket from the clients. +In the current implementation, if we open two browser side-by-side, we only see the counter latest +value upon refresh. -When the counter is incremented, the broadcaster service will notify all clients that they need to fetch a -new value from our API. +In this step we will create a broadcasting service which deploys a WebSocket server on the backend. +Clients then connect to this WebSocket to receive real-time notifications when the counter is +updated. + +When the counter is incremented, the broadcaster service will notify all clients that they need to +fetch a new value from our API. ### Create a Broadcaster class -The Broadcaster class contains two public API endpoints: -- a public websocket URL that will be sent to clients +The `Broadcaster` class contains two public API endpoints: + +- a static public WebSocket URL that will be sent to clients through `publicEnv`. - an `inflight` broadcast message, that sends a message to all connected clients -1. We will be using `@winglibs/websockets`, so lets first install it -```sh -npm i -s @winglibs/websockets -``` -2. Let's create a new file `backend/broadcaster.w`, and implement it as follows: -```ts -bring cloud; -bring websockets; - -pub class Broadcaster { - pub wsUrl: str; - wb: websockets.WebSocket; - db: cloud.Bucket; - new() { - this.wb = new websockets.WebSocket(name: "MyWebSocket") as "my-websocket"; - this.wsUrl = this.wb.url; - this.db = new cloud.Bucket(); - - this.wb.onConnect(inflight(id: str): void => { - this.db.put(id, ""); - }); +1. First, let's install the `@winglibs/websockets` library: + + ```sh + cd ~/shared-counter/backend + npm i @winglibs/websockets + ``` + +2. Create a new file `backend/broadcaster.w`, with the following implementation: + + ```ts + bring cloud; + bring websockets; + + pub class Broadcaster { + pub url: str; + server: websockets.WebSocket; + clients: cloud.Bucket; + + new() { + this.server = new websockets.WebSocket(name: "counter_updates"); + this.url = this.server.url; + this.clients = new cloud.Bucket(); + + // upon connection, add the client to the list + this.server.onConnect(inflight(id: str): void => { + this.clients.put(id, ""); + }); + + // upon disconnect, remove the client from the list + this.server.onDisconnect(inflight(id: str): void => { + this.clients.delete(id); + }); + } + + // send a message to all clients + pub inflight broadcast(message: str) { + for id in this.clients.list() { + this.server.sendMessage(id, message); + } + } + } + ``` + +3. In `backend/main.w`, lets bring and instantiate our broadcaster service: - this.wb.onDisconnect(inflight(id: str): void => { - this.db.delete(id); + ```ts + bring "./broadcaster.w" as b; + + let broadcaster = new b.Broadcaster(); + ``` + +4. Send the WebSocket URL to the client: + + ```ts + new vite.Vite( + root: "../frontend", + publicEnv: { + TITLE: "Wing + Vite + React", + WS_URL: broadcaster.url, // <-- add this + API_URL: api.url, + } + ); + ``` + +5. Now, every time the counter is increment, let's send a broadcast `"refresh"` message to all our clients. Add this to the `POST /counter` handler: + + ```ts + api.post("/counter", inflight () => { + let oldValue = counter.inc(); + broadcaster.broadcast("refresh"); + + return { + body: "{oldValue + 1}" + }; }); + ``` - } - pub inflight broadcast(message: str) { - for id in this.db.list() { - this.wb.sendMessage(id, message); - } - } -} -``` -3. In our `backend/main.w` file lets instantiate the broadcasting service: -```ts -bring "./broadcaster.w" as b; +--- -let broadcaster = new b.Broadcaster(); -``` -4. Send the websocket url to the client -```ts -new vite.Vite( - root: "../frontend", - publicEnv: { - title: "Wing + Vite + React", - API_URL: api.url, - WS_URL: broadcaster.wsUrl // <-- This is new - } -); -``` -5. Also, lets send a broadcast "refresh" message every time we increment the counter, -in `backend/main.w` `post` endpoint: -```ts -api.post("/counter", inflight () => { - let oldValue = counter.inc(); - broadcaster.broadcast("refresh"); - return { - status: 200, - body: "{oldValue + 1}" - }; -}); -``` +

+main.w -6. For convenience, here is the entire `backend/main.w` file: ```ts bring vite; bring cloud; bring "./broadcaster.w" as b; let broadcaster = new b.Broadcaster(); -let api = new cloud.Api(cors: true); -new vite.Vite( - root: "../frontend", - publicEnv: { - title: "Wing + Vite + React", - API_URL: api.url, - WS_URL: broadcaster.wsUrl - } -); +let api = new cloud.Api(cors: true); let counter = new cloud.Counter(); + api.get("/counter", inflight () => { return { - status: 200, body: "{counter.peek()}" }; }); api.post("/counter", inflight () => { - let oldValue = counter.inc(); + let prev = counter.inc(); broadcaster.broadcast("refresh"); return { - status: 200, - body: "{oldValue + 1}" + body: "{prev + 1}" }; }); + +new vite.Vite( + root: "../frontend", + publicEnv: { + TITLE: "Wing + Vite + React", + WS_URL: broadcaster.url, + API_URL: api.url, + } +); ``` +
### Listen to ws message and trigger data refresh -On the client side we are going to use `react-use-websocket` and listen to any -event from the broadcaster, once an event is received we will read the counter value from -the API. +Let's move to the client. + +On the client side we are going to use `react-use-websocket` and listen to any event from the +broadcaster, once an event is received we will read the counter value from the API. 1. Start by installing `react-use-websocket` on the `frontend/`: -```sh -cd ~/shared-counter/frontend -npm i -s react-use-websocket -``` + ```sh + cd ~/shared-counter/frontend + npm i react-use-websocket + ``` + 2. Lets import and use it inside `frontend/App.tsx`: -```ts -import useWebSocket from 'react-use-websocket'; -``` -3. And use it inside the `App()` function body: -```ts -useWebSocket(window.wing.env.WS_URL, { - onMessage: () => { - getCount(); - } -}); -``` -4. For convenience, here is the entire `App.tsx` file: + + ```ts + import useWebSocket from 'react-use-websocket'; + ``` + +3. And use it inside the `App()` function body (after the definition of `updateCount()`): + + ```ts + useWebSocket(window.wing.env.WS_URL, { + onMessage: () => { + updateCount(); + } + }); + ``` + +5. Play around by opening multiple tabs of the website; they should automatically update when the + counter increments. + +--- + +
+App.tsx ```ts import { useState, useEffect } from 'react' @@ -419,24 +599,29 @@ import useWebSocket from 'react-use-websocket'; function App() { const API_URL = window.wing.env.API_URL; const [count, setCount] = useState("NA") + const incrementCount = async () => { const response = await fetch(`${API_URL}/counter`, { method: "POST" }); setCount(await response.text()); }; - const getCount = async () => { + + const updateCount = async () => { const response = await fetch(`${API_URL}/counter`); setCount(await response.text()); }; + useWebSocket(window.wing.env.WS_URL, { onMessage: () => { - getCount(); + updateCount(); } }); + useEffect(() => { - getCount(); + updateCount(); }, []); + return ( <>
@@ -447,9 +632,9 @@ function App() { React logo
-

{window.wing.env.title}

+

{window.wing.env.TITLE}

-

@@ -465,8 +650,8 @@ function App() { export default App; ``` -5. Play around by opening multiple tabs of the website; they should automatically update when the counter increments. +

## Step 5 - Deploy on AWS @@ -479,27 +664,24 @@ Once deployed, the above code translates into the following (simplified) AWS arc In order to deploy to AWS, you will need: * [Terraform](https://terraform.io/downloads) -* AWS CLI with configured credentials. See -[here](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) -for more information. +* [AWS CLI](https://docs.aws.amazon.com/cli) with configured credentials. See + [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html) for more + information. 1. Compile to Terraform/AWS -We will use the `tf-aws` platform to tell the compiler to bind all of our resources -to the default set of AWS resources and use Terraform as the provisioning engine. + We will use the `tf-aws` platform to tell the compiler to bind all of our resources + to the default set of AWS resources and use Terraform as the provisioning engine. -```sh -cd ~/shared-counter/backend -wing compile --platform tf-aws main.w -``` + ```sh + cd ~/shared-counter/backend + wing compile --platform tf-aws main.w + ``` 2. Run Terraform Init and Apply -```sh -cd ./target/main.tfaws -terraform init -terraform apply # this takes some time -``` - - - + ```sh + cd ./target/main.tfaws + terraform init + terraform apply # this takes some time + ``` diff --git a/examples/tests/invalid/stringify.test.w b/examples/tests/invalid/stringify.test.w new file mode 100644 index 00000000000..123cd1b0621 --- /dev/null +++ b/examples/tests/invalid/stringify.test.w @@ -0,0 +1,8 @@ +class B {} +let b = new B(); +log("hello {b}"); +// ^ Error: expected type to be stringable + +let x: str? = nil; +log("{x}"); +// ^ Error: expected type to be stringable diff --git a/examples/tests/invalid/void_in_expression_position.test.w b/examples/tests/invalid/void_in_expression_position.test.w index e2251178a40..7cf3e6a12f0 100644 --- a/examples/tests/invalid/void_in_expression_position.test.w +++ b/examples/tests/invalid/void_in_expression_position.test.w @@ -2,7 +2,7 @@ log("hey").get("x"); // ^^^^^^^^^ Expression must be a class to access property "get", instead found type "void" let x = "my name is {log("mister cloud")}"; -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Expected type to be one of "str,num", but got "void" instead +// ^^^^^^^^^^^^^^^^^^^ Expected type to be stringable, but got "void" instead let y = 5 + log("hello"); // ^^^^^^^^^^^^^^ Expected type to be "num", but got "void" instead diff --git a/examples/tests/sdk_tests/function/concurrency.test.w b/examples/tests/sdk_tests/function/concurrency.test.w new file mode 100644 index 00000000000..699c22e028c --- /dev/null +++ b/examples/tests/sdk_tests/function/concurrency.test.w @@ -0,0 +1,44 @@ +bring cloud; +bring util; + +// TODO: support concurrency on AWS + +if util.env("WING_TARGET") == "sim" { + let c = new cloud.Counter(); + + let f1 = new cloud.Function(inflight () => { + c.inc(); + util.sleep(5s); + }, concurrency: 1) as "concurrency fn"; + + test "f1 concurrency limit reached" { + f1.invokeAsync(); + try { + f1.invoke(); + } catch e { + assert(e.contains("Too many requests, the function has reached its concurrency limit")); + return; + } + + log("No error thrown"); + assert(false); + } + + let q = new cloud.Queue(); + + q.setConsumer(inflight (message: str) => { + util.sleep(1s); + c.inc(); + }, concurrency: 1, batchSize: 1); + + test "queue applies backpressure to functions with limited concurrency" { + q.push("m1"); + q.push("m2"); + q.push("m3"); + + util.sleep(5s); + + log("c: {c.peek()}"); + assert(c.peek() == 3); + } +} diff --git a/examples/tests/sdk_tests/function/invoke.test.w b/examples/tests/sdk_tests/function/invoke.test.w index 482b0a1f095..35196871d62 100644 --- a/examples/tests/sdk_tests/function/invoke.test.w +++ b/examples/tests/sdk_tests/function/invoke.test.w @@ -10,7 +10,7 @@ let f = new cloud.Function(inflight (input): str => { let target = util.tryEnv("WING_TARGET"); assert(target?); // make sure WING_TARGET is defined in all environments - return "{input}-response"; + return "{input ?? "nil"}-response"; }); test "invoke" { @@ -34,4 +34,4 @@ test "invoke without inputs and outputs" { let response = f3.invoke(); expect.equal(response, nil); -} \ No newline at end of file +} diff --git a/examples/tests/valid/bring_local_dir.test.w b/examples/tests/valid/bring_local_dir.test.w index a4819cbadcb..8d53a31371e 100644 --- a/examples/tests/valid/bring_local_dir.test.w +++ b/examples/tests/valid/bring_local_dir.test.w @@ -1,7 +1,7 @@ bring "./subdir2/inner/widget.w" as w; bring "./subdir2" as subdir; -let widget1 = new w.Widget(); +let widget1 = new w.Widget() as "widget1"; assert(widget1.compute() == 42); // from subdir/file1.w @@ -13,7 +13,7 @@ let bar = new subdir.Bar(); assert(bar.bar() == "bar"); // from subdir/inner/widget.w -let widget2 = new subdir.inner.Widget(); +let widget2 = new subdir.inner.Widget() as "widget2"; assert(widget2.compute() == 42); assert(foo.checkWidget(widget2) == 1379); diff --git a/examples/tests/valid/doubler.test.w b/examples/tests/valid/doubler.test.w index 454a09dcfb2..04f12c1d9d0 100644 --- a/examples/tests/valid/doubler.test.w +++ b/examples/tests/valid/doubler.test.w @@ -15,7 +15,7 @@ class Doubler { } let fn = new Doubler(inflight (m: str?): str => { - return "Hello {m}!"; + return "Hello {m ?? "nil"}!"; }); // ---------- diff --git a/examples/tests/valid/enums.test.w b/examples/tests/valid/enums.test.w index f006c94899f..cb8ccaf5faa 100644 --- a/examples/tests/valid/enums.test.w +++ b/examples/tests/valid/enums.test.w @@ -20,3 +20,14 @@ test "inflight" { assert(one == SomeEnum.ONE); assert(two == SomeEnum.TWO); } + +// values stringify into their own names +assert("{SomeEnum.ONE}" == "ONE"); +assert("{SomeEnum.TWO}" == "TWO"); +assert("{SomeEnum.THREE}" == "THREE"); + +test "toStr inflight" { + assert("{SomeEnum.ONE}" == "ONE"); + assert("{SomeEnum.TWO}" == "TWO"); + assert("{SomeEnum.THREE}" == "THREE"); +} diff --git a/examples/tests/valid/inflight_handler_singleton.test.w b/examples/tests/valid/inflight_handler_singleton.test.w index d5d526a2c28..c4cf053c5d8 100644 --- a/examples/tests/valid/inflight_handler_singleton.test.w +++ b/examples/tests/valid/inflight_handler_singleton.test.w @@ -12,6 +12,10 @@ class Foo { this.n += 1; return this.n; } + + pub inflight get(): num { + return this.n; + } } let foo = new Foo(); @@ -34,9 +38,27 @@ test "single instance of Foo" { let z = fn2.invoke(""); expect.equal(x, "100"); + + // the simulator intentionally reuses the sandbox across invocations + // but we can't trust that this will always happen on the cloud + if sim { + expect.equal(y, "101"); + log("client has been reused"); + } + expect.equal(z, "100-fn2"); // fn2 should have a separate instance +} + +// a function that takes at least three seconds to run +let fn3 = new cloud.Function(inflight () => { + let n = foo.inc(); + util.sleep(3s); + assert(n == foo.get()); +}) as "fn3"; - // y could be 100 or 101 depending on whether the execution environment - // was reused or not between the two calls. - assert(y == "100" || y == "101"); +test "Foo state is not shared between function invocations" { + // start two invocations of fn, staggering them by 1 second + fn3.invokeAsync(""); + util.sleep(1s); + fn3.invoke(""); } diff --git a/examples/tests/valid/redis.test.w b/examples/tests/valid/redis.test.w index 27defe8c8e4..617bc9a1325 100644 --- a/examples/tests/valid/redis.test.w +++ b/examples/tests/valid/redis.test.w @@ -30,5 +30,5 @@ test "testing Redis" { return r.get("hello") != nil; }); - assert("world!" == "{r.get("hello")}"); + assert("world!" == "{r.get("hello") ?? "nil"}"); } diff --git a/examples/wing-fixture/turbo.json b/examples/wing-fixture/turbo.json index 06b4cea5490..c2dcd75a401 100644 --- a/examples/wing-fixture/turbo.json +++ b/examples/wing-fixture/turbo.json @@ -4,7 +4,8 @@ "pipeline": { "compile": { "dependsOn": ["^compile"], - "inputs": ["**/*.w", "**/*.js", "**/*.ts"] + "inputs": ["**/*.w", "**/*.js", "**/*.ts"], + "outputs": ["target/wing-fixture.wsim/**"] }, "topo": {} } diff --git a/libs/awscdk/src/api.ts b/libs/awscdk/src/api.ts index a188436ea82..927e190220a 100644 --- a/libs/awscdk/src/api.ts +++ b/libs/awscdk/src/api.ts @@ -10,18 +10,18 @@ import { import { CfnPermission } from "aws-cdk-lib/aws-lambda"; import { Construct } from "constructs"; import { App } from "./app"; -import { Function } from "./function"; import { cloud, core, std } from "@winglang/sdk"; import { convertBetweenHandlers } from "@winglang/sdk/lib/shared/convert"; import { IAwsApi, STAGE_NAME } from "@winglang/sdk/lib/shared-aws/api"; import { API_DEFAULT_RESPONSE } from "@winglang/sdk/lib/shared-aws/api.default"; +import { isAwsCdkFunction } from "./function"; /** * AWS Implementation of `cloud.Api`. */ export class Api extends cloud.Api implements IAwsApi { private readonly api: WingRestApi; - private readonly handlers: Record = {}; + private readonly handlers: Record = {}; private readonly endpoint: cloud.Endpoint; constructor(scope: Construct, id: string, props: cloud.ApiProps = {}) { @@ -187,12 +187,8 @@ export class Api extends cloud.Api implements IAwsApi { inflight: cloud.IApiEndpointHandler, method: string, path: string - ): Function { - let fn = this.addInflightHandler(inflight, method, path); - if (!(fn instanceof Function)) { - throw new Error("Api only supports creating tfaws.Function right now"); - } - return fn; + ): cloud.Function { + return this.addInflightHandler(inflight, method, path); } /** @@ -205,7 +201,7 @@ export class Api extends cloud.Api implements IAwsApi { inflight: cloud.IApiEndpointHandler, method: string, path: string - ): Function { + ): cloud.Function { let handler = this.handlers[inflight._id]; if (!handler) { const newInflight = convertBetweenHandlers( @@ -218,7 +214,7 @@ export class Api extends cloud.Api implements IAwsApi { } ); const prefix = `${method.toLowerCase()}${path.replace(/\//g, "_")}_}`; - handler = new Function( + handler = new cloud.Function( this, App.of(this).makeId(this, prefix), newInflight @@ -231,12 +227,7 @@ export class Api extends cloud.Api implements IAwsApi { /** @internal */ public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("apis can only be bound by awscdk.Function for now"); - } - host.addEnvironment(this.urlEnvName(), this.url); - super.onLift(host, ops); } @@ -338,7 +329,7 @@ class WingRestApi extends Construct { * @param handler Lambda function to handle the endpoint * @returns OpenApi spec extension for the endpoint */ - public addEndpoint(path: string, method: string, handler: Function) { + public addEndpoint(path: string, method: string, handler: cloud.Function) { const endpointExtension = this.createApiSpecExtension(handler); this.addHandlerPermissions(path, method, handler); return endpointExtension; @@ -349,10 +340,14 @@ class WingRestApi extends Construct { * @param handler Lambda function to handle the endpoint * @returns OpenApi extension object for the endpoint and handler */ - private createApiSpecExtension(handler: Function) { + private createApiSpecExtension(handler: cloud.Function) { + if (!isAwsCdkFunction(handler)) { + throw new Error("Expected 'handler' to implement IAwsCdkFunction"); + } + const extension = { "x-amazon-apigateway-integration": { - uri: `arn:aws:apigateway:${this.region}:lambda:path/2015-03-31/functions/${handler.functionArn}/invocations`, + uri: `arn:aws:apigateway:${this.region}:lambda:path/2015-03-31/functions/${handler.awscdkFunction.functionArn}/invocations`, type: "aws_proxy", httpMethod: "POST", responses: { @@ -377,13 +372,18 @@ class WingRestApi extends Construct { private addHandlerPermissions = ( path: string, method: string, - handler: Function + handler: cloud.Function ) => { + if (!isAwsCdkFunction(handler)) { + throw new Error("Expected 'handler' to implement IAwsCdkFunction"); + } + const pathHash = createHash("sha1").update(path).digest("hex").slice(-8); const permissionId = `${method}-${pathHash}`; + new CfnPermission(this, `permission-${permissionId}`, { action: "lambda:InvokeFunction", - functionName: handler.functionName, + functionName: handler.awscdkFunction.functionName, principal: "apigateway.amazonaws.com", sourceArn: this.api.arnForExecuteApi(method, Api._toOpenApiPath(path)), }); diff --git a/libs/awscdk/src/app.ts b/libs/awscdk/src/app.ts index 5f914fdf20d..ccf9addc6be 100644 --- a/libs/awscdk/src/app.ts +++ b/libs/awscdk/src/app.ts @@ -44,9 +44,18 @@ import { registerTokenResolver } from "@winglang/sdk/lib/core/tokens"; export interface CdkAppProps extends core.AppProps { /** * CDK Stack Name - * @default - undefined + * + * @default - read from the CDK_STACK_NAME environment variable */ readonly stackName?: string; + + /** + * A hook for customizating the way the root CDK stack is created. You can override this if you wish to use a custom stack + * instead of the default `cdk.Stack`. + * + * @default - creates a standard `cdk.Stack` + */ + readonly stackFactory?: (app: cdk.App, stackName: string) => cdk.Stack; } /** @@ -85,7 +94,9 @@ export class App extends core.App { mkdirSync(cdkOutdir, { recursive: true }); const cdkApp = new cdk.App({ outdir: cdkOutdir }); - const cdkStack = new cdk.Stack(cdkApp, stackName); + + const createStack = props.stackFactory ?? ((app, stackName) => new cdk.Stack(app, stackName)); + const cdkStack = createStack(cdkApp, stackName); super(cdkStack, props.rootId ?? "Default", props); diff --git a/libs/awscdk/src/bucket.ts b/libs/awscdk/src/bucket.ts index a99f0f4fc2c..d6d20585c98 100644 --- a/libs/awscdk/src/bucket.ts +++ b/libs/awscdk/src/bucket.ts @@ -10,11 +10,11 @@ import { BucketDeployment, Source } from "aws-cdk-lib/aws-s3-deployment"; import { LambdaDestination } from "aws-cdk-lib/aws-s3-notifications"; import { Construct } from "constructs"; import { App } from "./app"; -import { Function } from "./function"; import { cloud, core, std } from "@winglang/sdk"; import { convertBetweenHandlers } from "@winglang/sdk/lib/shared/convert"; import { calculateBucketPermissions } from "@winglang/sdk/lib/shared-aws/permissions"; import { IAwsBucket } from "@winglang/sdk/lib/shared-aws/bucket"; +import { IAwsCdkFunction, addPolicyStatements, isAwsCdkFunction } from "./function"; const EVENTS = { [cloud.BucketEventType.DELETE]: EventType.OBJECT_REMOVED, @@ -59,24 +59,22 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { event: string, inflight: cloud.IBucketEventHandler, opts?: cloud.BucketOnCreateOptions - ): Function { + ): IAwsCdkFunction { const functionHandler = convertBetweenHandlers( inflight, this.eventHandlerLocation(), `BucketEventHandlerClient` ); - const fn = new Function( + const fn = new cloud.Function( this.node.scope!, // ok since we're not a tree root App.of(this).makeId(this, `${this.node.id}-${event}`), functionHandler, opts ); - if (!(fn instanceof Function)) { - throw new Error( - "Bucket only supports creating awscdk.Function right now" - ); + if (!isAwsCdkFunction(fn)) { + throw new Error("Expected function to implement IAwsCdkFunction"); } return fn; @@ -117,7 +115,7 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.CREATE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); } @@ -135,7 +133,7 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.DELETE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); } @@ -153,7 +151,7 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.UPDATE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); } @@ -170,7 +168,7 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { }); this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.CREATE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); std.Node.of(this).addConnection({ @@ -180,7 +178,7 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { }); this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.DELETE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); std.Node.of(this).addConnection({ @@ -190,18 +188,16 @@ export class Bucket extends cloud.Bucket implements IAwsBucket { }); this.bucket.addEventNotification( EVENTS[cloud.BucketEventType.UPDATE], - new LambdaDestination(fn._function) + new LambdaDestination(fn.awscdkFunction) ); } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("buckets can only be bound by tfaws.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement IAwsCdkFunction"); } - host.addPolicyStatements( - ...calculateBucketPermissions(this.bucket.bucketArn, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateBucketPermissions(this.bucket.bucketArn, ops)); // The bucket name needs to be passed through an environment variable since // it may not be resolved until deployment time. diff --git a/libs/awscdk/src/counter.ts b/libs/awscdk/src/counter.ts index 2f441d7f6be..e474c28bfb5 100644 --- a/libs/awscdk/src/counter.ts +++ b/libs/awscdk/src/counter.ts @@ -1,11 +1,11 @@ import { RemovalPolicy } from "aws-cdk-lib"; import { AttributeType, BillingMode, Table } from "aws-cdk-lib/aws-dynamodb"; import { Construct } from "constructs"; -import { Function } from "./function"; import { cloud, core, std } from "@winglang/sdk"; import { COUNTER_HASH_KEY } from "@winglang/sdk/lib/shared-aws/commons"; import { calculateCounterPermissions } from "@winglang/sdk/lib/shared-aws/permissions"; import { IAwsCounter } from "@winglang/sdk/lib/shared-aws/counter"; +import { addPolicyStatements, isAwsCdkFunction } from "./function"; /** * AWS implementation of `cloud.Counter`. @@ -36,13 +36,11 @@ export class Counter extends cloud.Counter implements IAwsCounter { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("counters can only be bound by awscdk.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement 'isAwsCdkFunction' method"); } - host.addPolicyStatements( - ...calculateCounterPermissions(this.table.tableArn, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateCounterPermissions(this.table.tableArn, ops)); host.addEnvironment(this.envName(), this.table.tableName); diff --git a/libs/awscdk/src/dynamodb-table.ts b/libs/awscdk/src/dynamodb-table.ts index b9b110a6f79..69346a9fdf7 100644 --- a/libs/awscdk/src/dynamodb-table.ts +++ b/libs/awscdk/src/dynamodb-table.ts @@ -1,7 +1,7 @@ import { RemovalPolicy } from "aws-cdk-lib"; -import { AttributeType, BillingMode, Table } from "aws-cdk-lib/aws-dynamodb"; +import { AttributeType, Billing, TableV2 } from "aws-cdk-lib/aws-dynamodb"; import { Construct } from "constructs"; -import { Function } from "./function"; +import { addPolicyStatements, isAwsCdkFunction } from "./function"; import { core, ex, std } from "@winglang/sdk"; import { ResourceNames } from "@winglang/sdk/lib/shared/resource-names"; import { IAwsDynamodbTable, NAME_OPTS } from "@winglang/sdk/lib/shared-aws/dynamodb-table"; @@ -13,14 +13,14 @@ import { calculateDynamodbTablePermissions } from "@winglang/sdk/lib/shared-aws/ * @inflight `@winglang/sdk.ex.IDynamodbTableClient` */ export class DynamodbTable extends ex.DynamodbTable implements IAwsDynamodbTable { - private readonly table: Table; + private readonly table: TableV2; constructor(scope: Construct, id: string, props: ex.DynamodbTableProps) { super(scope, id, props); const attributeDefinitions = props.attributeDefinitions as any; - this.table = new Table(this, "Default", { + this.table = new TableV2(this, "Default", { tableName: ResourceNames.generateName(this, { prefix: this.name, ...NAME_OPTS, @@ -35,21 +35,17 @@ export class DynamodbTable extends ex.DynamodbTable implements IAwsDynamodbTable type: attributeDefinitions[props.rangeKey] as AttributeType, } : undefined, - billingMode: BillingMode.PAY_PER_REQUEST, + billing: Billing.onDemand(), removalPolicy: RemovalPolicy.DESTROY, }); } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error( - "Dynamodb tables can only be bound by tfaws.Function for now" - ); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement 'isAwsCdkFunction' method"); } - host.addPolicyStatements( - ...calculateDynamodbTablePermissions(this.table.tableArn, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateDynamodbTablePermissions(this.table.tableArn, ops)); host.addEnvironment(this.envName(), this.table.tableName); diff --git a/libs/awscdk/src/endpoint.ts b/libs/awscdk/src/endpoint.ts index 2edbb4ae1cd..63924a1d03f 100644 --- a/libs/awscdk/src/endpoint.ts +++ b/libs/awscdk/src/endpoint.ts @@ -16,12 +16,7 @@ export class Endpoint extends cloud.Endpoint { /** @internal */ public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("endpoints can only be bound by awscdk.Function for now"); - } - host.addEnvironment(this.urlEnvName(), this.url); - super.onLift(host, ops); } diff --git a/libs/awscdk/src/function.ts b/libs/awscdk/src/function.ts index aba1d6a2e61..5ac2a3311d8 100644 --- a/libs/awscdk/src/function.ts +++ b/libs/awscdk/src/function.ts @@ -4,27 +4,51 @@ import { Architecture, Function as CdkFunction, Code, - IEventSource, Runtime, } from "aws-cdk-lib/aws-lambda"; -import { - LogGroup, RetentionDays -} from "aws-cdk-lib/aws-logs"; +import { LogGroup, RetentionDays } from "aws-cdk-lib/aws-logs"; import { Asset } from "aws-cdk-lib/aws-s3-assets"; -import { Construct } from "constructs"; +import { Construct, IConstruct } from "constructs"; import { cloud, std, core } from "@winglang/sdk"; +import { NotImplementedError } from "@winglang/sdk/lib/core/errors"; import { createBundle } from "@winglang/sdk/lib/shared/bundling"; import { IAwsFunction, PolicyStatement } from "@winglang/sdk/lib/shared-aws"; import { resolve } from "path"; import { renameSync, rmSync, writeFileSync } from "fs"; import { App } from "./app"; +/** + * Implementation of `awscdk.Function` are expected to implement this + */ +export interface IAwsCdkFunction extends IConstruct { + awscdkFunction: CdkFunction; +} + +export function isAwsCdkFunction(x: any): x is IAwsCdkFunction { + return typeof x["awscdkFunction"] === "object"; +} + +/** + * Adds a bunch of policy statements to the function's role. + */ +export function addPolicyStatements( + fn: CdkFunction, + statements: PolicyStatement[] +) { + for (const statement of statements) { + fn.addToRolePolicy(new CdkPolicyStatement(statement)); + } +} + /** * AWS implementation of `cloud.Function`. * * @inflight `@winglang/sdk.cloud.IFunctionClient` */ -export class Function extends cloud.Function implements IAwsFunction { +export class Function + extends cloud.Function + implements IAwsCdkFunction, IAwsFunction +{ private readonly function: CdkFunction; private readonly assetPath: string; @@ -36,6 +60,12 @@ export class Function extends cloud.Function implements IAwsFunction { ) { super(scope, id, inflight, props); + if (props.concurrency != null) { + throw new NotImplementedError( + "Function concurrency isn't implemented yet on the current target." + ); + } + // The code in `this.entrypoint` will be replaced during preSynthesize // but we produce an initial version and bundle it so that `lambda.Function` // has something to work with. @@ -44,42 +74,19 @@ export class Function extends cloud.Function implements IAwsFunction { writeFileSync(this.entrypoint, inflightCodeApproximation); const bundle = createBundle(this.entrypoint); - const logRetentionDays = - props.logRetentionDays === undefined - ? 30 - : props.logRetentionDays < 0 - ? RetentionDays.INFINITE // Negative value means Infinite retention - : props.logRetentionDays; - const code = Code.fromAsset(resolve(bundle.directory)); - const logs = new LogGroup(this, "LogGroup", { - retention: logRetentionDays - }); - - this.function = new CdkFunction(this, "Default", { - handler: "index.handler", - code, - runtime: Runtime.NODEJS_20_X, - environment: { - NODE_OPTIONS: "--enable-source-maps", - ...this.env - }, - timeout: props.timeout - ? Duration.seconds(props.timeout.seconds) - : Duration.minutes(1), - memorySize: props.memory ?? 1024, - architecture: Architecture.ARM_64, - logGroup: logs - }); + this.function = this.createFunction(code, props); // hack: accessing private field from aws_lambda.AssetCode // https://github.com/aws/aws-cdk/blob/109b2abe4c713624e731afa1b82c3c1a3ba064c9/packages/aws-cdk-lib/aws-lambda/lib/code.ts#L266 const asset: Asset = (code as any).asset; if (!asset.assetPath) { - throw new Error("AWS CDK 'Asset' class no longer has an 'assetPath' property"); + throw new Error( + "AWS CDK 'Asset' class no longer has an 'assetPath' property" + ); } - this.assetPath = asset.assetPath + this.assetPath = asset.assetPath; } /** @internal */ @@ -92,7 +99,7 @@ export class Function extends cloud.Function implements IAwsFunction { // copy files from bundle.directory to this.assetPath const assetDir = resolve(App.of(this).outdir, this.assetPath); - rmSync(assetDir, { recursive: true, force: true }) + rmSync(assetDir, { recursive: true, force: true }); renameSync(bundle.directory, assetDir); } @@ -105,15 +112,17 @@ export class Function extends cloud.Function implements IAwsFunction { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("functions can only be bound by awscdk.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected host to implement IAwsCdkFunction"); } if (ops.includes(cloud.FunctionInflightMethods.INVOKE)) { - host.addPolicyStatements({ - actions: ["lambda:InvokeFunction"], - resources: [`${this.function.functionArn}`], - }); + host.awscdkFunction.addToRolePolicy( + new CdkPolicyStatement({ + actions: ["lambda:InvokeFunction"], + resources: [`${this.function.functionArn}`], + }) + ); } // The function name needs to be passed through an environment variable since @@ -125,12 +134,47 @@ export class Function extends cloud.Function implements IAwsFunction { /** @internal */ public _toInflight(): string { - return core.InflightClient.for( - __dirname, - __filename, - "FunctionClient", - [`process.env["${this.envName()}"], "${this.node.path}"`] - ); + return core.InflightClient.for(__dirname, __filename, "FunctionClient", [ + `process.env["${this.envName()}"], "${this.node.path}"`, + ]); + } + + /** + * Can be overridden by subclasses to customize the AWS CDK function creation. + * @param code The AWS Lambda `Code` object that represents the inflight closure defined for this function. + * @param props Cloud function properties. + * @returns an object that implements `aws-lambda.IFunction`. + */ + protected createFunction( + code: Code, + props: cloud.FunctionProps + ): CdkFunction { + const logRetentionDays = + props.logRetentionDays === undefined + ? 30 + : props.logRetentionDays < 0 + ? RetentionDays.INFINITE // Negative value means Infinite retention + : props.logRetentionDays; + + const logs = new LogGroup(this, "LogGroup", { + retention: logRetentionDays, + }); + + return new CdkFunction(this, "Default", { + handler: "index.handler", + code, + runtime: Runtime.NODEJS_20_X, + environment: { + NODE_OPTIONS: "--enable-source-maps", + ...this.env, + }, + timeout: props.timeout + ? Duration.seconds(props.timeout.seconds) + : Duration.minutes(1), + memorySize: props.memory ?? 1024, + architecture: Architecture.ARM_64, + logGroup: logs, + }); } /** @@ -154,17 +198,11 @@ export class Function extends cloud.Function implements IAwsFunction { } } - /** @internal */ - public _addEventSource(eventSource: IEventSource) { - this.function.addEventSource(eventSource); - } - private envName(): string { return `FUNCTION_NAME_${this.node.addr.slice(-8)}`; } - /** @internal */ - get _function() { + public get awscdkFunction() { return this.function; } diff --git a/libs/awscdk/src/on-deploy.ts b/libs/awscdk/src/on-deploy.ts index 19ab1101f47..22b40f14ae1 100644 --- a/libs/awscdk/src/on-deploy.ts +++ b/libs/awscdk/src/on-deploy.ts @@ -1,7 +1,7 @@ import { Trigger } from "aws-cdk-lib/triggers"; import { Construct } from "constructs"; -import { Function as AwsFunction } from "./function"; import { cloud, core } from "@winglang/sdk"; +import { isAwsCdkFunction } from "./function"; /** * AWS implementation of `cloud.OnDeploy`. @@ -18,10 +18,13 @@ export class OnDeploy extends cloud.OnDeploy { super(scope, id, handler, props); let fn = new cloud.Function(this, "Function", handler as cloud.IFunctionHandler, props); - const awsFn = fn as AwsFunction; + + if (!isAwsCdkFunction(fn)) { + throw new Error("Expected function to implement 'IAwsCdkFunction' method"); + } let trigger = new Trigger(this, "Trigger", { - handler: awsFn._function, + handler: fn.awscdkFunction, }); trigger.executeAfter(...(props.executeAfter ?? [])); diff --git a/libs/awscdk/src/queue.ts b/libs/awscdk/src/queue.ts index 4a9d4092326..248fe7b3ca2 100644 --- a/libs/awscdk/src/queue.ts +++ b/libs/awscdk/src/queue.ts @@ -3,12 +3,12 @@ import { Duration } from "aws-cdk-lib"; import { SqsEventSource } from "aws-cdk-lib/aws-lambda-event-sources"; import { Queue as SQSQueue } from "aws-cdk-lib/aws-sqs"; import { Construct } from "constructs"; -import { Function } from "./function"; import { App } from "./app"; import { std, core, cloud } from "@winglang/sdk"; import { convertBetweenHandlers } from "@winglang/sdk/lib/shared/convert"; import { calculateQueuePermissions } from "@winglang/sdk/lib/shared-aws/permissions"; import { IAwsQueue } from "@winglang/sdk/lib/shared-aws/queue"; +import { addPolicyStatements, isAwsCdkFunction } from "./function"; /** * AWS implementation of `cloud.Queue`. @@ -46,7 +46,7 @@ export class Queue extends cloud.Queue implements IAwsQueue { "QueueSetConsumerHandlerClient" ); - const fn = new Function( + const fn = new cloud.Function( // ok since we're not a tree root this.node.scope!, App.of(this).makeId(this, `${this.node.id}-SetConsumer`), @@ -57,15 +57,15 @@ export class Queue extends cloud.Queue implements IAwsQueue { } ); - // TODO: remove this constraint by adding generic permission APIs to cloud.Function - if (!(fn instanceof Function)) { - throw new Error("Queue only supports creating awscdk.Function right now"); + if (!isAwsCdkFunction(fn)) { + throw new Error("Queue only supports creating IAwsCdkFunction right now"); } const eventSource = new SqsEventSource(this.queue, { batchSize: props.batchSize ?? 1, }); - fn._addEventSource(eventSource); + + fn.awscdkFunction.addEventSource(eventSource); std.Node.of(this).addConnection({ source: this, @@ -87,15 +87,13 @@ export class Queue extends cloud.Queue implements IAwsQueue { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("queues can only be bound by tfaws.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement IAwsCdkFunction"); } const env = this.envName(); - host.addPolicyStatements( - ...calculateQueuePermissions(this.queue.queueArn, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateQueuePermissions(this.queue.queueArn, ops)); // The queue url needs to be passed through an environment variable since // it may not be resolved until deployment time. diff --git a/libs/awscdk/src/schedule.ts b/libs/awscdk/src/schedule.ts index a992ed84ee2..6bdb8471ccb 100644 --- a/libs/awscdk/src/schedule.ts +++ b/libs/awscdk/src/schedule.ts @@ -6,10 +6,10 @@ import { addLambdaPermission, } from "aws-cdk-lib/aws-events-targets"; import { Construct } from "constructs"; -import { Function } from "./function"; import { App } from "./app"; import { cloud, core, std } from "@winglang/sdk"; import { convertBetweenHandlers } from "@winglang/sdk/lib/shared/convert"; +import { isAwsCdkFunction } from "./function"; /** * AWS implementation of `cloud.Schedule`. @@ -73,7 +73,7 @@ export class Schedule extends cloud.Schedule { "ScheduleOnTickHandlerClient" ); - const fn = new Function( + const fn = new cloud.Function( // ok since we're not a tree root this.node.scope!, App.of(this).makeId(this, `${this.node.id}-OnTick`), @@ -81,15 +81,12 @@ export class Schedule extends cloud.Schedule { props ); - // TODO: remove this constraint by adding generic permission APIs to cloud.Function - if (!(fn instanceof Function)) { - throw new Error( - "Schedule only supports creating awscdk.Function right now" - ); + if (!isAwsCdkFunction(fn)) { + throw new Error("Expected function to implement 'isAwsCdkFunction' method"); } - this.rule.addTarget(new LambdaFunction(fn._function)); - addLambdaPermission(this.rule, fn._function); + this.rule.addTarget(new LambdaFunction(fn.awscdkFunction)); + addLambdaPermission(this.rule, fn.awscdkFunction); std.Node.of(this).addConnection({ source: this, diff --git a/libs/awscdk/src/secret.ts b/libs/awscdk/src/secret.ts index 027e01f462a..5e660fffa0f 100644 --- a/libs/awscdk/src/secret.ts +++ b/libs/awscdk/src/secret.ts @@ -4,7 +4,7 @@ import { Secret as CdkSecret, } from "aws-cdk-lib/aws-secretsmanager"; import { Construct } from "constructs"; -import { Function } from "./function"; +import { addPolicyStatements, isAwsCdkFunction } from "./function"; import { cloud, core, std } from "@winglang/sdk"; import { calculateSecretPermissions } from "@winglang/sdk/lib/shared-aws/permissions"; @@ -48,13 +48,11 @@ export class Secret extends cloud.Secret { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("secrets can only be bound by awscdk.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement 'isAwsCdkFunction' method"); } - host.addPolicyStatements( - ...calculateSecretPermissions(this.arnForPolicies, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateSecretPermissions(this.arnForPolicies, ops)); host.addEnvironment(this.envName(), this.secret.secretArn); diff --git a/libs/awscdk/src/test-runner.ts b/libs/awscdk/src/test-runner.ts index 30b6c9c0d5a..23915daea7c 100644 --- a/libs/awscdk/src/test-runner.ts +++ b/libs/awscdk/src/test-runner.ts @@ -1,7 +1,7 @@ import { CfnOutput, Lazy } from "aws-cdk-lib"; import { Construct } from "constructs"; -import { Function as AwsFunction } from "./function"; import { core, std } from "@winglang/sdk"; +import { isAwsCdkFunction } from "./function"; const OUTPUT_TEST_RUNNER_FUNCTION_ARNS = "WingTestRunnerFunctionArns"; @@ -28,10 +28,6 @@ export class TestRunner extends std.TestRunner { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof AwsFunction)) { - throw new Error("TestRunner can only be bound by tfaws.Function for now"); - } - // Collect all of the test functions and their ARNs, and pass them to the // test engine so they can be invoked inflight. // TODO: are we going to run into AWS's 4KB environment variable limit here? @@ -66,12 +62,12 @@ export class TestRunner extends std.TestRunner { const arns = new Map(); for (const test of this.findTests()) { if (test._fn) { - if (!(test._fn instanceof AwsFunction)) { + if (!(isAwsCdkFunction(test._fn))) { throw new Error( `Unsupported test function type, ${test._fn.node.path} was not a tfaws.Function` ); } - arns.set(test.node.path, (test._fn as AwsFunction).functionArn); + arns.set(test.node.path, test._fn.awscdkFunction.functionArn); } } return arns; diff --git a/libs/awscdk/src/tokens.ts b/libs/awscdk/src/tokens.ts index 34247080433..6184860ad0a 100644 --- a/libs/awscdk/src/tokens.ts +++ b/libs/awscdk/src/tokens.ts @@ -1,7 +1,7 @@ import { Fn, Token } from "aws-cdk-lib"; -import { Function } from "@winglang/sdk/lib/cloud"; import { tokenEnvName, ITokenResolver } from "@winglang/sdk/lib/core/tokens"; import { IInflightHost } from "@winglang/sdk/lib/std"; +import { isAwsCdkFunction } from "./function"; /** * Represents values that can only be resolved after the app is synthesized. @@ -41,8 +41,8 @@ export class CdkTokens implements ITokenResolver { * Binds the given token to the host. */ public onLiftValue(host: IInflightHost, value: any) { - if (!(host instanceof Function)) { - throw new Error(`Tokens can only be bound by a Function for now`); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement 'isAwsCdkFunction' method"); } let envValue; @@ -65,9 +65,8 @@ export class CdkTokens implements ITokenResolver { } const envName = tokenEnvName(value.toString()); + // the same token might be bound multiple times by different variables/inflight contexts - if (host.env[envName] === undefined) { - host.addEnvironment(envName, envValue); - } + host.addEnvironment(envName, envValue); } } diff --git a/libs/awscdk/src/topic.ts b/libs/awscdk/src/topic.ts index 77d594cb808..93a5b6758b0 100644 --- a/libs/awscdk/src/topic.ts +++ b/libs/awscdk/src/topic.ts @@ -2,12 +2,12 @@ import { join } from "path"; import { Topic as SNSTopic } from "aws-cdk-lib/aws-sns"; import { LambdaSubscription } from "aws-cdk-lib/aws-sns-subscriptions"; import { Construct } from "constructs"; -import { Function } from "./function"; import { App } from "./app"; import { cloud, core, std } from "@winglang/sdk"; import { convertBetweenHandlers } from "@winglang/sdk/lib/shared/convert"; import { calculateTopicPermissions } from "@winglang/sdk/lib/shared-aws/permissions"; import { IAwsTopic } from "@winglang/sdk/lib/shared-aws/topic"; +import { addPolicyStatements, isAwsCdkFunction } from "./function"; /** * AWS Implementation of `cloud.Topic`. @@ -35,19 +35,18 @@ export class Topic extends cloud.Topic implements IAwsTopic { "TopicOnMessageHandlerClient" ); - const fn = new Function( + const fn = new cloud.Function( this.node.scope!, // ok since we're not a tree root App.of(this).makeId(this, `${this.node.id}-OnMessage`), functionHandler, props ); - // TODO: remove this constraint by adding geric permission APIs to cloud.Function - if (!(fn instanceof Function)) { - throw new Error("Topic only supports creating awscdk.Function right now"); + if (!isAwsCdkFunction(fn)) { + throw new Error("Expected function to implement 'IAwsCdkFunction' method"); } - const subscription = new LambdaSubscription(fn._function); + const subscription = new LambdaSubscription(fn.awscdkFunction); this.topic.addSubscription(subscription); std.Node.of(this).addConnection({ @@ -60,13 +59,11 @@ export class Topic extends cloud.Topic implements IAwsTopic { } public onLift(host: std.IInflightHost, ops: string[]): void { - if (!(host instanceof Function)) { - throw new Error("topics can only be bound by awscdk.Function for now"); + if (!isAwsCdkFunction(host)) { + throw new Error("Expected 'host' to implement 'IAwsCdkFunction' method"); } - host.addPolicyStatements( - ...calculateTopicPermissions(this.topic.topicArn, ops) - ); + addPolicyStatements(host.awscdkFunction, calculateTopicPermissions(this.topic.topicArn, ops)); host.addEnvironment(this.envName(), this.topic.topicArn); diff --git a/libs/awscdk/test/__snapshots__/dynamodb-table.test.ts.snap b/libs/awscdk/test/__snapshots__/dynamodb-table.test.ts.snap index d3c8ecd5ca7..6dad8f4b2bd 100644 --- a/libs/awscdk/test/__snapshots__/dynamodb-table.test.ts.snap +++ b/libs/awscdk/test/__snapshots__/dynamodb-table.test.ts.snap @@ -26,9 +26,16 @@ exports[`default dynamodb table behavior 1`] = ` "KeyType": "HASH", }, ], + "Replicas": [ + { + "Region": { + "Ref": "AWS::Region", + }, + }, + ], "TableName": "my-wing-tableTable-c85e6383", }, - "Type": "AWS::DynamoDB::Table", + "Type": "AWS::DynamoDB::GlobalTable", "UpdateReplacePolicy": "Delete", }, }, @@ -204,9 +211,16 @@ exports[`function with a table binding 1`] = ` "KeyType": "HASH", }, ], + "Replicas": [ + { + "Region": { + "Ref": "AWS::Region", + }, + }, + ], "TableName": "my-wing-tableTable-c85e6383", }, - "Type": "AWS::DynamoDB::Table", + "Type": "AWS::DynamoDB::GlobalTable", "UpdateReplacePolicy": "Delete", }, }, diff --git a/libs/awscdk/test/app.test.ts b/libs/awscdk/test/app.test.ts new file mode 100644 index 00000000000..408ca6a415b --- /dev/null +++ b/libs/awscdk/test/app.test.ts @@ -0,0 +1,48 @@ +import { test, expect } from "vitest"; +import * as awscdk from "../src"; +import { CDK_APP_OPTS } from "./util"; +import { Duration, Stack } from "aws-cdk-lib"; +import { mkdtemp } from "@winglang/sdk/test/util"; +import { cloud, simulator } from "@winglang/sdk"; +import { Code, Function, Runtime } from "aws-cdk-lib/aws-lambda"; + +test("custom stack", async () => { + const app = new awscdk.App({ + ...CDK_APP_OPTS, + outdir: mkdtemp(), + stackFactory: (app, stackName) => { + return new Stack(app, stackName, { + description: "This is a custom stack description" + }); + } + }); + + const out = JSON.parse(app.synth()); + expect(out.Description, "This is a custom stack description"); +}); + +test("custom Functions", async () => { + const app = new awscdk.App({ + ...CDK_APP_OPTS, + outdir: mkdtemp(), + }); + + class CustomFunction extends awscdk.Function { + protected createFunction(code: Code, props: cloud.FunctionProps): Function { + return new Function(this, "Function", { + code, + handler: "index.handler", + runtime: Runtime.NODEJS_LATEST, + environment: { + BOOM: "BAR" + } + }); + } + } + + new CustomFunction(app, "MyFunction", simulator.Testing.makeHandler("async handle(name) { console.log('hello'); }")); + + const cfn = JSON.parse(app.synth()); + + expect(cfn.Resources.MyFunctionDBE6350A.Properties.Environment.Variables).toStrictEqual({ BOOM: 'BAR' }); +}); \ No newline at end of file diff --git a/libs/awscdk/test/bucket.test.ts b/libs/awscdk/test/bucket.test.ts index 208ca4949bd..4c212a43739 100644 --- a/libs/awscdk/test/bucket.test.ts +++ b/libs/awscdk/test/bucket.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { cloud, simulator } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { awscdkSanitize, CDK_APP_OPTS } from "./util"; test("create a bucket", async () => { // GIVEN diff --git a/libs/awscdk/test/counter.test.ts b/libs/awscdk/test/counter.test.ts index 613b3494f63..5611c43c04e 100644 --- a/libs/awscdk/test/counter.test.ts +++ b/libs/awscdk/test/counter.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { cloud, simulator } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { sanitizeCode, awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { sanitizeCode, awscdkSanitize, CDK_APP_OPTS } from "./util"; test("default counter behavior", () => { const app = new awscdk.App({ outdir: mkdtemp(), ...CDK_APP_OPTS }); diff --git a/libs/awscdk/test/dynamodb-table.test.ts b/libs/awscdk/test/dynamodb-table.test.ts index 38d73b10825..a9e05f309db 100644 --- a/libs/awscdk/test/dynamodb-table.test.ts +++ b/libs/awscdk/test/dynamodb-table.test.ts @@ -1,14 +1,9 @@ -import { Match, Template } from "aws-cdk-lib/assertions"; +import { Template } from "aws-cdk-lib/assertions"; import { test, expect } from "vitest"; import { cloud, simulator, ex } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { awscdkSanitize, CDK_APP_OPTS } from "./util"; test("default dynamodb table behavior", () => { // GIVEN @@ -22,7 +17,7 @@ test("default dynamodb table behavior", () => { // THEN const template = Template.fromJSON(JSON.parse(output)); - template.hasResource("AWS::DynamoDB::Table", 1); + template.hasResource("AWS::DynamoDB::GlobalTable", 1); expect(awscdkSanitize(template)).toMatchSnapshot(); }); @@ -52,7 +47,7 @@ test("function with a table binding", () => { const template = Template.fromJSON(JSON.parse(output)); template.resourceCountIs("AWS::Logs::LogGroup", 1); - template.hasResource("AWS::DynamoDB::Table", 1); + template.hasResource("AWS::DynamoDB::GlobalTable", 1); template.hasResource("AWS::IAM::Role", 1); template.hasResource("AWS::IAM::Policy", 1); template.hasResource("AWS::Lambda::Function", 1); diff --git a/libs/awscdk/test/function.test.ts b/libs/awscdk/test/function.test.ts index ec6dcb20620..c93e7cdce46 100644 --- a/libs/awscdk/test/function.test.ts +++ b/libs/awscdk/test/function.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { cloud, simulator, std } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { awscdkSanitize, CDK_APP_OPTS } from "./util"; const INFLIGHT_CODE = `async handle(name) { console.log("Hello, " + name); }`; diff --git a/libs/awscdk/test/on-deploy.test.ts b/libs/awscdk/test/on-deploy.test.ts index 48d94936c3f..3c2f95b22f2 100644 --- a/libs/awscdk/test/on-deploy.test.ts +++ b/libs/awscdk/test/on-deploy.test.ts @@ -3,11 +3,7 @@ import { expect, test } from "vitest"; import { cloud, simulator } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", -}; +import { awscdkSanitize, CDK_APP_OPTS } from "./util"; const INFLIGHT_CODE = `async handle(name) { console.log("Hello, " + name); }`; @@ -15,7 +11,6 @@ test("create an OnDeploy", () => { // GIVEN const app = new awscdk.App({ outdir: mkdtemp(), - entrypointDir: __dirname, ...CDK_APP_OPTS, }); const handler = simulator.Testing.makeHandler(INFLIGHT_CODE); @@ -32,7 +27,6 @@ test("execute OnDeploy after other resources", () => { // GIVEN const app = new awscdk.App({ outdir: mkdtemp(), - entrypointDir: __dirname, ...CDK_APP_OPTS, }); const bucket = new cloud.Bucket(app, "my_bucket"); @@ -55,7 +49,6 @@ test("execute OnDeploy before other resources", () => { // GIVEN const app = new awscdk.App({ outdir: mkdtemp(), - entrypointDir: __dirname, ...CDK_APP_OPTS, }); const bucket = new cloud.Bucket(app, "my_bucket"); diff --git a/libs/awscdk/test/queue.test.ts b/libs/awscdk/test/queue.test.ts index abca96e738f..641b43abb0e 100644 --- a/libs/awscdk/test/queue.test.ts +++ b/libs/awscdk/test/queue.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { std, simulator, cloud } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { sanitizeCode, awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { sanitizeCode, awscdkSanitize, CDK_APP_OPTS } from "./util"; test("default queue behavior", () => { // GIVEN diff --git a/libs/awscdk/test/schedule.test.ts b/libs/awscdk/test/schedule.test.ts index 6ec765850dd..5092f3c4f30 100644 --- a/libs/awscdk/test/schedule.test.ts +++ b/libs/awscdk/test/schedule.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { simulator, cloud, std } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { awscdkSanitize, CDK_APP_OPTS } from "./util"; test("schedule behavior with rate", () => { // GIVEN diff --git a/libs/awscdk/test/secret.test.ts b/libs/awscdk/test/secret.test.ts index d30a34e0639..af636c5b280 100644 --- a/libs/awscdk/test/secret.test.ts +++ b/libs/awscdk/test/secret.test.ts @@ -4,11 +4,7 @@ import { test, expect } from "vitest"; import { cloud } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { CDK_APP_OPTS} from "./util"; test("default secret behavior", () => { // GIVEN diff --git a/libs/awscdk/test/topic.test.ts b/libs/awscdk/test/topic.test.ts index 56a24d74544..50c8c288933 100644 --- a/libs/awscdk/test/topic.test.ts +++ b/libs/awscdk/test/topic.test.ts @@ -3,12 +3,7 @@ import { test, expect } from "vitest"; import { cloud, simulator } from "@winglang/sdk"; import * as awscdk from "../src"; import { mkdtemp } from "@winglang/sdk/test/util"; -import { sanitizeCode, awscdkSanitize } from "./util"; - -const CDK_APP_OPTS = { - stackName: "my-project", - entrypointDir: __dirname, -}; +import { sanitizeCode, awscdkSanitize, CDK_APP_OPTS } from "./util"; test("default topic behavior", () => { // GIVEN diff --git a/libs/awscdk/test/util.ts b/libs/awscdk/test/util.ts index ff0f03c53a2..d57deadd97c 100644 --- a/libs/awscdk/test/util.ts +++ b/libs/awscdk/test/util.ts @@ -31,4 +31,9 @@ export function awscdkSanitize(template: Template): any { ); return JSON.parse(jsonString); -} \ No newline at end of file +} + +export const CDK_APP_OPTS = { + stackName: "my-project", + entrypointDir: __dirname, +}; diff --git a/libs/tree-sitter-wing/grammar.js b/libs/tree-sitter-wing/grammar.js index c7f9b3709fe..7bfe12e3485 100644 --- a/libs/tree-sitter-wing/grammar.js +++ b/libs/tree-sitter-wing/grammar.js @@ -396,7 +396,7 @@ module.exports = grammar({ /[0-7]{1,3}/, /x[0-9a-fA-F]{2}/, /u[0-9a-fA-F]{4}/, - /u{[0-9a-fA-F]+}/ + /u\{[0-9a-fA-F]+\}/ ) ) ), diff --git a/libs/wingc/src/jsify.rs b/libs/wingc/src/jsify.rs index 1d30850256e..1dda49a9edc 100644 --- a/libs/wingc/src/jsify.rs +++ b/libs/wingc/src/jsify.rs @@ -508,7 +508,11 @@ impl<'a> JSifier<'a> { Some(if let Some(id_exp) = obj_id { self.jsify_expression(id_exp, ctx).to_string() } else { - format!("\"{}\"", ctor.to_string()) + // take only the last part of the fully qualified name (the class name) because any + // leading parts like the namespace are volatile and can be changed easily by the user + let s = ctor.to_string(); + let class_name = s.split(".").last().unwrap().to_string(); + format!("\"{}\"", class_name) }) } else { None @@ -1211,11 +1215,9 @@ impl<'a> JSifier<'a> { for value in values { code.line(new_code!( &value.span, - "tmp[tmp[\"", + "tmp[\"", jsify_symbol(value), - "\"] = ", - value_index.to_string(), - "] = \",", + "\"] = \"", jsify_symbol(value), "\";" )); diff --git a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap index cf66c39f334..f78004d09d4 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_lift_indirect.snap @@ -83,7 +83,7 @@ class $Root extends $stdlib.std.Resource { class Base extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap index 1c70d586f2c..d7ebc177c6c 100644 --- a/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap +++ b/libs/wingc/src/jsify/snapshots/base_class_with_lifted_field_object.snap @@ -74,7 +74,7 @@ class $Root extends $stdlib.std.Resource { class Base extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap index c577e6eabe6..53f3b82011e 100644 --- a/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/calls_methods_on_preflight_object.snap @@ -86,7 +86,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap index 697366362be..aa81640b27d 100644 --- a/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap +++ b/libs/wingc/src/jsify/snapshots/capture_identifier_from_preflight_scope_with_nested_object.snap @@ -74,7 +74,7 @@ class $Root extends $stdlib.std.Resource { class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap index ce6e538abc7..f7db052f9b9 100644 --- a/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap +++ b/libs/wingc/src/jsify/snapshots/capture_object_with_this_in_name.snap @@ -83,7 +83,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket_this = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket_this = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const fn = new $Closure1(this, "$Closure1"); } } diff --git a/libs/wingc/src/jsify/snapshots/capture_token.snap b/libs/wingc/src/jsify/snapshots/capture_token.snap index 3df441b6f16..29ea132fdc4 100644 --- a/libs/wingc/src/jsify/snapshots/capture_token.snap +++ b/libs/wingc/src/jsify/snapshots/capture_token.snap @@ -82,7 +82,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/closure_field.snap b/libs/wingc/src/jsify/snapshots/closure_field.snap index 6d2b5a57cf5..33cb54eb787 100644 --- a/libs/wingc/src/jsify/snapshots/closure_field.snap +++ b/libs/wingc/src/jsify/snapshots/closure_field.snap @@ -214,7 +214,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const x = new MyResource(this, "MyResource"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:variable can be an inflight closure", new $Closure2(this, "$Closure2")); } diff --git a/libs/wingc/src/jsify/snapshots/enum_value.snap b/libs/wingc/src/jsify/snapshots/enum_value.snap index 492ba875019..e8e39f2798f 100644 --- a/libs/wingc/src/jsify/snapshots/enum_value.snap +++ b/libs/wingc/src/jsify/snapshots/enum_value.snap @@ -52,8 +52,8 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); const MyEnum = (function (tmp) { - tmp[tmp["B"] = 0] = ",B"; - tmp[tmp["C"] = 1] = ",C"; + tmp["B"] = "B"; + tmp["C"] = "C"; return tmp; })({}) ; diff --git a/libs/wingc/src/jsify/snapshots/identify_field.snap b/libs/wingc/src/jsify/snapshots/identify_field.snap index 80e1ee53e7a..abd10c04ccc 100644 --- a/libs/wingc/src/jsify/snapshots/identify_field.snap +++ b/libs/wingc/src/jsify/snapshots/identify_field.snap @@ -54,7 +54,7 @@ class $Root extends $stdlib.std.Resource { class A extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.bucket_this = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.bucket_this = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap index ffc90570b92..b87e9d42683 100644 --- a/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap +++ b/libs/wingc/src/jsify/snapshots/implicit_lift_inflight_init.snap @@ -72,7 +72,7 @@ class $Root extends $stdlib.std.Resource { class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + this.c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/indirect_capture.snap b/libs/wingc/src/jsify/snapshots/indirect_capture.snap index 332e4322f70..1eee7ecb268 100644 --- a/libs/wingc/src/jsify/snapshots/indirect_capture.snap +++ b/libs/wingc/src/jsify/snapshots/indirect_capture.snap @@ -87,7 +87,7 @@ class $Root extends $stdlib.std.Resource { class Capture extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); } static _toInflightType() { return ` @@ -156,7 +156,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const f = new Capture(this, "Capture"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } diff --git a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap index 916228372d4..8ba6c02c1f8 100644 --- a/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/inline_inflight_class.snap @@ -75,8 +75,8 @@ class $Root extends $stdlib.std.Resource { class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); - this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); + this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); const __parent_this_1 = this; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap index f524d978861..87aa5717c2a 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_as_field.snap @@ -55,7 +55,7 @@ class $Root extends $stdlib.std.Resource { class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.arr = [this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket")]; + this.arr = [this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket")]; } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap index 7945d0ccb18..cff66f9c6ec 100644 --- a/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap +++ b/libs/wingc/src/jsify/snapshots/lift_element_from_collection_of_objects.snap @@ -84,7 +84,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const a = [this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket")]; + const a = [this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket")]; this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap index 088c6133bc9..57b650951db 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure.snap @@ -145,7 +145,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const fn = new $Closure1(this, "$Closure1"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure2(this, "$Closure2")); } diff --git a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap index 8d874725446..28db92b97cf 100644 --- a/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap +++ b/libs/wingc/src/jsify/snapshots/lift_via_closure_class_explicit.snap @@ -94,7 +94,7 @@ class $Root extends $stdlib.std.Resource { _id = $stdlib.core.closureId(); constructor($scope, $id, ) { super($scope, $id); - this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap index d9a50654485..deea62f439d 100644 --- a/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/nested_preflight_operation.snap @@ -95,7 +95,7 @@ class $Root extends $stdlib.std.Resource { class YourType extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap index af08fbe99b6..394c0eb17c1 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_nested_object_with_operations.snap @@ -135,7 +135,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const a = new A(this, "A"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap index 1b4608057c9..47e41e41fa6 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_through_property.snap @@ -75,7 +75,7 @@ class $Root extends $stdlib.std.Resource { class MyType extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap index ddb280c4a9d..2af7944c3cb 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations.snap @@ -85,7 +85,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap index eb1970f75b5..dc66c3c19c9 100644 --- a/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap +++ b/libs/wingc/src/jsify/snapshots/preflight_object_with_operations_multiple_methods.snap @@ -91,7 +91,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap index e388418ee39..acf17e637c4 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_fields.snap @@ -72,7 +72,7 @@ class $Root extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); this.s = "hello"; - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap index f483d3e0269..4e0c6271f7f 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_free_variable_with_this_in_the_expression.snap @@ -92,7 +92,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap index c556815c1ff..32c5abb62aa 100644 --- a/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap +++ b/libs/wingc/src/jsify/snapshots/reference_preflight_object_from_static_inflight.snap @@ -86,7 +86,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap index e16ed3c57f1..7564cb78703 100644 --- a/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap +++ b/libs/wingc/src/jsify/snapshots/reference_static_inflight_which_references_preflight_object.snap @@ -148,7 +148,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap index cef20fdbe78..46f1fb8fd2a 100644 --- a/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap +++ b/libs/wingc/src/jsify/snapshots/static_inflight_operation.snap @@ -145,7 +145,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference.snap b/libs/wingc/src/jsify/snapshots/transitive_reference.snap index 1f83e8d00f2..9f015c038ca 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference.snap @@ -94,7 +94,7 @@ class $Root extends $stdlib.std.Resource { class MyType extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap index 3c6d69f7a4c..9a2ab0825ff 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_inflight_class.snap @@ -140,7 +140,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap index 9e0635e9298..270c246026b 100644 --- a/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap +++ b/libs/wingc/src/jsify/snapshots/transitive_reference_via_static.snap @@ -204,7 +204,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const t = new YourType(this, "YourType"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } diff --git a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap index a47cb9ac5a6..8c0bf845e5f 100644 --- a/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap +++ b/libs/wingc/src/jsify/snapshots/two_identical_lifts.snap @@ -91,7 +91,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/libs/wingc/src/lib.rs b/libs/wingc/src/lib.rs index 0f3ea243447..36850203ce6 100644 --- a/libs/wingc/src/lib.rs +++ b/libs/wingc/src/lib.rs @@ -20,6 +20,7 @@ use jsify::JSifier; use lifting::LiftVisitor; use parser::{is_entrypoint_file, parse_wing_project}; +use serde::Serialize; use struct_schema::StructSchemaVisitor; use type_check::jsii_importer::JsiiImportSpec; use type_check::symbol_env::SymbolEnvKind; @@ -37,7 +38,7 @@ use std::mem; use crate::ast::Phase; use crate::type_check::symbol_env::SymbolEnv; -use crate::type_check::{TypeChecker, Types}; +use crate::type_check::{SymbolEnvOrNamespace, TypeChecker, Types}; #[macro_use] #[cfg(test)] @@ -124,7 +125,10 @@ const MACRO_REPLACE_ARGS_TEXT: &'static str = "$args_text$"; pub const TRUSTED_LIBRARY_NPM_NAMESPACE: &'static str = "@winglibs"; -pub struct CompilerOutput {} +#[derive(Serialize)] +pub struct CompilerOutput { + imported_namespaces: Vec, +} /// Exposes an allocation function to the WASM host /// @@ -200,10 +204,11 @@ pub unsafe extern "C" fn wingc_compile(ptr: u32, len: u32) -> u64 { } let results = compile(project_dir, source_path, None, output_dir); + if results.is_err() { WASM_RETURN_ERROR } else { - string_to_combined_ptr("".to_string()) + string_to_combined_ptr(serde_json::to_string(&results.unwrap()).unwrap()) } } @@ -378,7 +383,16 @@ pub fn compile( return Err(()); } - return Ok(CompilerOutput {}); + let imported_namespaces = types + .source_file_envs + .iter() + .filter_map(|(k, v)| match v { + SymbolEnvOrNamespace::Namespace(_) => Some(k.to_string()), + _ => None, + }) + .collect::>(); + + return Ok(CompilerOutput { imported_namespaces }); } pub fn is_absolute_path(path: &Utf8Path) -> bool { diff --git a/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap b/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap index a121951c269..bfe32f53fca 100644 --- a/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap +++ b/libs/wingc/src/lsp/snapshots/completions/incomplete_inflight_namespace.snap @@ -35,13 +35,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Function - label: OnDeploy kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -245,7 +245,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." + value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|FunctionProps - label: GetSecretValueOptions kind: 22 @@ -263,7 +263,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -275,13 +275,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -299,7 +299,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 diff --git a/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap b/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap index a121951c269..bfe32f53fca 100644 --- a/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap +++ b/libs/wingc/src/lsp/snapshots/completions/namespace_middle_dot.snap @@ -35,13 +35,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Function - label: OnDeploy kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -245,7 +245,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." + value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|FunctionProps - label: GetSecretValueOptions kind: 22 @@ -263,7 +263,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -275,13 +275,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -299,7 +299,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 diff --git a/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap b/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap index a959ed7534d..8ccc2e0fadd 100644 --- a/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap +++ b/libs/wingc/src/lsp/snapshots/completions/new_expression_nested.snap @@ -60,7 +60,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Function insertText: Function($1) insertTextFormat: 2 @@ -71,7 +71,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy insertText: OnDeploy($1) insertTextFormat: 2 diff --git a/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap b/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap index a121951c269..bfe32f53fca 100644 --- a/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap +++ b/libs/wingc/src/lsp/snapshots/completions/partial_type_reference_annotation.snap @@ -35,13 +35,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Function - label: OnDeploy kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -245,7 +245,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." + value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|FunctionProps - label: GetSecretValueOptions kind: 22 @@ -263,7 +263,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -275,13 +275,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -299,7 +299,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 diff --git a/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap b/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap index a121951c269..bfe32f53fca 100644 --- a/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap +++ b/libs/wingc/src/lsp/snapshots/completions/variable_type_annotation_namespace.snap @@ -35,13 +35,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 7 documentation: kind: markdown - value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass Function impl IInflightHost\n```\n---\nA function.\n\n### Initializer\n- `handler` — `inflight (event: str?): str?`\n- `...props` — `FunctionProps?`\n \n - `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n - `env?` — `Map?` — Environment variables to pass to the function.\n - `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n - `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n - `timeout?` — `duration?` — The maximum amount of time the function can run.\n### Fields\n- `env` — `Map` — Returns the set of environment variables for this function.\n- `node` — `Node` — The tree node.\n### Methods\n- `addEnvironment` — `preflight (name: str, value: str): void` — Add an environment variable to the function.\n- `invoke` — `inflight (payload: str?): str?` — Invokes the function with a payload and waits for the result.\n- `invokeAsync` — `inflight (payload: str?): void` — Kicks off the execution of the function with a payload and returns immediately while the function is running.\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|Function - label: OnDeploy kind: 7 documentation: kind: markdown - value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." + value: "```wing\nclass OnDeploy\n```\n---\nRun code every time the app is deployed.\n\n### Initializer\n- `handler` — `inflight (): void`\n- `...props` — `OnDeployProps?`\n \n - `concurrency?` — `num?`\n - `env?` — `Map?`\n - `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n - `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n - `logRetentionDays?` — `num?`\n - `memory?` — `num?`\n - `timeout?` — `duration?`\n### Fields\n- `node` — `Node` — The tree node.\n### Methods\n- `isConstruct` — `preflight (x: any): bool` — Checks if `x` is a construct.\n- `onLift` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this resource inflight.\n- `onLiftType` — `preflight (host: IInflightHost, ops: Array): void` — A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.\n- `toString` — `preflight (): str` — Returns a string representation of this construct." sortText: gg|OnDeploy - label: Queue kind: 7 @@ -245,7 +245,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." + value: "```wing\nstruct FunctionProps\n```\n---\nOptions for `Function`.\n### Fields\n- `concurrency?` — `num?` — The maximum concurrent invocations that can run at one time.\n- `env?` — `Map?` — Environment variables to pass to the function.\n- `logRetentionDays?` — `num?` — Specifies the number of days that function logs will be kept.\n- `memory?` — `num?` — The amount of memory to allocate to the function, in MB.\n- `timeout?` — `duration?` — The maximum amount of time the function can run." sortText: hh|FunctionProps - label: GetSecretValueOptions kind: 22 @@ -263,7 +263,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct OnDeployProps extends FunctionProps\n```\n---\nOptions for `OnDeploy`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `executeAfter?` — `Array?` — Execute this trigger only after these resources have been provisioned.\n- `executeBefore?` — `Array?` — Adds this trigger as a dependency on other constructs.\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|OnDeployProps - label: QueueProps kind: 22 @@ -275,13 +275,13 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct QueueSetConsumerOptions extends FunctionProps\n```\n---\nOptions for Queue.setConsumer.\n### Fields\n- `batchSize?` — `num?` — The maximum number of messages to send to subscribers at once.\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|QueueSetConsumerOptions - label: ScheduleOnTickOptions kind: 22 documentation: kind: markdown - value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ScheduleOnTickOptions extends FunctionProps\n```\n---\nOptions for Schedule.onTick.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ScheduleOnTickOptions - label: ScheduleProps kind: 22 @@ -299,7 +299,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct ServiceOnStartOptions extends FunctionProps\n```\n---\nOptions for Service.onStart.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|ServiceOnStartOptions - label: ServiceProps kind: 22 @@ -311,7 +311,7 @@ source: libs/wingc/src/lsp/completions.rs kind: 22 documentation: kind: markdown - value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" + value: "```wing\nstruct TopicOnMessageOptions extends FunctionProps\n```\n---\nOptions for `Topic.onMessage`.\n### Fields\n- `concurrency?` — `num?`\n- `env?` — `Map?`\n- `logRetentionDays?` — `num?`\n- `memory?` — `num?`\n- `timeout?` — `duration?`" sortText: hh|TopicOnMessageOptions - label: TopicProps kind: 22 diff --git a/libs/wingc/src/type_check.rs b/libs/wingc/src/type_check.rs index 2852074448a..c274525dd1c 100644 --- a/libs/wingc/src/type_check.rs +++ b/libs/wingc/src/type_check.rs @@ -1127,6 +1127,17 @@ impl TypeRef { matches!(**self, Type::Function(_)) } + pub fn is_enum(&self) -> bool { + matches!(**self, Type::Enum(_)) + } + + pub fn is_stringable(&self) -> bool { + matches!( + **self, + Type::String | Type::Number | Type::Boolean | Type::Json(_) | Type::MutJson | Type::Enum(_) | Type::Anything + ) + } + /// If this is a function and its last argument is a struct, return that struct. pub fn get_function_struct_arg(&self) -> Option<&Struct> { if let Some(func) = self.maybe_unwrap_option().as_function_sig() { @@ -1338,7 +1349,7 @@ pub struct Types { /// A map from source paths to type information about that path /// If it's a file, we save its symbol environment, and if it's a directory, we save a namespace that points to /// all of the symbol environments of the files (or subdirectories) in that directory - source_file_envs: IndexMap, + pub source_file_envs: IndexMap, pub libraries: SymbolEnv, numeric_idx: usize, string_idx: usize, @@ -1557,18 +1568,6 @@ impl Types { self.get_typeref(self.mut_json_idx) } - pub fn stringables(&self) -> Vec { - // TODO: This should be more complex and return all types that have some stringification facility - // see: https://github.com/winglang/wing/issues/741 - vec![ - self.string(), - self.number(), - self.json(), - self.mut_json(), - self.anything(), - ] - } - pub fn add_namespace(&mut self, n: Namespace) -> NamespaceRef { self.namespaces.push(Box::new(n)); self.get_namespaceref(self.namespaces.len() - 1) @@ -2063,7 +2062,7 @@ impl<'a> TypeChecker<'a> { if let InterpolatedStringPart::Expr(interpolated_expr) = part { let (exp_type, p) = self.type_check_exp(interpolated_expr, env); phase = combine_phases(phase, p); - self.validate_type_in(exp_type, &self.types.stringables(), interpolated_expr); + self.validate_type_is_stringable(exp_type, interpolated_expr); } }); (self.types.string(), phase) @@ -3220,6 +3219,28 @@ impl<'a> TypeChecker<'a> { first_expected_type } + pub fn validate_type_is_stringable(&mut self, actual_type: TypeRef, span: &impl Spanned) { + // If it's a type we can't resolve then we silently ignore it, assuming an error was already reported + if actual_type.is_unresolved() || actual_type.is_inferred() { + return; + } + + if !actual_type.is_stringable() { + let message = format!("Expected type to be stringable, but got \"{actual_type}\" instead"); + + let hint = if actual_type.maybe_unwrap_option().is_stringable() { + format!( + "{} is an optional, try unwrapping it with 'x ?? \"nil\"' or 'x!'", + actual_type + ) + } else { + "str, num, bool, json, and enums are stringable".to_string() + }; + + self.spanned_error_with_hints(span, message, vec![hint]); + } + } + pub fn type_check_file_or_dir(&mut self, source_path: &Utf8Path, scope: &Scope) { CompilationContext::set(CompilationPhase::TypeChecking, &scope.span); self.type_check_scope(scope); diff --git a/libs/wingcompiler/src/compile.ts b/libs/wingcompiler/src/compile.ts index 06984032cbb..26f0533f270 100644 --- a/libs/wingcompiler/src/compile.ts +++ b/libs/wingcompiler/src/compile.ts @@ -164,8 +164,7 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom if (!existsSync(synthDir)) { await fs.mkdir(workDir, { recursive: true }); } - - let preflightEntrypoint = await compileForPreflight({ + const compileForPreflightResult = await compileForPreflight({ entrypointFile, workDir, wingDir, @@ -185,6 +184,7 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom WING_VALUES: options.value?.length == 0 ? undefined : options.value, WING_VALUES_FILE: options.values ?? defaultValuesFile(), WING_NODE_MODULES: wingNodeModules, + WING_IMPORTED_NAMESPACES: compileForPreflightResult.compilerOutput?.imported_namespaces.join(";"), }; if (options.rootId) { @@ -201,10 +201,8 @@ export async function compile(entrypoint: string, options: CompileOptions): Prom delete preflightEnv.Path; } } - - await runPreflightCodeInWorkerThread(preflightEntrypoint, preflightEnv); + await runPreflightCodeInWorkerThread(compileForPreflightResult.preflightEntrypoint, preflightEnv); } - return synthDir; } @@ -219,6 +217,13 @@ function isEntrypointFile(path: string) { ); } +interface CompileForPreflightResult { + readonly preflightEntrypoint: string; + readonly compilerOutput?: { + imported_namespaces: string[]; + } +} + async function compileForPreflight(props: { entrypointFile: string; workDir: string; @@ -226,7 +231,7 @@ async function compileForPreflight(props: { synthDir: string; color?: boolean; log?: (...args: any[]) => void; -}) { +}): Promise { if (props.entrypointFile.endsWith(".ts")) { const typescriptFramework = await import("@wingcloud/framework") .then((m) => m.internal) @@ -239,10 +244,12 @@ npm i @wingcloud/framework `); }); - return await typescriptFramework.compile({ - workDir: props.workDir, - entrypoint: props.entrypointFile, - }); + return { + preflightEntrypoint: await typescriptFramework.compile({ + workDir: props.workDir, + entrypoint: props.entrypointFile, + }) + } } else { let env: Record = { RUST_BACKTRACE: "full", @@ -278,8 +285,10 @@ npm i @wingcloud/framework )}`; props.log?.(`invoking %s with: "%s"`, WINGC_COMPILE, arg); let compileSuccess: boolean; + let compilerOutput: string | number = ""; try { - compileSuccess = wingCompiler.invoke(wingc, WINGC_COMPILE, arg) !== 0; + compilerOutput = wingCompiler.invoke(wingc, WINGC_COMPILE, arg); + compileSuccess = compilerOutput !== 0; } catch (error) { // This is a bug in the compiler, indicate a compilation failure. // The bug details should be part of the diagnostics handling below. @@ -290,7 +299,12 @@ npm i @wingcloud/framework throw new CompileError(errors); } - return join(props.workDir, WINGC_PREFLIGHT); + return { + preflightEntrypoint: join(props.workDir, WINGC_PREFLIGHT), + compilerOutput: JSON.parse( + compilerOutput as string + ), + } } } diff --git a/libs/wingcompiler/src/wingc.ts b/libs/wingcompiler/src/wingc.ts index 56fd5a64569..9f3cceecf94 100644 --- a/libs/wingcompiler/src/wingc.ts +++ b/libs/wingcompiler/src/wingc.ts @@ -282,7 +282,7 @@ export function invoke( argMemoryBuffer.set(bytes); const result = exports[func](argPointer, bytes.byteLength); - + if (result === 0 || result === undefined || result === 0n) { return 0; } else { diff --git a/libs/wingsdk/.projen/deps.json b/libs/wingsdk/.projen/deps.json index 9fd500c9965..8776ce3074e 100644 --- a/libs/wingsdk/.projen/deps.json +++ b/libs/wingsdk/.projen/deps.json @@ -253,6 +253,11 @@ "name": "@types/aws-lambda", "type": "bundled" }, + { + "name": "@winglang/wingtunnels", + "version": "workspace:^", + "type": "bundled" + }, { "name": "ajv", "type": "bundled" diff --git a/libs/wingsdk/.projenrc.ts b/libs/wingsdk/.projenrc.ts index 8c7642eab67..dd182e0d22b 100644 --- a/libs/wingsdk/.projenrc.ts +++ b/libs/wingsdk/.projenrc.ts @@ -88,6 +88,8 @@ const project = new cdk.JsiiProject({ // enhanced diagnostics "stacktracey", "ulid", + // tunnels + "@winglang/wingtunnels@workspace:^", ], devDeps: [ `@cdktf/provider-aws@^19`, // only for testing Wing plugins diff --git a/libs/wingsdk/package.json b/libs/wingsdk/package.json index 4c21da8e180..8cdc839af21 100644 --- a/libs/wingsdk/package.json +++ b/libs/wingsdk/package.json @@ -96,6 +96,7 @@ "@smithy/util-stream": "2.0.17", "@smithy/util-utf8": "2.0.0", "@types/aws-lambda": "^8.10.119", + "@winglang/wingtunnels": "workspace:^", "ajv": "^8.12.0", "cdktf": "0.20.3", "constructs": "^10.3", @@ -136,6 +137,7 @@ "@smithy/util-stream", "@smithy/util-utf8", "@types/aws-lambda", + "@winglang/wingtunnels", "ajv", "cdktf", "cron-parser", diff --git a/libs/wingsdk/src/cloud/endpoint.ts b/libs/wingsdk/src/cloud/endpoint.ts index 79af4fb447f..509be13915e 100644 --- a/libs/wingsdk/src/cloud/endpoint.ts +++ b/libs/wingsdk/src/cloud/endpoint.ts @@ -55,7 +55,6 @@ export class Endpoint extends Resource { super(scope, id); - Node.of(this).hidden = true; Node.of(this).title = "Endpoint"; Node.of(this).description = props?.label ?? "A cloud endpoint"; diff --git a/libs/wingsdk/src/cloud/function.md b/libs/wingsdk/src/cloud/function.md index 0d576669965..06cc35c0baf 100644 --- a/libs/wingsdk/src/cloud/function.md +++ b/libs/wingsdk/src/cloud/function.md @@ -56,12 +56,12 @@ new cloud.Function(inflight () => { ## Function container reuse -Most cloud providers will opportunistically reuse the function's container in additional invocations. It is possible -to leverage this behavior to cache objects across function executions using `inflight new` and inflight fields. +Most cloud providers will opportunistically reuse the function's container in additional invocations. +It is possible to leverage this behavior to cache objects across function executions using `inflight new` and inflight fields. The following example reads the `bigdata.json` file once and reuses it every time `query()` is called. -```js +```ts playground bring cloud; let big = new cloud.Bucket(); @@ -95,6 +95,14 @@ new cloud.Function(inflight () => { The sim implementation of `cloud.Function` runs the inflight code as a JavaScript function. +By default, a maximum of 10 workers can be processing requests sent to a `cloud.Function` concurrently, but this number can be adjusted with the `concurrency` property: + +```ts playground +new cloud.Function(inflight () => { + // ... code that shouldn't run concurrently ... +}, concurrency: 1); +``` + ### AWS (`tf-aws` and `awscdk`) The AWS implementation of `cloud.Function` uses [AWS Lambda](https://aws.amazon.com/lambda/). diff --git a/libs/wingsdk/src/cloud/function.ts b/libs/wingsdk/src/cloud/function.ts index 95786aff4be..ffcc9d01fdb 100644 --- a/libs/wingsdk/src/cloud/function.ts +++ b/libs/wingsdk/src/cloud/function.ts @@ -40,6 +40,12 @@ export interface FunctionProps { * @default 30 */ readonly logRetentionDays?: number; + + /** + * The maximum concurrent invocations that can run at one time. + * @default - platform specific limits (100 on the simulator) + */ + readonly concurrency?: number; } /** @@ -94,6 +100,12 @@ export class Function extends Resource implements IInflightHost { if (process.env.WING_TARGET) { this.addEnvironment("WING_TARGET", process.env.WING_TARGET); } + + if (props.concurrency !== undefined && props.concurrency <= 0) { + throw new Error( + "concurrency option on cloud.Function must be a positive integer" + ); + } } /** @internal */ diff --git a/libs/wingsdk/src/core/tree.ts b/libs/wingsdk/src/core/tree.ts index 61115da8abe..806b8895b37 100644 --- a/libs/wingsdk/src/core/tree.ts +++ b/libs/wingsdk/src/core/tree.ts @@ -4,6 +4,7 @@ import { IConstruct } from "constructs"; import { App } from "./app"; import { IResource, Node, Resource } from "../std"; import { VisualComponent } from "../ui/base"; +import { Colors, isOfTypeColors } from "../ui/colors"; export const TREE_FILE_PATH = "tree.json"; @@ -75,6 +76,11 @@ export interface DisplayInfo { * @default - no UI components */ readonly ui?: any[]; // UIComponent + + /** + * The color of the resource in the UI. + */ + readonly color?: Colors; } /** @internal */ @@ -206,13 +212,20 @@ function synthDisplay(construct: IConstruct): DisplayInfo | undefined { } } - if (display.description || display.title || display.hidden || ui) { + if ( + display.description || + display.title || + display.hidden || + ui || + display.color + ) { return { title: display.title, description: display.description, hidden: display.hidden, sourceModule: display.sourceModule, ui: ui.length > 0 ? ui : undefined, + color: isOfTypeColors(display.color) ? display.color : undefined, }; } return; diff --git a/libs/wingsdk/src/platform/platform-manager.ts b/libs/wingsdk/src/platform/platform-manager.ts index da2a85b3ab7..321385ed188 100644 --- a/libs/wingsdk/src/platform/platform-manager.ts +++ b/libs/wingsdk/src/platform/platform-manager.ts @@ -3,6 +3,7 @@ import { basename, dirname, join } from "path"; import { cwd } from "process"; import * as vm from "vm"; import { IPlatform } from "./platform"; +import { scanDirForPlatformFile } from "./util"; import { App, AppProps, SynthHooks } from "../core"; interface PlatformManagerOptions { @@ -21,6 +22,41 @@ export class PlatformManager { constructor(options: PlatformManagerOptions) { this.platformPaths = options.platformPaths ?? []; + this.retrieveImplicitPlatforms(); + } + + /** + * Retrieve all implicit platform declarations. + * + * These are platforms that are not explicitly declared in the cli options + * but are implicitly available to the app. + * + * We look for platforms in the following locations: + * - The source directory + * - Any imported namespaces (provided by the wingc compiler output) + * + * To determine if a directory contains a platform, we check if it contains a file ending in "wplatform.js" + * TODO: Support platforms defined in Wing (platform.w) https://github.com/winglang/wing/issues/4937 + */ + private retrieveImplicitPlatforms() { + const importedNamespaces = process.env.WING_IMPORTED_NAMESPACES?.split(";"); + const sourceDir = process.env.WING_SOURCE_DIR!; + + if (sourceDir) { + const sourceDirPlatformFile = scanDirForPlatformFile(sourceDir); + if (sourceDirPlatformFile) { + this.platformPaths.push(...sourceDirPlatformFile); + } + } + + if (importedNamespaces) { + importedNamespaces.forEach((namespaceDir) => { + const namespaceDirPlatformFile = scanDirForPlatformFile(namespaceDir); + if (namespaceDirPlatformFile) { + this.platformPaths.push(...namespaceDirPlatformFile); + } + }); + } } private loadPlatformPath(platformPath: string) { diff --git a/libs/wingsdk/src/platform/util.ts b/libs/wingsdk/src/platform/util.ts index b0220d1d8f7..7b92a6c5c66 100644 --- a/libs/wingsdk/src/platform/util.ts +++ b/libs/wingsdk/src/platform/util.ts @@ -1,4 +1,4 @@ -import { existsSync, readFileSync } from "fs"; +import { existsSync, readFileSync, readdirSync } from "fs"; import * as path from "path"; import * as toml from "toml"; import * as yaml from "yaml"; @@ -101,3 +101,26 @@ export function loadPlatformSpecificValues() { })(); return { ...fileValues, ...cliValues }; } + +/** + * Scans a directory for any platform files. + * + * @param dir the directory to scan + * @returns the path to any platform files + */ +export function scanDirForPlatformFile(dir: string): string[] { + const result: string[] = []; + + if (!existsSync(dir)) { + return result; + } + + const files = readdirSync(dir); + for (const file of files) { + if (file === "wplatform.js" || file.endsWith(".wplatform.js")) { + result.push(path.join(dir, file)); + } + } + + return result; +} diff --git a/libs/wingsdk/src/shared/sandbox.ts b/libs/wingsdk/src/shared/sandbox.ts index 9d065bfc91a..4d73c7ce1be 100644 --- a/libs/wingsdk/src/shared/sandbox.ts +++ b/libs/wingsdk/src/shared/sandbox.ts @@ -2,8 +2,8 @@ import * as cp from "child_process"; import { writeFileSync } from "fs"; import { mkdtemp, readFile, stat } from "fs/promises"; import { tmpdir } from "os"; -import * as path from "path"; -import { createBundle } from "./bundling"; +import path from "path"; +import { Bundle, createBundle } from "./bundling"; import { processStream } from "./stream-processor"; export interface SandboxOptions { @@ -35,45 +35,23 @@ type ProcessResponse = }; export class Sandbox { - private createBundlePromise: Promise; - private entrypoint: string; - private readonly exitingChildren: Promise[] = []; - private readonly timeouts: NodeJS.Timeout[] = []; - private readonly options: SandboxOptions; - - constructor(entrypoint: string, options: SandboxOptions = {}) { - this.entrypoint = entrypoint; - this.options = options; - this.createBundlePromise = this.createBundle(); - } - - public async cleanup() { - await this.createBundlePromise; - for (const timeout of this.timeouts) { - clearTimeout(timeout); - } - // Make sure all child processes have exited before cleaning up the sandbox. - for (const exitingChild of this.exitingChildren) { - await exitingChild; - } - } - - private async createBundle() { + public static async createBundle( + entrypoint: string, + log?: (message: string) => void + ): Promise { const workdir = await mkdtemp(path.join(tmpdir(), "wing-bundles-")); - // wrap contents with a shim that handles the communication with the parent process - // we insert this shim before bundling to ensure source maps are generated correctly - let contents = (await readFile(this.entrypoint)).toString(); + let contents = (await readFile(entrypoint)).toString(); // log a warning if contents includes __dirname or __filename if (contents.includes("__dirname") || contents.includes("__filename")) { - this.options.log?.( - false, - "warn", + log?.( `Warning: __dirname and __filename cannot be used within bundled cloud functions. There may be unexpected behavior.` ); } + // wrap contents with a shim that handles the communication with the parent process + // we insert this shim before bundling to ensure source maps are generated correctly contents = ` "use strict"; ${contents} @@ -87,30 +65,81 @@ process.on("message", async (message) => { } }); `; - const wrappedPath = this.entrypoint.replace(/\.js$/, ".sandbox.js"); + const wrappedPath = entrypoint.replace(/\.js$/, ".sandbox.js"); writeFileSync(wrappedPath, contents); // async fsPromises.writeFile "flush" option is not available in Node 20 const bundle = createBundle(wrappedPath, [], workdir); - this.entrypoint = bundle.entrypointPath; if (process.env.DEBUG) { - const bundleSize = (await stat(bundle.entrypointPath)).size; - this.debugLog(`Bundled code (${bundleSize} bytes).`); + const fileStats = await stat(entrypoint); + log?.(`Bundled code (${fileStats.size} bytes).`); } + + return bundle; } - public async call(fn: string, ...args: any[]): Promise { - // wait for the bundle to finish creation - await this.createBundlePromise; + private readonly entrypoint: string; + private readonly options: SandboxOptions; + + private child: cp.ChildProcess | undefined; + private onChildMessage: ((message: ProcessResponse) => void) | undefined; + private onChildError: ((error: Error) => void) | undefined; + private onChildExit: + | ((code: number | null, signal: NodeJS.Signals | null) => void) + | undefined; + + private timeout: NodeJS.Timeout | undefined; + + // Tracks whether the sandbox is available to process a new request + // When call() is called, it sets this to false, and when it's returning + // a response or error, it sets it back to true. + private available = true; + + constructor(entrypoint: string, options: SandboxOptions = {}) { + this.entrypoint = entrypoint; + this.options = options; + } - this.debugLog("Forking process to run bundled code."); + public async cleanup() { + if (this.timeout) { + clearTimeout(this.timeout); + } + + if (this.child) { + this.child.kill("SIGTERM"); + this.child = undefined; + this.available = true; + } + } + + public isAvailable(): boolean { + return this.available; + } + + public async initialize() { + this.debugLog("Initializing sandbox."); + const childEnv = this.options.env ?? {}; + if ( + process.env.NODE_OPTIONS?.includes("--inspect") || + process.execArgv.some((a) => a.startsWith("--inspect")) + ) { + // We're exposing a debugger, let's attempt to ensure the child process automatically attaches + childEnv.NODE_OPTIONS = + (childEnv.NODE_OPTIONS ?? "") + (process.env.NODE_OPTIONS ?? ""); + + // VSCode's debugger adds some environment variables that we want to pass to the child process + for (const key in process.env) { + if (key.startsWith("VSCODE_")) { + childEnv[key] = process.env[key]!; + } + } + } - // start a Node.js process that runs the bundled code + // start a Node.js process that runs the inflight code // note: unlike the fork(2) POSIX system call, child_process.fork() // does not clone the current process - const child = cp.fork(this.entrypoint, [], { - env: this.options.env, + this.child = cp.fork(this.entrypoint, { + env: childEnv, stdio: "pipe", - // execArgv: ["--enable-source-maps"], // this option allows complex objects like Error to be sent from the child process to the parent serialization: "advanced", }); @@ -120,82 +149,97 @@ process.on("message", async (message) => { this.options.log?.(false, "error", message); // pipe stdout and stderr from the child process - if (child.stdout) { - processStream(child.stdout, log); + if (this.child.stdout) { + processStream(this.child.stdout, log); } - if (child.stderr) { - processStream(child.stderr, logError); + if (this.child.stderr) { + processStream(this.child.stderr, logError); } - // Keep track of when the child process exits so that the simulator doesn't try - // to clean up the sandbox before the child process has exited. - // NOTE: If child processes are taking too long to exit (preventing simulator cleanups), - // we could add a mechanism to send SIGKILL to the child process after a certain amount of time. - let childExited: (value?: any) => void; - this.exitingChildren.push( - new Promise((resolve) => { - childExited = resolve; - }) - ); + this.child.on("message", (message: ProcessResponse) => { + this.onChildMessage?.(message); + }); + this.child!.on("error", (error) => { + this.onChildError?.(error); + }); + this.child!.on("exit", (code, signal) => { + this.onChildExit?.(code, signal); + }); + } + + public async call(fn: string, ...args: any[]): Promise { + // Prevent multiple calls to the same sandbox running concurrently. + this.available = false; + + // If this sandbox doesn't have a child process running (because it + // just got created, OR because the previous child process was killed due + // to timeout or an unexpected error), initialize one. + if (!this.child) { + await this.initialize(); + } // Send the function name and arguments to the child process. - // When a message is received, kill the child process. - // Once the child process is killed (by the parent process or because the user code - // exited on its own), resolve or reject the promise. + // When a message is received, resolve or reject the promise. return new Promise((resolve, reject) => { - child.send({ fn, args } as ProcessRequest); - - let result: any; - let status: "resolve" | "reject" | "pending" = "pending"; + this.child!.send({ fn, args } as ProcessRequest); - child.on("message", (message: ProcessResponse) => { - this.debugLog("Received a message, killing child process."); - child.kill(); + this.onChildMessage = (message: ProcessResponse) => { + this.debugLog("Received a message from the sandbox."); + this.available = true; + if (this.timeout) { + clearTimeout(this.timeout); + } if (message.type === "resolve") { - result = message.value; - status = "resolve"; + resolve(message.value); } else if (message.type === "reject") { - result = message.reason; - status = "reject"; + reject(message.reason); } else { - result = `Parent received unexpected message from child process: ${message}`; - status = "reject"; + reject( + new Error( + `Unexpected message from sandbox child process: ${message}` + ) + ); } - }); + }; // "error" could be emitted for any number of reasons // (e.g. the process couldn't be spawned or killed, or a message couldn't be sent). // Since this is unexpected, we kill the process with SIGKILL to ensure it's dead, and reject the promise. - child.on("error", (error) => { - this.debugLog("Killing process after error."); - child.kill("SIGKILL"); - childExited(); - reject(`Unexpected error: ${error}`); - }); - - child.on("exit", (code, _signal) => { + this.onChildError = (error: Error) => { + this.debugLog("Unexpected error from the sandbox."); + this.child?.kill("SIGKILL"); + this.child = undefined; + this.available = true; + if (this.timeout) { + clearTimeout(this.timeout); + } + reject(error); + }; + + // "exit" could be emitted if the user code called process.exit(), or if we killed the process + // due to a timeout or unexpected error. In any case, we reject the promise. + this.onChildExit = (code: number | null) => { this.debugLog("Child processed stopped."); - childExited(); - if (status === "pending") { - // If the child process stopped without sending us back a message, reject the promise. - reject(new Error(`Process exited with code ${code}`)); - } else if (status === "resolve") { - resolve(result); - } else if (status === "reject") { - reject(result); + this.child = undefined; + this.available = true; + if (this.timeout) { + clearTimeout(this.timeout); } - }); + reject(new Error(`Process exited with code ${code}`)); + }; if (this.options.timeout) { - const timeout = setTimeout(() => { + this.timeout = setTimeout(() => { this.debugLog("Killing process after timeout."); - child.kill(); - status = "reject"; - result = new Error( - `Function timed out (it was configured to only run for ${this.options.timeout}ms)` + this.child?.kill("SIGTERM"); + this.child = undefined; + this.available = true; + reject( + new Error( + `Function timed out (it was configured to only run for ${this.options.timeout}ms)` + ) ); }, this.options.timeout); - this.timeouts.push(timeout); } }); } diff --git a/libs/wingsdk/src/simulator/graph.ts b/libs/wingsdk/src/simulator/graph.ts new file mode 100644 index 00000000000..c73a11b7118 --- /dev/null +++ b/libs/wingsdk/src/simulator/graph.ts @@ -0,0 +1,103 @@ +import { resolveTokens } from "./tokens"; + +export interface Definition { + path: string; + deps?: string[]; + props?: Record; +} + +class Node { + public readonly dependencies = new Set(); + public readonly dependents = new Set(); + constructor(public readonly def: T) {} + + public get path() { + return this.def.path; + } +} + +export class Graph { + private byPath: Record> = {}; + + constructor(resources: T[] = []) { + for (const resource of resources) { + this.byPath[resource.path] = new Node(resource); + } + + // build the dependency graph + for (const resource of resources) { + const consumer = resource.path; + + // add explicit dependencies + for (const dep of resource.deps ?? []) { + this.recordDependency(consumer, dep); + } + + // add implicit dependencies (e.g. from tokens in props) + const implicitDeps: string[] = []; + + // collect all tokens from the props object (recursive) the "resolver" here is just a dummy + // function that collects all tokens and returns a dummy value (we don't care about the + // result). + resolveTokens(resource.props ?? {}, (token) => { + implicitDeps.push(token.path); + return "[T]"; // <-- we don't really use the result, just need to return something + }); + + // now add all implicit dependencies + for (const dep of implicitDeps) { + this.recordDependency(consumer, dep); + } + } + } + + public get nodes(): Node[] { + return Object.values(this.byPath); + } + + public tryFind(path: string): Node | undefined { + const node = this.byPath[path]; + if (!node) { + return undefined; + } + + return node; + } + + private recordDependency(consumer: string, producer: string) { + this.tryFind(consumer)?.dependencies.add(producer); + this.tryFind(producer)?.dependents.add(consumer); + + // check for cyclic dependencies + this.detectCycles(consumer); + this.detectCycles(producer); + } + + private detectCycles(root: string) { + const visited = new Set(); + const stack = new Set(); + + const visit = (path: string) => { + if (stack.has(path)) { + throw new Error( + `cyclic dependency detected: ${[...stack, path].join(" -> ")}` + ); + } + + if (visited.has(path)) { + return; + } + + visited.add(path); + stack.add(path); + + for (const dep of this.tryFind(path)?.dependencies ?? []) { + visit(dep); + } + + stack.delete(path); + }; + + visit(root); + } +} diff --git a/libs/wingsdk/src/simulator/simulator.ts b/libs/wingsdk/src/simulator/simulator.ts index 79f0e9c37dc..8a43e74d65a 100644 --- a/libs/wingsdk/src/simulator/simulator.ts +++ b/libs/wingsdk/src/simulator/simulator.ts @@ -3,19 +3,17 @@ import { mkdir, rm } from "fs/promises"; import type { Server, IncomingMessage, ServerResponse } from "http"; import { join } from "path"; import { makeSimulatorClient } from "./client"; +import { Graph } from "./graph"; import { deserialize, serialize } from "./serialization"; +import { resolveTokens } from "./tokens"; import { Tree } from "./tree"; import { SDK_VERSION } from "../constants"; -import { ConstructTree, TREE_FILE_PATH } from "../core"; +import { TREE_FILE_PATH } from "../core"; import { readJsonSync } from "../shared/misc"; import { CONNECTIONS_FILE_PATH, Trace, TraceType } from "../std"; -import { - SIMULATOR_TOKEN_REGEX, - SIMULATOR_TOKEN_REGEX_FULL, -} from "../target-sim/tokens"; -const START_ATTEMPT_COUNT = 10; const LOCALHOST_ADDRESS = "127.0.0.1"; +const HANDLE_ATTRIBUTE = "handle"; /** * Props for `Simulator`. @@ -160,13 +158,24 @@ export interface ITraceSubscriber { */ type RunningState = "starting" | "running" | "stopping" | "stopped"; +interface Model { + simdir: string; + tree: Tree; + connections: ConnectionData[]; + schema: WingSimulatorSchema; + graph: Graph; +} + +interface ResourceState { + props: Record; + attrs: Record; +} + /** * A simulator that can be used to test your application locally. */ export class Simulator { // fields that are same between simulation runs / reloads - private _config: WingSimulatorSchema; - private readonly simdir: string; private readonly statedir: string; // fields that change between simulation runs / reloads @@ -174,18 +183,18 @@ export class Simulator { private readonly _handles: HandleManager; private _traces: Array; private readonly _traceSubscribers: Array; - private _tree: Tree; - private _connections: ConnectionData[]; private _serverUrl: string | undefined; private _server: Server | undefined; + private _model: Model; + + // keeps the actual resolved state (props and attrs) of all started resources. this state is + // merged in when calling `getResourceConfig()`. + private state: Record = {}; constructor(props: SimulatorProps) { - this.simdir = props.simfile; - this.statedir = props.stateDir ?? join(this.simdir, ".state"); - const { config, treeData, connectionData } = this._loadApp(props.simfile); - this._config = config; - this._tree = new Tree(treeData); - this._connections = connectionData; + const simdir = props.simfile; + this.statedir = props.stateDir ?? join(simdir, ".state"); + this._model = this._loadApp(simdir); this._running = "stopped"; this._handles = new HandleManager(); @@ -193,50 +202,48 @@ export class Simulator { this._traceSubscribers = new Array(); } - private _loadApp(simdir: string): { - config: any; - treeData: ConstructTree; - connectionData: ConnectionData[]; - } { - const simJson = join(this.simdir, "simulator.json"); + private _loadApp(simdir: string): Model { + const simJson = join(simdir, "simulator.json"); if (!existsSync(simJson)) { throw new Error( `Invalid Wing app (${simdir}) - simulator.json not found.` ); } - const config: WingSimulatorSchema = readJsonSync(simJson); + const schema = readJsonSync(simJson) as WingSimulatorSchema; - const foundVersion = config.sdkVersion ?? "unknown"; + const foundVersion = schema.sdkVersion ?? "unknown"; const expectedVersion = SDK_VERSION; if (foundVersion !== expectedVersion) { console.error( `WARNING: The simulator directory (${simdir}) was generated with Wing SDK v${foundVersion} but it is being simulated with Wing SDK v${expectedVersion}.` ); } - if (config.resources === undefined) { + if (schema.resources === undefined) { throw new Error( `Incompatible .wsim file. The simulator directory (${simdir}) was generated with Wing SDK v${foundVersion} but it is being simulated with Wing SDK v${expectedVersion}.` ); } - const treeJson = join(this.simdir, TREE_FILE_PATH); + const treeJson = join(simdir, TREE_FILE_PATH); if (!existsSync(treeJson)) { throw new Error( `Invalid Wing app (${simdir}) - ${TREE_FILE_PATH} not found.` ); } - const treeData = readJsonSync(treeJson); - const connectionJson = join(this.simdir, CONNECTIONS_FILE_PATH); + const tree = new Tree(readJsonSync(treeJson)); + + const connectionJson = join(simdir, CONNECTIONS_FILE_PATH); if (!existsSync(connectionJson)) { throw new Error( `Invalid Wing app (${simdir}) - ${CONNECTIONS_FILE_PATH} not found.` ); } - const connectionData = readJsonSync(connectionJson).connections; + const connections = readJsonSync(connectionJson).connections; + const graph = new Graph(schema.resources); - return { config, treeData, connectionData }; + return { schema, tree, connections, simdir, graph }; } /** @@ -250,45 +257,76 @@ export class Simulator { } this._running = "starting"; - // create a copy of the resource list to be used as an init queue. - const initQueue: (BaseResourceSchema & { _attempts?: number })[] = [ - ...this._config.resources, - ]; - await this.startServer(); try { - while (true) { - const next = initQueue.shift(); - if (!next) { - break; - } - - // we couldn't start this resource yet, so decrement the retry counter and put it back in - // the init queue. - if (!(await this.tryStartResource(next))) { - // we couldn't start this resource yet, so decrement the attempt counter - next._attempts = next._attempts ?? START_ATTEMPT_COUNT; - next._attempts--; + await this.startResources(); + this._running = "running"; + } catch (err) { + this.stopServer(); + this._running = "stopped"; + throw err; + } + } - // if we've tried too many times, give up (might be a dependency cycle or a bad reference) - if (next._attempts === 0) { + private async startResources() { + const retries: Record = {}; + const queue = this._model.graph.nodes.map((n) => n.path); + while (queue.length > 0) { + const top = queue.shift()!; + try { + await this.startResource(top); + } catch (e) { + if (e instanceof UnresolvedTokenError) { + retries[top] = (retries[top] ?? 0) + 1; + if (retries[top] > 10) { throw new Error( - `Could not start resource ${next.path} after ${START_ATTEMPT_COUNT} attempts. This could be due to a dependency cycle or an invalid attribute reference.` + `Could not start resource after 10 attempts: ${e.message}` ); } - - // put back in the queue for another round - initQueue.push(next); + queue.push(top); + } else { + throw e; } } + } + } - this._running = "running"; - } catch (err) { - this.stopServer(); - this._running = "stopped"; - throw err; + /** + * Updates the running simulation with a new version of the app. This will create/update/delete + * resources as necessary to get to the desired state. + * @param simDir The path to the new version of the app + */ + public async update(simDir: string) { + const newModel = this._loadApp(simDir); + + const plan = planUpdate( + this._model.schema.resources, + newModel.schema.resources + ); + + this.addTrace({ + type: TraceType.SIMULATOR, + data: { + message: `Update: ${plan.added.length} added, ${plan.updated.length} updated, ${plan.deleted.length} deleted`, + update: plan, + }, + sourcePath: "root", + sourceType: "Simulator", + timestamp: new Date().toISOString(), + }); + + // stop all *deleted* and *updated* resources + for (const c of [...plan.deleted, ...plan.updated]) { + await this.stopResource(c); // <-- this also stops all dependent resources if needed } + + // now update the internal model to the new version + this._model = newModel; + + // start all *added* and *updated* resources (the updated model basically includes only these) + // this will also start all dependencies as needed and not touch any resource that is already started + await this.startResources(); } /** @@ -308,31 +346,9 @@ export class Simulator { } this._running = "stopping"; - for (const resourceConfig of this._config.resources.slice().reverse()) { - const handle = resourceConfig.attrs?.handle; - if (!handle) { - throw new Error( - `Resource ${resourceConfig.path} could not be cleaned up, no handle for it was found.` - ); - } - - try { - const resource = this._handles.find(handle); - await resource.save(this.getResourceStateDir(resourceConfig.path)); - this._handles.deallocate(handle); - await resource.cleanup(); - } catch (err) { - console.warn(err); - } - - let event: Trace = { - type: TraceType.RESOURCE, - data: { message: `${resourceConfig.type} deleted.` }, - sourcePath: resourceConfig.path, - sourceType: resourceConfig.type, - timestamp: new Date().toISOString(), - }; - this._addTrace(event); + // just call "stopResource" for all resources. it will stop all dependents as well. + for (const node of this._model.graph.nodes) { + await this.stopResource(node.path); } this.stopServer(); @@ -341,6 +357,51 @@ export class Simulator { this._running = "stopped"; } + private isStarted(path: string): boolean { + return path in this.state; + } + + private async stopResource(path: string) { + if (!this.isStarted(path)) { + return; // resource is already stopped + } + + // first, stop all dependent resources + for (const consumer of this._model.graph.tryFind(path)?.dependents ?? []) { + await this.stopResource(consumer); + } + + const handle = this.tryGetResourceHandle(path); + if (!handle) { + throw new Error( + `Resource ${path} could not be cleaned up, no handle for it was found.` + ); + } + + try { + const resource = this._handles.find(handle); + await resource.save(this.getResourceStateDir(path)); + this._handles.deallocate(handle); + await resource.cleanup(); + } catch (err) { + console.warn(err); + } + + this.addSimulatorTrace(path, { message: `${path} stopped` }); + delete this.state[path]; // delete the state of the resource + } + + private addSimulatorTrace(path: string, data: any) { + const resourceConfig = this.getResourceConfig(path); + this.addTrace({ + type: TraceType.SIMULATOR, + data: data, + sourcePath: resourceConfig.path, + sourceType: resourceConfig.type, + timestamp: new Date().toISOString(), + }); + } + /** * Stop the simulation, reload the simulation tree from the latest version of * the app file, and restart the simulation. @@ -352,10 +413,7 @@ export class Simulator { await rm(this.statedir, { recursive: true }); } - const { config, treeData, connectionData } = this._loadApp(this.simdir); - this._config = config; - this._tree = new Tree(treeData); - this._connections = connectionData; + this._model = this._loadApp(this._model.simdir); await this.start(); } @@ -364,7 +422,7 @@ export class Simulator { * Get a list of all resource paths. */ public listResources(): string[] { - return this._config.resources.map((config) => config.path).sort(); + return this._model.graph.nodes.map((x) => x.path).sort(); } /** @@ -391,7 +449,7 @@ export class Simulator { * @returns The resource or undefined if not found */ public tryGetResource(path: string): any | undefined { - const handle: string = this.tryGetResourceConfig(path)?.attrs.handle; + const handle = this.tryGetResourceHandle(path); if (!handle) { return undefined; } @@ -399,6 +457,10 @@ export class Simulator { return makeSimulatorClient(this.url, handle); } + private tryGetResourceHandle(path: string): string | undefined { + return this.tryGetResourceConfig(path)?.attrs[HANDLE_ATTRIBUTE]; + } + /** * Obtain a resource's configuration, including its type, props, and attrs. * @returns The resource configuration or undefined if not found @@ -408,7 +470,20 @@ export class Simulator { if (path.startsWith("/")) { path = `root${path}`; } - return this._config.resources.find((r) => r.path === path); + + const def = this._model.graph.tryFind(path)?.def; + if (!def) { + return undefined; + } + + const state = this.state[path]; + + return { + ...def, + + // merge the actual state (props and attrs) over the desired state in `def` + ...state, + }; } /** @@ -447,7 +522,7 @@ export class Simulator { } private typeInfo(fqn: string): TypeSchema { - return this._config.types[fqn]; + return this._model.schema.types[fqn]; } /** @@ -462,14 +537,14 @@ export class Simulator { * Obtain information about the application's construct tree. */ public tree(): Tree { - return this._tree; + return this._model.tree; } /** * Obtain information about the application's connections. */ public connections(): ConnectionData[] { - return structuredClone(this._connections); + return structuredClone(this._model.connections); } /** @@ -600,31 +675,20 @@ export class Simulator { return this._serverUrl; } - private async tryStartResource( - resourceConfig: BaseResourceSchema - ): Promise { - const context = this.createContext(resourceConfig); - - const { resolved, value: resolvedProps } = this.tryResolveTokens( - resourceConfig.props - ); - if (!resolved) { - this._addTrace({ - type: TraceType.RESOURCE, - data: { message: `${resourceConfig.path} is waiting on a dependency` }, - sourcePath: resourceConfig.path, - sourceType: resourceConfig.type, - timestamp: new Date().toISOString(), - }); + private async startResource(path: string): Promise { + if (this.isStarted(path)) { + return; // already started + } - // this means the resource has a dependency that hasn't been started yet (hopefully). return - // it to the init queue. - return false; + // first lets make sure all my dependencies have been started (depth-first) + for (const d of this._model.graph.tryFind(path)?.dependencies ?? []) { + await this.startResource(d); } - // update the resource's config with the resolved props - const config = this.getResourceConfig(resourceConfig.path); - (config.props as any) = resolvedProps; + const resourceConfig = this.getResourceConfig(path); + const context = this.createContext(resourceConfig); + + const resolvedProps = this.resolveTokens(resourceConfig.props); // look up the location of the code for the type const typeInfo = this.typeInfo(resourceConfig.type); @@ -634,6 +698,12 @@ export class Simulator { recursive: true, }); + // initialize the resource state object without attrs for now + this.state[path] = { + props: resolvedProps, + attrs: {}, + }; + // create the resource based on its type // eslint-disable-next-line @typescript-eslint/no-require-imports const ResourceType = require(typeInfo.sourcePath)[typeInfo.className]; @@ -646,24 +716,22 @@ export class Simulator { // allocate a handle for the resource so others can find it const handle = this._handles.allocate(resourceObject); - // update the resource configuration with new attrs returned after initialization - context.setResourceAttributes(resourceConfig.path, { ...attrs, handle }); + // merge the attributes + this.state[path].attrs = { + ...this.state[path].attrs, + ...attrs, + [HANDLE_ATTRIBUTE]: handle, + }; // trace the resource creation - this._addTrace({ - type: TraceType.RESOURCE, - data: { message: `${resourceConfig.type} created.` }, - sourcePath: resourceConfig.path, - sourceType: resourceConfig.type, - timestamp: new Date().toISOString(), + this.addSimulatorTrace(path, { + message: `${resourceConfig.path} started`, }); - - return true; } private createContext(resourceConfig: BaseResourceSchema): ISimulatorContext { return { - simdir: this.simdir, + simdir: this._model.simdir, statedir: join(this.statedir, resourceConfig.addr), resourcePath: resourceConfig.path, serverUrl: this.url, @@ -671,13 +739,13 @@ export class Simulator { return this._handles.find(handle); }, addTrace: (trace: Trace) => { - this._addTrace(trace); + this.addTrace(trace); }, withTrace: async (props: IWithTraceProps) => { // TODO: log start time and end time of activity? try { let result = await props.activity(); - this._addTrace({ + this.addTrace({ data: { message: props.message, status: "success", @@ -690,7 +758,7 @@ export class Simulator { }); return result; } catch (err) { - this._addTrace({ + this.addTrace({ data: { message: props.message, status: "failure", error: err }, type: TraceType.RESOURCE, sourcePath: resourceConfig.path, @@ -704,17 +772,21 @@ export class Simulator { return [...this._traces]; }, setResourceAttributes: (path: string, attrs: Record) => { - const config = this.getResourceConfig(path); - const prev = config.attrs; - (config as any).attrs = { ...prev, ...attrs }; + for (const [key, value] of Object.entries(attrs)) { + this.addSimulatorTrace(path, { + message: `${path}.${key} = ${value}`, + }); + } + + this.state[path].attrs = { ...this.state[path].attrs, ...attrs }; }, resourceAttributes: (path: string) => { - return this.getResourceConfig(path).attrs; + return this.state[path].attrs; }, }; } - private _addTrace(event: Trace) { + private addTrace(event: Trace) { event = Object.freeze(event); for (const sub of this._traceSubscribers) { sub.callback(event); @@ -722,40 +794,6 @@ export class Simulator { this._traces.push(event); } - private tryResolveToken(s: string): { resolved: boolean; value: any } { - const ref = s.slice(2, -1); - const [_, path, rest] = ref.split("#"); - const config = this.getResourceConfig(path); - if (rest.startsWith("attrs.")) { - const attrName = rest.slice(6); - const attr = config?.attrs[attrName]; - - // we couldn't find the attribute. this doesn't mean it doesn't exist, it's just likely - // that this resource haven't been started yet. so return `undefined`, which will cause - // this resource to go back to the init queue. - if (!attr) { - return { resolved: false, value: undefined }; - } - return { resolved: true, value: attr }; - } else if (rest.startsWith("props.")) { - if (!config.props) { - throw new Error( - `Tried to resolve token "${s}" but resource ${path} has no props defined.` - ); - } - const propPath = rest.slice(6); - const value = config.props[propPath]; - if (value === undefined) { - throw new Error( - `Tried to resolve token "${s}" but resource ${path} has no prop "${propPath}".` - ); - } - return { resolved: true, value }; - } else { - throw new Error(`Invalid token reference: "${ref}"`); - } - } - /** * Return an object with all tokens in it resolved to their appropriate values. * @@ -770,82 +808,38 @@ export class Simulator { * @returns `undefined` if the token could not be resolved (e.g. needs a dependency), otherwise * the resolved value. */ - private tryResolveTokens(obj: any): { resolved: boolean; value: any } { - if (typeof obj === "string") { - // there are two cases - a token can be the entire string, or it can be part of the string. - // first, check if the entire string is a token - if (SIMULATOR_TOKEN_REGEX_FULL.test(obj)) { - const { resolved, value } = this.tryResolveToken(obj); - if (!resolved) { - return { resolved: false, value: undefined }; - } - return { resolved: true, value }; - } - - // otherwise, check if the string contains tokens inside it. if so, we need to resolve them - // and then check if the result is a string - const globalRegex = new RegExp(SIMULATOR_TOKEN_REGEX.source, "g"); - const matches = obj.matchAll(globalRegex); - const replacements = []; - for (const match of matches) { - const { resolved, value } = this.tryResolveToken(match[0]); - if (!resolved) { - return { resolved: false, value: undefined }; - } - if (typeof value !== "string") { - throw new Error( - `Expected token "${ - match[0] - }" to resolve to a string, but it resolved to ${typeof value}.` - ); - } - replacements.push({ match, value }); + private resolveTokens(obj: any): any { + return resolveTokens(obj, (token) => { + const target = this._model.graph.tryFind(token.path); + if (!target) { + throw new Error( + `Could not resolve token "${token}" because the resource at path "${token.path}" does not exist.` + ); } - // replace all the tokens in reverse order, and return the result - // if a token returns another token (god forbid), do not resolve it again - let result = obj; - for (const { match, value } of replacements.reverse()) { - if (match.index === undefined) { - throw new Error(`unexpected error: match.index is undefined`); - } - result = - result.slice(0, match.index) + - value + - result.slice(match.index + match[0].length); - } - return { resolved: true, value: result }; - } + const r = this.getResourceConfig(target.path); - if (Array.isArray(obj)) { - const result = []; - for (const x of obj) { - const { resolved, value } = this.tryResolveTokens(x); - if (!resolved) { - return { resolved: false, value: undefined }; + if (token.attr) { + const value = r.attrs[token.attr]; + if (value === undefined) { + throw new UnresolvedTokenError( + `Unable to resolve attribute '${token.attr}' for resource: ${target.path}` + ); } - result.push(value); + return value; } - return { resolved: true, value: result }; - } - - if (typeof obj === "object") { - const ret: any = {}; - for (const [key, v] of Object.entries(obj)) { - const { resolved, value } = this.tryResolveTokens(v); - if (!resolved) { - return { resolved: false, value: undefined }; - } - ret[key] = value; + if (token.prop) { + return r.props[token.prop]; } - return { resolved: true, value: ret }; - } - return { resolved: true, value: obj }; + throw new Error(`Invalid token: ${token}`); + }); } } +class UnresolvedTokenError extends Error {} + /** * A factory that can turn resource descriptions into (inflight) resource simulations. */ @@ -954,13 +948,14 @@ export interface BaseResourceSchema { readonly props: { [key: string]: any }; /** The resource-specific attributes that are set after the resource is created. */ readonly attrs: Record; - // TODO: model dependencies + /** Resources that should be deployed before this resource. */ + readonly deps?: string[]; } /** Schema for resource attributes */ export interface BaseResourceAttributes { /** The resource's simulator-unique id. */ - readonly handle: string; + readonly [HANDLE_ATTRIBUTE]: string; } /** Schema for `.connections` in connections.json */ @@ -996,3 +991,66 @@ export interface SimulatorServerResponse { /** The error that occurred during the method call. */ readonly error?: any; } + +/** + * Given the "current" set of resources and a "next" set of resources, calculate the diff and + * determine which resources need to be added, updated or deleted. + * + * Note that dependencies are not considered here but they are implicitly handled by the + * `startResource` and `stopResource` methods. So, for example, when a resource is updated, + * all of it's dependents will be stopped and started again. + */ +function planUpdate(current: BaseResourceSchema[], next: BaseResourceSchema[]) { + const currentByPath = toMap(current); + const nextByPath = toMap(next); + + const added: string[] = []; + const updated: string[] = []; + const deleted: string[] = []; + + for (const [path, nextConfig] of Object.entries(nextByPath)) { + const currConfig = currentByPath[path]; + + // if the resource is not in "current", it means it was added + if (!currConfig) { + added.push(nextConfig.path); + continue; + } + + // the resource is already in "current", if it's different from "next", it means it was updated + const state = (r: BaseResourceSchema) => + JSON.stringify({ + props: r.props, + type: r.type, + }); + + if (state(currConfig) !== state(nextConfig)) { + updated.push(nextConfig.path); + } + + // remove it from "current" so we know what's left to be deleted + delete currentByPath[path]; + } + + // everything left in "current" is to be deleted + for (const config of Object.values(currentByPath)) { + deleted.push(config.path); + } + + return { added, updated, deleted }; + + function toMap(list: BaseResourceSchema[]): { + [path: string]: BaseResourceSchema; + } { + const ret: { [path: string]: BaseResourceSchema } = {}; + for (const resource of list) { + if (ret[resource.path]) { + throw new Error( + `unexpected - duplicate resources with the same path: ${resource.path}` + ); + } + ret[resource.path] = resource; + } + return ret; + } +} diff --git a/libs/wingsdk/src/simulator/tokens.ts b/libs/wingsdk/src/simulator/tokens.ts new file mode 100644 index 00000000000..b2ef9023e7f --- /dev/null +++ b/libs/wingsdk/src/simulator/tokens.ts @@ -0,0 +1,113 @@ +import { + SIMULATOR_TOKEN_REGEX, + SIMULATOR_TOKEN_REGEX_FULL, +} from "../target-sim/tokens"; + +type Token = { + path: string; + attr?: string; + prop?: string; +}; + +export function parseToken(s: string): Token { + const ref = s.slice(2, -1); + const parts = ref.split("#"); + if (parts.length !== 3) { + throw new Error(`Invalid token reference: ${s}`); + } + + const [_, path, rest] = parts; + + if (rest.startsWith("attrs.")) { + const attrName = rest.slice(6); + return { path, attr: attrName }; + } else if (rest.startsWith("props.")) { + const propPath = rest.slice(6); + return { path, prop: propPath }; + } else { + throw new Error(`Invalid token reference: ${s}`); + } +} + +type TokenResolver = (token: Token) => string; + +/** + * Return an object with all tokens in it resolved to their appropriate values. + * + * A token can be a string like "${app/my_bucket#attrs.handle}". This token would be resolved to + * the "handle" attribute of the resource at path "app/my_bucket". If that attribute does not + * exist at the time of resolution (for example, if my_bucket is not being simulated yet), an + * error will be thrown. + * + * Tokens can also be nested, like "${app/my_bucket#attrs.handle}/foo/bar". + * + * @param obj The object to resolve tokens in. + * @returns The resolved token or throws an error if the token cannot be resolved. + */ +export function resolveTokens(obj: any, resolver: TokenResolver): any { + if (obj === undefined) { + return obj; + } + + if (typeof obj === "string") { + // there are two cases - a token can be the entire string, or it can be part of the string. + // first, check if the entire string is a token + if (SIMULATOR_TOKEN_REGEX_FULL.test(obj)) { + return resolver(parseToken(obj)); + } + + // otherwise, check if the string contains tokens inside it. if so, we need to resolve them + // and then check if the result is a string + const globalRegex = new RegExp(SIMULATOR_TOKEN_REGEX.source, "g"); + const matches = obj.matchAll(globalRegex); + const replacements = []; + for (const match of matches) { + const value = resolveTokens(match[0], resolver); + + if (typeof value !== "string") { + throw new Error( + `Expected token "${ + match[0] + }" to resolve to a string, but it resolved to ${typeof value}.` + ); + } + + replacements.push({ match, value }); + } + + // replace all the tokens in reverse order, and return the result + // if a token returns another token (god forbid), do not resolve it again + let result = obj; + for (const { match, value } of replacements.reverse()) { + if (match.index === undefined) { + throw new Error(`unexpected error: match.index is undefined`); + } + result = + result.slice(0, match.index) + + value + + result.slice(match.index + match[0].length); + } + + return result; + } + + if (Array.isArray(obj)) { + const result = []; + for (const x of obj) { + const value = resolveTokens(x, resolver); + result.push(value); + } + + return result; + } + + if (typeof obj === "object") { + const ret: any = {}; + for (const [key, v] of Object.entries(obj)) { + ret[key] = resolveTokens(v, resolver); + } + return ret; + } + + return obj; +} diff --git a/libs/wingsdk/src/std/node.ts b/libs/wingsdk/src/std/node.ts index 43aefd94941..f3154e2a27f 100644 --- a/libs/wingsdk/src/std/node.ts +++ b/libs/wingsdk/src/std/node.ts @@ -62,6 +62,23 @@ export class Node { */ public hidden?: boolean; + /** + * The color of the construct for display purposes. + * Supported colors are: + * - orange + * - sky + * - emerald + * - lime + * - pink + * - amber + * - cyan + * - purple + * - red + * - violet + * - slate + */ + public color?: string; + private readonly _constructsNode: ConstructsNode; private readonly _connections: Connections; private _app: IApp | undefined; diff --git a/libs/wingsdk/src/std/test-runner.ts b/libs/wingsdk/src/std/test-runner.ts index cf7c9a0f8b2..2b78ef799eb 100644 --- a/libs/wingsdk/src/std/test-runner.ts +++ b/libs/wingsdk/src/std/test-runner.ts @@ -232,6 +232,10 @@ export interface Trace { * @skipDocs */ export enum TraceType { + /** + * A trace representing simulator activity. + */ + SIMULATOR = "simulator", /** * A trace representing a resource activity. */ diff --git a/libs/wingsdk/src/target-sim/api.inflight.ts b/libs/wingsdk/src/target-sim/api.inflight.ts index 5993cde0ff6..d8e43c575dd 100644 --- a/libs/wingsdk/src/target-sim/api.inflight.ts +++ b/libs/wingsdk/src/target-sim/api.inflight.ts @@ -56,7 +56,6 @@ export class Api private port: number | undefined; constructor(props: ApiSchema["props"], context: ISimulatorContext) { - props; this.routes = []; this.context = context; const { corsHeaders } = props; @@ -131,8 +130,16 @@ export class Api public async cleanup(): Promise { this.addTrace(`Closing server on ${this.url}`); - this.server?.close(); - this.server?.closeAllConnections(); + return new Promise((resolve, reject) => { + this.server?.close((err) => { + if (err) { + return reject(err); + } + + this.server?.closeAllConnections(); + return resolve(); + }); + }); } public async save(): Promise { diff --git a/libs/wingsdk/src/target-sim/app.ts b/libs/wingsdk/src/target-sim/app.ts index 11c4fe55aed..5d7b5de4ac4 100644 --- a/libs/wingsdk/src/target-sim/app.ts +++ b/libs/wingsdk/src/target-sim/app.ts @@ -12,7 +12,7 @@ import { OnDeploy } from "./on-deploy"; import { Queue } from "./queue"; import { ReactApp } from "./react-app"; import { Redis } from "./redis"; -import { isSimulatorResource } from "./resource"; +import { ISimulatorResource, isSimulatorResource } from "./resource"; import { Schedule } from "./schedule"; import { Secret } from "./secret"; import { Service } from "./service"; @@ -261,10 +261,22 @@ export class App extends core.App { } private synthSimulatorFile(outdir: string) { + const toSimulatorWithDeps = (res: ISimulatorResource) => { + const cfg = res.toSimulator(); + const deps = res.node.dependencies.map((d) => d.node.path); + + return deps.length === 0 + ? cfg + : { + ...cfg, + deps, + }; + }; + const resources = new core.DependencyGraph(this.node) .topology() .filter(isSimulatorResource) - .map((res) => res.toSimulator()); + .map(toSimulatorWithDeps); const types: { [fqn: string]: TypeSchema } = {}; for (const [fqn, className] of Object.entries(SIMULATOR_CLASS_DATA)) { diff --git a/libs/wingsdk/src/target-sim/dynamodb-table.inflight.ts b/libs/wingsdk/src/target-sim/dynamodb-table.inflight.ts index c11f70834b5..c28e40653a3 100644 --- a/libs/wingsdk/src/target-sim/dynamodb-table.inflight.ts +++ b/libs/wingsdk/src/target-sim/dynamodb-table.inflight.ts @@ -30,6 +30,7 @@ export class DynamodbTable process.env.WING_DYNAMODB_IMAGE ?? "amazon/dynamodb-local:2.0.0"; private readonly context: ISimulatorContext; private client?: DynamoDBClient; + private _endpoint?: string; public constructor( private props: DynamodbTableSchema["props"], @@ -51,6 +52,8 @@ export class DynamodbTable containerPort: "8000", }); + this._endpoint = `http://0.0.0.0:${hostPort}`; + // dynamodb url based on host port this.client = new DynamoDBClient({ region: "local", @@ -58,7 +61,7 @@ export class DynamodbTable accessKeyId: "x", secretAccessKey: "y", }, - endpoint: `http://0.0.0.0:${hostPort}`, + endpoint: this._endpoint, }); await this.createTable(); @@ -75,10 +78,22 @@ export class DynamodbTable this.client?.destroy(); // stop the dynamodb container await runCommand("docker", ["rm", "-f", this.containerName]); + this._endpoint = undefined; } public async save(): Promise {} + /** + * Returns the local endpoint of the DynamoDB table. + */ + public async endpoint(): Promise { + if (!this._endpoint) { + throw new Error("DynamoDB hasn't been started"); + } + + return this._endpoint; + } + public async _rawClient(): Promise { if (this.client) { return this.client; diff --git a/libs/wingsdk/src/target-sim/endpoint.inflight.ts b/libs/wingsdk/src/target-sim/endpoint.inflight.ts index 5e8fd8cbe83..d78b77c81a6 100644 --- a/libs/wingsdk/src/target-sim/endpoint.inflight.ts +++ b/libs/wingsdk/src/target-sim/endpoint.inflight.ts @@ -1,22 +1,116 @@ +import { readFile, writeFile } from "node:fs/promises"; +import { join } from "node:path"; +import { connect, ConnectResponse } from "@winglang/wingtunnels"; import { EndpointAttributes, EndpointSchema } from "./schema-resources"; +import { exists } from "./util"; import { IEndpointClient } from "../cloud"; import { ISimulatorContext, ISimulatorResourceInstance } from "../simulator"; +const STATE_FILENAME = "state.json"; + +/** + * Contents of the state file for this resource. + */ +interface StateFileContents { + /** + * The last subdomain used by the tunnel on a previous simulator run. + */ + readonly subdomain?: string; +} + +export type EndpointExposeStatus = "connected" | "disconnected" | "connecting"; + export class Endpoint implements IEndpointClient, ISimulatorResourceInstance { + private connectResponse?: ConnectResponse; + private lastSubdomain?: string; + private status: EndpointExposeStatus = "disconnected"; constructor( private readonly _props: EndpointSchema["props"], - _context: ISimulatorContext + private readonly _context: ISimulatorContext ) {} public async init(): Promise { + const state: StateFileContents = await this.loadState(); + if (state.subdomain) { + await this.connect(state.subdomain); + } + return { inputUrl: this._props.inputUrl, - url: this._props.url, + url: this.connectResponse?.url ?? this._props.url, label: this._props.label, browserSupport: this._props.browserSupport, }; } - public async cleanup(): Promise {} + public async cleanup(): Promise { + this.connectResponse?.close(); + } + + public async save(): Promise { + return this.saveState({ + ...(this.lastSubdomain && { subdomain: this.lastSubdomain }), + }); + } + + public async expose(): Promise { + if (this.status === "connecting" || this.status === "connected") { + throw new Error("Can only expose when status is disconnected."); + } + return this.connect(); + } - public async save(): Promise {} + public async hide(): Promise { + this.connectResponse?.close(); + this.connectResponse = undefined; + this.lastSubdomain = undefined; + this.status = "disconnected"; + } + + public async exposeStatus(): Promise { + return this.status; + } + + private async loadState(): Promise { + const stateFileExists = await exists( + join(this._context.statedir, STATE_FILENAME) + ); + if (stateFileExists) { + const stateFileContents = await readFile( + join(this._context.statedir, STATE_FILENAME), + "utf-8" + ); + return JSON.parse(stateFileContents); + } else { + return {}; + } + } + + private async saveState(state: StateFileContents): Promise { + await writeFile( + join(this._context.statedir, STATE_FILENAME), + JSON.stringify(state) + ); + } + + private async connect(subdomain?: string) { + try { + await this._context.withTrace({ + message: `Creating tunnel for endpoint. ${ + subdomain ? `Using subdomain: ${subdomain}` : "" + }`, + activity: async () => { + this.status = "connecting"; + this.connectResponse = await connect(this._props.inputUrl, { + subdomain, + }); + this.lastSubdomain = new URL(this.connectResponse.url).hostname.split( + "." + )[0]; + this.status = "connected"; + }, + }); + } catch { + this.status = "disconnected"; + } + } } diff --git a/libs/wingsdk/src/target-sim/function.inflight.ts b/libs/wingsdk/src/target-sim/function.inflight.ts index bc5918b49e2..cbb1b93be5c 100644 --- a/libs/wingsdk/src/target-sim/function.inflight.ts +++ b/libs/wingsdk/src/target-sim/function.inflight.ts @@ -1,6 +1,7 @@ import * as path from "path"; import { FunctionAttributes, FunctionSchema } from "./schema-resources"; import { FUNCTION_FQN, IFunctionClient } from "../cloud"; +import { Bundle } from "../shared/bundling"; import { Sandbox } from "../shared/sandbox"; import { ISimulatorContext, @@ -9,36 +10,26 @@ import { import { TraceType } from "../std"; export class Function implements IFunctionClient, ISimulatorResourceInstance { - private readonly filename: string; + private readonly originalFile: string; + private bundle: Bundle | undefined; private readonly env: Record; private readonly context: ISimulatorContext; private readonly timeout: number; - private readonly sandbox: Sandbox; + private readonly maxWorkers: number; + private readonly workers = new Array(); + private createBundlePromise: Promise; constructor(props: FunctionSchema["props"], context: ISimulatorContext) { if (props.sourceCodeLanguage !== "javascript") { throw new Error("Only JavaScript is supported"); } - this.filename = path.resolve(context.simdir, props.sourceCodeFile); + this.originalFile = path.resolve(context.simdir, props.sourceCodeFile); this.env = props.environmentVariables ?? {}; this.context = context; this.timeout = props.timeout; - this.sandbox = new Sandbox(this.filename, { - env: { - ...this.env, - WING_SIMULATOR_URL: this.context.serverUrl, - }, - timeout: this.timeout, - log: (internal, _level, message) => { - this.context.addTrace({ - data: { message }, - type: internal ? TraceType.RESOURCE : TraceType.LOG, - sourcePath: this.context.resourcePath, - sourceType: FUNCTION_FQN, - timestamp: new Date().toISOString(), - }); - }, - }); + this.maxWorkers = props.concurrency; + + this.createBundlePromise = this.createBundle(); } public async init(): Promise { @@ -46,7 +37,15 @@ export class Function implements IFunctionClient, ISimulatorResourceInstance { } public async cleanup(): Promise { - await this.sandbox.cleanup(); + // We wait for the bundle to be created since there's no way to otherwise cancel the work. + // If the simulator runs for a short time (and cloud.Function is created and then deleted) + // and the bundling code is allowed to run after the simulator has stopped, it might fail + // and throw an error to the user because the files the simulator was using may no longer be there there. + await this.createBundlePromise; + + for (const worker of this.workers) { + await worker.cleanup(); + } } public async save(): Promise {} @@ -54,7 +53,15 @@ export class Function implements IFunctionClient, ISimulatorResourceInstance { public async invoke(payload: string): Promise { return this.context.withTrace({ message: `Invoke (payload=${JSON.stringify(payload)}).`, - activity: () => this.sandbox.call("handler", payload), + activity: async () => { + const worker = await this.findAvailableWorker(); + if (!worker) { + throw new Error( + "Too many requests, the function has reached its concurrency limit." + ); + } + return worker.call("handler", payload); + }, }); } @@ -62,10 +69,89 @@ export class Function implements IFunctionClient, ISimulatorResourceInstance { await this.context.withTrace({ message: `InvokeAsync (payload=${JSON.stringify(payload)}).`, activity: async () => { + const worker = await this.findAvailableWorker(); + if (!worker) { + throw new Error( + "Too many requests, the function has reached its concurrency limit." + ); + } process.nextTick(() => { - void this.sandbox.call("handler", payload); + // If the call fails, we log the error and continue since we've already + // handed control back to the caller. + void worker.call("handler", payload).catch((e) => { + this.context.addTrace({ + data: { + message: `InvokeAsync (payload=${JSON.stringify(payload)}).`, + status: "failure", + error: e, + }, + type: TraceType.RESOURCE, + sourcePath: this.context.resourcePath, + sourceType: FUNCTION_FQN, + timestamp: new Date().toISOString(), + }); + }); }); }, }); } + + private async createBundle(): Promise { + this.bundle = await Sandbox.createBundle(this.originalFile, (msg) => { + this.addTrace(msg); + }); + } + + // Used internally by cloud.Queue to apply backpressure + public async hasAvailableWorkers(): Promise { + return ( + this.workers.length < this.maxWorkers || + this.workers.some((w) => w.isAvailable()) + ); + } + + private async findAvailableWorker(): Promise { + const worker = this.workers.find((w) => w.isAvailable()); + if (worker) { + return worker; + } + + if (this.workers.length < this.maxWorkers) { + const newWorker = await this.initWorker(); + this.workers.push(newWorker); + return newWorker; + } + + return undefined; + } + + private async initWorker(): Promise { + // ensure inflight code is bundled before we create any workers + await this.createBundlePromise; + + if (!this.bundle) { + throw new Error("Bundle not created"); + } + + return new Sandbox(this.bundle.entrypointPath, { + env: { + ...this.env, + WING_SIMULATOR_URL: this.context.serverUrl, + }, + timeout: this.timeout, + log: (internal, _level, message) => { + this.addTrace(message, internal); + }, + }); + } + + private addTrace(message: string, internal: boolean = true) { + this.context.addTrace({ + data: { message }, + type: internal ? TraceType.RESOURCE : TraceType.LOG, + sourcePath: this.context.resourcePath, + sourceType: FUNCTION_FQN, + timestamp: new Date().toISOString(), + }); + } } diff --git a/libs/wingsdk/src/target-sim/function.ts b/libs/wingsdk/src/target-sim/function.ts index a711bbce017..3a77d1d7951 100644 --- a/libs/wingsdk/src/target-sim/function.ts +++ b/libs/wingsdk/src/target-sim/function.ts @@ -21,6 +21,7 @@ export const ENV_WING_SIM_INFLIGHT_RESOURCE_TYPE = */ export class Function extends cloud.Function implements ISimulatorResource { private readonly timeout: Duration; + private readonly concurrency: number; constructor( scope: Construct, id: string, @@ -31,6 +32,7 @@ export class Function extends cloud.Function implements ISimulatorResource { // props.memory is unused since we are not simulating it this.timeout = props.timeout ?? Duration.fromMinutes(1); + this.concurrency = props.concurrency ?? 100; } public toSimulator(): BaseResourceSchema { @@ -44,6 +46,7 @@ export class Function extends cloud.Function implements ISimulatorResource { sourceCodeLanguage: "javascript", environmentVariables: this.env, timeout: this.timeout.seconds * 1000, + concurrency: this.concurrency, }, attrs: {} as any, }; diff --git a/libs/wingsdk/src/target-sim/queue.inflight.ts b/libs/wingsdk/src/target-sim/queue.inflight.ts index dbf71f7744a..9d5ca729034 100644 --- a/libs/wingsdk/src/target-sim/queue.inflight.ts +++ b/libs/wingsdk/src/target-sim/queue.inflight.ts @@ -1,4 +1,5 @@ import { IEventPublisher } from "./event-mapping"; +import type { Function as FunctionClient } from "./function.inflight"; import { QueueAttributes, QueueSchema, @@ -149,6 +150,16 @@ export class Queue if (!fnClient) { throw new Error("No function client found"); } + + // If the function we picked is at capacity, keep the messages in the queue + const hasWorkers = await ( + fnClient as FunctionClient + ).hasAvailableWorkers(); + if (!hasWorkers) { + this.messages.push(...messages); + continue; + } + this.context.addTrace({ type: TraceType.RESOURCE, data: { @@ -166,6 +177,14 @@ export class Queue void fnClient .invoke(JSON.stringify({ messages: messagesPayload })) .catch((err) => { + // If the function is at a concurrency limit, pretend we just didn't call it + if ( + err.message === + "Too many requests, the function has reached its concurrency limit." + ) { + this.messages.push(...messages); + return; + } // If the function returns an error, put the message back on the queue after timeout period this.context.addTrace({ data: { diff --git a/libs/wingsdk/src/target-sim/react-app.inflight.ts b/libs/wingsdk/src/target-sim/react-app.inflight.ts index 362f8a88fd6..e930f267f72 100644 --- a/libs/wingsdk/src/target-sim/react-app.inflight.ts +++ b/libs/wingsdk/src/target-sim/react-app.inflight.ts @@ -13,6 +13,7 @@ export class ReactApp implements IReactAppClient, ISimulatorResourceInstance { private readonly path: string; private readonly environmentVariables: Record; private readonly useBuildCommand: boolean; + private readonly localPort: string | number; private childProcess?: ChildProcess; private url: string; @@ -22,6 +23,7 @@ export class ReactApp implements IReactAppClient, ISimulatorResourceInstance { this.startCommand = props.startCommand; this.environmentVariables = props.environmentVariables; this.useBuildCommand = props.useBuildCommand; + this.localPort = props.localPort; this.url = props.url; } @@ -56,6 +58,8 @@ window.wingEnv = ${JSON.stringify(this.environmentVariables, null, 2)};` } else { // react usually offer hot reloading- // we're waiting for execution ending since it's ending only when manually terminating the process + options.env = { ...process.env, PORT: `${this.localPort}` }; + this.childProcess = exec( this.startCommand, options, diff --git a/libs/wingsdk/src/target-sim/react-app.ts b/libs/wingsdk/src/target-sim/react-app.ts index 9e8dc9f52e6..825428ec240 100644 --- a/libs/wingsdk/src/target-sim/react-app.ts +++ b/libs/wingsdk/src/target-sim/react-app.ts @@ -17,9 +17,7 @@ export class ReactApp extends ex.ReactApp implements ISimulatorResource { this._startCommand = this._useBuildCommand ? props.buildCommand ?? ex.DEFAULT_REACT_APP_BUILD_COMMAND - : `PORT=${this._localPort} ${ - props.startCommand ?? DEFAULT_START_COMMAND - }`; + : props.startCommand ?? DEFAULT_START_COMMAND; if (this._useBuildCommand) { // In the future we can create an host (proxy like) for the development one if needed @@ -55,6 +53,7 @@ export class ReactApp extends ex.ReactApp implements ISimulatorResource { ), useBuildCommand: this._useBuildCommand, url: this.url, + localPort: this._localPort, }, attrs: {}, }; diff --git a/libs/wingsdk/src/target-sim/schema-resources.ts b/libs/wingsdk/src/target-sim/schema-resources.ts index 0e16c361eae..f2901973e78 100644 --- a/libs/wingsdk/src/target-sim/schema-resources.ts +++ b/libs/wingsdk/src/target-sim/schema-resources.ts @@ -76,6 +76,8 @@ export interface FunctionSchema extends BaseResourceSchema { readonly environmentVariables: Record; /** The maximum amount of time the function can run, in milliseconds. */ readonly timeout: number; + /** The maximum number of concurrent invocations that can run at one time. */ + readonly concurrency: number; }; } @@ -263,6 +265,7 @@ export interface ReactAppSchema extends BaseResourceSchema { environmentVariables: Record; useBuildCommand: boolean; url: string; + localPort: string | number; }; } export interface ReactAppAttributes { diff --git a/libs/wingsdk/src/target-tf-aws/function.ts b/libs/wingsdk/src/target-tf-aws/function.ts index 4ca13f8b048..fa2c17be175 100644 --- a/libs/wingsdk/src/target-tf-aws/function.ts +++ b/libs/wingsdk/src/target-tf-aws/function.ts @@ -11,6 +11,7 @@ import { S3Object } from "../.gen/providers/aws/s3-object"; import { SecurityGroup } from "../.gen/providers/aws/security-group"; import * as cloud from "../cloud"; import * as core from "../core"; +import { NotImplementedError } from "../core/errors"; import { createBundle } from "../shared/bundling"; import { DEFAULT_MEMORY_SIZE } from "../shared/function"; import { NameOptions, ResourceNames } from "../shared/resource-names"; @@ -86,6 +87,12 @@ export class Function extends cloud.Function implements IAwsFunction { ) { super(scope, id, inflight, props); + if (props.concurrency != null) { + throw new NotImplementedError( + "Function concurrency isn't implemented yet on the current target." + ); + } + // Create unique S3 bucket for hosting Lambda code const app = App.of(this) as App; const bucket = app.codeBucket; diff --git a/libs/wingsdk/src/target-tf-azure/function.ts b/libs/wingsdk/src/target-tf-azure/function.ts index 022d53502e0..6c321583526 100644 --- a/libs/wingsdk/src/target-tf-azure/function.ts +++ b/libs/wingsdk/src/target-tf-azure/function.ts @@ -79,6 +79,12 @@ export class Function extends cloud.Function { // Create Bucket to store function code const functionCodeBucket = new Bucket(this, "FunctionBucket"); + if (props.concurrency != null) { + throw new NotImplementedError( + "Function concurrency isn't implemented yet on the current target." + ); + } + // throw an error if props.memory is defined for an Azure function if (props.memory) { throw new NotImplementedError("memory is an invalid parameter on Azure", { diff --git a/libs/wingsdk/src/target-tf-gcp/function.ts b/libs/wingsdk/src/target-tf-gcp/function.ts index d14e0e2d585..43a6868af9b 100644 --- a/libs/wingsdk/src/target-tf-gcp/function.ts +++ b/libs/wingsdk/src/target-tf-gcp/function.ts @@ -14,6 +14,7 @@ import { ProjectIamMember } from "../.gen/providers/google/project-iam-member"; import { ServiceAccount } from "../.gen/providers/google/service-account"; import { StorageBucketObject } from "../.gen/providers/google/storage-bucket-object"; import * as cloud from "../cloud"; +import { NotImplementedError } from "../core/errors"; import { createBundle } from "../shared/bundling"; import { DEFAULT_MEMORY_SIZE } from "../shared/function"; import { @@ -92,6 +93,12 @@ export class Function extends cloud.Function { // app is a property of the `cloud.Function` class const app = App.of(this) as App; + if (props.concurrency != null) { + throw new NotImplementedError( + "Function concurrency isn't implemented yet on the current target." + ); + } + // memory limits must be between 128 and 8192 MB if (props?.memory && (props.memory < 128 || props.memory > 8192)) { throw new Error( @@ -171,6 +178,7 @@ export class Function extends cloud.Function { sourceArchiveObject: FunctionObjectBucket.name, entryPoint: "handler", triggerHttp: true, + httpsTriggerSecurityLevel: "SECURE_ALWAYS", // It takes around 1 minutes to the function invocation permissions to be established - // therefore, the timeout is higher than in other targets timeout: props.timeout?.seconds ?? 120, diff --git a/libs/wingsdk/src/ui/colors.ts b/libs/wingsdk/src/ui/colors.ts new file mode 100644 index 00000000000..bbee25ec467 --- /dev/null +++ b/libs/wingsdk/src/ui/colors.ts @@ -0,0 +1,28 @@ +export type Colors = + | "orange" + | "sky" + | "emerald" + | "lime" + | "pink" + | "amber" + | "cyan" + | "purple" + | "red" + | "violet" + | "slate"; + +export const isOfTypeColors = (keyInput?: string): keyInput is Colors => { + return [ + "orange", + "sky", + "emerald", + "lime", + "pink", + "amber", + "cyan", + "purple", + "red", + "violet", + "slate", + ].includes(keyInput || ""); +}; diff --git a/libs/wingsdk/src/ui/index.ts b/libs/wingsdk/src/ui/index.ts index 2c2913c3902..9024c73c68f 100644 --- a/libs/wingsdk/src/ui/index.ts +++ b/libs/wingsdk/src/ui/index.ts @@ -1,4 +1,5 @@ export * from "./base"; export * from "./button"; +export * from "./colors"; export * from "./field"; export * from "./section"; diff --git a/libs/wingsdk/test/core/__snapshots__/connections.test.ts.snap b/libs/wingsdk/test/core/__snapshots__/connections.test.ts.snap index d3c2c487048..416f15e9cb7 100644 --- a/libs/wingsdk/test/core/__snapshots__/connections.test.ts.snap +++ b/libs/wingsdk/test/core/__snapshots__/connections.test.ts.snap @@ -47,6 +47,7 @@ return class Handler { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/my_function_c85c4e0e.js", "sourceCodeLanguage": "javascript", diff --git a/libs/wingsdk/test/global.setup.ts b/libs/wingsdk/test/global.setup.ts index 2fb3fadf648..270e39e504c 100644 --- a/libs/wingsdk/test/global.setup.ts +++ b/libs/wingsdk/test/global.setup.ts @@ -1,11 +1,16 @@ -import { execSync } from "child_process"; +import { execFileSync } from "child_process"; import fs from "fs/promises"; import path from "path"; export async function setup() { - // compile src/**/*.on*.inflight.ts to .js because these are going to be + // compile src/**/*.ts to .js because these are going to be // injected into our javascript vm and cannot be resolved via vitest - execSync("pnpm tsc -p tsconfig.test.json", { stdio: "inherit" }); + const tscPath = path.join(__dirname, "..", "node_modules", ".bin", "tsc"); + const tsconfigPath = path.join(__dirname, "..", "tsconfig.test.json"); + execFileSync(tscPath, ["-p", tsconfigPath], { + stdio: "inherit", + }); + return () => {}; } @@ -16,7 +21,7 @@ export async function teardown() { if (process.env.WING_SDK_VITEST_SKIP_TEARDOWN) { return; } - const files = await findFilesWithExtension(["src"], [".d.ts", ".js"]); + const files = await findFilesWithExtension(["src"], [".js"]); for (const file of files) { try { await fs.unlink(file); diff --git a/libs/wingsdk/test/simulator/__snapshots__/simulator.test.ts.snap b/libs/wingsdk/test/simulator/__snapshots__/simulator.test.ts.snap index e875ea04279..bcb942f46ab 100644 --- a/libs/wingsdk/test/simulator/__snapshots__/simulator.test.ts.snap +++ b/libs/wingsdk/test/simulator/__snapshots__/simulator.test.ts.snap @@ -91,13 +91,7 @@ exports[`run single test > happy path 1`] = ` exports[`run single test > test failure 1`] = ` { - "error": "Error: test failed - at Handler.handle ([abs]) - at exports.handler ([abs]) - at process. ([abs]) - at process.emit (node:events:) - at emit (node:internal/child_process:) - at process.processTicksAndRejections (node:internal/process/task_queues:)", + "error": "Error: test failed", "pass": false, "path": "root/test", "traces": [ diff --git a/libs/wingsdk/test/simulator/graph.test.ts b/libs/wingsdk/test/simulator/graph.test.ts new file mode 100644 index 00000000000..8a9a033b232 --- /dev/null +++ b/libs/wingsdk/test/simulator/graph.test.ts @@ -0,0 +1,100 @@ +import { test, expect, describe } from "vitest"; +import { Graph } from "../../src/simulator/graph"; + +test("empty", () => { + const graph = new Graph([]); + expect(graph.nodes.length).toBe(0); +}); + +test("two disconnected nodes", () => { + const graph = new Graph([{ path: "a" }, { path: "b" }]); + + expect(graph.nodes.length).toBe(2); + + const a = graph.tryFind("a")!; + expect(a.def).toStrictEqual({ path: "a" }); + expect(Array.from(a.dependencies)).toStrictEqual([]); + expect(Array.from(a.dependents)).toStrictEqual([]); + + const b = graph.tryFind("b")!; + expect(b.def).toStrictEqual({ path: "b" }); + expect(Array.from(b.dependencies)).toStrictEqual([]); + expect(Array.from(b.dependents)).toStrictEqual([]); +}); + +test("explicit deps", () => { + const graph = new Graph([{ path: "a", deps: ["b"] }, { path: "b" }]); + + const a = graph.tryFind("a")!; + expect(a.dependencies.size).toBe(1); + expect(Array.from(a.dependencies)).toStrictEqual(["b"]); + + const b = graph.tryFind("b")!; + expect(b.dependents.size).toBe(1); + expect(Array.from(b.dependents)).toStrictEqual(["a"]); +}); + +test("implicit deps", () => { + const graph = new Graph([ + { + path: "a", + props: { + foo: "${wsim#b#attrs.bar}", + another: "i depend on: ${wsim#c/d/e#attrs.xxx}", + }, + }, + { path: "b", props: { hello: ["bang", "${wsim#c/d/e#attrs.aaa}"] } }, + { path: "c/d/e" }, + { path: "d", props: { a: "${wsim#a#attrs.aaa}" }, deps: ["b"] }, + ]); + + const a = graph.tryFind("a")!; + expect(Array.from(a.dependencies)).toStrictEqual(["b", "c/d/e"]); + expect(Array.from(a.dependents)).toStrictEqual(["d"]); + + const b = graph.tryFind("b")!; + expect(Array.from(b.dependencies)).toStrictEqual(["c/d/e"]); + expect(Array.from(b.dependents)).toStrictEqual(["a", "d"]); + + const c = graph.tryFind("c/d/e")!; + expect(Array.from(c.dependencies)).toStrictEqual([]); + expect(Array.from(c.dependents)).toStrictEqual(["a", "b"]); + + const d = graph.tryFind("d")!; + expect(Array.from(d.dependencies)).toStrictEqual(["b", "a"]); + expect(Array.from(d.dependents)).toStrictEqual([]); +}); + +test("tryFind returns undefined if node does not exist", () => { + const graph = new Graph([]); + expect(graph.tryFind("a")).toBe(undefined); +}); + +test("fails on a direct cyclic dependency", () => { + expect(() => { + new Graph([ + { path: "a", deps: ["b"] }, + { path: "b", deps: ["a"] }, + ]); + }).toThrowError(/cyclic dependency detected: b -> a/); +}); + +test("fails on an indirect cyclic dependency", () => { + expect(() => { + new Graph([ + { path: "a", deps: ["b"] }, + { path: "b", deps: ["c"] }, + { path: "c", deps: ["a"] }, + ]); + }).toThrowError(/cyclic dependency detected: c -> a/); +}); + +test("cyclic deps introduced by token", () => { + expect(() => { + new Graph([ + { path: "a", props: { foo: "${wsim#b#attrs.bar}" } }, + { path: "b", props: { bar: "${wsim#c#attrs.baz}" } }, + { path: "c", props: { baz: "${wsim#a#attrs.foo}" } }, + ]); + }).toThrowError(/cyclic dependency detected: c -> a -> b -> c/); +}); diff --git a/libs/wingsdk/test/simulator/simulator.test.ts b/libs/wingsdk/test/simulator/simulator.test.ts index 3d80b525360..dd494bf6627 100644 --- a/libs/wingsdk/test/simulator/simulator.test.ts +++ b/libs/wingsdk/test/simulator/simulator.test.ts @@ -1,10 +1,23 @@ +import * as fs from "fs"; import { Construct } from "constructs"; import { test, expect, describe } from "vitest"; -import { Bucket } from "../../src/cloud"; +import { + Api, + Bucket, + Function, + IApiClient, + IBucketClient, + IFunctionClient, + IServiceClient, + OnDeploy, + Service, +} from "../../src/cloud"; import { InflightBindings } from "../../src/core"; -import { Testing } from "../../src/simulator"; -import { ITestRunnerClient, Test, TestResult } from "../../src/std"; +import { Simulator, Testing } from "../../src/simulator"; +import { ITestRunnerClient, Test, TestResult, TraceType } from "../../src/std"; +import { State } from "../../src/target-sim"; import { SimApp } from "../sim-app"; +import { mkdtemp } from "../util"; describe("run single test", () => { test("test not found", async () => { @@ -178,6 +191,417 @@ test("provides raw tree data", async () => { expect(treeData).toMatchSnapshot(); }); +test("unable to resolve token during initialization", async () => { + const app = new SimApp(); + const state = new State(app, "State"); + const bucket = new Bucket(app, "Bucket"); + bucket.addObject("url.txt", state.token("my_token")); + + let error; + try { + await app.startSimulator(); + } catch (e) { + error = e; + } + expect(error).toBeDefined(); + expect(error.message).toMatch(/Unable to resolve attribute 'my_token'/); +}); + +describe("in-place updates", () => { + test("no change", async () => { + const stateDir = mkdtemp(); + + const app = new SimApp(); + new Bucket(app, "Bucket1"); + + const sim = await app.startSimulator(stateDir); + expect(sim.listResources()).toEqual(["root/Bucket1"]); + + expect(simTraces(sim)).toStrictEqual(["root/Bucket1 started"]); + + const app2 = new SimApp(); + new Bucket(app2, "Bucket1"); + + const app2Dir = app2.synth(); + + await sim.update(app2Dir); + expect(updateTrace(sim)).toStrictEqual({ + added: [], + deleted: [], + updated: [], + }); + + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "Update: 0 added, 0 updated, 0 deleted", + ]); + + expect(sim.listResources()).toEqual(["root/Bucket1"]); + await sim.stop(); + }); + + test("add", async () => { + const stateDir = mkdtemp(); + + const app = new SimApp(); + + new Bucket(app, "Bucket1"); + const sim = await app.startSimulator(stateDir); + expect(sim.listResources()).toEqual(["root/Bucket1"]); + expect(simTraces(sim)).toStrictEqual(["root/Bucket1 started"]); + + const app2 = new SimApp(); + new Bucket(app2, "Bucket1"); + new Bucket(app2, "Bucket2"); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + expect(updateTrace(sim)).toStrictEqual({ + added: ["root/Bucket2"], + deleted: [], + updated: [], + }); + + expect(sim.listResources()).toEqual(["root/Bucket1", "root/Bucket2"]); + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "Update: 1 added, 0 updated, 0 deleted", + "root/Bucket2 started", + ]); + + await sim.stop(); + }); + + test("delete", async () => { + const stateDir = mkdtemp(); + + const app = new SimApp(); + new Bucket(app, "Bucket1"); + new Bucket(app, "Bucket2"); + const sim = await app.startSimulator(stateDir); + expect(sim.listResources()).toEqual(["root/Bucket1", "root/Bucket2"]); + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "root/Bucket2 started", + ]); + + const app2 = new SimApp(); + new Bucket(app2, "Bucket1"); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + expect(updateTrace(sim)).toStrictEqual({ + added: [], + deleted: ["root/Bucket2"], + updated: [], + }); + + expect(sim.listResources()).toEqual(["root/Bucket1"]); + + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "root/Bucket2 started", + "Update: 0 added, 0 updated, 1 deleted", + "root/Bucket2 stopped", + ]); + + await sim.stop(); + }); + + test("update", async () => { + const stateDir = mkdtemp(); + + const app = new SimApp(); + new Bucket(app, "Bucket1"); + const sim = await app.startSimulator(stateDir); + expect(sim.listResources()).toEqual(["root/Bucket1"]); + expect(sim.getResourceConfig("root/Bucket1").props.public).toBeFalsy(); + expect(simTraces(sim)).toStrictEqual(["root/Bucket1 started"]); + + const app2 = new SimApp(); + new Bucket(app2, "Bucket1", { public: true }); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + expect(updateTrace(sim)).toStrictEqual({ + added: [], + deleted: [], + updated: ["root/Bucket1"], + }); + + expect(sim.listResources()).toEqual(["root/Bucket1"]); + + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "Update: 0 added, 1 updated, 0 deleted", + "root/Bucket1 stopped", + "root/Bucket1 started", + ]); + + expect(sim.getResourceConfig("root/Bucket1").props.public).toBeTruthy(); + + await sim.stop(); + }); + + test("add resource that depends on an existing resource", async () => { + const stateDir = mkdtemp(); + + const app = new SimApp(); + new Bucket(app, "Bucket1"); + + const sim = await app.startSimulator(stateDir); + + expect(simTraces(sim)).toStrictEqual(["root/Bucket1 started"]); + + expect(sim.listResources()).toEqual(["root/Bucket1"]); + expect(sim.getResourceConfig("root/Bucket1").props.public).toBeFalsy(); + + const app2 = new SimApp(); + const bucket1 = new Bucket(app2, "Bucket1"); + const api = new Api(app2, "Api"); + bucket1.addObject("url.txt", api.url); + + const handler = `async handle() { return process.env.API_URL; }`; + new Function(app2, "Function", Testing.makeHandler(handler), { + env: { API_URL: api.url }, + }); + + const app2Dir = app2.synth(); + + await sim.update(app2Dir); + expect(updateTrace(sim)).toStrictEqual({ + added: ["root/Api", "root/Api/Endpoint", "root/Function"], + deleted: [], + updated: ["root/Bucket1"], + }); + + expect(simTraces(sim)).toStrictEqual([ + "root/Bucket1 started", + "Update: 3 added, 1 updated, 0 deleted", + "root/Bucket1 stopped", + "root/Api started", + "root/Bucket1 started", + "root/Api/Endpoint started", + "root/Function started", + ]); + + expect(sim.listResources()).toEqual([ + "root/Api", + "root/Api/Endpoint", + "root/Bucket1", + "root/Function", + ]); + + const bucketClient = sim.getResource("root/Bucket1") as IBucketClient; + const urlFromBucket = await bucketClient.get("url.txt"); + expect(urlFromBucket.startsWith("http://127.0.0")).toBeTruthy(); + + const functionClient = sim.getResource("root/Function") as IFunctionClient; + const ret = await functionClient.invoke(); + expect(ret).toEqual(urlFromBucket); + }); + + test("retained resource is not removed", async () => { + const app = new SimApp(); + const api1 = new Api(app, "Api"); + const bucket1 = new Bucket(app, "Bucket"); + bucket1.addObject("url.txt", api1.url); + + const stateDir = mkdtemp(); + const sim = await app.startSimulator(stateDir); + + const urlBeforeUpdate = await sim.getResource("root/Bucket").get("url.txt"); + + // remove the state directory otherwise Api reuses the port + fs.rmdirSync(sim.getResourceStateDir("/Api"), { recursive: true }); + + const app2 = new SimApp(); + const api2 = new Api(app2, "Api"); + const bucket2 = new Bucket(app2, "Bucket", { public: true }); // <-- causing the update to be updated because we are deleting the state dirtectory, so we want the file to be uploaded again. + bucket2.addObject("url.txt", api2.url); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + + expect(updateTrace(sim)).toStrictEqual({ + added: [], + deleted: [], + updated: ["root/Bucket"], + }); + + const urlAfterUpdate = await sim.getResource("root/Bucket").get("url.txt"); + expect(urlBeforeUpdate).toStrictEqual(urlAfterUpdate); + }); + + test("dependent resource is replaced when a dependency is replaced", async () => { + const app = new SimApp(); + const myApi = new Api(app, "Api1"); + const myBucket = new Bucket(app, "Bucket1"); + + // BUCKET depends on API + myBucket.addObject("url.txt", myApi.url); + + const stateDir = mkdtemp(); + const sim = await app.startSimulator(stateDir); + + const urlBeforeUpdate = await sim + .getResource("root/Bucket1") + .get("url.txt"); + expect(urlBeforeUpdate.startsWith("http://127.0.0")).toBeTruthy(); + + expect(simTraces(sim)).toEqual([ + "root/Api1 started", + "root/Api1/Endpoint started", + "root/Bucket1 started", + ]); + + // now lets change some configuration of Api1. we expect the bucket to be replaced as well + + const app2 = new SimApp(); + const myApi2 = new Api(app2, "Api1", { cors: true }); + const myBucket2 = new Bucket(app2, "Bucket1"); + myBucket2.addObject("url.txt", myApi2.url); + + // clear the state directory + fs.rmdirSync(stateDir, { recursive: true }); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + + expect(updateTrace(sim)).toStrictEqual({ + added: [], + deleted: [], + updated: ["root/Api1"], + }); + + expect(simTraces(sim)).toEqual([ + "root/Api1 started", + "root/Api1/Endpoint started", + "root/Bucket1 started", + "Update: 0 added, 1 updated, 0 deleted", + "root/Api1/Endpoint stopped", + "root/Bucket1 stopped", + "root/Api1 stopped", + "root/Api1 started", + "root/Api1/Endpoint started", + "root/Bucket1 started", + ]); + + const urlAfterUpdate = await ( + sim.getResource("root/Bucket1") as IBucketClient + ).get("url.txt"); + expect(urlAfterUpdate).not.toEqual(urlBeforeUpdate); + }); + + test("token value is changed across an update", async () => { + const app = new SimApp(); + const stateKey = "my_value"; + + const myState = new State(app, "State"); + + const myService = new Service( + app, + "Service", + Testing.makeHandler( + `async handle() { await this.myState.set("${stateKey}", "bang"); }`, + { myState: { obj: myState, ops: ["set"] } } + ), + { env: { VER: "1" } } + ); + + new Function( + app, + "Function", + Testing.makeHandler(`async handle() { return process.env.MY_VALUE; }`), + { + env: { MY_VALUE: myState.token(stateKey) }, + } + ); + + const sim = await app.startSimulator(); + + const fn = sim.getResource("root/Function") as IFunctionClient; + const result = await fn.invoke(); + expect(result).toEqual("bang"); + + // okay, now we are ready to update + const app2 = new SimApp(); + + const myState2 = new State(app2, "State"); + + const myService2 = new Service( + app2, + "Service", + Testing.makeHandler( + `async handle() { await this.myState.set("${stateKey}", "bing"); }`, + { myState: { obj: myState2, ops: ["set"] } } + ), + { env: { VER: "2" } } + ); + + new Function( + app2, + "Function", + Testing.makeHandler(`async handle() { return process.env.MY_VALUE; }`), + { + env: { MY_VALUE: myState.token(stateKey) }, + } + ); + + await sim.update(app2.synth()); + + expect(simTraces(sim)).toEqual([ + "root/State started", + "root/State.my_value = bang", + "root/Service started", + "root/Function started", + "Update: 0 added, 1 updated, 0 deleted", + "root/Service stopped", + "root/State.my_value = bing", + "root/Service started", + ]); + }); + + test("Construct dependencies are taken into account", async () => { + const app = new SimApp(); + const handler = Testing.makeHandler(`async handle() {}`); + const bucket = new Bucket(app, "Bucket1"); + + new OnDeploy(app, "OnDeploy", handler, { + executeAfter: [bucket], + }); + + const sim = await app.startSimulator(); + + const app2 = new SimApp(); + const bucket2 = new Bucket(app2, "Bucket1", { public: true }); + new OnDeploy(app2, "OnDeploy", handler, { + executeAfter: [bucket2], + }); + + const app2Dir = app2.synth(); + await sim.update(app2Dir); + + expect(simTraces(sim)).toEqual([ + "root/OnDeploy/Function started", + "root/Bucket1 started", + "root/OnDeploy started", + "Update: 0 added, 1 updated, 0 deleted", + "root/OnDeploy stopped", + "root/Bucket1 stopped", + "root/Bucket1 started", + "root/OnDeploy started", + ]); + }); +}); + +test("tryGetResource returns undefined if the resource not found", async () => { + const app = new SimApp(); + const sim = await app.startSimulator(); + expect(sim.tryGetResource("bang")).toBeUndefined(); + expect(sim.tryGetResourceConfig("bing")).toBeUndefined(); +}); + function makeTest( scope: Construct, id: string, @@ -191,45 +615,10 @@ function makeTest( return new Test(scope, id, handler, bindings); } -function removePathsFromTraceLine(line?: string) { - if (!line) { - return undefined; - } - - // convert wingsdk paths to src (e.g. "/a/b/wingsdk/src/z/t.js" -> "[src]/z/t.js") with relative paths - line = line.replace(/\/.+\/wingsdk\/src\//g, "[src]/"); - - // if any absolute paths remain, replace them with "[abs]" - line = line.replace(/([ (])\/[^)]+/g, "$1[abs]"); - - return line; -} - -function removeLineNumbers(line?: string) { - if (!line) { - return undefined; - } - - return line.replace(/:\d+:\d+/g, ":"); -} - function sanitizeResult(result: TestResult): TestResult { let error: string | undefined; if (result.error) { - let lines = result.error - .split("\n") - .map(removePathsFromTraceLine) - .map(removeLineNumbers); - - // remove all lines after "at Simulator.runTest" since they are platform-dependent - let lastLine = lines.findIndex((line) => - line?.includes("Simulator.runTest") - ); - if (lastLine !== -1) { - lines = lines.slice(0, lastLine + 1); - } - - error = lines.join("\n"); + error = result.error.split("\n")[0]; } return { @@ -250,3 +639,16 @@ async function runAllTests(runner: ITestRunnerClient): Promise { } return results; } + +function simTraces(s: Simulator) { + return s + .listTraces() + .filter((t) => t.type === TraceType.SIMULATOR) + .map((t) => t.data.message); +} + +function updateTrace(s: Simulator) { + return s + .listTraces() + .find((t) => t.type === TraceType.SIMULATOR && t.data.update)?.data.update; +} diff --git a/libs/wingsdk/test/simulator/tokens.test.ts b/libs/wingsdk/test/simulator/tokens.test.ts new file mode 100644 index 00000000000..f1c03f3ff2b --- /dev/null +++ b/libs/wingsdk/test/simulator/tokens.test.ts @@ -0,0 +1,138 @@ +import { test, describe, expect } from "vitest"; +import { parseToken, resolveTokens } from "../../src/simulator/tokens"; + +describe("parseToken", () => { + test("parses path", () => { + expect(parseToken("${wsim#foo#attrs.bar}")?.path).toBe("foo"); + expect(parseToken("${wsim#foo/jang/bang#props.bar}")?.path).toBe( + "foo/jang/bang" + ); + }); + + test("parses attribute", () => { + const result = parseToken("${wsim#foo/lang#attrs.bar}"); + expect(result?.path).toBe("foo/lang"); + expect(result?.attr).toBe("bar"); + expect(result?.prop).toBeUndefined(); + }); + + test("parses property", () => { + const result = parseToken("${wsim#foo#props.bar}"); + expect(result?.path).toBe("foo"); + expect(result?.prop).toBe("bar"); + expect(result?.attr).toBeUndefined(); + }); + + test("invalid tokens", () => { + expect(() => parseToken("${foo#baz}")).toThrow(/Invalid token reference/); + expect(() => parseToken("${wsim#foo#baz}")).toThrow( + /Invalid token reference/ + ); + }); +}); + +describe("tryResolveTokens", () => { + test("undefined", () => { + expect(resolveTokens(undefined, () => "foo")).toBeUndefined(); + }); + + test("terminal token", () => { + expect( + resolveTokens("${wsim#foo/bar#attrs.bar}", (token) => { + expect(token.path).toBe("foo/bar"); + expect(token.attr).toBe("bar"); + expect(token.prop).toBeUndefined(); + return "resolved_token"; + }) + ).toBe("resolved_token"); + + expect( + resolveTokens("${wsim#foo/bar#props.bar}", (token) => { + expect(token.path).toBe("foo/bar"); + expect(token.prop).toBe("bar"); + expect(token.attr).toBeUndefined(); + return "resolved_token_2"; + }) + ).toBe("resolved_token_2"); + }); + + test("nested token inside a string", () => { + expect( + resolveTokens( + "hello, I am a ${wsim#foo/bar#attrs.tttt} inside a ${wsim#bing/bang#props.vvv}", + (token) => { + if (token.path === "foo/bar" && token.attr === "tttt") { + return "cool nested token"; + } + + if (token.path === "bing/bang" && token.prop === "vvv") { + return "cool string"; + } + + expect.fail(`unexpected token: ${JSON.stringify(token)}`); + } + ) + ).toBe("hello, I am a cool nested token inside a cool string"); + }); + + test("tokens within an array", () => { + const result = resolveTokens( + [ + "bla", + "${wsim#foo/bar#attrs.tttt}", + "blabla", + "nested nested ${wsim#bing/bang#props.vvv} nested", + ], + (token) => { + if (token.path === "foo/bar" && token.attr === "tttt") { + return "T1"; + } + + if (token.path === "bing/bang" && token.prop === "vvv") { + return "T2"; + } + + expect.fail(`unexpected token: ${JSON.stringify(token)}`); + } + ); + + expect(result).toEqual(["bla", "T1", "blabla", "nested nested T2 nested"]); + }); + + test("tokens within an object", () => { + const result = resolveTokens( + { + key1: "bla", + key2: "${wsim#foo/bar#attrs.tttt}", + key3: { + bang: ["nested nested ${wsim#bing/bang#props.vvv} nested"], + bing: { + jone: "${wsim#foo/bar#attrs.tttt}", + }, + }, + }, + (token) => { + if (token.path === "foo/bar" && token.attr === "tttt") { + return "T1"; + } + + if (token.path === "bing/bang" && token.prop === "vvv") { + return "T2"; + } + + expect.fail(`unexpected token: ${JSON.stringify(token)}`); + } + ); + + expect(result).toEqual({ + key1: "bla", + key2: "T1", + key3: { + bang: ["nested nested T2 nested"], + bing: { + jone: "T1", + }, + }, + }); + }); +}); diff --git a/libs/wingsdk/test/target-sim/__snapshots__/api.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/api.test.ts.snap index 024e61fe721..99448498f90 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/api.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/api.test.ts.snap @@ -52,6 +52,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -97,6 +98,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -224,7 +229,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -271,20 +275,19 @@ return class Handler { exports[`api handler can read the request params 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{\\"foo\\":\\"bar\\",\\"bar\\":\\"baz\\"},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -335,6 +338,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -370,6 +374,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -493,7 +501,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -540,20 +547,19 @@ return class Handler { exports[`api handler can read the request path 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -604,6 +610,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -639,6 +646,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -762,7 +773,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -809,20 +819,19 @@ return class Handler { exports[`api handler can set response headers 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"foo\\":\\"bar\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -873,6 +882,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -908,6 +918,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -1031,7 +1045,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -1078,20 +1091,19 @@ return class Handler { exports[`api response returns Content-Type header from inflight 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -1142,6 +1154,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -1177,6 +1190,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -1300,7 +1317,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -1347,20 +1363,19 @@ return class Handler { exports[`api response returns default Content-Type header 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -1411,6 +1426,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -1446,6 +1462,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -1569,7 +1589,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -1616,12 +1635,11 @@ return class Handler { exports[`api supports every method type 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", @@ -1643,11 +1661,11 @@ exports[`api supports every method type 1`] = ` "Processing "PATCH /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\",\\"content-length\\":\\"0\\"},\\"body\\":\\"\\",\\"method\\":\\"PATCH\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "PATCH /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -1728,6 +1746,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -1823,6 +1842,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -1970,7 +1993,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -2017,20 +2039,19 @@ return class Handler { exports[`api with 'name' & 'age' parameter 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /:name/:age" params={"name":"akhil","age":"23"}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/akhil/23\\",\\"query\\":{},\\"vars\\":{\\"name\\":\\"akhil\\",\\"age\\":\\"23\\"}}").", "GET /:name/:age - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -2081,6 +2102,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -2133,6 +2155,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -2256,7 +2282,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -2303,20 +2328,19 @@ return class Handler { exports[`api with 'name' parameter 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /:name" params={"name":"akhil"}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/akhil\\",\\"query\\":{},\\"vars\\":{\\"name\\":\\"akhil\\"}}").", "GET /:name - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -2367,6 +2391,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -2411,6 +2436,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -2534,7 +2563,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -2626,6 +2654,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -2673,6 +2702,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -2800,7 +2833,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -2847,27 +2879,26 @@ return class Handler { exports[`api with multiple methods on same route 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", + "root/my_api/OnRequestHandler1 started", + "root/my_api/ApiEventMapping1 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", "Processing "POST /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\",\\"content-length\\":\\"0\\"},\\"body\\":\\"\\",\\"method\\":\\"POST\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "POST /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", + "root/my_api/ApiEventMapping1 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", + "root/my_api/OnRequestHandler1 stopped", ] `; @@ -2940,6 +2971,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -2985,6 +3017,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -3005,6 +3041,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler1", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler1_c84819d7.js", "sourceCodeLanguage": "javascript", @@ -3015,6 +3052,10 @@ return class Handler { { "addr": "c874047faffbf7bc1cdc78bb5f3f942cf01cd31844", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler1", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping1", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -3149,7 +3190,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -3210,27 +3250,26 @@ return class Handler { exports[`api with multiple routes 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", + "root/my_api/OnRequestHandler1 started", + "root/my_api/ApiEventMapping1 started", "Processing "GET /hello/world" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello/world\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello/world - 200.", "Processing "GET /hello/wingnuts" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello/wingnuts\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello/wingnuts - 200.", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", + "root/my_api/ApiEventMapping1 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", + "root/my_api/OnRequestHandler1 stopped", ] `; @@ -3303,6 +3342,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -3350,6 +3390,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -3370,6 +3414,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler1", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler1_c84819d7.js", "sourceCodeLanguage": "javascript", @@ -3380,6 +3425,10 @@ return class Handler { { "addr": "c874047faffbf7bc1cdc78bb5f3f942cf01cd31844", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler1", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping1", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -3514,7 +3563,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -3575,20 +3623,19 @@ return class Handler { exports[`api with one GET route 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "GET /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -3639,6 +3686,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -3674,6 +3722,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -3797,7 +3849,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -3844,20 +3895,19 @@ return class Handler { exports[`api with one GET route with request params 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "GET /users/:name" params={"name":"tsuf"}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\"},\\"body\\":\\"\\",\\"method\\":\\"GET\\",\\"path\\":\\"/users/tsuf\\",\\"query\\":{},\\"vars\\":{\\"name\\":\\"tsuf\\"}}").", "GET /users/:name - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -3908,6 +3958,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -3952,6 +4003,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -4075,7 +4130,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -4122,20 +4176,19 @@ return class Handler { exports[`api with one POST route, with body 1`] = ` [ - "root/my_api/Endpoint is waiting on a dependency", - "@winglang/sdk.cloud.Function created.", "Server listening on http://127.0.0.1:", - "@winglang/sdk.cloud.Api created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Endpoint created.", + "root/my_api started", + "root/my_api/Endpoint started", + "root/my_api/OnRequestHandler0 started", + "root/my_api/ApiEventMapping0 started", "Processing "POST /hello" params={}).", "Invoke (payload="{\\"headers\\":{\\"host\\":\\"127.0.0.1:\\",\\"connection\\":\\"keep-alive\\",\\"content-type\\":\\"application/json\\",\\"accept\\":\\"*/*\\",\\"accept-language\\":\\"*\\",\\"sec-fetch-mode\\":\\"cors\\",\\"user-agent\\":\\"node\\",\\"accept-encoding\\":\\"gzip, deflate\\",\\"content-length\\":\\"25\\"},\\"body\\":\\"{\\\\\\"message\\\\\\":\\\\\\"hello world\\\\\\"}\\",\\"method\\":\\"POST\\",\\"path\\":\\"/hello\\",\\"query\\":{},\\"vars\\":{}}").", "POST /hello - 200.", - "@winglang/sdk.sim.EventMapping deleted.", + "root/my_api/Endpoint stopped", + "root/my_api/ApiEventMapping0 stopped", + "root/my_api/OnRequestHandler0 stopped", "Closing server on http://127.0.0.1:", - "@winglang/sdk.cloud.Api deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Endpoint deleted.", + "root/my_api stopped", ] `; @@ -4186,6 +4239,7 @@ return class Handler { "attrs": {}, "path": "root/my_api/OnRequestHandler0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/onrequesthandler0_c82d41b2.js", "sourceCodeLanguage": "javascript", @@ -4221,6 +4275,10 @@ return class Handler { { "addr": "c8a199e7bc539eb442a47653fe0f2b1f0bf50aa6d1", "attrs": {}, + "deps": [ + "root/my_api/OnRequestHandler0", + "root/my_api", + ], "path": "root/my_api/ApiEventMapping0", "props": { "publisher": "\${wsim#root/my_api#attrs.handle}", @@ -4344,7 +4402,6 @@ return class Handler { }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -4517,7 +4574,6 @@ exports[`create an api 1`] = ` }, "display": { "description": "Api root/my_api", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/bucket.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/bucket.test.ts.snap index ba662f42370..5250ece5155 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/bucket.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/bucket.test.ts.snap @@ -2,17 +2,17 @@ exports[`bucket on event creates 3 topics, and sends the right event and key in the event handlers 1`] = ` [ - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.cloud.Bucket created.", - "@winglang/sdk.cloud.Bucket created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", + "root/my_bucket/oncreate started", + "root/my_bucket/onupdate started", + "root/my_bucket/ondelete started", + "root/my_bucket started", + "root/log_bucket started", + "root/my_bucket/oncreate/OnMessage0 started", + "root/my_bucket/oncreate/TopicEventMapping0 started", + "root/my_bucket/onupdate/OnMessage0 started", + "root/my_bucket/onupdate/TopicEventMapping0 started", + "root/my_bucket/ondelete/OnMessage0 started", + "root/my_bucket/ondelete/TopicEventMapping0 started", "Publish (message=a).", "Sending message (message=a, subscriber=sim-5).", "InvokeAsync (payload="a").", @@ -34,28 +34,28 @@ exports[`bucket on event creates 3 topics, and sends the right event and key in "Put (key=a).", "I am done", "Get (key=a).", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Bucket deleted.", - "@winglang/sdk.cloud.Bucket deleted.", - "@winglang/sdk.cloud.Topic deleted.", - "@winglang/sdk.cloud.Topic deleted.", - "@winglang/sdk.cloud.Topic deleted.", + "root/my_bucket stopped", + "root/my_bucket/oncreate/TopicEventMapping0 stopped", + "root/my_bucket/oncreate stopped", + "root/my_bucket/onupdate/TopicEventMapping0 stopped", + "root/my_bucket/onupdate stopped", + "root/my_bucket/ondelete/TopicEventMapping0 stopped", + "root/my_bucket/ondelete stopped", + "root/my_bucket/oncreate/OnMessage0 stopped", + "root/my_bucket/onupdate/OnMessage0 stopped", + "root/my_bucket/ondelete/OnMessage0 stopped", + "root/log_bucket stopped", ] `; exports[`can add file in preflight 1`] = ` [ "Adding object from preflight (key=test.txt).", - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Get (key=test.txt).", "Get (key=test.txt).", "List (prefix=null).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; @@ -196,11 +196,11 @@ exports[`can add file in preflight 2`] = ` exports[`can add object in preflight 1`] = ` [ "Adding object from preflight (key=greeting.txt).", - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Get (key=greeting.txt).", "Get (key=greeting.txt).", "List (prefix=null).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; @@ -472,9 +472,9 @@ exports[`create a bucket 1`] = ` exports[`get invalid object throws an error 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Get (key=unknown.txt).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; @@ -612,20 +612,20 @@ exports[`get invalid object throws an error 2`] = ` exports[`list respects prefixes 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=path/dir1/file1.txt).", "Put (key=path/dir2/file2.txt).", "List (prefix=null).", "List (prefix=path).", "List (prefix=path/dir1).", "List (prefix=path/dir2).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`objects can have keys that look like directories 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=foo).", "Put (key=foo/).", "Put (key=foo/bar).", @@ -637,105 +637,101 @@ exports[`objects can have keys that look like directories 1`] = ` "List (prefix=foo/bar).", "List (prefix=foo/bar/).", "List (prefix=foo/bar/baz).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`put and get metadata of objects from bucket 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=file1.main.w).", "Put (key=file2.txt).", "Put (key=file3.txt).", "Metadata (key=file1.main.w).", "Metadata (key=file2.txt).", "Metadata (key=file3.txt).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`put and get object from bucket 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=greeting.txt).", "Get (key=greeting.txt).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`put multiple json objects and list all from bucket 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put Json (key=greeting1.json).", "Put Json (key=greeting2.json).", "Put Json (key=greeting3.json).", "List (prefix=null).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`put multiple objects and list all from bucket 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=greeting1.txt).", "Put (key=greeting2.txt).", "Put (key=greeting3.txt).", "List (prefix=null).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`remove object from a bucket 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=unknown.txt).", "Delete (key=unknown.txt).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`remove object from a bucket with mustExist as option 1`] = ` [ - "@winglang/sdk.cloud.Bucket created.", + "root/my_bucket started", "Put (key=unknown.txt).", "Delete (key=unknown.txt).", - "@winglang/sdk.cloud.Bucket deleted.", + "root/my_bucket stopped", ] `; exports[`removing a key will call onDelete method 1`] = ` [ - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.cloud.Bucket created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", + "root/my_bucket/ondelete started", + "root/my_bucket started", + "root/my_bucket/ondelete/OnMessage0 started", + "root/my_bucket/ondelete/TopicEventMapping0 started", "Put (key=unknown.txt).", "Publish (message=unknown.txt).", "Sending message (message=unknown.txt, subscriber=sim-2).", "InvokeAsync (payload="unknown.txt").", "Delete (key=unknown.txt).", "Received unknown.txt", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Bucket deleted.", - "@winglang/sdk.cloud.Topic deleted.", + "root/my_bucket stopped", + "root/my_bucket/ondelete/TopicEventMapping0 stopped", + "root/my_bucket/ondelete stopped", + "root/my_bucket/ondelete/OnMessage0 stopped", ] `; exports[`update an object in bucket 1`] = ` [ - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.cloud.Bucket created.", - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.sim.EventMapping created.", - "Publish (message=greeting.txt).", - "Sending message (message=greeting.txt, subscriber=sim-2).", - "InvokeAsync (payload="greeting.txt").", - "Put (key=greeting.txt).", - "Put (key=greeting.txt).", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Bucket deleted.", - "@winglang/sdk.cloud.Topic deleted.", + "root/my_bucket/oncreate started", + "root/my_bucket started", + "root/my_bucket/oncreate/OnMessage0 started", + "root/my_bucket/oncreate/TopicEventMapping0 started", + "Publish (message=1.txt).", + "Sending message (message=1.txt, subscriber=sim-2).", + "InvokeAsync (payload="1.txt").", + "Put (key=1.txt).", + "Put (key=1.txt).", ] `; diff --git a/libs/wingsdk/test/target-sim/__snapshots__/counter.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/counter.test.ts.snap index 9924402a1f9..0f0a012662f 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/counter.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/counter.test.ts.snap @@ -132,12 +132,12 @@ exports[`create a counter 1`] = ` exports[`dec 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Dec (amount=1).", "Dec (amount=1).", "Dec (amount=10).", "Dec (amount=10).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; @@ -273,12 +273,12 @@ exports[`dec 2`] = ` exports[`inc 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Inc (amount=1).", "Inc (amount=1).", "Inc (amount=10).", "Inc (amount=10).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; @@ -414,12 +414,12 @@ exports[`inc 2`] = ` exports[`key dec 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Dec (amount=1, key: my-key).", "Dec (amount=1, key: my-key).", "Dec (amount=10, key: my-key).", "Dec (amount=10, key: my-key).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; @@ -555,12 +555,12 @@ exports[`key dec 2`] = ` exports[`key inc 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Inc (amount=1, key: my-key).", "Inc (amount=1, key: my-key).", "Inc (amount=10, key: my-key).", "Inc (amount=10, key: my-key).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; @@ -696,10 +696,10 @@ exports[`key inc 2`] = ` exports[`key set to new value 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Set (value=5, key: my-key).", "Peek (value=5, key: my-key).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; @@ -835,10 +835,10 @@ exports[`key set to new value 2`] = ` exports[`set to new value 1`] = ` [ - "@winglang/sdk.cloud.Counter created.", + "root/my_counter started", "Set (value=5).", "Peek (value=5).", - "@winglang/sdk.cloud.Counter deleted.", + "root/my_counter stopped", ] `; diff --git a/libs/wingsdk/test/target-sim/__snapshots__/dynamodb-table.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/dynamodb-table.test.ts.snap index ad5970b6334..8206342b869 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/dynamodb-table.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/dynamodb-table.test.ts.snap @@ -136,8 +136,8 @@ exports[`create a table 1`] = ` exports[`get item 1`] = ` [ - "@winglang/sdk.ex.DynamodbTable created.", - "@winglang/sdk.ex.DynamodbTable deleted.", + "root/get_table started", + "root/get_table stopped", ] `; @@ -277,8 +277,8 @@ exports[`get item 2`] = ` exports[`put item 1`] = ` [ - "@winglang/sdk.ex.DynamodbTable created.", - "@winglang/sdk.ex.DynamodbTable deleted.", + "root/put_table started", + "root/put_table stopped", ] `; @@ -418,8 +418,8 @@ exports[`put item 2`] = ` exports[`update item 1`] = ` [ - "@winglang/sdk.ex.DynamodbTable created.", - "@winglang/sdk.ex.DynamodbTable deleted.", + "root/update_table started", + "root/update_table stopped", ] `; diff --git a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap index 27a5d887fb1..5c661456c95 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/file-counter.test.ts.snap @@ -89,8 +89,13 @@ bucket: (function() { { "addr": "c8e82e9fd83d9e59c5af169a3042b9ed0b40e91185", "attrs": {}, + "deps": [ + "root/HelloWorld/Counter", + "root/HelloWorld/Bucket", + ], "path": "root/HelloWorld/Queue/SetConsumer0", "props": { + "concurrency": 100, "environmentVariables": { "BUCKET_HANDLE_5f2a41c8": "\${wsim#root/HelloWorld/Bucket#attrs.handle}", "COUNTER_HANDLE_4ecd8d46": "\${wsim#root/HelloWorld/Counter#attrs.handle}", @@ -114,6 +119,10 @@ bucket: (function() { { "addr": "c80de7940bef4e6ad61443a5ed07362f300a117b29", "attrs": {}, + "deps": [ + "root/HelloWorld/Queue/SetConsumer0", + "root/HelloWorld/Queue", + ], "path": "root/HelloWorld/Queue/QueueEventMapping0", "props": { "publisher": "\${wsim#root/HelloWorld/Queue#attrs.handle}", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/function.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/function.test.ts.snap index 9a0a47fcef6..66fa0e3c6e2 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/function.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/function.test.ts.snap @@ -2,8 +2,8 @@ exports[`__dirname and __filename cannot be used within inflight code 1`] = ` [ - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.cloud.Function created.", + "root/Function.0 started", + "root/Function.1 started", "Warning: __dirname and __filename cannot be used within bundled cloud functions. There may be unexpected behavior.", "Warning: __dirname and __filename cannot be used within bundled cloud functions. There may be unexpected behavior.", "Invoke (payload=undefined).", @@ -54,6 +54,7 @@ async handle(event) { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": { "ENV_VAR1": "true", }, @@ -178,9 +179,9 @@ async handle(event) { exports[`invoke function fails 1`] = ` [ - "@winglang/sdk.cloud.Function created.", + "root/my_function started", "Invoke (payload="{\\"name\\":\\"alice\\"}").", - "@winglang/sdk.cloud.Function deleted.", + "root/my_function stopped", ] `; @@ -227,6 +228,7 @@ async handle(event) { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/my_function_c85c4e0e.js", "sourceCodeLanguage": "javascript", @@ -349,9 +351,9 @@ async handle(event) { exports[`invoke function succeeds 1`] = ` [ - "@winglang/sdk.cloud.Function created.", + "root/my_function started", "Invoke (payload="{\\"name\\":\\"Alice\\"}").", - "@winglang/sdk.cloud.Function deleted.", + "root/my_function stopped", ] `; @@ -398,6 +400,7 @@ async handle(event) { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/my_function_c85c4e0e.js", "sourceCodeLanguage": "javascript", @@ -520,9 +523,9 @@ async handle(event) { exports[`invoke function with environment variables 1`] = ` [ - "@winglang/sdk.cloud.Function created.", + "root/my_function started", "Invoke (payload="{\\"name\\":\\"Alice\\"}").", - "@winglang/sdk.cloud.Function deleted.", + "root/my_function stopped", ] `; @@ -569,6 +572,7 @@ async handle(event) { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": { "PIG_LATIN": "true", }, @@ -693,9 +697,9 @@ async handle(event) { exports[`invoke function with process.exit(1) 1`] = ` [ - "@winglang/sdk.cloud.Function created.", + "root/my_function started", "Invoke (payload="{}").", - "@winglang/sdk.cloud.Function deleted.", + "root/my_function stopped", ] `; @@ -732,6 +736,7 @@ async handle() { "attrs": {}, "path": "root/my_function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/my_function_c85c4e0e.js", "sourceCodeLanguage": "javascript", @@ -953,6 +958,7 @@ return class Handler { "attrs": {}, "path": "root/Function.0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function.0_c8d5fca2.js", "sourceCodeLanguage": "javascript", @@ -965,6 +971,7 @@ return class Handler { "attrs": {}, "path": "root/Function.1", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function.1_c89ed254.js", "sourceCodeLanguage": "javascript", @@ -977,6 +984,7 @@ return class Handler { "attrs": {}, "path": "root/Function.2", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function.2_c8cd6c39.js", "sourceCodeLanguage": "javascript", @@ -989,6 +997,7 @@ return class Handler { "attrs": {}, "path": "root/Function.3", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function.3_c8badafa.js", "sourceCodeLanguage": "javascript", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/immutable-capture.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/immutable-capture.test.ts.snap index 408a9c54001..b1194ddf286 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/immutable-capture.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/immutable-capture.test.ts.snap @@ -35,6 +35,7 @@ my_capture: ["hello","dude"] "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -190,6 +191,7 @@ my_array: [(new (require("[REDACTED]/wingsdk/src/std/duration.js").Duration)(600 "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -344,6 +346,7 @@ my_array: [new Map([["foo",1],["bar",2]]),new Map([["foo",3],["bar",4]])] "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -497,6 +500,7 @@ my_capture: false "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -652,6 +656,7 @@ my_capture: (new (require("[REDACTED]/wingsdk/src/std/duration.js").Duration)(72 "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -809,6 +814,7 @@ my_capture: new Map([["foo",123],["bar",456]]) "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -968,6 +974,7 @@ my_map: new Map([["foo",[1,2]],["bar",[3,4]]]) "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1124,6 +1131,7 @@ my_map: new Map([["foo",[(new (require("[REDACTED]/wingsdk/src/std/duration.js") "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1277,6 +1285,7 @@ my_capture: 123 "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1433,6 +1442,7 @@ my_capture: new Set(["boom","bam","bang"]) "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1588,6 +1598,7 @@ my_set: new Set([(new (require("[REDACTED]/wingsdk/src/std/duration.js").Duratio "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1742,6 +1753,7 @@ my_capture: "bam bam bam" "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -1898,6 +1910,7 @@ my_capture: {"hello": "dude","world": "cup","foo": "bar",} "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", @@ -2054,6 +2067,7 @@ my_struct: {"foo": new Map([["foo",1],["bar",2]]),"bar": new Map([["foo",3],["ba "attrs": {}, "path": "root/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c8e6b4af.js", "sourceCodeLanguage": "javascript", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/on-deploy.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/on-deploy.test.ts.snap index b8d62dd4b47..4398e5d3abf 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/on-deploy.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/on-deploy.test.ts.snap @@ -30,6 +30,7 @@ return class Handler { "attrs": {}, "path": "root/my_on_deploy/Function", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/function_c83fbf14.js", "sourceCodeLanguage": "javascript", @@ -40,6 +41,9 @@ return class Handler { { "addr": "c8e2618b976544550a8396a3817f0bad07099f7050", "attrs": {}, + "deps": [ + "root/my_on_deploy/Function", + ], "path": "root/my_on_deploy", "props": { "functionHandle": "\${wsim#root/my_on_deploy/Function#attrs.handle}", @@ -176,12 +180,12 @@ return class Handler { exports[`create an OnDeploy 2`] = ` [ - "@winglang/sdk.cloud.Function created.", + "root/my_on_deploy/Function started", "super duper success", "Invoke (payload=undefined).", "OnDeploy invoked.", - "@winglang/sdk.cloud.OnDeploy created.", - "@winglang/sdk.cloud.OnDeploy deleted.", - "@winglang/sdk.cloud.Function deleted.", + "root/my_on_deploy started", + "root/my_on_deploy stopped", + "root/my_on_deploy/Function stopped", ] `; diff --git a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap index 4daa24f9642..ceae7ab1536 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/queue.test.ts.snap @@ -584,9 +584,9 @@ async handle(message) { exports[`push rejects empty message 1`] = ` [ - "@winglang/sdk.cloud.Queue created.", + "root/my_queue started", "Push (messages=).", - "@winglang/sdk.cloud.Queue deleted.", + "root/my_queue stopped", ] `; @@ -723,13 +723,13 @@ exports[`push rejects empty message 2`] = ` exports[`queue batch size of 2, purge the queue 1`] = ` [ - "@winglang/sdk.cloud.Queue created.", + "root/my_queue started", "Push (messages=A).", "Push (messages=B).", "ApproxSize ().", "Purge ().", "ApproxSize ().", - "@winglang/sdk.cloud.Queue deleted.", + "root/my_queue stopped", ] `; @@ -944,6 +944,7 @@ async handle(message) { "attrs": {}, "path": "root/my_queue/SetConsumer0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/setconsumer0_c8e33b9b.js", "sourceCodeLanguage": "javascript", @@ -964,6 +965,10 @@ async handle(message) { { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "attrs": {}, + "deps": [ + "root/my_queue/SetConsumer0", + "root/my_queue", + ], "path": "root/my_queue/QueueEventMapping0", "props": { "publisher": "\${wsim#root/my_queue#attrs.handle}", @@ -977,8 +982,12 @@ async handle(message) { { "addr": "c8ab799f6c9c9a3cd279909012c4f322ab902f5e19", "attrs": {}, + "deps": [ + "root/my_queue", + ], "path": "root/my_queue_messages/Function", "props": { + "concurrency": 100, "environmentVariables": { "QUEUE_HANDLE_54fcf4cd": "\${wsim#root/my_queue#attrs.handle}", }, @@ -991,6 +1000,9 @@ async handle(message) { { "addr": "c8e2354407fd3536187725c2b37c5327f47bb841e9", "attrs": {}, + "deps": [ + "root/my_queue_messages/Function", + ], "path": "root/my_queue_messages", "props": { "functionHandle": "\${wsim#root/my_queue_messages/Function#attrs.handle}", @@ -1204,6 +1216,7 @@ async handle(message) { "attrs": {}, "path": "root/my_queue/SetConsumer0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/setconsumer0_c8e33b9b.js", "sourceCodeLanguage": "javascript", @@ -1224,6 +1237,10 @@ async handle(message) { { "addr": "c8f9f7d56097ba3d2e0e82988718175a5d841f855e", "attrs": {}, + "deps": [ + "root/my_queue/SetConsumer0", + "root/my_queue", + ], "path": "root/my_queue/QueueEventMapping0", "props": { "publisher": "\${wsim#root/my_queue#attrs.handle}", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/schedule.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/schedule.test.ts.snap index a4446eb2e41..00dcc05c893 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/schedule.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/schedule.test.ts.snap @@ -169,6 +169,7 @@ console.log("Hello from schedule!"); "attrs": {}, "path": "root/my_schedule/OnTick0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/ontick0_c83eddbe.js", "sourceCodeLanguage": "javascript", @@ -188,6 +189,10 @@ console.log("Hello from schedule!"); { "addr": "c863abe75f0d01961369ad52fd7212846989919eaf", "attrs": {}, + "deps": [ + "root/my_schedule/OnTick0", + "root/my_schedule", + ], "path": "root/my_schedule/OnTickMapping0", "props": { "publisher": "\${wsim#root/my_schedule#attrs.handle}", @@ -374,6 +379,7 @@ console.log("Hello from schedule!"); "attrs": {}, "path": "root/my_schedule/OnTick0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/ontick0_c83eddbe.js", "sourceCodeLanguage": "javascript", @@ -393,6 +399,10 @@ console.log("Hello from schedule!"); { "addr": "c863abe75f0d01961369ad52fd7212846989919eaf", "attrs": {}, + "deps": [ + "root/my_schedule/OnTick0", + "root/my_schedule", + ], "path": "root/my_schedule/OnTickMapping0", "props": { "publisher": "\${wsim#root/my_schedule#attrs.handle}", @@ -579,6 +589,7 @@ console.log("Hello from schedule!"); "attrs": {}, "path": "root/my_schedule/OnTick0", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/ontick0_c83eddbe.js", "sourceCodeLanguage": "javascript", @@ -598,6 +609,10 @@ console.log("Hello from schedule!"); { "addr": "c863abe75f0d01961369ad52fd7212846989919eaf", "attrs": {}, + "deps": [ + "root/my_schedule/OnTick0", + "root/my_schedule", + ], "path": "root/my_schedule/OnTickMapping0", "props": { "publisher": "\${wsim#root/my_schedule#attrs.handle}", diff --git a/libs/wingsdk/test/target-sim/__snapshots__/table.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/table.test.ts.snap index 1382d46638f..bd139bec879 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/table.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/table.test.ts.snap @@ -3,9 +3,9 @@ exports[`can add row in preflight 1`] = ` [ "Adding initial row (key=joe-id).", - "@winglang/sdk.ex.Table created.", + "root/my_table started", "get row joe-id from table my_addrow_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; @@ -289,11 +289,11 @@ exports[`create a table 1`] = ` exports[`get row 1`] = ` [ - "@winglang/sdk.ex.Table created.", + "root/my_table started", "insert row joe-id into the table my_get_table.", "get row joe-id from table my_get_table.", "get row NON_EXISTENT_KEY from table my_get_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; @@ -435,9 +435,9 @@ exports[`get row 2`] = ` exports[`insert row 1`] = ` [ - "@winglang/sdk.ex.Table created.", + "root/my_table started", "insert row joe-id into the table my_insert_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; @@ -579,11 +579,11 @@ exports[`insert row 2`] = ` exports[`list table 1`] = ` [ - "@winglang/sdk.ex.Table created.", + "root/my_table started", "insert row joe-id into the table my_list_table.", "insert row jane-id into the table my_list_table.", "list all rows from table my_list_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; @@ -725,10 +725,10 @@ exports[`list table 2`] = ` exports[`tryGet row 1`] = ` [ - "@winglang/sdk.ex.Table created.", + "root/my_table started", "insert row joe-id into the table my_get_table.", "get row joe-id from table my_get_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; @@ -870,13 +870,13 @@ exports[`tryGet row 2`] = ` exports[`update row 1`] = ` [ - "@winglang/sdk.ex.Table created.", + "root/my_table started", "insert row joe-id into the table my_update_table.", "get row joe-id from table my_update_table.", "get row joe-id from table my_update_table.", "update row joe-id in table my_update_table.", "get row joe-id from table my_update_table.", - "@winglang/sdk.ex.Table deleted.", + "root/my_table stopped", ] `; diff --git a/libs/wingsdk/test/target-sim/__snapshots__/test.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/test.test.ts.snap index fb53466eb88..5c40e12dd55 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/test.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/test.test.ts.snap @@ -33,6 +33,7 @@ async handle(event) { "attrs": {}, "path": "root/env0/test:my_test/Handler", "props": { + "concurrency": 100, "environmentVariables": {}, "sourceCodeFile": ".wing/handler_c86fc180.js", "sourceCodeLanguage": "javascript", @@ -43,6 +44,9 @@ async handle(event) { { "addr": "c8647dd8d2adabe83cc081ebe0ccbefe4a068ef3bf", "attrs": {}, + "deps": [ + "root/env0/test:my_test/Handler", + ], "path": "root/cloud.TestRunner", "props": { "tests": { diff --git a/libs/wingsdk/test/target-sim/__snapshots__/topic-producer.test.ts.snap b/libs/wingsdk/test/target-sim/__snapshots__/topic-producer.test.ts.snap index b57726cd755..22c43627674 100644 --- a/libs/wingsdk/test/target-sim/__snapshots__/topic-producer.test.ts.snap +++ b/libs/wingsdk/test/target-sim/__snapshots__/topic-producer.test.ts.snap @@ -2,17 +2,17 @@ exports[`publishing messages to topic 1`] = ` [ - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.cloud.Topic created.", - "@winglang/sdk.sim.EventMapping created.", - "@winglang/sdk.cloud.Function created.", + "root/TopicTester/MyTopic/OnMessage0 started", + "root/TopicTester/MyTopic started", + "root/TopicTester/MyTopic/TopicEventMapping0 started", + "root/TopicTester/Function started", "Publish (message=ABC).", "Sending message (message=ABC, subscriber=sim-0).", "InvokeAsync (payload="ABC").", "Invoke (payload="ABC").", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.sim.EventMapping deleted.", - "@winglang/sdk.cloud.Topic deleted.", - "@winglang/sdk.cloud.Function deleted.", + "root/TopicTester/MyTopic/TopicEventMapping0 stopped", + "root/TopicTester/MyTopic/OnMessage0 stopped", + "root/TopicTester/Function stopped", + "root/TopicTester/MyTopic stopped", ] `; diff --git a/libs/wingsdk/test/target-sim/bucket.test.ts b/libs/wingsdk/test/target-sim/bucket.test.ts index 7030edb668b..e4df95f647d 100644 --- a/libs/wingsdk/test/target-sim/bucket.test.ts +++ b/libs/wingsdk/test/target-sim/bucket.test.ts @@ -43,17 +43,17 @@ test("update an object in bucket", async () => { const s = await app.startSimulator(); const client = s.getResource("/my_bucket") as cloud.IBucketClient; - - const KEY = "greeting.txt"; - const VALUE = JSON.stringify({ msg: "Hello world!" }); + const KEY = "1.txt"; // WHEN - await client.put(KEY, VALUE); - await client.put(KEY, JSON.stringify({ msg: "another msg" })); + await client.put(KEY, JSON.stringify({ msg: "Hello world 1!" })); + await waitUntilTraceCount(s, 4, (trace) => trace.data.message.includes(KEY)); + await client.put(KEY, JSON.stringify({ msg: "Hello world 2!" })); + await waitUntilTraceCount(s, 5, (trace) => trace.data.message.includes(KEY)); // THEN - await s.stop(); expect(listMessages(s)).toMatchSnapshot(); + await s.stop(); }); test("bucket on event creates 3 topics, and sends the right event and key in the event handlers", async () => { diff --git a/libs/wingsdk/test/target-sim/dynamodb-table.test.ts b/libs/wingsdk/test/target-sim/dynamodb-table.test.ts index 1d8f9095865..6060462b52d 100644 --- a/libs/wingsdk/test/target-sim/dynamodb-table.test.ts +++ b/libs/wingsdk/test/target-sim/dynamodb-table.test.ts @@ -13,6 +13,10 @@ test("create a table", async () => { }); const s = await app.startSimulator(); + + const endpoint = await s.getResource("/create_table").endpoint(); + expect(endpoint.startsWith("http://0.0.0.0:")).toBeTruthy(); + expect(s.getResourceConfig("/create_table")).toEqual({ attrs: { handle: expect.any(String), diff --git a/libs/wingsdk/test/target-sim/function.test.ts b/libs/wingsdk/test/target-sim/function.test.ts index b32ac6a9e2e..a140e353e37 100644 --- a/libs/wingsdk/test/target-sim/function.test.ts +++ b/libs/wingsdk/test/target-sim/function.test.ts @@ -49,6 +49,7 @@ test("create a function", async () => { environmentVariables: { ENV_VAR1: "true", }, + concurrency: 100, timeout: 60000, }, type: cloud.FUNCTION_FQN, diff --git a/libs/wingsdk/test/target-sim/on-deploy.test.ts b/libs/wingsdk/test/target-sim/on-deploy.test.ts index 93618b3d69f..1aa9077b3fe 100644 --- a/libs/wingsdk/test/target-sim/on-deploy.test.ts +++ b/libs/wingsdk/test/target-sim/on-deploy.test.ts @@ -18,6 +18,7 @@ test("create an OnDeploy", async () => { attrs: { handle: expect.any(String), }, + deps: ["root/my_on_deploy/Function"], path: "root/my_on_deploy", addr: expect.any(String), props: { diff --git a/libs/wingsdk/test/target-sim/queue.test.ts b/libs/wingsdk/test/target-sim/queue.test.ts index 2e3c9afcea0..8941c55c0bc 100644 --- a/libs/wingsdk/test/target-sim/queue.test.ts +++ b/libs/wingsdk/test/target-sim/queue.test.ts @@ -24,7 +24,6 @@ test("create a queue", async () => { const s = await app.startSimulator(); // THEN - await s.stop(); expect(s.getResourceConfig("/my_queue")).toEqual({ attrs: { handle: expect.any(String), @@ -38,6 +37,8 @@ test("create a queue", async () => { type: cloud.QUEUE_FQN, }); + await s.stop(); + expect(app.snapshot()).toMatchSnapshot(); }); diff --git a/libs/wingsdk/test/target-sim/react-app.test.ts b/libs/wingsdk/test/target-sim/react-app.test.ts index 17940aaa53b..174c3f94f51 100644 --- a/libs/wingsdk/test/target-sim/react-app.test.ts +++ b/libs/wingsdk/test/target-sim/react-app.test.ts @@ -21,12 +21,17 @@ function getWebsiteUrl(s: Simulator, path: string): string { return apiAttrs.url; } -function expectFirstArgToBe(fn: SpyInstance, firstArg: any) { +function expectExecToBe(fn: SpyInstance, cmd: any, port?: number) { const lastCall = fn.mock.lastCall; if (!lastCall) { throw new Error("function wasn't called"); } - expect(lastCall[0]).toBe(firstArg); + + expect(lastCall[0]).toBe(cmd); + + if (port) { + expect(lastCall[1].env.PORT === `${port}`); + } } describe("Testing ReactApp", () => { @@ -86,7 +91,7 @@ describe("Testing ReactApp", () => { ).toEqual(`// This file is generated by wing window.wingEnv = {};`); - expectFirstArgToBe(execMock, "npm run build"); + expectExecToBe(execMock, "npm run build"); }); test("adding an env var to the website ", async () => { @@ -127,7 +132,7 @@ window.wingEnv = { "key": "value" };`); - expectFirstArgToBe(execMock, "npm run build"); + expectExecToBe(execMock, "npm run build"); }); test("running React App on dev mode", async () => { @@ -143,7 +148,7 @@ window.wingEnv = { // THEN await s.stop(); - expectFirstArgToBe(execMock, "PORT=3001 npm run start"); + expectExecToBe(execMock, "npm run start", 3001); }); test("running React App on dev mode on custom port", async () => { @@ -161,7 +166,7 @@ window.wingEnv = { // THEN await s.stop(); - expectFirstArgToBe(execMock, "PORT=4032 npm run start"); + expectExecToBe(execMock, "npm run start", 4032); }); test("running React App on dev mode with custom command", async () => { @@ -180,7 +185,7 @@ window.wingEnv = { // THEN await s.stop(); - expectFirstArgToBe(execMock, `PORT=3001 ${CUSTOM_COMMAND}`); + expectExecToBe(execMock, CUSTOM_COMMAND, 3001); }); test("running React App with custom command", async () => { @@ -219,7 +224,7 @@ window.wingEnv = { ).toEqual(`// This file is generated by wing window.wingEnv = {};`); - expectFirstArgToBe(execMock, CUSTOM_COMMAND); + expectExecToBe(execMock, CUSTOM_COMMAND); }); test("custom error page", async () => { diff --git a/libs/wingsdk/test/target-sim/schedule.test.ts b/libs/wingsdk/test/target-sim/schedule.test.ts index 1706f985287..1a6624e4d0f 100644 --- a/libs/wingsdk/test/target-sim/schedule.test.ts +++ b/libs/wingsdk/test/target-sim/schedule.test.ts @@ -64,7 +64,6 @@ test("schedule with one task using rate of 10m", async () => { const s = await app.startSimulator(); // THEN - await s.stop(); expect(app.snapshot()).toMatchSnapshot(); expect(s.getResourceConfig("/my_schedule")).toEqual({ attrs: { @@ -77,6 +76,8 @@ test("schedule with one task using rate of 10m", async () => { }, type: cloud.SCHEDULE_FQN, }); + + await s.stop(); }); test("schedule with one task using rate of 3h", async () => { @@ -91,7 +92,6 @@ test("schedule with one task using rate of 3h", async () => { const s = await app.startSimulator(); // THEN - await s.stop(); expect(app.snapshot()).toMatchSnapshot(); expect(s.getResourceConfig("/my_schedule")).toEqual({ attrs: { @@ -104,4 +104,6 @@ test("schedule with one task using rate of 3h", async () => { }, type: cloud.SCHEDULE_FQN, }); + + await s.stop(); }); diff --git a/libs/wingsdk/test/target-sim/service.test.ts b/libs/wingsdk/test/target-sim/service.test.ts index ebc5d999cf1..b783cc91e63 100644 --- a/libs/wingsdk/test/target-sim/service.test.ts +++ b/libs/wingsdk/test/target-sim/service.test.ts @@ -52,7 +52,6 @@ test("create a service with a on stop method", async () => { // WHEN const s = await app.startSimulator(); - await s.stop(); // THEN expect(s.getResourceConfig("/my_service")).toEqual({ @@ -69,6 +68,8 @@ test("create a service with a on stop method", async () => { type: cloud.SERVICE_FQN, }); + await s.stop(); + expect( s .listTraces() @@ -76,9 +77,9 @@ test("create a service with a on stop method", async () => { .map((trace) => trace.data.message) ).toEqual([ "start!", - "@winglang/sdk.cloud.Service created.", + "root/my_service started", "stop!", - "@winglang/sdk.cloud.Service deleted.", + "root/my_service stopped", ]); }); @@ -94,7 +95,6 @@ test("create a service without autostart", async () => { // WHEN const s = await app.startSimulator(); - await s.stop(); // THEN expect(s.getResourceConfig("/my_service")).toEqual({ @@ -111,15 +111,14 @@ test("create a service without autostart", async () => { type: cloud.SERVICE_FQN, }); + await s.stop(); + expect( s .listTraces() .filter((v) => v.sourceType == cloud.SERVICE_FQN) .map((trace) => trace.data.message) - ).toEqual([ - "@winglang/sdk.cloud.Service created.", // Service created never started - "@winglang/sdk.cloud.Service deleted.", - ]); + ).toEqual(["root/my_service started", "root/my_service stopped"]); }); test("start and stop service", async () => { @@ -149,13 +148,7 @@ test("start and stop service", async () => { .listTraces() .filter((v) => v.sourceType == cloud.SERVICE_FQN) .map((trace) => trace.data.message) - ).toEqual([ - "@winglang/sdk.cloud.Service created.", - "start!", - "stop!", - "start!", - "stop!", - ]); + ).toEqual(["root/my_service started", "start!", "stop!", "start!", "stop!"]); }); test("consecutive start and stop service", async () => { @@ -186,7 +179,7 @@ test("consecutive start and stop service", async () => { .listTraces() .filter((v) => v.sourceType == cloud.SERVICE_FQN) .map((trace) => trace.data.message) - ).toEqual(["@winglang/sdk.cloud.Service created.", "start!", "stop!"]); + ).toEqual(["root/my_service started", "start!", "stop!"]); }); test("throws during service start", async () => { diff --git a/libs/wingsdk/test/target-sim/test.test.ts b/libs/wingsdk/test/target-sim/test.test.ts index a157fdb7702..a91aeabc56b 100644 --- a/libs/wingsdk/test/target-sim/test.test.ts +++ b/libs/wingsdk/test/target-sim/test.test.ts @@ -35,6 +35,7 @@ test("create a test", async () => { sourceCodeFile: expect.any(String), sourceCodeLanguage: "javascript", timeout: 60000, + concurrency: 100, }, type: "@winglang/sdk.cloud.Function", }); diff --git a/libs/wingsdk/test/target-tf-aws/__snapshots__/domain.test.ts.snap b/libs/wingsdk/test/target-tf-aws/__snapshots__/domain.test.ts.snap index c7295a164ef..b2b3851ba09 100644 --- a/libs/wingsdk/test/target-tf-aws/__snapshots__/domain.test.ts.snap +++ b/libs/wingsdk/test/target-tf-aws/__snapshots__/domain.test.ts.snap @@ -261,7 +261,6 @@ exports[`cloud.Domain for tf-aws > react website with a domain when passing valu }, "display": { "description": "Website root/Default/Website/Website-host", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -628,7 +627,6 @@ exports[`cloud.Domain for tf-aws > react website with a domain when passing valu }, "display": { "description": "Website root/Default/Website/Website-host", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -988,7 +986,6 @@ exports[`cloud.Domain for tf-aws > website with a domain when passing values fro }, "display": { "description": "Website root/Default/Website", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -1344,7 +1341,6 @@ exports[`cloud.Domain for tf-aws > website with a domain when passing values on }, "display": { "description": "Website root/Default/Website", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", diff --git a/libs/wingsdk/test/target-tf-aws/__snapshots__/react-app.test.ts.snap b/libs/wingsdk/test/target-tf-aws/__snapshots__/react-app.test.ts.snap index 8479d8161ee..8f417ece5e8 100644 --- a/libs/wingsdk/test/target-tf-aws/__snapshots__/react-app.test.ts.snap +++ b/libs/wingsdk/test/target-tf-aws/__snapshots__/react-app.test.ts.snap @@ -379,7 +379,6 @@ exports[`Testing ReactApp > default React App behavior 2`] = ` }, "display": { "description": "Website root/Default/Website/Website-host", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -703,7 +702,6 @@ exports[`Testing ReactApp > website with addEnvironment 2`] = ` }, "display": { "description": "Website root/Default/Website/Website-host", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", diff --git a/libs/wingsdk/test/target-tf-aws/__snapshots__/website.test.ts.snap b/libs/wingsdk/test/target-tf-aws/__snapshots__/website.test.ts.snap index b3161b78a50..9a4ebd1a710 100644 --- a/libs/wingsdk/test/target-tf-aws/__snapshots__/website.test.ts.snap +++ b/libs/wingsdk/test/target-tf-aws/__snapshots__/website.test.ts.snap @@ -382,7 +382,6 @@ exports[`default website behavior 2`] = ` }, "display": { "description": "Website root/Default/Website", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -702,7 +701,6 @@ exports[`website with addFile 2`] = ` }, "display": { "description": "Website root/Default/Website", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", @@ -1030,7 +1028,6 @@ exports[`website with addJson 2`] = ` }, "display": { "description": "Website root/Default/Website", - "hidden": true, "title": "Endpoint", }, "id": "Endpoint", diff --git a/libs/wingsdk/test/target-tf-gcp/__snapshots__/function.test.ts.snap b/libs/wingsdk/test/target-tf-gcp/__snapshots__/function.test.ts.snap index 8051357d2a5..ba50a9f991e 100644 --- a/libs/wingsdk/test/target-tf-gcp/__snapshots__/function.test.ts.snap +++ b/libs/wingsdk/test/target-tf-gcp/__snapshots__/function.test.ts.snap @@ -9,6 +9,7 @@ exports[`basic function 1`] = ` "description": "This function was created by Wing", "entry_point": "handler", "environment_variables": {}, + "https_trigger_security_level": "SECURE_ALWAYS", "name": "function-c852aba6", "project": "my-project", "region": "us-central1", @@ -249,6 +250,7 @@ exports[`basic function with environment variables 1`] = ` "BOOM": "BAM", "FOO": "BAR", }, + "https_trigger_security_level": "SECURE_ALWAYS", "name": "function-c852aba6", "project": "my-project", "region": "us-central1", @@ -488,6 +490,7 @@ exports[`basic function with memory size specified 1`] = ` "description": "This function was created by Wing", "entry_point": "handler", "environment_variables": {}, + "https_trigger_security_level": "SECURE_ALWAYS", "name": "function-c852aba6", "project": "my-project", "region": "us-central1", @@ -727,6 +730,7 @@ exports[`basic function with timeout explicitly set 1`] = ` "description": "This function was created by Wing", "entry_point": "handler", "environment_variables": {}, + "https_trigger_security_level": "SECURE_ALWAYS", "name": "function-c852aba6", "project": "my-project", "region": "us-central1", diff --git a/libs/wingsdk/test/ui/__snapshots__/ui.test.ts.snap b/libs/wingsdk/test/ui/__snapshots__/ui.test.ts.snap index a1a081d4675..013056fac0d 100644 --- a/libs/wingsdk/test/ui/__snapshots__/ui.test.ts.snap +++ b/libs/wingsdk/test/ui/__snapshots__/ui.test.ts.snap @@ -2,11 +2,11 @@ exports[`can obtain ui components 1`] = ` [ - "@winglang/sdk.cloud.Function created.", - "@winglang/sdk.cloud.Function created.", + "root/MyClass/Button/Handler started", + "root/MyClass/Field/Handler started", "Invoke (payload="").", "Invoke (payload="").", - "@winglang/sdk.cloud.Function deleted.", - "@winglang/sdk.cloud.Function deleted.", + "root/MyClass/Button/Handler stopped", + "root/MyClass/Field/Handler stopped", ] `; diff --git a/libs/wingsdk/tsconfig.test.json b/libs/wingsdk/tsconfig.test.json index 05fe632f7db..5fdf27ffedf 100644 --- a/libs/wingsdk/tsconfig.test.json +++ b/libs/wingsdk/tsconfig.test.json @@ -1,27 +1,12 @@ { + "extends": "./tsconfig.dev.json", "compilerOptions": { - "alwaysStrict": true, - "declaration": true, - "esModuleInterop": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "inlineSources": true, - "lib": ["es2019", "dom"], - "module": "CommonJS", - "noEmitOnError": false, - "noFallthroughCasesInSwitch": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "resolveJsonModule": true, - "strict": true, - "strictNullChecks": true, - "strictPropertyInitialization": true, - "stripInternal": true, - "target": "ES2019" + "declaration": false, + "inlineSources": false, + "noEmitOnError": true, + "skipLibCheck": true, + "isolatedModules": true, }, - "include": ["src/**/*.ts", "src/**/*.on*.inflight.ts"], - "exclude": ["node_modules"] + "include": ["src/**/*.ts"], + "exclude": ["src/.gen/**"] } diff --git a/libs/wingsdk/turbo.json b/libs/wingsdk/turbo.json index 37483e4e0b2..5f913a33066 100644 --- a/libs/wingsdk/turbo.json +++ b/libs/wingsdk/turbo.json @@ -7,7 +7,7 @@ "outputs": ["src/.gen/**"] }, "compile": { - "dependsOn": ["pre-compile"], + "dependsOn": ["^compile", "pre-compile"], "outputs": ["lib/**", ".jsii"] }, "post-compile": { diff --git a/libs/wingtunnels/.gitignore b/libs/wingtunnels/.gitignore new file mode 100644 index 00000000000..c3af857904e --- /dev/null +++ b/libs/wingtunnels/.gitignore @@ -0,0 +1 @@ +lib/ diff --git a/libs/wingtunnels/.prettierrc.json b/libs/wingtunnels/.prettierrc.json new file mode 100644 index 00000000000..84c85a38828 --- /dev/null +++ b/libs/wingtunnels/.prettierrc.json @@ -0,0 +1,3 @@ +{ + "overrides": [] +} diff --git a/libs/wingtunnels/package.json b/libs/wingtunnels/package.json new file mode 100644 index 00000000000..89120970437 --- /dev/null +++ b/libs/wingtunnels/package.json @@ -0,0 +1,47 @@ +{ + "name": "@winglang/wingtunnels", + "version": "0.0.0", + "author": { + "name": "Wing Cloud", + "email": "ping@wing.cloud", + "organization": true + }, + "repository": { + "type": "git", + "url": "https://github.com/winglang/wing.git", + "directory": "libs/wingtunnels" + }, + "description": "Tunnels Library for Wing", + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org", + "tag": "latest" + }, + "main": "lib/index.js", + "types": "lib/index.d.ts", + "license": "MIT", + "dependencies": { + "@types/debug": "^4.1.9", + "@types/node": "^20.11.19", + "@types/ws": "^8.5.7", + "debug": "^4.3.4", + "ws": "^8.14.2" + }, + "devDependencies": { + "bump-pack": "workspace:^", + "typescript": "^5.3.3", + "tsup": "^6.7.0", + "vitest": "^0.34.6" + }, + "scripts": { + "compile": "tsup", + "package": "bump-pack -b", + "test": "vitest run --update" + }, + "files": [ + "lib" + ], + "volta": { + "extends": "../../package.json" + } +} diff --git a/libs/wingtunnels/src/events.ts b/libs/wingtunnels/src/events.ts new file mode 100644 index 00000000000..110e1486def --- /dev/null +++ b/libs/wingtunnels/src/events.ts @@ -0,0 +1,8 @@ +import { EventEmitter } from "node:events"; + +export const eventHandler = new EventEmitter(); + +export enum Events { + UrlAssigned = "URL_ASSIGNED", + SubdomainInUse = "SUBDOMAIN_IN_USE", +} diff --git a/libs/wingtunnels/src/forward-request.ts b/libs/wingtunnels/src/forward-request.ts new file mode 100644 index 00000000000..37836f5d114 --- /dev/null +++ b/libs/wingtunnels/src/forward-request.ts @@ -0,0 +1,105 @@ +import { type WebSocket } from "ws"; +import { request, RequestOptions, IncomingMessage } from "http"; +import { request as httpsRequest } from "https"; +import { ForwardRequestMessage } from "./messages.js"; +import { forwardResponse } from "./forward-response.js"; +import debug from "debug"; +import { format, parse } from "url"; +const log = debug("wing:tunnels"); + +export interface ForwardRequestMessageProps { + ws: WebSocket; + port: number; + message: ForwardRequestMessage; + hostname?: string; +} + +export default async function forwardRequest({ message, ws, port, hostname }: ForwardRequestMessageProps) { + const { requestId, path, headers, method, body } = message; + + let requestBody : Buffer | undefined = undefined; + if (body) { + requestBody = Buffer.from(body, "base64"); + headers["Content-length"] = requestBody.length.toString(); + } + + let hs = hostname; + let p = path; + let h = headers; + let requestFn = request; + + // For testing + if (hs?.includes("https://")) { + hs = hs.replace("https://", ""); + requestFn = httpsRequest; + + if (hs?.includes("/")) { + const parts = hs.split("/"); + hs = parts[0]; + p = "/" + parts.slice(1).join("/") + if (path !== "/") { + p = p + path; + } + } + + delete h["Via"]; + delete h["Host"] + } + + const url = parse(format({ + protocol: "http", + hostname: hs ?? "localhost", + pathname: p, + query: message.query, + }), true); + + const requestOptions : RequestOptions = { + hostname: url.hostname, + method, + port, + path: url.path, + headers: h, + }; + + log("request", requestOptions, body); + + const req = requestFn(requestOptions, (response : IncomingMessage) => { + log("response status", response.statusCode); + let responseBody : Buffer; + response.on('data', (chunk: Buffer) => { + if (typeof responseBody === 'undefined') { + responseBody = chunk; + } else { + responseBody = Buffer.concat([responseBody, chunk]); + } + }); + + response.on("error", (err) => { + log("response error", err.message); + }); + + response.on('end', () => { + log("response", response.statusCode, response.headers, responseBody); + forwardResponse({ ws, message: { + action: "FORWARD_RESPONSE", + requestId, + status: response.statusCode, + path, + method, + headers: response.headers, + body: Buffer.isBuffer(responseBody) ? responseBody.toString('base64') : undefined + }}); + }) + }); + + if (requestBody && body) { + req.write(requestBody); + log("request body write", requestBody) + } + + req.on('error', (error : any) => { + log("request error", error); + }); + + req.end(); +} \ No newline at end of file diff --git a/libs/wingtunnels/src/forward-response.ts b/libs/wingtunnels/src/forward-response.ts new file mode 100644 index 00000000000..8e4cb2c6926 --- /dev/null +++ b/libs/wingtunnels/src/forward-response.ts @@ -0,0 +1,11 @@ +import { type WebSocket } from "ws"; +import { ForwardResponseMessage } from "./messages.js"; + +export interface ForwardRequestMessageProps { + ws: WebSocket; + message: ForwardResponseMessage; +} + +export const forwardResponse = ({ws, message}: ForwardRequestMessageProps) => { + ws.send(JSON.stringify(message)); +} diff --git a/libs/wingtunnels/src/index.ts b/libs/wingtunnels/src/index.ts new file mode 100644 index 00000000000..72f4fef5f81 --- /dev/null +++ b/libs/wingtunnels/src/index.ts @@ -0,0 +1,55 @@ +import { WebSocket } from "ws"; +import { initialize } from "./initialize.js"; +import { eventHandler, Events } from "./events.js"; +import { onMessage } from "./onmessage.js"; +import { ErrorMessage, InitializedMessage } from "./messages.js"; + +const WING_CLOUD_URL = "wss://4lc628cb78.execute-api.us-east-1.amazonaws.com/prod"; + +export interface ConnectProps { + subdomain?: string; +} + +export interface ConnectResponse { + url: string; + subdomain: string; + close: () => void; +} + +export const connect = (targetUrl: string, props?: ConnectProps): Promise => { + return new Promise((resolve, reject) => { + try { + const url = new URL(targetUrl); + const ws = new WebSocket(process.env["WING_TUNNELS_URL"] ?? WING_CLOUD_URL); + if (ws.readyState === 1) { + initialize({ ws, subdomain: props?.subdomain }); + } else { + ws.on("open", () => { + initialize({ ws, subdomain: props?.subdomain }); + }); + } + + ws.on("message", (data) => { + const onMessageImpl = onMessage({ ws, port: parseInt(url.port), hostname: url.hostname }); + onMessageImpl(data); + }); + + ws.on("error", (error) => { + reject(error); + }); + + eventHandler.on(Events.UrlAssigned, ({ url, subdomain }: InitializedMessage) => { + resolve({ url, subdomain, close: () => { + ws.close(); + } }); + }); + + eventHandler.on(Events.SubdomainInUse, ({ message }: ErrorMessage) => { + ws.close(); + reject(message); + }); + } catch (error) { + reject(error); + } + }) +}; diff --git a/libs/wingtunnels/src/initialize.ts b/libs/wingtunnels/src/initialize.ts new file mode 100644 index 00000000000..d68d087e4d3 --- /dev/null +++ b/libs/wingtunnels/src/initialize.ts @@ -0,0 +1,16 @@ +import { type WebSocket } from "ws"; +import { InitializeMessage } from "./messages.js"; + +export interface InitializeProps { + subdomain: string | undefined; + ws: WebSocket; +} + +export const initialize = ({ ws, subdomain }: InitializeProps) => { + const message: InitializeMessage = { + action: "INITIALIZE", + subdomain + } + + ws.send(JSON.stringify(message)); +} diff --git a/libs/wingtunnels/src/messages.ts b/libs/wingtunnels/src/messages.ts new file mode 100644 index 00000000000..20150e88cc2 --- /dev/null +++ b/libs/wingtunnels/src/messages.ts @@ -0,0 +1,39 @@ +export type Action = "INITIALIZE" | "INITIALIZED" | "FORWARD_REQUEST" | "FORWARD_RESPONSE" | "ERROR"; +export type ErrorType = "SUBDOMAIN_IN_USE"; + +export interface InitializeMessage { + action: "INITIALIZE"; + subdomain: string | undefined; +} + +export interface InitializedMessage { + action: "INITIALIZED"; + subdomain: string; + url: string; +} + +export interface ForwardRequestMessage { + action: "FORWARD_REQUEST"; + requestId: string; + path: string; + method: string; + headers: Record; + query: Record; + body: string | undefined; +} + +export interface ForwardResponseMessage { + action: "FORWARD_RESPONSE"; + requestId: string; + status: number | undefined; + path: string; + method: string; + headers: Record; + body: string | undefined; +} + +export interface ErrorMessage { + action: "ERROR"; + type: ErrorType; + message: string; +} diff --git a/libs/wingtunnels/src/onmessage.ts b/libs/wingtunnels/src/onmessage.ts new file mode 100644 index 00000000000..680413f4d94 --- /dev/null +++ b/libs/wingtunnels/src/onmessage.ts @@ -0,0 +1,37 @@ +import { type WebSocket, type RawData } from "ws"; +import { Action, ForwardRequestMessage, InitializedMessage, ErrorMessage } from "./messages.js"; +import { Events, eventHandler } from "./events.js"; +import forwardRequest from "./forward-request.js"; + +export interface OnMessageProps { + ws: WebSocket; + port: number; + hostname?: string; +} + +export const onMessage = ({ ws, port, hostname }: OnMessageProps) => { + return (data: RawData) => { + const raw = data.toString("utf8"); + try { + const json = JSON.parse(raw); + const action: Action = json.action; + if (action === "INITIALIZED") { + const msg = json as InitializedMessage; + eventHandler.emit(Events.UrlAssigned, msg); + } else if (action === "FORWARD_REQUEST") { + const msg = json as ForwardRequestMessage; + forwardRequest({ message: msg, ws, port, hostname }); + } else if (action === "ERROR") { + const msg = json as ErrorMessage; + if (msg.type === "SUBDOMAIN_IN_USE") { + eventHandler.emit(Events.SubdomainInUse, msg); + } else { + console.error("onMessage error", msg.message); + ws.close(); + } + } + } catch (err: any) { + console.error("onMessage failure", raw, err.toString()); + } + } +} diff --git a/libs/wingtunnels/test/tunnels.test.ts b/libs/wingtunnels/test/tunnels.test.ts new file mode 100644 index 00000000000..d0512e46fcc --- /dev/null +++ b/libs/wingtunnels/test/tunnels.test.ts @@ -0,0 +1,59 @@ +import { test, describe, expect } from "vitest"; +import { WebSocketServer, WebSocket } from "ws"; +import { connect } from "../src/index.js"; +import * as http from "http"; + +describe("wing tunnels", async () => { + test("will forward a message", async () => { + process.env["WING_TUNNELS_URL"] = "ws://localhost:4567"; + const wss = new WebSocketServer({ port: 4567 }); + let _ws: WebSocket | undefined = undefined; + const messages = new Promise((resolve) => { + wss.on("connection", (ws) => { + _ws = ws; + ws.on("message", (message) => { + const data = JSON.parse(message.toString("utf8")); + if (data.action === "INITIALIZE") { + expect(data).toStrictEqual({"action":"INITIALIZE"}); + ws.send(JSON.stringify({ + url: "https://example.com", + subdomain: "example", + action: "INITIALIZED" + })); + } else if (data.action === "FORWARD_RESPONSE") { + expect(data.requestId).toBe("123"); + expect(data.status).toBe(200); + resolve(true); + } else { + throw "Invalid action" + } + }); + }); + }); + + const server = http.createServer(function (req, res) { + if (req.method == "GET") { + res.writeHead(200, {"Content-Type": "text/plain"}); + res.end("OK"); + } + }).listen(4568); + + const res = await connect("http://localhost:4568"); + expect(res.url).toBe("https://example.com"); + + if (_ws !== undefined) { + const ws = _ws as WebSocket; + ws.send(JSON.stringify({ + action: "FORWARD_REQUEST", + requestId: "123", + path: "/", + method: "GET", + })); + } + + await messages; + + wss.close(); + server.close(); + }); +}); \ No newline at end of file diff --git a/libs/wingtunnels/tsconfig.json b/libs/wingtunnels/tsconfig.json new file mode 100644 index 00000000000..0761c4952df --- /dev/null +++ b/libs/wingtunnels/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "ES2020", + "module": "commonjs", + "strict": true, + }, + "include": [ + "src/**/*.ts", + "test/**/*.ts", + ], + "exclude": [] +} diff --git a/libs/wingtunnels/tsup.config.ts b/libs/wingtunnels/tsup.config.ts new file mode 100644 index 00000000000..2c2adf316ca --- /dev/null +++ b/libs/wingtunnels/tsup.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from "tsup"; + +export default defineConfig({ + entry: ["src/index.ts"], + bundle: true, + dts: true, + format: "cjs", + outDir: "lib", +}); diff --git a/libs/wingtunnels/turbo.json b/libs/wingtunnels/turbo.json new file mode 100644 index 00000000000..4ed944778fc --- /dev/null +++ b/libs/wingtunnels/turbo.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://turborepo.org/schema.json", + "extends": ["//"], + "pipeline": { + "compile": { + "outputs": ["lib/**"] + }, + "test": { + "dependsOn": ["compile"] + }, + "package": { + "dependsOn": ["compile"], + "outputs": ["../../dist/winglang-wingtunnels-*.tgz"] + } + } +} diff --git a/package.json b/package.json index d5d70b8853b..0fa9014adf1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "bump-pack": "workspace:^", "generate-workspace": "workspace:^", "@winglang/compatibility-spy": "workspace:^", - "turbo": "^1.12.4" + "turbo": "^1.12.5" }, "scripts": { "build": "turbo compile post-compile lint eslint test package", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 31a1cf4a417..b7489dcae87 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,8 +35,8 @@ importers: specifier: workspace:^ version: link:tools/generate-workspace turbo: - specifier: ^1.12.4 - version: 1.12.4 + specifier: ^1.12.5 + version: 1.12.5 apps/jsii-docgen: dependencies: @@ -1317,6 +1317,9 @@ importers: '@types/aws-lambda': specifier: ^8.10.119 version: 8.10.124 + '@winglang/wingtunnels': + specifier: workspace:^ + version: link:../wingtunnels ajv: specifier: ^8.12.0 version: 8.12.0 @@ -1476,6 +1479,37 @@ importers: specifier: workspace:^ version: link:../../apps/wing-api-checker + libs/wingtunnels: + dependencies: + '@types/debug': + specifier: ^4.1.9 + version: 4.1.12 + '@types/node': + specifier: ^20.11.19 + version: 20.11.20 + '@types/ws': + specifier: ^8.5.7 + version: 8.5.10 + debug: + specifier: ^4.3.4 + version: 4.3.4 + ws: + specifier: ^8.14.2 + version: 8.14.2 + devDependencies: + bump-pack: + specifier: workspace:^ + version: link:../../tools/bump-pack + tsup: + specifier: ^6.7.0 + version: 6.7.0(typescript@5.3.3) + typescript: + specifier: ^5.3.3 + version: 5.3.3 + vitest: + specifier: ^0.34.6 + version: 0.34.6(happy-dom@9.20.3) + tools/bump-pack: dependencies: '@actions/core': @@ -5619,6 +5653,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-arm64@0.17.19: + resolution: {integrity: sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -5645,6 +5688,15 @@ packages: dev: true optional: true + /@esbuild/android-arm@0.17.19: + resolution: {integrity: sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm@0.18.20: resolution: {integrity: sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw==} engines: {node: '>=12'} @@ -5662,6 +5714,15 @@ packages: requiresBuild: true optional: true + /@esbuild/android-x64@0.17.19: + resolution: {integrity: sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.18.20: resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} engines: {node: '>=12'} @@ -5679,6 +5740,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-arm64@0.17.19: + resolution: {integrity: sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.18.20: resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} engines: {node: '>=12'} @@ -5696,6 +5766,15 @@ packages: requiresBuild: true optional: true + /@esbuild/darwin-x64@0.17.19: + resolution: {integrity: sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.18.20: resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} engines: {node: '>=12'} @@ -5713,6 +5792,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-arm64@0.17.19: + resolution: {integrity: sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.18.20: resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} engines: {node: '>=12'} @@ -5730,6 +5818,15 @@ packages: requiresBuild: true optional: true + /@esbuild/freebsd-x64@0.17.19: + resolution: {integrity: sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.18.20: resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} engines: {node: '>=12'} @@ -5747,6 +5844,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm64@0.17.19: + resolution: {integrity: sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.18.20: resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} engines: {node: '>=12'} @@ -5764,6 +5870,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-arm@0.17.19: + resolution: {integrity: sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.18.20: resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} engines: {node: '>=12'} @@ -5781,6 +5896,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ia32@0.17.19: + resolution: {integrity: sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.18.20: resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} engines: {node: '>=12'} @@ -5807,6 +5931,15 @@ packages: dev: true optional: true + /@esbuild/linux-loong64@0.17.19: + resolution: {integrity: sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-loong64@0.18.20: resolution: {integrity: sha512-nXW8nqBTrOpDLPgPY9uV+/1DjxoQ7DoB2N8eocyq8I9XuqJ7BiAMDMf9n1xZM9TgW0J8zrquIb/A7s3BJv7rjg==} engines: {node: '>=12'} @@ -5824,6 +5957,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-mips64el@0.17.19: + resolution: {integrity: sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.18.20: resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} engines: {node: '>=12'} @@ -5841,6 +5983,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-ppc64@0.17.19: + resolution: {integrity: sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.18.20: resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} engines: {node: '>=12'} @@ -5858,6 +6009,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-riscv64@0.17.19: + resolution: {integrity: sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.18.20: resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} engines: {node: '>=12'} @@ -5875,6 +6035,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-s390x@0.17.19: + resolution: {integrity: sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.18.20: resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} engines: {node: '>=12'} @@ -5892,6 +6061,15 @@ packages: requiresBuild: true optional: true + /@esbuild/linux-x64@0.17.19: + resolution: {integrity: sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.18.20: resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} engines: {node: '>=12'} @@ -5909,6 +6087,15 @@ packages: requiresBuild: true optional: true + /@esbuild/netbsd-x64@0.17.19: + resolution: {integrity: sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.18.20: resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} engines: {node: '>=12'} @@ -5926,6 +6113,15 @@ packages: requiresBuild: true optional: true + /@esbuild/openbsd-x64@0.17.19: + resolution: {integrity: sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.18.20: resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} engines: {node: '>=12'} @@ -5943,6 +6139,15 @@ packages: requiresBuild: true optional: true + /@esbuild/sunos-x64@0.17.19: + resolution: {integrity: sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.18.20: resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} engines: {node: '>=12'} @@ -5960,6 +6165,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-arm64@0.17.19: + resolution: {integrity: sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.18.20: resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} engines: {node: '>=12'} @@ -5977,6 +6191,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-ia32@0.17.19: + resolution: {integrity: sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.18.20: resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} engines: {node: '>=12'} @@ -5994,6 +6217,15 @@ packages: requiresBuild: true optional: true + /@esbuild/win32-x64@0.17.19: + resolution: {integrity: sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.18.20: resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} engines: {node: '>=12'} @@ -6184,7 +6416,7 @@ packages: engines: {node: ^8.13.0 || >=10.10.0} dependencies: '@grpc/proto-loader': 0.7.10 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: false /@grpc/proto-loader@0.7.10: @@ -6293,7 +6525,7 @@ packages: dependencies: '@inquirer/type': 1.1.5 '@types/mute-stream': 0.0.1 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 chalk: 4.1.2 @@ -6313,7 +6545,7 @@ packages: dependencies: '@inquirer/type': 1.1.5 '@types/mute-stream': 0.0.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 chalk: 4.1.2 @@ -6491,7 +6723,7 @@ packages: dependencies: '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/yargs': 16.0.6 chalk: 4.1.2 dev: true @@ -6503,7 +6735,7 @@ packages: '@jest/schemas': 28.1.3 '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/yargs': 17.0.28 chalk: 4.1.2 dev: true @@ -6515,7 +6747,7 @@ packages: '@jest/schemas': 29.6.3 '@types/istanbul-lib-coverage': 2.0.4 '@types/istanbul-reports': 3.0.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/yargs': 17.0.28 chalk: 4.1.2 dev: true @@ -10463,7 +10695,7 @@ packages: resolution: {integrity: sha512-oyl4jvAfTGX9Bt6Or4H9ni1Z447/tQuxnZsytsCaExKlmJiU8sFgnIBRzJUpKwB5eWn9HuBYlUlVA74q/yN0eQ==} dependencies: '@types/connect': 3.4.36 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/btoa-lite@1.0.0: @@ -10473,7 +10705,7 @@ packages: /@types/cacache@17.0.0: resolution: {integrity: sha512-4BfoYFzkHdmINTyUIX9MSbKUkntVPR082FRnNc+5KlvvebrcxWWhfP3MRQ28QgfFncP3fTKCuemDYJqFjmWEAA==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/caseless@0.12.4: @@ -10493,7 +10725,7 @@ packages: /@types/connect@3.4.36: resolution: {integrity: sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/cors@2.8.14: @@ -10505,7 +10737,7 @@ packages: /@types/cross-spawn@6.0.3: resolution: {integrity: sha512-BDAkU7WHHRHnvBf5z89lcvACsvkz/n7Tv+HyD/uW76O29HoH1Tk/W6iQrepaZVbisvlEek4ygwT8IW7ow9XLAA==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/cross-spawn@6.0.6: @@ -10592,7 +10824,7 @@ packages: /@types/express-serve-static-core@4.17.37: resolution: {integrity: sha512-ZohaCYTgGFcOP7u6aJOhY9uIZQgZ2vxC2yWoArY+FeDXlqeH66ZVBjgvg+RLVAS/DWNq4Ap9ZXu1+SUQiiWYMg==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/qs': 6.9.8 '@types/range-parser': 1.2.5 '@types/send': 0.17.2 @@ -10621,7 +10853,7 @@ packages: /@types/fs-extra@8.1.4: resolution: {integrity: sha512-OMcQKnlrkrOI0TaZ/MgVDA8LYFl7CykzFsjMj9l5x3un2nFxCY20ZFlnqrM0lcqlbs0Yro2HbnZlmopyRaoJ5w==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/fs-extra@9.0.13: @@ -10634,20 +10866,20 @@ packages: resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/glob@8.1.0: resolution: {integrity: sha512-IO+MJPVhoqz+28h1qLAcBEH2+xHMK6MTyHJc7MTnnYb6wsoLR29POVGJ7LycmVXIqyy/4/2ShP5sUwTXuOwb/w==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: false /@types/graceful-fs@4.1.7: resolution: {integrity: sha512-MhzcwU8aUygZroVwL2jeYk6JisJrPl/oov/gsgGCue9mkgl9wjGbzReYQClxiUgFDnib9FuHqTndccKeZKxTRw==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/hast@3.0.3: @@ -10663,7 +10895,7 @@ packages: /@types/ignore-walk@4.0.1: resolution: {integrity: sha512-jve9GxuPfapQBNbsmLB4yTUV/uT16xJTxgnlcEWKcA9D5i1uMqokpyq7eKjrTH0zb1sBx1SAY3xRXSbxqj0fAg==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/inquirer@9.0.7: @@ -10709,13 +10941,13 @@ packages: /@types/jsonfile@6.1.2: resolution: {integrity: sha512-8t92P+oeW4d/CRQfJaSqEwXujrhH4OEeHRjGU3v1Q8mUS8GPF3yiX26sw4svv6faL2HfBtGTe2xWIoVgN3dy9w==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/jsonwebtoken@9.0.3: resolution: {integrity: sha512-b0jGiOgHtZ2jqdPgPnP6WLCXZk1T8p06A/vPGzUvxpFGgKMbjXJDjC5m52ErqBnIuWZFgGoIJyRdeG5AyreJjA==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/lodash.debounce@4.0.7: @@ -10790,13 +11022,13 @@ packages: /@types/mute-stream@0.0.1: resolution: {integrity: sha512-0yQLzYhCqGz7CQPE3iDmYjhb7KMBFOP+tBkyw+/Y2YyDI5wpS7itXXxneN1zSsUwWx3Ji6YiVYrhAnpQGS/vkw==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/mute-stream@0.0.2: resolution: {integrity: sha512-FpiGjk6+IOrN0lZEfUUjdra1csU1VxwYFj4S0Zj+TJpu5x5mZW30RkEZojTadrNZHNmpCHgoE62IQZAH0OeuIA==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/node-fetch@2.6.6: @@ -10826,6 +11058,11 @@ packages: dependencies: undici-types: 5.26.5 + /@types/node@20.11.20: + resolution: {integrity: sha512-7/rR21OS+fq8IyHTgtLkDK949uzsa6n8BkziAKtPVpugIkO6D+/ooXMvzXxDnZrmtXVfjb1bKQafYpb8s89LOg==} + dependencies: + undici-types: 5.26.5 + /@types/normalize-package-data@2.4.2: resolution: {integrity: sha512-lqa4UEhhv/2sjjIQgjX8B+RBjj47eo0mzGasklVJ78UKGQY1r0VpB9XHDaZZO9qzEFDdy4MrXLuEaSmPrPSe/A==} @@ -10843,7 +11080,7 @@ packages: /@types/npm-registry-fetch@8.0.5: resolution: {integrity: sha512-mAyQmKTF/4dhXTeSicltEtMO+Vj/LEUoBkMgDn9tS2fGp8IsrZPkYv2GH0KKBcbFLXUq67wuzYwl0DCZGeRcpw==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/node-fetch': 2.6.6 '@types/npm-package-arg': 6.1.2 '@types/npmlog': 4.1.4 @@ -10870,7 +11107,7 @@ packages: /@types/pacote@11.1.6: resolution: {integrity: sha512-Uh0+ivCS2p+pMFZmU1u20sGi7O8BJnBOCuNXsBaAMD/6/NIcbI/CcnBUNpTeVhOuFmOwn9/z8BxprpPhL+UkVg==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/npm-registry-fetch': 8.0.5 '@types/npmlog': 4.1.4 '@types/ssri': 7.1.2 @@ -10912,7 +11149,7 @@ packages: resolution: {integrity: sha512-HuihY1+Vss5RS9ZHzRyTGIzwPTdrJBkCm/mAeLRYrOQu/MGqyezKXWOK1VhCnR+SDbp9G2mRUP+OVEqCrzpcfA==} dependencies: '@types/caseless': 0.12.4 - '@types/node': 20.11.0 + '@types/node': 20.11.20 '@types/tough-cookie': 4.0.4 form-data: 2.5.1 dev: false @@ -10931,7 +11168,7 @@ packages: resolution: {integrity: sha512-aAG6yRf6r0wQ29bkS+x97BIs64ZLxeE/ARwyS6wrldMm3C1MdKwCcnnEwMC1slI8wuxJOpiUH9MioC0A0i+GJw==} dependencies: '@types/mime': 1.3.3 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/serve-static@1.15.3: @@ -10939,7 +11176,7 @@ packages: dependencies: '@types/http-errors': 2.0.2 '@types/mime': 3.0.2 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/sinon@10.0.19: @@ -10955,7 +11192,7 @@ packages: /@types/ssri@7.1.2: resolution: {integrity: sha512-Mbo/NaBiZlXNlOFTLK+PXeVEzKFxi+ZVELuzmk4VxdRz6aqKpmP9bhcNqsIB2c/s78355WBHwUCGYhQDydcfEg==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 /@types/stack-utils@2.0.1: resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==} @@ -10971,7 +11208,7 @@ packages: /@types/through@0.0.33: resolution: {integrity: sha512-HsJ+z3QuETzP3cswwtzt2vEIiHBk/dCcHGhbmG5X3ecnwFD/lPrMpliGXxSCg03L9AhrdwA4Oz/qfspkDW+xGQ==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /@types/tough-cookie@4.0.4: @@ -10987,7 +11224,7 @@ packages: /@types/tunnel@0.0.3: resolution: {integrity: sha512-sOUTGn6h1SfQ+gbgqC364jLFBw2lnFqkgF3q0WovEHRLMrVD1sd5aufqi/aJObLekJO+Aq5z646U4Oxy6shXMA==} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: false /@types/unist@2.0.10: @@ -11018,6 +11255,12 @@ packages: resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==} dev: true + /@types/ws@8.5.10: + resolution: {integrity: sha512-vmQSUcfalpIq0R9q7uTo2lXs6eGIpt9wtnLdMv9LVpIjCA/+ufZRozlVoVelIYixx1ugCBKDhn89vnsEGOCx9A==} + dependencies: + '@types/node': 20.11.20 + dev: false + /@types/ws@8.5.6: resolution: {integrity: sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg==} dependencies: @@ -11044,7 +11287,7 @@ packages: resolution: {integrity: sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==} requiresBuild: true dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true optional: true @@ -12834,6 +13077,16 @@ packages: run-applescript: 5.0.0 dev: false + /bundle-require@4.0.2(esbuild@0.17.19): + resolution: {integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.17.19 + load-tsconfig: 0.2.5 + dev: true + /bundle-require@4.0.2(esbuild@0.19.12): resolution: {integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -14020,6 +14273,7 @@ packages: /decompress-response@6.0.0: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} engines: {node: '>=10'} + requiresBuild: true dependencies: mimic-response: 3.1.0 dev: true @@ -14358,7 +14612,7 @@ packages: dependencies: semver: 7.5.4 shelljs: 0.8.5 - typescript: 5.5.0-dev.20240305 + typescript: 5.5.0-dev.20240311 dev: true /dset@3.1.2: @@ -14850,6 +15104,36 @@ packages: esbuild-windows-arm64: 0.15.18 dev: true + /esbuild@0.17.19: + resolution: {integrity: sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/android-arm': 0.17.19 + '@esbuild/android-arm64': 0.17.19 + '@esbuild/android-x64': 0.17.19 + '@esbuild/darwin-arm64': 0.17.19 + '@esbuild/darwin-x64': 0.17.19 + '@esbuild/freebsd-arm64': 0.17.19 + '@esbuild/freebsd-x64': 0.17.19 + '@esbuild/linux-arm': 0.17.19 + '@esbuild/linux-arm64': 0.17.19 + '@esbuild/linux-ia32': 0.17.19 + '@esbuild/linux-loong64': 0.17.19 + '@esbuild/linux-mips64el': 0.17.19 + '@esbuild/linux-ppc64': 0.17.19 + '@esbuild/linux-riscv64': 0.17.19 + '@esbuild/linux-s390x': 0.17.19 + '@esbuild/linux-x64': 0.17.19 + '@esbuild/netbsd-x64': 0.17.19 + '@esbuild/openbsd-x64': 0.17.19 + '@esbuild/sunos-x64': 0.17.19 + '@esbuild/win32-arm64': 0.17.19 + '@esbuild/win32-ia32': 0.17.19 + '@esbuild/win32-x64': 0.17.19 + dev: true + /esbuild@0.18.20: resolution: {integrity: sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==} engines: {node: '>=12'} @@ -15997,6 +16281,7 @@ packages: /fs-constants@1.0.0: resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==} + requiresBuild: true dev: true /fs-extra@10.1.0: @@ -17503,7 +17788,7 @@ packages: dependencies: '@jest/types': 29.6.3 '@types/graceful-fs': 4.1.7 - '@types/node': 20.11.0 + '@types/node': 20.11.20 anymatch: 3.1.3 fb-watchman: 2.0.2 graceful-fs: 4.2.11 @@ -17546,7 +17831,7 @@ packages: engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} dependencies: '@jest/types': 27.5.1 - '@types/node': 20.11.0 + '@types/node': 20.11.20 dev: true /jest-regex-util@29.6.3: @@ -17559,7 +17844,7 @@ packages: engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0} dependencies: '@jest/types': 28.1.3 - '@types/node': 20.11.0 + '@types/node': 20.11.20 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -17571,7 +17856,7 @@ packages: engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: '@jest/types': 29.6.3 - '@types/node': 20.11.0 + '@types/node': 20.11.20 chalk: 4.1.2 ci-info: 3.9.0 graceful-fs: 4.2.11 @@ -17582,7 +17867,7 @@ packages: resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} engines: {node: '>= 10.13.0'} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 merge-stream: 2.0.0 supports-color: 8.1.1 dev: true @@ -17591,7 +17876,7 @@ packages: resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} dependencies: - '@types/node': 20.11.0 + '@types/node': 20.11.20 jest-util: 29.7.0 merge-stream: 2.0.0 supports-color: 8.1.1 @@ -18915,6 +19200,7 @@ packages: /mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} engines: {node: '>=10'} + requiresBuild: true dev: true /min-indent@1.0.1: @@ -19035,6 +19321,7 @@ packages: /mkdirp-classic@0.5.3: resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==} + requiresBuild: true dev: true /mkdirp@0.5.6: @@ -20207,6 +20494,22 @@ packages: camelcase-css: 2.0.1 postcss: 8.4.31 + /postcss-load-config@3.1.4: + resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} + engines: {node: '>= 10'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 2.1.0 + yaml: 1.10.2 + dev: true + /postcss-load-config@4.0.1(postcss@8.4.31): resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} engines: {node: '>= 14'} @@ -20621,6 +20924,7 @@ packages: /rc@1.2.8: resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} hasBin: true + requiresBuild: true dependencies: deep-extend: 0.6.0 ini: 1.3.8 @@ -22585,6 +22889,42 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} + /tsup@6.7.0(typescript@5.3.3): + resolution: {integrity: sha512-L3o8hGkaHnu5TdJns+mCqFsDBo83bJ44rlK7e6VdanIvpea4ArPcU3swWGsLVbXak1PqQx/V+SSmFPujBK+zEQ==} + engines: {node: '>=14.18'} + hasBin: true + peerDependencies: + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.1.0' + peerDependenciesMeta: + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 4.0.2(esbuild@0.17.19) + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4 + esbuild: 0.17.19 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 3.1.4 + resolve-from: 5.0.0 + rollup: 3.29.4 + source-map: 0.8.0-beta.0 + sucrase: 3.34.0 + tree-kill: 1.2.2 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + /tsup@8.0.2(postcss@8.4.31)(typescript@5.2.2): resolution: {integrity: sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==} engines: {node: '>=18'} @@ -22754,64 +23094,64 @@ packages: resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} - /turbo-darwin-64@1.12.4: - resolution: {integrity: sha512-dBwFxhp9isTa9RS/fz2gDVk5wWhKQsPQMozYhjM7TT4jTrnYn0ZJMzr7V3B/M/T8QF65TbniW7w1gtgxQgX5Zg==} + /turbo-darwin-64@1.12.5: + resolution: {integrity: sha512-0GZ8reftwNQgIQLHkHjHEXTc/Z1NJm+YjsrBP+qhM/7yIZ3TEy9gJhuogDt2U0xIWwFgisTyzbtU7xNaQydtoA==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.12.4: - resolution: {integrity: sha512-1Uo5iI6xsJ1j9ObsqxYRsa3W26mEbUe6fnj4rQYV6kDaqYD54oAMJ6hM53q9rB8JvFxwdrUXGp3PwTw9A0qqkA==} + /turbo-darwin-arm64@1.12.5: + resolution: {integrity: sha512-8WpOLNNzvH6kohQOjihD+gaWL+ZFNfjvBwhOF0rjEzvW+YR3Pa7KjhulrjWyeN2yMFqAPubTbZIGOz1EVXLuQA==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.12.4: - resolution: {integrity: sha512-ONg2aSqKP7LAQOg7ysmU5WpEQp4DGNxSlAiR7um+LKtbmC/UxogbR5+T+Uuq6zGuQ5kJyKjWJ4NhtvUswOqBsA==} + /turbo-linux-64@1.12.5: + resolution: {integrity: sha512-INit73+bNUpwqGZCxgXCR3I+cQsdkQ3/LkfkgSOibkpg+oGqxJRzeXw3sp990d7SCoE8QOcs3iw+PtiFX/LDAA==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.12.4: - resolution: {integrity: sha512-9FPufkwdgfIKg/9jj87Cdtftw8o36y27/S2vLN7FTR2pp9c0MQiTBOLVYadUr1FlShupddmaMbTkXEhyt9SdrA==} + /turbo-linux-arm64@1.12.5: + resolution: {integrity: sha512-6lkRBvxtI/GQdGtaAec9LvVQUoRw6nXFp0kM+Eu+5PbZqq7yn6cMkgDJLI08zdeui36yXhone8XGI8pHg8bpUQ==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.12.4: - resolution: {integrity: sha512-2mOtxHW5Vjh/5rDVu/aFwsMzI+chs8XcEuJHlY1sYOpEymYTz+u6AXbnzRvwZFMrLKr7J7fQOGl+v96sLKbNdA==} + /turbo-windows-64@1.12.5: + resolution: {integrity: sha512-gQYbOhZg5Ww0bQ/bC0w/4W6yQRwBumUUnkB+QPo15VznwxZe2a7bo6JM+9Xy9dKLa/kn+p7zTqme4OEp6M3/Yg==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.12.4: - resolution: {integrity: sha512-nOY5wae9qnxPOpT1fRuYO0ks6dTwpKMPV6++VkDkamFDLFHUDVM/9kmD2UTeh1yyrKnrZksbb9zmShhmfj1wog==} + /turbo-windows-arm64@1.12.5: + resolution: {integrity: sha512-auvhZ9FrhnvQ4mgBlY9O68MT4dIfprYGvd2uPICba/mHUZZvVy5SGgbHJ0KbMwaJfnnFoPgLJO6M+3N2gDprKw==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.12.4: - resolution: {integrity: sha512-yUJ7elEUSToiGwFZogXpYKJpQ0BvaMbkEuQECIWtkBLcmWzlMOt6bActsIm29oN83mRU0WbzGt4e8H1KHWedhg==} + /turbo@1.12.5: + resolution: {integrity: sha512-FATU5EnhrYG8RvQJYFJnDd18DpccDjyvd53hggw9T9JEg9BhWtIEoeaKtBjYbpXwOVrJQMDdXcIB4f2nD3QPPg==} hasBin: true optionalDependencies: - turbo-darwin-64: 1.12.4 - turbo-darwin-arm64: 1.12.4 - turbo-linux-64: 1.12.4 - turbo-linux-arm64: 1.12.4 - turbo-windows-64: 1.12.4 - turbo-windows-arm64: 1.12.4 + turbo-darwin-64: 1.12.5 + turbo-darwin-arm64: 1.12.5 + turbo-linux-64: 1.12.5 + turbo-linux-arm64: 1.12.5 + turbo-windows-64: 1.12.5 + turbo-windows-arm64: 1.12.5 dev: true /type-check@0.4.0: @@ -22933,8 +23273,8 @@ packages: engines: {node: '>=14.17'} hasBin: true - /typescript@5.5.0-dev.20240305: - resolution: {integrity: sha512-ERkltjdukpttYHdXPg6cQAeuQrK1BIZ/QnNXLljBx5r90B+8lZ7pZ1qCL/XHHsUEi0lkVLpf9LPfwEYxie3qcA==} + /typescript@5.5.0-dev.20240311: + resolution: {integrity: sha512-Cdp0eYgn/19lkcrq7WCqQxmnvCqvuJrd/jGhm1HyPMSYVTGzjxVP0NfXr2A4YVS12IAipt1uO4zgAJeLlYG2JA==} engines: {node: '>=14.17'} hasBin: true dev: true @@ -23940,7 +24280,6 @@ packages: optional: true utf-8-validate: optional: true - dev: true /xml-js@1.6.11: resolution: {integrity: sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==} @@ -23998,6 +24337,11 @@ packages: /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} + /yaml@1.10.2: + resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} + engines: {node: '>= 6'} + dev: true + /yaml@2.3.2: resolution: {integrity: sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==} engines: {node: '>= 14'} diff --git a/tools/hangar/__snapshots__/compatibility-spy.ts.snap b/tools/hangar/__snapshots__/compatibility-spy.ts.snap index b99592ddb2b..2911cd80b36 100644 --- a/tools/hangar/__snapshots__/compatibility-spy.ts.snap +++ b/tools/hangar/__snapshots__/compatibility-spy.ts.snap @@ -636,7 +636,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env1/cloud.Counter", + "sourcePath": "root/env1/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -647,7 +647,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env1/cloud.Counter", + "sourcePath": "root/env1/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -658,7 +658,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env1/cloud.Counter", + "sourcePath": "root/env1/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -669,7 +669,7 @@ exports[`peek.test.w 1`] = ` "result": "1", "status": "success", }, - "sourcePath": "root/env1/cloud.Counter", + "sourcePath": "root/env1/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -707,7 +707,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env0/cloud.Counter", + "sourcePath": "root/env0/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -718,7 +718,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env0/cloud.Counter", + "sourcePath": "root/env0/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -729,7 +729,7 @@ exports[`peek.test.w 1`] = ` "result": "0", "status": "success", }, - "sourcePath": "root/env0/cloud.Counter", + "sourcePath": "root/env0/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", @@ -740,7 +740,7 @@ exports[`peek.test.w 1`] = ` "result": "1", "status": "success", }, - "sourcePath": "root/env0/cloud.Counter", + "sourcePath": "root/env0/Counter", "sourceType": "@winglang/sdk.cloud.Counter", "timestamp": "", "type": "resource", diff --git a/tools/hangar/__snapshots__/error.ts.snap b/tools/hangar/__snapshots__/error.ts.snap index 8ffaed3182b..795a29e9153 100644 --- a/tools/hangar/__snapshots__/error.ts.snap +++ b/tools/hangar/__snapshots__/error.ts.snap @@ -98,7 +98,7 @@ Duration " `; exports[`repeat_construct_id.test.w 1`] = ` -"Error: There is already a Construct with name 'cloud.Bucket' in $Root [env0] +"Error: There is already a Construct with name 'Bucket' in $Root [env0] hint: Every preflight object needs a unique identifier within its scope. You can assign one as shown: diff --git a/tools/hangar/__snapshots__/invalid.ts.snap b/tools/hangar/__snapshots__/invalid.ts.snap index 9987d3e7177..70aa1aaa646 100644 --- a/tools/hangar/__snapshots__/invalid.ts.snap +++ b/tools/hangar/__snapshots__/invalid.ts.snap @@ -3591,6 +3591,32 @@ exports[`std_containers.test.w 1`] = ` +Tests 1 failed (1) +Test Files 1 failed (1) +Duration " +`; + +exports[`stringify.test.w 1`] = ` +"error: Expected type to be stringable, but got \\"B\\" instead + --> ../../../examples/tests/invalid/stringify.test.w:3:13 + | +3 | log(\\"hello {b}\\"); + | ^ Expected type to be stringable, but got \\"B\\" instead + | + = hint: str, num, bool, json, and enums are stringable + + +error: Expected type to be stringable, but got \\"str?\\" instead + --> ../../../examples/tests/invalid/stringify.test.w:7:7 + | +7 | log(\\"{x}\\"); + | ^ Expected type to be stringable, but got \\"str?\\" instead + | + = hint: str? is an optional, try unwrapping it with 'x ?? \\"nil\\"' or 'x!' + + + + Tests 1 failed (1) Test Files 1 failed (1) Duration " @@ -4057,7 +4083,7 @@ Duration " `; exports[`unresolved_state.test.w 1`] = ` -"Could not start resource root/env0/cloud.Function after 10 attempts. This could be due to a dependency cycle or an invalid attribute reference. +"Could not start resource after 10 attempts: Unable to resolve attribute 'my_unresolved_token' for resource: root/env0/State Tests 1 failed (1) @@ -4113,6 +4139,15 @@ exports[`void_in_expression_position.test.w 1`] = ` | ^^^ Property not found +error: Expected type to be stringable, but got \\"void\\" instead + --> ../../../examples/tests/invalid/void_in_expression_position.test.w:4:22 + | +4 | let x = \\"my name is {log(\\"mister cloud\\")}\\"; + | ^^^^^^^^^^^^^^^^^^^ Expected type to be stringable, but got \\"void\\" instead + | + = hint: str, num, bool, json, and enums are stringable + + error: Binary operator '+' cannot be applied to operands of type 'num' and 'void'; only (num, num) and (str, str) are supported --> ../../../examples/tests/invalid/void_in_expression_position.test.w:7:9 | diff --git a/tools/hangar/__snapshots__/platform.ts.snap b/tools/hangar/__snapshots__/platform.ts.snap index c8d4307b81d..61e7c5e154e 100644 --- a/tools/hangar/__snapshots__/platform.ts.snap +++ b/tools/hangar/__snapshots__/platform.ts.snap @@ -17,71 +17,71 @@ exports[`Multiple platforms > only first platform app is used 1`] = ` }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -89,21 +89,21 @@ exports[`Multiple platforms > only first platform app is used 1`] = ` ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -111,32 +111,32 @@ exports[`Multiple platforms > only first platform app is used 1`] = ` }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -145,15 +145,15 @@ exports[`Multiple platforms > only first platform app is used 1`] = ` }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, @@ -178,23 +178,23 @@ exports[`Platform examples > AWS target platform > permission-boundary.js 1`] = }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", @@ -202,48 +202,48 @@ exports[`Platform examples > AWS target platform > permission-boundary.js 1`] = }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -251,21 +251,21 @@ exports[`Platform examples > AWS target platform > permission-boundary.js 1`] = ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -273,32 +273,32 @@ exports[`Platform examples > AWS target platform > permission-boundary.js 1`] = }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -307,15 +307,15 @@ exports[`Platform examples > AWS target platform > permission-boundary.js 1`] = }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, @@ -340,18 +340,28 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_policy": { + "Bucket_ReplicaDefaultPolicy_5311A90C": { + "//": { + "metadata": { + "path": "root/Default/Default/Bucket/ReplicaDefaultPolicy", + "uniqueId": "Bucket_ReplicaDefaultPolicy_5311A90C", + }, + }, + "name": "some-prefix\${aws_s3_bucket.Bucket.bucket}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"s3:GetReplicationConfiguration\\",\\"s3:ListBucket\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"]},{\\"Action\\":[\\"s3:GetObjectVersionForReplication\\",\\"s3:GetObjectVersionAcl\\",\\"s3:GetObjectVersionTagging\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.Bucket.arn}/*\\"},{\\"Action\\":[\\"s3:ReplicateObject\\",\\"s3:ReplicateDelete\\",\\"s3:ReplicateTags\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.Bucket_ReplicaDefault_F9F29351.arn}/*\\"}]}", + }, "ReplicaCodePolicy": { "//": { "metadata": { @@ -362,18 +372,21 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` "name": "some-prefix\${aws_s3_bucket.Code.bucket}", "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"s3:GetReplicationConfiguration\\",\\"s3:ListBucket\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":[\\"\${aws_s3_bucket.Code.arn}\\",\\"\${aws_s3_bucket.Code.arn}/*\\"]},{\\"Action\\":[\\"s3:GetObjectVersionForReplication\\",\\"s3:GetObjectVersionAcl\\",\\"s3:GetObjectVersionTagging\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.Code.arn}/*\\"},{\\"Action\\":[\\"s3:ReplicateObject\\",\\"s3:ReplicateDelete\\",\\"s3:ReplicateTags\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.ReplicaCode.arn}/*\\"}]}", }, - "cloudBucket_ReplicaDefaultPolicy_8B2539A7": { + }, + "aws_iam_policy_attachment": { + "Bucket_ReplicaDefaultPolicyAttachment_710AD30F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefaultPolicy", - "uniqueId": "cloudBucket_ReplicaDefaultPolicy_8B2539A7", + "path": "root/Default/Default/Bucket/ReplicaDefaultPolicyAttachment", + "uniqueId": "Bucket_ReplicaDefaultPolicyAttachment_710AD30F", }, }, - "name": "some-prefix\${aws_s3_bucket.cloudBucket.bucket}", - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"s3:GetReplicationConfiguration\\",\\"s3:ListBucket\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"]},{\\"Action\\":[\\"s3:GetObjectVersionForReplication\\",\\"s3:GetObjectVersionAcl\\",\\"s3:GetObjectVersionTagging\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"},{\\"Action\\":[\\"s3:ReplicateObject\\",\\"s3:ReplicateDelete\\",\\"s3:ReplicateTags\\"],\\"Effect\\":\\"Allow\\",\\"Resource\\":\\"\${aws_s3_bucket.cloudBucket_ReplicaDefault_870F5CB9.arn}/*\\"}]}", + "name": "some-prefixpolicy-attachment\${aws_s3_bucket.Bucket.bucket}", + "policy_arn": "\${aws_iam_policy.Bucket_ReplicaDefaultPolicy_5311A90C.arn}", + "roles": [ + "\${aws_iam_role.Bucket_ReplicaDefaultRole_B700A568.name}", + ], }, - }, - "aws_iam_policy_attachment": { "ReplicaCodePolicyAttachment": { "//": { "metadata": { @@ -387,94 +400,81 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` "\${aws_iam_role.ReplicaCodeRole.name}", ], }, - "cloudBucket_ReplicaDefaultPolicyAttachment_7A65C0F4": { - "//": { - "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefaultPolicyAttachment", - "uniqueId": "cloudBucket_ReplicaDefaultPolicyAttachment_7A65C0F4", - }, - }, - "name": "some-prefixpolicy-attachment\${aws_s3_bucket.cloudBucket.bucket}", - "policy_arn": "\${aws_iam_policy.cloudBucket_ReplicaDefaultPolicy_8B2539A7.arn}", - "roles": [ - "\${aws_iam_role.cloudBucket_ReplicaDefaultRole_8996C4FA.name}", - ], - }, }, "aws_iam_role": { - "ReplicaCodeRole": { + "Bucket_ReplicaDefaultRole_B700A568": { "//": { "metadata": { - "path": "root/Default/ReplicaCodeRole", - "uniqueId": "ReplicaCodeRole", + "path": "root/Default/Default/Bucket/ReplicaDefaultRole", + "uniqueId": "Bucket_ReplicaDefaultRole_B700A568", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"s3.amazonaws.com\\"},\\"Effect\\":\\"Allow\\",\\"Sid\\":\\"AllowS3Replication\\"}]}", - "name": "some-prefix\${aws_s3_bucket.Code.bucket}", + "name": "some-prefix\${aws_s3_bucket.Bucket.bucket}", }, - "cloudBucket_ReplicaDefaultRole_8996C4FA": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefaultRole", - "uniqueId": "cloudBucket_ReplicaDefaultRole_8996C4FA", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, - "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"s3.amazonaws.com\\"},\\"Effect\\":\\"Allow\\",\\"Sid\\":\\"AllowS3Replication\\"}]}", - "name": "some-prefix\${aws_s3_bucket.cloudBucket.bucket}", + "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", }, - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "ReplicaCodeRole": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/ReplicaCodeRole", + "uniqueId": "ReplicaCodeRole", }, }, - "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", + "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"s3.amazonaws.com\\"},\\"Effect\\":\\"Allow\\",\\"Sid\\":\\"AllowS3Replication\\"}]}", + "name": "some-prefix\${aws_s3_bucket.Code.bucket}", }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -482,21 +482,21 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -504,150 +504,150 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "ReplicaCode": { + "Bucket_ReplicaDefault_F9F29351": { "//": { "metadata": { - "path": "root/Default/ReplicaCode", - "uniqueId": "ReplicaCode", + "path": "root/Default/Default/Bucket/ReplicaDefault", + "uniqueId": "Bucket_ReplicaDefault_F9F29351", }, }, - "bucket": "some-prefix\${aws_s3_bucket.Code.bucket}", + "bucket": "some-prefix\${aws_s3_bucket.Bucket.bucket}", }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, - "cloudBucket_ReplicaDefault_870F5CB9": { + "ReplicaCode": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefault", - "uniqueId": "cloudBucket_ReplicaDefault_870F5CB9", + "path": "root/Default/ReplicaCode", + "uniqueId": "ReplicaCode", }, }, - "bucket": "some-prefix\${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "some-prefix\${aws_s3_bucket.Code.bucket}", }, }, "aws_s3_bucket_replication_configuration": { - "ReplicaCodeConfig": { + "Bucket_ReplicaDefaultConfig_A63C952B": { "//": { "metadata": { - "path": "root/Default/ReplicaCodeConfig", - "uniqueId": "ReplicaCodeConfig", + "path": "root/Default/Default/Bucket/ReplicaDefaultConfig", + "uniqueId": "Bucket_ReplicaDefaultConfig_A63C952B", }, }, - "bucket": "\${aws_s3_bucket.Code.id}", + "bucket": "\${aws_s3_bucket.Bucket.id}", "depends_on": [ - "aws_s3_bucket_versioning.ReplicaCodeVersioning", - "aws_s3_bucket_versioning.SourceCodeVersioning", + "aws_s3_bucket_versioning.Bucket_ReplicaDefaultVersioning_38F52DB1", + "aws_s3_bucket_versioning.Bucket_SourceDefaultVersioning_07CBDA44", ], - "role": "\${aws_iam_role.ReplicaCodeRole.arn}", + "role": "\${aws_iam_role.Bucket_ReplicaDefaultRole_B700A568.arn}", "rule": [ { "destination": { - "bucket": "\${aws_s3_bucket.ReplicaCode.arn}", + "bucket": "\${aws_s3_bucket.Bucket_ReplicaDefault_F9F29351.arn}", "storage_class": "STANDARD", }, - "id": "some-prefix\${aws_s3_bucket.Code.bucket}", + "id": "some-prefix\${aws_s3_bucket.Bucket.bucket}", "status": "Enabled", }, ], }, - "cloudBucket_ReplicaDefaultConfig_B5F7C7E5": { + "ReplicaCodeConfig": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefaultConfig", - "uniqueId": "cloudBucket_ReplicaDefaultConfig_B5F7C7E5", + "path": "root/Default/ReplicaCodeConfig", + "uniqueId": "ReplicaCodeConfig", }, }, - "bucket": "\${aws_s3_bucket.cloudBucket.id}", + "bucket": "\${aws_s3_bucket.Code.id}", "depends_on": [ - "aws_s3_bucket_versioning.cloudBucket_ReplicaDefaultVersioning_1CE02442", - "aws_s3_bucket_versioning.cloudBucket_SourceDefaultVersioning_6A904B70", + "aws_s3_bucket_versioning.ReplicaCodeVersioning", + "aws_s3_bucket_versioning.SourceCodeVersioning", ], - "role": "\${aws_iam_role.cloudBucket_ReplicaDefaultRole_8996C4FA.arn}", + "role": "\${aws_iam_role.ReplicaCodeRole.arn}", "rule": [ { "destination": { - "bucket": "\${aws_s3_bucket.cloudBucket_ReplicaDefault_870F5CB9.arn}", + "bucket": "\${aws_s3_bucket.ReplicaCode.arn}", "storage_class": "STANDARD", }, - "id": "some-prefix\${aws_s3_bucket.cloudBucket.bucket}", + "id": "some-prefix\${aws_s3_bucket.Code.bucket}", "status": "Enabled", }, ], }, }, "aws_s3_bucket_versioning": { - "ReplicaCodeVersioning": { + "Bucket_ReplicaDefaultVersioning_38F52DB1": { "//": { "metadata": { - "path": "root/Default/ReplicaCodeVersioning", - "uniqueId": "ReplicaCodeVersioning", + "path": "root/Default/Default/Bucket/ReplicaDefaultVersioning", + "uniqueId": "Bucket_ReplicaDefaultVersioning_38F52DB1", }, }, - "bucket": "\${aws_s3_bucket.ReplicaCode.id}", + "bucket": "\${aws_s3_bucket.Bucket_ReplicaDefault_F9F29351.id}", "versioning_configuration": { "status": "Enabled", }, }, - "SourceCodeVersioning": { + "Bucket_SourceDefaultVersioning_07CBDA44": { "//": { "metadata": { - "path": "root/Default/SourceCodeVersioning", - "uniqueId": "SourceCodeVersioning", + "path": "root/Default/Default/Bucket/SourceDefaultVersioning", + "uniqueId": "Bucket_SourceDefaultVersioning_07CBDA44", }, }, - "bucket": "\${aws_s3_bucket.Code.id}", + "bucket": "\${aws_s3_bucket.Bucket.id}", "versioning_configuration": { "status": "Enabled", }, }, - "cloudBucket_ReplicaDefaultVersioning_1CE02442": { + "ReplicaCodeVersioning": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ReplicaDefaultVersioning", - "uniqueId": "cloudBucket_ReplicaDefaultVersioning_1CE02442", + "path": "root/Default/ReplicaCodeVersioning", + "uniqueId": "ReplicaCodeVersioning", }, }, - "bucket": "\${aws_s3_bucket.cloudBucket_ReplicaDefault_870F5CB9.id}", + "bucket": "\${aws_s3_bucket.ReplicaCode.id}", "versioning_configuration": { "status": "Enabled", }, }, - "cloudBucket_SourceDefaultVersioning_6A904B70": { + "SourceCodeVersioning": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/SourceDefaultVersioning", - "uniqueId": "cloudBucket_SourceDefaultVersioning_6A904B70", + "path": "root/Default/SourceCodeVersioning", + "uniqueId": "SourceCodeVersioning", }, }, - "bucket": "\${aws_s3_bucket.cloudBucket.id}", + "bucket": "\${aws_s3_bucket.Code.id}", "versioning_configuration": { "status": "Enabled", }, }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -656,15 +656,15 @@ exports[`Platform examples > AWS target platform > replicate-s3.js 1`] = ` }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, @@ -689,71 +689,71 @@ exports[`Platform examples > AWS target platform > tf-backend.js > azurerm backe }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -761,21 +761,21 @@ exports[`Platform examples > AWS target platform > tf-backend.js > azurerm backe ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -783,32 +783,32 @@ exports[`Platform examples > AWS target platform > tf-backend.js > azurerm backe }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -817,15 +817,15 @@ exports[`Platform examples > AWS target platform > tf-backend.js > azurerm backe }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, @@ -850,71 +850,71 @@ exports[`Platform examples > AWS target platform > tf-backend.js > gcp backend 1 }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -922,21 +922,21 @@ exports[`Platform examples > AWS target platform > tf-backend.js > gcp backend 1 ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -944,32 +944,32 @@ exports[`Platform examples > AWS target platform > tf-backend.js > gcp backend 1 }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -978,15 +978,15 @@ exports[`Platform examples > AWS target platform > tf-backend.js > gcp backend 1 }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, @@ -1011,71 +1011,71 @@ exports[`Platform examples > AWS target platform > tf-backend.js > s3 backend 1` }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419", + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C", }, }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30, }, }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138", + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED", }, }, "assume_role_policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":\\"sts:AssumeRole\\",\\"Principal\\":{\\"Service\\":\\"lambda.amazonaws.com\\"},\\"Effect\\":\\"Allow\\"}]}", }, }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB", }, }, - "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.cloudQueue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.cloudBucket.arn}\\",\\"\${aws_s3_bucket.cloudBucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "policy": "{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":[{\\"Action\\":[\\"sqs:ReceiveMessage\\",\\"sqs:ChangeMessageVisibility\\",\\"sqs:GetQueueUrl\\",\\"sqs:DeleteMessage\\",\\"sqs:GetQueueAttributes\\"],\\"Resource\\":[\\"\${aws_sqs_queue.Queue.arn}\\"],\\"Effect\\":\\"Allow\\"},{\\"Action\\":[\\"s3:PutObject*\\",\\"s3:Abort*\\"],\\"Resource\\":[\\"\${aws_s3_bucket.Bucket.arn}\\",\\"\${aws_s3_bucket.Bucket.arn}/*\\"],\\"Effect\\":\\"Allow\\"}]}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A", + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D", }, }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}", }, }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136", + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC", }, }, "batch_size": 1, - "event_source_arn": "\${aws_sqs_queue.cloudQueue.arn}", - "function_name": "\${aws_lambda_function.cloudQueue-SetConsumer0.function_name}", + "event_source_arn": "\${aws_sqs_queue.Queue.arn}", + "function_name": "\${aws_lambda_function.Queue-SetConsumer0.function_name}", }, }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0", + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0", }, }, "architectures": [ @@ -1083,21 +1083,21 @@ exports[`Platform examples > AWS target platform > tf-backend.js > s3 backend 1` ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "\${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "\${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws", }, }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "\${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "\${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "\${aws_s3_bucket.Code.bucket}", - "s3_key": "\${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "\${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "\${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "\${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [], @@ -1105,32 +1105,32 @@ exports[`Platform examples > AWS target platform > tf-backend.js > s3 backend 1` }, }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code", + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket", }, }, - "bucket_prefix": "code-c84a50b1-", + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false, }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket", + "path": "root/Default/Code", + "uniqueId": "Code", }, }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false, + "bucket_prefix": "code-c84a50b1-", }, }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF", + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795", }, }, "bucket": "\${aws_s3_bucket.Code.bucket}", @@ -1139,15 +1139,15 @@ exports[`Platform examples > AWS target platform > tf-backend.js > s3 backend 1` }, }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue", + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue", }, }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30, }, }, diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_compile_tf-aws.md index 37c7a4c3533..b47ac610f74 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/404.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello\":{\"get\":{\"operationId\":\"get-hello\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello0-c8a0ae61/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello\":{\"get\":{\"operationId\":\"get-hello\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello0-c8557c1a/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_hello0_CloudwatchLogGroup_25A0C74E": { + "Api_get_hello0_CloudwatchLogGroup_1025B41C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_hello0_CloudwatchLogGroup_25A0C74E" + "path": "root/Default/Default/Api/get_hello0/CloudwatchLogGroup", + "uniqueId": "Api_get_hello0_CloudwatchLogGroup_1025B41C" } }, - "name": "/aws/lambda/get_hello0-c8a0ae61", + "name": "/aws/lambda/get_hello0-c8557c1a", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_hello0_IamRole_55903A67": { + "Api_get_hello0_IamRole_1E6956F6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRole", - "uniqueId": "cloudApi_get_hello0_IamRole_55903A67" + "path": "root/Default/Default/Api/get_hello0/IamRole", + "uniqueId": "Api_get_hello0_IamRole_1E6956F6" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_hello0_IamRolePolicy_7E9CA094": { + "Api_get_hello0_IamRolePolicy_CFA96C73": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRolePolicy", - "uniqueId": "cloudApi_get_hello0_IamRolePolicy_7E9CA094" + "path": "root/Default/Default/Api/get_hello0/IamRolePolicy", + "uniqueId": "Api_get_hello0_IamRolePolicy_CFA96C73" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.name}" + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_hello0_IamRolePolicyAttachment_B5AC70C0": { + "Api_get_hello0_IamRolePolicyAttachment_2CF40947": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_hello0_IamRolePolicyAttachment_B5AC70C0" + "path": "root/Default/Default/Api/get_hello0/IamRolePolicyAttachment", + "uniqueId": "Api_get_hello0_IamRolePolicyAttachment_2CF40947" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.name}" + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.name}" } }, "aws_lambda_function": { - "cloudApi_get_hello0_FD9AD345": { + "Api_get_hello0_910B8B13": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/Default", - "uniqueId": "cloudApi_get_hello0_FD9AD345" + "path": "root/Default/Default/Api/get_hello0/Default", + "uniqueId": "Api_get_hello0_910B8B13" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_hello0-c8a0ae61", + "WING_FUNCTION_NAME": "get_hello0-c8557c1a", "WING_TARGET": "tf-aws" } }, - "function_name": "get_hello0-c8a0ae61", + "function_name": "get_hello0-c8557c1a", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.arn}", + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_hello0_S3Object_771D5C96.key}", + "s3_key": "${aws_s3_object.Api_get_hello0_S3Object_6B43B0B3.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-df16733f_0EEF8FF5": { + "Api_api_permission-GET-df16733f_BE6D5FC5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-df16733f", - "uniqueId": "cloudApi_api_permission-GET-df16733f_0EEF8FF5" + "path": "root/Default/Default/Api/api/permission-GET-df16733f", + "uniqueId": "Api_api_permission-GET-df16733f_BE6D5FC5" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_hello0_FD9AD345.function_name}", + "function_name": "${aws_lambda_function.Api_get_hello0_910B8B13.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/hello", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/hello", "statement_id": "AllowExecutionFromAPIGateway-GET-df16733f" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_get_hello0_S3Object_771D5C96": { + "Api_get_hello0_S3Object_6B43B0B3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/S3Object", - "uniqueId": "cloudApi_get_hello0_S3Object_771D5C96" + "path": "root/Default/Default/Api/get_hello0/S3Object", + "uniqueId": "Api_get_hello0_S3Object_6B43B0B3" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_compile_tf-aws.md index 422b7786318..5d38575858b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cors.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"get\":{\"operationId\":\"get-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path0-c8877c6b/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,PUT,DELETE,HEAD,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Requested-With'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"get\":{\"operationId\":\"get-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path0-c8789d12/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,PUT,DELETE,HEAD,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Requested-With'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_path0_CloudwatchLogGroup_0507D70F": { + "Api_get_path0_CloudwatchLogGroup_B7150EB5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_path0_CloudwatchLogGroup_0507D70F" + "path": "root/Default/Default/Api/get_path0/CloudwatchLogGroup", + "uniqueId": "Api_get_path0_CloudwatchLogGroup_B7150EB5" } }, - "name": "/aws/lambda/get_path0-c8877c6b", + "name": "/aws/lambda/get_path0-c8789d12", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_path0_IamRole_87E16677": { + "Api_get_path0_IamRole_66BB88D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRole", - "uniqueId": "cloudApi_get_path0_IamRole_87E16677" + "path": "root/Default/Default/Api/get_path0/IamRole", + "uniqueId": "Api_get_path0_IamRole_66BB88D8" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_path0_IamRolePolicy_956114E9": { + "Api_get_path0_IamRolePolicy_C87DDBC3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRolePolicy", - "uniqueId": "cloudApi_get_path0_IamRolePolicy_956114E9" + "path": "root/Default/Default/Api/get_path0/IamRolePolicy", + "uniqueId": "Api_get_path0_IamRolePolicy_C87DDBC3" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.name}" + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_path0_IamRolePolicyAttachment_7CB65894": { + "Api_get_path0_IamRolePolicyAttachment_94BA0B78": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_path0_IamRolePolicyAttachment_7CB65894" + "path": "root/Default/Default/Api/get_path0/IamRolePolicyAttachment", + "uniqueId": "Api_get_path0_IamRolePolicyAttachment_94BA0B78" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.name}" + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.name}" } }, "aws_lambda_function": { - "cloudApi_get_path0_4B9520C1": { + "Api_get_path0_CB7C4BBC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/Default", - "uniqueId": "cloudApi_get_path0_4B9520C1" + "path": "root/Default/Default/Api/get_path0/Default", + "uniqueId": "Api_get_path0_CB7C4BBC" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_path0-c8877c6b", + "WING_FUNCTION_NAME": "get_path0-c8789d12", "WING_TARGET": "tf-aws" } }, - "function_name": "get_path0-c8877c6b", + "function_name": "get_path0-c8789d12", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.arn}", + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_path0_S3Object_65090D2E.key}", + "s3_key": "${aws_s3_object.Api_get_path0_S3Object_6334C185.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-e2131352_3FDDE199": { + "Api_api_permission-GET-e2131352_9A82BDF8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-e2131352", - "uniqueId": "cloudApi_api_permission-GET-e2131352_3FDDE199" + "path": "root/Default/Default/Api/api/permission-GET-e2131352", + "uniqueId": "Api_api_permission-GET-e2131352_9A82BDF8" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_path0_4B9520C1.function_name}", + "function_name": "${aws_lambda_function.Api_get_path0_CB7C4BBC.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/path", "statement_id": "AllowExecutionFromAPIGateway-GET-e2131352" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_get_path0_S3Object_65090D2E": { + "Api_get_path0_S3Object_6334C185": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/S3Object", - "uniqueId": "cloudApi_get_path0_S3Object_65090D2E" + "path": "root/Default/Default/Api/get_path0/S3Object", + "uniqueId": "Api_get_path0_S3Object_6334C185" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_compile_tf-aws.md index 3b9901908d2..7ccb8596129 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/cycle.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/my_url\":{\"get\":{\"operationId\":\"get-my_url\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_my_url0-c833d48d/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/my_url\":{\"get\":{\"operationId\":\"get-my_url\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_my_url0-c8ebe364/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_my_url0_CloudwatchLogGroup_BB5CF936": { + "Api_get_my_url0_CloudwatchLogGroup_03778440": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_my_url0_CloudwatchLogGroup_BB5CF936" + "path": "root/Default/Default/Api/get_my_url0/CloudwatchLogGroup", + "uniqueId": "Api_get_my_url0_CloudwatchLogGroup_03778440" } }, - "name": "/aws/lambda/get_my_url0-c833d48d", + "name": "/aws/lambda/get_my_url0-c8ebe364", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_my_url0_IamRole_2D9A7821": { + "Api_get_my_url0_IamRole_2A08E79F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/IamRole", - "uniqueId": "cloudApi_get_my_url0_IamRole_2D9A7821" + "path": "root/Default/Default/Api/get_my_url0/IamRole", + "uniqueId": "Api_get_my_url0_IamRole_2A08E79F" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_my_url0_IamRolePolicy_96AAEEC4": { + "Api_get_my_url0_IamRolePolicy_04BD1959": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/IamRolePolicy", - "uniqueId": "cloudApi_get_my_url0_IamRolePolicy_96AAEEC4" + "path": "root/Default/Default/Api/get_my_url0/IamRolePolicy", + "uniqueId": "Api_get_my_url0_IamRolePolicy_04BD1959" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_my_url0_IamRole_2D9A7821.name}" + "role": "${aws_iam_role.Api_get_my_url0_IamRole_2A08E79F.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_my_url0_IamRolePolicyAttachment_114B149F": { + "Api_get_my_url0_IamRolePolicyAttachment_291D6C17": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_my_url0_IamRolePolicyAttachment_114B149F" + "path": "root/Default/Default/Api/get_my_url0/IamRolePolicyAttachment", + "uniqueId": "Api_get_my_url0_IamRolePolicyAttachment_291D6C17" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_my_url0_IamRole_2D9A7821.name}" + "role": "${aws_iam_role.Api_get_my_url0_IamRole_2A08E79F.name}" } }, "aws_lambda_function": { - "cloudApi_get_my_url0_C529619B": { + "Api_get_my_url0_7A7AAD6C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/Default", - "uniqueId": "cloudApi_get_my_url0_C529619B" + "path": "root/Default/Default/Api/get_my_url0/Default", + "uniqueId": "Api_get_my_url0_7A7AAD6C" } }, "architectures": [ @@ -162,19 +162,19 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_my_url0-c833d48d", + "WING_FUNCTION_NAME": "get_my_url0-c8ebe364", "WING_TARGET": "tf-aws", - "WING_TOKEN_HTTPS_TFTOKEN_TOKEN_8_EXECUTE_API_TFTOKEN_TOKEN_0_AMAZONAWS_COM_TFTOKEN_TOKEN_9": "${jsonencode(\"https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}\")}" + "WING_TOKEN_HTTPS_TFTOKEN_TOKEN_8_EXECUTE_API_TFTOKEN_TOKEN_0_AMAZONAWS_COM_TFTOKEN_TOKEN_9": "${jsonencode(\"https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}\")}" } }, - "function_name": "get_my_url0-c833d48d", + "function_name": "get_my_url0-c8ebe364", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_my_url0_IamRole_2D9A7821.arn}", + "role": "${aws_iam_role.Api_get_my_url0_IamRole_2A08E79F.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_my_url0_S3Object_895D809B.key}", + "s3_key": "${aws_s3_object.Api_get_my_url0_S3Object_1398834C.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -183,17 +183,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-1cdff2e7_C4032B55": { + "Api_api_permission-GET-1cdff2e7_A9CF8DD9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-1cdff2e7", - "uniqueId": "cloudApi_api_permission-GET-1cdff2e7_C4032B55" + "path": "root/Default/Default/Api/api/permission-GET-1cdff2e7", + "uniqueId": "Api_api_permission-GET-1cdff2e7_A9CF8DD9" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_my_url0_C529619B.function_name}", + "function_name": "${aws_lambda_function.Api_get_my_url0_7A7AAD6C.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/my_url", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/my_url", "statement_id": "AllowExecutionFromAPIGateway-GET-1cdff2e7" } }, @@ -209,11 +209,11 @@ } }, "aws_s3_object": { - "cloudApi_get_my_url0_S3Object_895D809B": { + "Api_get_my_url0_S3Object_1398834C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_my_url0/S3Object", - "uniqueId": "cloudApi_get_my_url0_S3Object_895D809B" + "path": "root/Default/Default/Api/get_my_url0/S3Object", + "uniqueId": "Api_get_my_url0_S3Object_1398834C" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_compile_tf-aws.md index 6961ac26525..b3c85a67fe5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/delete.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"delete\":{\"operationId\":\"delete-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:delete_path0-c89fc010/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"delete\":{\"operationId\":\"delete-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:delete_path0-c8bf96b7/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_delete_path0_CloudwatchLogGroup_6376DCBD": { + "Api_delete_path0_CloudwatchLogGroup_89857450": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_delete_path0_CloudwatchLogGroup_6376DCBD" + "path": "root/Default/Default/Api/delete_path0/CloudwatchLogGroup", + "uniqueId": "Api_delete_path0_CloudwatchLogGroup_89857450" } }, - "name": "/aws/lambda/delete_path0-c89fc010", + "name": "/aws/lambda/delete_path0-c8bf96b7", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_delete_path0_IamRole_6BF53DA9": { + "Api_delete_path0_IamRole_00A5C11E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/IamRole", - "uniqueId": "cloudApi_delete_path0_IamRole_6BF53DA9" + "path": "root/Default/Default/Api/delete_path0/IamRole", + "uniqueId": "Api_delete_path0_IamRole_00A5C11E" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_delete_path0_IamRolePolicy_A7C97377": { + "Api_delete_path0_IamRolePolicy_144236F6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/IamRolePolicy", - "uniqueId": "cloudApi_delete_path0_IamRolePolicy_A7C97377" + "path": "root/Default/Default/Api/delete_path0/IamRolePolicy", + "uniqueId": "Api_delete_path0_IamRolePolicy_144236F6" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_delete_path0_IamRole_6BF53DA9.name}" + "role": "${aws_iam_role.Api_delete_path0_IamRole_00A5C11E.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_delete_path0_IamRolePolicyAttachment_E38D979C": { + "Api_delete_path0_IamRolePolicyAttachment_D76FD008": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_delete_path0_IamRolePolicyAttachment_E38D979C" + "path": "root/Default/Default/Api/delete_path0/IamRolePolicyAttachment", + "uniqueId": "Api_delete_path0_IamRolePolicyAttachment_D76FD008" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_delete_path0_IamRole_6BF53DA9.name}" + "role": "${aws_iam_role.Api_delete_path0_IamRole_00A5C11E.name}" } }, "aws_lambda_function": { - "cloudApi_delete_path0_84B69AC8": { + "Api_delete_path0_6B77C227": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/Default", - "uniqueId": "cloudApi_delete_path0_84B69AC8" + "path": "root/Default/Default/Api/delete_path0/Default", + "uniqueId": "Api_delete_path0_6B77C227" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "delete_path0-c89fc010", + "WING_FUNCTION_NAME": "delete_path0-c8bf96b7", "WING_TARGET": "tf-aws" } }, - "function_name": "delete_path0-c89fc010", + "function_name": "delete_path0-c8bf96b7", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_delete_path0_IamRole_6BF53DA9.arn}", + "role": "${aws_iam_role.Api_delete_path0_IamRole_00A5C11E.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_delete_path0_S3Object_0005D0D3.key}", + "s3_key": "${aws_s3_object.Api_delete_path0_S3Object_49A7AB9C.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-DELETE-e2131352_FCB789AC": { + "Api_api_permission-DELETE-e2131352_8848D3F7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-DELETE-e2131352", - "uniqueId": "cloudApi_api_permission-DELETE-e2131352_FCB789AC" + "path": "root/Default/Default/Api/api/permission-DELETE-e2131352", + "uniqueId": "Api_api_permission-DELETE-e2131352_8848D3F7" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_delete_path0_84B69AC8.function_name}", + "function_name": "${aws_lambda_function.Api_delete_path0_6B77C227.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/DELETE/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/DELETE/path", "statement_id": "AllowExecutionFromAPIGateway-DELETE-e2131352" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_delete_path0_S3Object_0005D0D3": { + "Api_delete_path0_S3Object_49A7AB9C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/delete_path0/S3Object", - "uniqueId": "cloudApi_delete_path0_S3Object_0005D0D3" + "path": "root/Default/Default/Api/delete_path0/S3Object", + "uniqueId": "Api_delete_path0_S3Object_49A7AB9C" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_compile_tf-aws.md index a3d6a11453e..3cafd6016bd 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/get.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,181 +57,181 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"get\":{\"operationId\":\"get-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path0-c8877c6b/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/default-response\":{\"get\":{\"operationId\":\"get-default-response\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_default-response0-c8a2ac3e/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/default-status\":{\"get\":{\"operationId\":\"get-default-status\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_default-status0-c83f25fe/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"get\":{\"operationId\":\"get-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path0-c8789d12/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/default-response\":{\"get\":{\"operationId\":\"get-default-response\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_default-response0-c8ce77c1/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/default-status\":{\"get\":{\"operationId\":\"get-default-status\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_default-status0-c8c4d89b/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_default-response0_CloudwatchLogGroup_E6D4A17A": { + "Api_get_default-response0_CloudwatchLogGroup_510DECD8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_default-response0_CloudwatchLogGroup_E6D4A17A" + "path": "root/Default/Default/Api/get_default-response0/CloudwatchLogGroup", + "uniqueId": "Api_get_default-response0_CloudwatchLogGroup_510DECD8" } }, - "name": "/aws/lambda/get_default-response0-c8a2ac3e", + "name": "/aws/lambda/get_default-response0-c8ce77c1", "retention_in_days": 30 }, - "cloudApi_get_default-status0_CloudwatchLogGroup_E7C991D6": { + "Api_get_default-status0_CloudwatchLogGroup_E8CEA189": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_default-status0_CloudwatchLogGroup_E7C991D6" + "path": "root/Default/Default/Api/get_default-status0/CloudwatchLogGroup", + "uniqueId": "Api_get_default-status0_CloudwatchLogGroup_E8CEA189" } }, - "name": "/aws/lambda/get_default-status0-c83f25fe", + "name": "/aws/lambda/get_default-status0-c8c4d89b", "retention_in_days": 30 }, - "cloudApi_get_path0_CloudwatchLogGroup_0507D70F": { + "Api_get_path0_CloudwatchLogGroup_B7150EB5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_path0_CloudwatchLogGroup_0507D70F" + "path": "root/Default/Default/Api/get_path0/CloudwatchLogGroup", + "uniqueId": "Api_get_path0_CloudwatchLogGroup_B7150EB5" } }, - "name": "/aws/lambda/get_path0-c8877c6b", + "name": "/aws/lambda/get_path0-c8789d12", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_default-response0_IamRole_A760A9B4": { + "Api_get_default-response0_IamRole_A864CAEB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/IamRole", - "uniqueId": "cloudApi_get_default-response0_IamRole_A760A9B4" + "path": "root/Default/Default/Api/get_default-response0/IamRole", + "uniqueId": "Api_get_default-response0_IamRole_A864CAEB" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_default-status0_IamRole_8901F9E6": { + "Api_get_default-status0_IamRole_39C8F206": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/IamRole", - "uniqueId": "cloudApi_get_default-status0_IamRole_8901F9E6" + "path": "root/Default/Default/Api/get_default-status0/IamRole", + "uniqueId": "Api_get_default-status0_IamRole_39C8F206" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_path0_IamRole_87E16677": { + "Api_get_path0_IamRole_66BB88D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRole", - "uniqueId": "cloudApi_get_path0_IamRole_87E16677" + "path": "root/Default/Default/Api/get_path0/IamRole", + "uniqueId": "Api_get_path0_IamRole_66BB88D8" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_default-response0_IamRolePolicy_B490BD07": { + "Api_get_default-response0_IamRolePolicy_6787CAC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/IamRolePolicy", - "uniqueId": "cloudApi_get_default-response0_IamRolePolicy_B490BD07" + "path": "root/Default/Default/Api/get_default-response0/IamRolePolicy", + "uniqueId": "Api_get_default-response0_IamRolePolicy_6787CAC4" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_default-response0_IamRole_A760A9B4.name}" + "role": "${aws_iam_role.Api_get_default-response0_IamRole_A864CAEB.name}" }, - "cloudApi_get_default-status0_IamRolePolicy_92609957": { + "Api_get_default-status0_IamRolePolicy_7535C430": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/IamRolePolicy", - "uniqueId": "cloudApi_get_default-status0_IamRolePolicy_92609957" + "path": "root/Default/Default/Api/get_default-status0/IamRolePolicy", + "uniqueId": "Api_get_default-status0_IamRolePolicy_7535C430" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_default-status0_IamRole_8901F9E6.name}" + "role": "${aws_iam_role.Api_get_default-status0_IamRole_39C8F206.name}" }, - "cloudApi_get_path0_IamRolePolicy_956114E9": { + "Api_get_path0_IamRolePolicy_C87DDBC3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRolePolicy", - "uniqueId": "cloudApi_get_path0_IamRolePolicy_956114E9" + "path": "root/Default/Default/Api/get_path0/IamRolePolicy", + "uniqueId": "Api_get_path0_IamRolePolicy_C87DDBC3" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.name}" + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_default-response0_IamRolePolicyAttachment_E75D6A69": { + "Api_get_default-response0_IamRolePolicyAttachment_852746EE": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_default-response0_IamRolePolicyAttachment_E75D6A69" + "path": "root/Default/Default/Api/get_default-response0/IamRolePolicyAttachment", + "uniqueId": "Api_get_default-response0_IamRolePolicyAttachment_852746EE" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_default-response0_IamRole_A760A9B4.name}" + "role": "${aws_iam_role.Api_get_default-response0_IamRole_A864CAEB.name}" }, - "cloudApi_get_default-status0_IamRolePolicyAttachment_B64BA8DC": { + "Api_get_default-status0_IamRolePolicyAttachment_6414F6CB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_default-status0_IamRolePolicyAttachment_B64BA8DC" + "path": "root/Default/Default/Api/get_default-status0/IamRolePolicyAttachment", + "uniqueId": "Api_get_default-status0_IamRolePolicyAttachment_6414F6CB" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_default-status0_IamRole_8901F9E6.name}" + "role": "${aws_iam_role.Api_get_default-status0_IamRole_39C8F206.name}" }, - "cloudApi_get_path0_IamRolePolicyAttachment_7CB65894": { + "Api_get_path0_IamRolePolicyAttachment_94BA0B78": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_path0_IamRolePolicyAttachment_7CB65894" + "path": "root/Default/Default/Api/get_path0/IamRolePolicyAttachment", + "uniqueId": "Api_get_path0_IamRolePolicyAttachment_94BA0B78" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.name}" + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.name}" } }, "aws_lambda_function": { - "cloudApi_get_default-response0_39D65CAD": { + "Api_get_default-response0_E3CB7035": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/Default", - "uniqueId": "cloudApi_get_default-response0_39D65CAD" + "path": "root/Default/Default/Api/get_default-response0/Default", + "uniqueId": "Api_get_default-response0_E3CB7035" } }, "architectures": [ @@ -240,29 +240,29 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_default-response0-c8a2ac3e", + "WING_FUNCTION_NAME": "get_default-response0-c8ce77c1", "WING_TARGET": "tf-aws" } }, - "function_name": "get_default-response0-c8a2ac3e", + "function_name": "get_default-response0-c8ce77c1", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_default-response0_IamRole_A760A9B4.arn}", + "role": "${aws_iam_role.Api_get_default-response0_IamRole_A864CAEB.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_default-response0_S3Object_B806078E.key}", + "s3_key": "${aws_s3_object.Api_get_default-response0_S3Object_1F3962E5.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_default-status0_7D57B0FA": { + "Api_get_default-status0_EF75A37E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/Default", - "uniqueId": "cloudApi_get_default-status0_7D57B0FA" + "path": "root/Default/Default/Api/get_default-status0/Default", + "uniqueId": "Api_get_default-status0_EF75A37E" } }, "architectures": [ @@ -271,29 +271,29 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_default-status0-c83f25fe", + "WING_FUNCTION_NAME": "get_default-status0-c8c4d89b", "WING_TARGET": "tf-aws" } }, - "function_name": "get_default-status0-c83f25fe", + "function_name": "get_default-status0-c8c4d89b", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_default-status0_IamRole_8901F9E6.arn}", + "role": "${aws_iam_role.Api_get_default-status0_IamRole_39C8F206.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_default-status0_S3Object_56679263.key}", + "s3_key": "${aws_s3_object.Api_get_default-status0_S3Object_300B32EC.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_path0_4B9520C1": { + "Api_get_path0_CB7C4BBC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/Default", - "uniqueId": "cloudApi_get_path0_4B9520C1" + "path": "root/Default/Default/Api/get_path0/Default", + "uniqueId": "Api_get_path0_CB7C4BBC" } }, "architectures": [ @@ -302,18 +302,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_path0-c8877c6b", + "WING_FUNCTION_NAME": "get_path0-c8789d12", "WING_TARGET": "tf-aws" } }, - "function_name": "get_path0-c8877c6b", + "function_name": "get_path0-c8789d12", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_path0_IamRole_87E16677.arn}", + "role": "${aws_iam_role.Api_get_path0_IamRole_66BB88D8.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_path0_S3Object_65090D2E.key}", + "s3_key": "${aws_s3_object.Api_get_path0_S3Object_6334C185.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -322,43 +322,43 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-06c7b019_3EAE9A0A": { + "Api_api_permission-GET-06c7b019_02ED7C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-06c7b019", - "uniqueId": "cloudApi_api_permission-GET-06c7b019_3EAE9A0A" + "path": "root/Default/Default/Api/api/permission-GET-06c7b019", + "uniqueId": "Api_api_permission-GET-06c7b019_02ED7C5D" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_default-status0_7D57B0FA.function_name}", + "function_name": "${aws_lambda_function.Api_get_default-status0_EF75A37E.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/default-status", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/default-status", "statement_id": "AllowExecutionFromAPIGateway-GET-06c7b019" }, - "cloudApi_api_permission-GET-e2131352_3FDDE199": { + "Api_api_permission-GET-e2131352_9A82BDF8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-e2131352", - "uniqueId": "cloudApi_api_permission-GET-e2131352_3FDDE199" + "path": "root/Default/Default/Api/api/permission-GET-e2131352", + "uniqueId": "Api_api_permission-GET-e2131352_9A82BDF8" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_path0_4B9520C1.function_name}", + "function_name": "${aws_lambda_function.Api_get_path0_CB7C4BBC.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/path", "statement_id": "AllowExecutionFromAPIGateway-GET-e2131352" }, - "cloudApi_api_permission-GET-eb193fe3_702F896F": { + "Api_api_permission-GET-eb193fe3_48F25ED3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-eb193fe3", - "uniqueId": "cloudApi_api_permission-GET-eb193fe3_702F896F" + "path": "root/Default/Default/Api/api/permission-GET-eb193fe3", + "uniqueId": "Api_api_permission-GET-eb193fe3_48F25ED3" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_default-response0_39D65CAD.function_name}", + "function_name": "${aws_lambda_function.Api_get_default-response0_E3CB7035.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/default-response", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/default-response", "statement_id": "AllowExecutionFromAPIGateway-GET-eb193fe3" } }, @@ -374,33 +374,33 @@ } }, "aws_s3_object": { - "cloudApi_get_default-response0_S3Object_B806078E": { + "Api_get_default-response0_S3Object_1F3962E5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-response0/S3Object", - "uniqueId": "cloudApi_get_default-response0_S3Object_B806078E" + "path": "root/Default/Default/Api/get_default-response0/S3Object", + "uniqueId": "Api_get_default-response0_S3Object_1F3962E5" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_default-status0_S3Object_56679263": { + "Api_get_default-status0_S3Object_300B32EC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_default-status0/S3Object", - "uniqueId": "cloudApi_get_default-status0_S3Object_56679263" + "path": "root/Default/Default/Api/get_default-status0/S3Object", + "uniqueId": "Api_get_default-status0_S3Object_300B32EC" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_path0_S3Object_65090D2E": { + "Api_get_path0_S3Object_6334C185": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path0/S3Object", - "uniqueId": "cloudApi_get_path0_S3Object_65090D2E" + "path": "root/Default/Default/Api/get_path0/S3Object", + "uniqueId": "Api_get_path0_S3Object_6334C185" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_compile_tf-aws.md index 69addc727aa..1c2a93db9ae 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/options.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,181 +57,181 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"options\":{\"operationId\":\"options-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:options_path0-c83f6886/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"head\":{\"operationId\":\"head-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:head_path0-c80b3037/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"connect\":{\"operationId\":\"connect-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:connect_path0-c8e61c72/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"options\":{\"operationId\":\"options-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:options_path0-c858e550/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"head\":{\"operationId\":\"head-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:head_path0-c8127a73/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"connect\":{\"operationId\":\"connect-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:connect_path0-c88ada6c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_connect_path0_CloudwatchLogGroup_4A842FB1": { + "Api_connect_path0_CloudwatchLogGroup_2EB34FC0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_connect_path0_CloudwatchLogGroup_4A842FB1" + "path": "root/Default/Default/Api/connect_path0/CloudwatchLogGroup", + "uniqueId": "Api_connect_path0_CloudwatchLogGroup_2EB34FC0" } }, - "name": "/aws/lambda/connect_path0-c8e61c72", + "name": "/aws/lambda/connect_path0-c88ada6c", "retention_in_days": 30 }, - "cloudApi_head_path0_CloudwatchLogGroup_3E180E87": { + "Api_head_path0_CloudwatchLogGroup_AE2FC969": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_head_path0_CloudwatchLogGroup_3E180E87" + "path": "root/Default/Default/Api/head_path0/CloudwatchLogGroup", + "uniqueId": "Api_head_path0_CloudwatchLogGroup_AE2FC969" } }, - "name": "/aws/lambda/head_path0-c80b3037", + "name": "/aws/lambda/head_path0-c8127a73", "retention_in_days": 30 }, - "cloudApi_options_path0_CloudwatchLogGroup_04D455C1": { + "Api_options_path0_CloudwatchLogGroup_55814EB4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_options_path0_CloudwatchLogGroup_04D455C1" + "path": "root/Default/Default/Api/options_path0/CloudwatchLogGroup", + "uniqueId": "Api_options_path0_CloudwatchLogGroup_55814EB4" } }, - "name": "/aws/lambda/options_path0-c83f6886", + "name": "/aws/lambda/options_path0-c858e550", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_connect_path0_IamRole_7BF088FF": { + "Api_connect_path0_IamRole_879E3AD0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/IamRole", - "uniqueId": "cloudApi_connect_path0_IamRole_7BF088FF" + "path": "root/Default/Default/Api/connect_path0/IamRole", + "uniqueId": "Api_connect_path0_IamRole_879E3AD0" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_head_path0_IamRole_82F9B314": { + "Api_head_path0_IamRole_8A76125C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/IamRole", - "uniqueId": "cloudApi_head_path0_IamRole_82F9B314" + "path": "root/Default/Default/Api/head_path0/IamRole", + "uniqueId": "Api_head_path0_IamRole_8A76125C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_options_path0_IamRole_3D30300C": { + "Api_options_path0_IamRole_993D1A6D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/IamRole", - "uniqueId": "cloudApi_options_path0_IamRole_3D30300C" + "path": "root/Default/Default/Api/options_path0/IamRole", + "uniqueId": "Api_options_path0_IamRole_993D1A6D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_connect_path0_IamRolePolicy_B4D302FD": { + "Api_connect_path0_IamRolePolicy_8F2AA257": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/IamRolePolicy", - "uniqueId": "cloudApi_connect_path0_IamRolePolicy_B4D302FD" + "path": "root/Default/Default/Api/connect_path0/IamRolePolicy", + "uniqueId": "Api_connect_path0_IamRolePolicy_8F2AA257" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_connect_path0_IamRole_7BF088FF.name}" + "role": "${aws_iam_role.Api_connect_path0_IamRole_879E3AD0.name}" }, - "cloudApi_head_path0_IamRolePolicy_41C0F8DE": { + "Api_head_path0_IamRolePolicy_C0B77C9E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/IamRolePolicy", - "uniqueId": "cloudApi_head_path0_IamRolePolicy_41C0F8DE" + "path": "root/Default/Default/Api/head_path0/IamRolePolicy", + "uniqueId": "Api_head_path0_IamRolePolicy_C0B77C9E" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_head_path0_IamRole_82F9B314.name}" + "role": "${aws_iam_role.Api_head_path0_IamRole_8A76125C.name}" }, - "cloudApi_options_path0_IamRolePolicy_B43E3272": { + "Api_options_path0_IamRolePolicy_6105672A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/IamRolePolicy", - "uniqueId": "cloudApi_options_path0_IamRolePolicy_B43E3272" + "path": "root/Default/Default/Api/options_path0/IamRolePolicy", + "uniqueId": "Api_options_path0_IamRolePolicy_6105672A" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_options_path0_IamRole_3D30300C.name}" + "role": "${aws_iam_role.Api_options_path0_IamRole_993D1A6D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_connect_path0_IamRolePolicyAttachment_EFC6D752": { + "Api_connect_path0_IamRolePolicyAttachment_0EA53E52": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_connect_path0_IamRolePolicyAttachment_EFC6D752" + "path": "root/Default/Default/Api/connect_path0/IamRolePolicyAttachment", + "uniqueId": "Api_connect_path0_IamRolePolicyAttachment_0EA53E52" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_connect_path0_IamRole_7BF088FF.name}" + "role": "${aws_iam_role.Api_connect_path0_IamRole_879E3AD0.name}" }, - "cloudApi_head_path0_IamRolePolicyAttachment_832536A0": { + "Api_head_path0_IamRolePolicyAttachment_D8123259": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_head_path0_IamRolePolicyAttachment_832536A0" + "path": "root/Default/Default/Api/head_path0/IamRolePolicyAttachment", + "uniqueId": "Api_head_path0_IamRolePolicyAttachment_D8123259" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_head_path0_IamRole_82F9B314.name}" + "role": "${aws_iam_role.Api_head_path0_IamRole_8A76125C.name}" }, - "cloudApi_options_path0_IamRolePolicyAttachment_58C196B3": { + "Api_options_path0_IamRolePolicyAttachment_6CDDBCBD": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_options_path0_IamRolePolicyAttachment_58C196B3" + "path": "root/Default/Default/Api/options_path0/IamRolePolicyAttachment", + "uniqueId": "Api_options_path0_IamRolePolicyAttachment_6CDDBCBD" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_options_path0_IamRole_3D30300C.name}" + "role": "${aws_iam_role.Api_options_path0_IamRole_993D1A6D.name}" } }, "aws_lambda_function": { - "cloudApi_connect_path0_E91F1D38": { + "Api_connect_path0_9A10CD07": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/Default", - "uniqueId": "cloudApi_connect_path0_E91F1D38" + "path": "root/Default/Default/Api/connect_path0/Default", + "uniqueId": "Api_connect_path0_9A10CD07" } }, "architectures": [ @@ -240,29 +240,29 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "connect_path0-c8e61c72", + "WING_FUNCTION_NAME": "connect_path0-c88ada6c", "WING_TARGET": "tf-aws" } }, - "function_name": "connect_path0-c8e61c72", + "function_name": "connect_path0-c88ada6c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_connect_path0_IamRole_7BF088FF.arn}", + "role": "${aws_iam_role.Api_connect_path0_IamRole_879E3AD0.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_connect_path0_S3Object_D307BD1C.key}", + "s3_key": "${aws_s3_object.Api_connect_path0_S3Object_F19FB71A.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_head_path0_917BE995": { + "Api_head_path0_CD0BF570": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/Default", - "uniqueId": "cloudApi_head_path0_917BE995" + "path": "root/Default/Default/Api/head_path0/Default", + "uniqueId": "Api_head_path0_CD0BF570" } }, "architectures": [ @@ -271,29 +271,29 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "head_path0-c80b3037", + "WING_FUNCTION_NAME": "head_path0-c8127a73", "WING_TARGET": "tf-aws" } }, - "function_name": "head_path0-c80b3037", + "function_name": "head_path0-c8127a73", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_head_path0_IamRole_82F9B314.arn}", + "role": "${aws_iam_role.Api_head_path0_IamRole_8A76125C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_head_path0_S3Object_F3DC2801.key}", + "s3_key": "${aws_s3_object.Api_head_path0_S3Object_AFB8E06A.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_options_path0_94964AC5": { + "Api_options_path0_AA6A3AAD": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/Default", - "uniqueId": "cloudApi_options_path0_94964AC5" + "path": "root/Default/Default/Api/options_path0/Default", + "uniqueId": "Api_options_path0_AA6A3AAD" } }, "architectures": [ @@ -302,18 +302,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "options_path0-c83f6886", + "WING_FUNCTION_NAME": "options_path0-c858e550", "WING_TARGET": "tf-aws" } }, - "function_name": "options_path0-c83f6886", + "function_name": "options_path0-c858e550", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_options_path0_IamRole_3D30300C.arn}", + "role": "${aws_iam_role.Api_options_path0_IamRole_993D1A6D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_options_path0_S3Object_55DF01C7.key}", + "s3_key": "${aws_s3_object.Api_options_path0_S3Object_F1D01B85.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -322,43 +322,43 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-CONNECT-e2131352_C00751A2": { + "Api_api_permission-CONNECT-e2131352_6940B960": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-CONNECT-e2131352", - "uniqueId": "cloudApi_api_permission-CONNECT-e2131352_C00751A2" + "path": "root/Default/Default/Api/api/permission-CONNECT-e2131352", + "uniqueId": "Api_api_permission-CONNECT-e2131352_6940B960" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_connect_path0_E91F1D38.function_name}", + "function_name": "${aws_lambda_function.Api_connect_path0_9A10CD07.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/CONNECT/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/CONNECT/path", "statement_id": "AllowExecutionFromAPIGateway-CONNECT-e2131352" }, - "cloudApi_api_permission-HEAD-e2131352_C80E1586": { + "Api_api_permission-HEAD-e2131352_8155B558": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-HEAD-e2131352", - "uniqueId": "cloudApi_api_permission-HEAD-e2131352_C80E1586" + "path": "root/Default/Default/Api/api/permission-HEAD-e2131352", + "uniqueId": "Api_api_permission-HEAD-e2131352_8155B558" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_head_path0_917BE995.function_name}", + "function_name": "${aws_lambda_function.Api_head_path0_CD0BF570.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/HEAD/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/HEAD/path", "statement_id": "AllowExecutionFromAPIGateway-HEAD-e2131352" }, - "cloudApi_api_permission-OPTIONS-e2131352_70546290": { + "Api_api_permission-OPTIONS-e2131352_EDD2B8E4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-OPTIONS-e2131352", - "uniqueId": "cloudApi_api_permission-OPTIONS-e2131352_70546290" + "path": "root/Default/Default/Api/api/permission-OPTIONS-e2131352", + "uniqueId": "Api_api_permission-OPTIONS-e2131352_EDD2B8E4" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_options_path0_94964AC5.function_name}", + "function_name": "${aws_lambda_function.Api_options_path0_AA6A3AAD.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/OPTIONS/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/OPTIONS/path", "statement_id": "AllowExecutionFromAPIGateway-OPTIONS-e2131352" } }, @@ -374,33 +374,33 @@ } }, "aws_s3_object": { - "cloudApi_connect_path0_S3Object_D307BD1C": { + "Api_connect_path0_S3Object_F19FB71A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/connect_path0/S3Object", - "uniqueId": "cloudApi_connect_path0_S3Object_D307BD1C" + "path": "root/Default/Default/Api/connect_path0/S3Object", + "uniqueId": "Api_connect_path0_S3Object_F19FB71A" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_head_path0_S3Object_F3DC2801": { + "Api_head_path0_S3Object_AFB8E06A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/head_path0/S3Object", - "uniqueId": "cloudApi_head_path0_S3Object_F3DC2801" + "path": "root/Default/Default/Api/head_path0/S3Object", + "uniqueId": "Api_head_path0_S3Object_AFB8E06A" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_options_path0_S3Object_55DF01C7": { + "Api_options_path0_S3Object_F1D01B85": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/options_path0/S3Object", - "uniqueId": "cloudApi_options_path0_S3Object_55DF01C7" + "path": "root/Default/Default/Api/options_path0/S3Object", + "uniqueId": "Api_options_path0_S3Object_F1D01B85" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_compile_tf-aws.md index b76d81021e8..1dba2764319 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/patch.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path/{id}\":{\"patch\":{\"operationId\":\"patch-path/:id\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:patch_path_-id0-c81e5c56/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path/{id}\":{\"patch\":{\"operationId\":\"patch-path/:id\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:patch_path_-id0-c8d36c2c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_patch_path_id0_CloudwatchLogGroup_B31D8D8B": { + "Api_patch_path_id0_CloudwatchLogGroup_07EB869E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/CloudwatchLogGroup", - "uniqueId": "cloudApi_patch_path_id0_CloudwatchLogGroup_B31D8D8B" + "path": "root/Default/Default/Api/patch_path_:id0/CloudwatchLogGroup", + "uniqueId": "Api_patch_path_id0_CloudwatchLogGroup_07EB869E" } }, - "name": "/aws/lambda/patch_path_-id0-c81e5c56", + "name": "/aws/lambda/patch_path_-id0-c8d36c2c", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_patch_path_id0_IamRole_B0C3F511": { + "Api_patch_path_id0_IamRole_E174D2FC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/IamRole", - "uniqueId": "cloudApi_patch_path_id0_IamRole_B0C3F511" + "path": "root/Default/Default/Api/patch_path_:id0/IamRole", + "uniqueId": "Api_patch_path_id0_IamRole_E174D2FC" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_patch_path_id0_IamRolePolicy_DEDE524A": { + "Api_patch_path_id0_IamRolePolicy_A5123AA6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/IamRolePolicy", - "uniqueId": "cloudApi_patch_path_id0_IamRolePolicy_DEDE524A" + "path": "root/Default/Default/Api/patch_path_:id0/IamRolePolicy", + "uniqueId": "Api_patch_path_id0_IamRolePolicy_A5123AA6" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_patch_path_id0_IamRole_B0C3F511.name}" + "role": "${aws_iam_role.Api_patch_path_id0_IamRole_E174D2FC.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_patch_path_id0_IamRolePolicyAttachment_EAAA56B3": { + "Api_patch_path_id0_IamRolePolicyAttachment_504F3B24": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_patch_path_id0_IamRolePolicyAttachment_EAAA56B3" + "path": "root/Default/Default/Api/patch_path_:id0/IamRolePolicyAttachment", + "uniqueId": "Api_patch_path_id0_IamRolePolicyAttachment_504F3B24" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_patch_path_id0_IamRole_B0C3F511.name}" + "role": "${aws_iam_role.Api_patch_path_id0_IamRole_E174D2FC.name}" } }, "aws_lambda_function": { - "cloudApi_patch_path_id0_D497FF13": { + "Api_patch_path_id0_2ECCFD42": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/Default", - "uniqueId": "cloudApi_patch_path_id0_D497FF13" + "path": "root/Default/Default/Api/patch_path_:id0/Default", + "uniqueId": "Api_patch_path_id0_2ECCFD42" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "patch_path_-id0-c81e5c56", + "WING_FUNCTION_NAME": "patch_path_-id0-c8d36c2c", "WING_TARGET": "tf-aws" } }, - "function_name": "patch_path_-id0-c81e5c56", + "function_name": "patch_path_-id0-c8d36c2c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_patch_path_id0_IamRole_B0C3F511.arn}", + "role": "${aws_iam_role.Api_patch_path_id0_IamRole_E174D2FC.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_patch_path_id0_S3Object_D2D22A39.key}", + "s3_key": "${aws_s3_object.Api_patch_path_id0_S3Object_14F8B22B.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-PATCH-b2e416be_7FF52903": { + "Api_api_permission-PATCH-b2e416be_999AAB0F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-PATCH-b2e416be", - "uniqueId": "cloudApi_api_permission-PATCH-b2e416be_7FF52903" + "path": "root/Default/Default/Api/api/permission-PATCH-b2e416be", + "uniqueId": "Api_api_permission-PATCH-b2e416be_999AAB0F" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_patch_path_id0_D497FF13.function_name}", + "function_name": "${aws_lambda_function.Api_patch_path_id0_2ECCFD42.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/PATCH/path/{id}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/PATCH/path/{id}", "statement_id": "AllowExecutionFromAPIGateway-PATCH-b2e416be" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_patch_path_id0_S3Object_D2D22A39": { + "Api_patch_path_id0_S3Object_14F8B22B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/patch_path_:id0/S3Object", - "uniqueId": "cloudApi_patch_path_id0_S3Object_D2D22A39" + "path": "root/Default/Default/Api/patch_path_:id0/S3Object", + "uniqueId": "Api_patch_path_id0_S3Object_14F8B22B" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_compile_tf-aws.md index ffa45ea5538..8efe8240e3f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/path_vars.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,142 +57,142 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users/{name}\":{\"get\":{\"operationId\":\"get-users/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c803560d/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/path/{name}\":{\"get\":{\"operationId\":\"get-path/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c803560d/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/users/permission/{name}\":{\"get\":{\"operationId\":\"get-users/permission/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c803560d/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/path/{name}/{age}\":{\"get\":{\"operationId\":\"get-path/:name/:age\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"age\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path_-name_-age0-c8a547f8/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users/{name}\":{\"get\":{\"operationId\":\"get-users/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c8831d94/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/path/{name}\":{\"get\":{\"operationId\":\"get-path/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c8831d94/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/users/permission/{name}\":{\"get\":{\"operationId\":\"get-users/permission/:name\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users_-name0-c8831d94/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/path/{name}/{age}\":{\"get\":{\"operationId\":\"get-path/:name/:age\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"name\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"age\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_path_-name_-age0-c8e1843f/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_path_name_age0_CloudwatchLogGroup_C60970E2": { + "Api_get_path_name_age0_CloudwatchLogGroup_4046BC2E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_path_name_age0_CloudwatchLogGroup_C60970E2" + "path": "root/Default/Default/Api/get_path_:name_:age0/CloudwatchLogGroup", + "uniqueId": "Api_get_path_name_age0_CloudwatchLogGroup_4046BC2E" } }, - "name": "/aws/lambda/get_path_-name_-age0-c8a547f8", + "name": "/aws/lambda/get_path_-name_-age0-c8e1843f", "retention_in_days": 30 }, - "cloudApi_get_users_name0_CloudwatchLogGroup_E6CD04D1": { + "Api_get_users_name0_CloudwatchLogGroup_32124378": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_users_name0_CloudwatchLogGroup_E6CD04D1" + "path": "root/Default/Default/Api/get_users_:name0/CloudwatchLogGroup", + "uniqueId": "Api_get_users_name0_CloudwatchLogGroup_32124378" } }, - "name": "/aws/lambda/get_users_-name0-c803560d", + "name": "/aws/lambda/get_users_-name0-c8831d94", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_path_name_age0_IamRole_6CD4A390": { + "Api_get_path_name_age0_IamRole_02E21B80": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/IamRole", - "uniqueId": "cloudApi_get_path_name_age0_IamRole_6CD4A390" + "path": "root/Default/Default/Api/get_path_:name_:age0/IamRole", + "uniqueId": "Api_get_path_name_age0_IamRole_02E21B80" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_users_name0_IamRole_2083FF03": { + "Api_get_users_name0_IamRole_B9DD1767": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/IamRole", - "uniqueId": "cloudApi_get_users_name0_IamRole_2083FF03" + "path": "root/Default/Default/Api/get_users_:name0/IamRole", + "uniqueId": "Api_get_users_name0_IamRole_B9DD1767" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_path_name_age0_IamRolePolicy_A1C4A09A": { + "Api_get_path_name_age0_IamRolePolicy_B3AA7950": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/IamRolePolicy", - "uniqueId": "cloudApi_get_path_name_age0_IamRolePolicy_A1C4A09A" + "path": "root/Default/Default/Api/get_path_:name_:age0/IamRolePolicy", + "uniqueId": "Api_get_path_name_age0_IamRolePolicy_B3AA7950" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_path_name_age0_IamRole_6CD4A390.name}" + "role": "${aws_iam_role.Api_get_path_name_age0_IamRole_02E21B80.name}" }, - "cloudApi_get_users_name0_IamRolePolicy_0D139AAF": { + "Api_get_users_name0_IamRolePolicy_F101FDF4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/IamRolePolicy", - "uniqueId": "cloudApi_get_users_name0_IamRolePolicy_0D139AAF" + "path": "root/Default/Default/Api/get_users_:name0/IamRolePolicy", + "uniqueId": "Api_get_users_name0_IamRolePolicy_F101FDF4" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_users_name0_IamRole_2083FF03.name}" + "role": "${aws_iam_role.Api_get_users_name0_IamRole_B9DD1767.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_path_name_age0_IamRolePolicyAttachment_484E562B": { + "Api_get_path_name_age0_IamRolePolicyAttachment_50B2C16D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_path_name_age0_IamRolePolicyAttachment_484E562B" + "path": "root/Default/Default/Api/get_path_:name_:age0/IamRolePolicyAttachment", + "uniqueId": "Api_get_path_name_age0_IamRolePolicyAttachment_50B2C16D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_path_name_age0_IamRole_6CD4A390.name}" + "role": "${aws_iam_role.Api_get_path_name_age0_IamRole_02E21B80.name}" }, - "cloudApi_get_users_name0_IamRolePolicyAttachment_C69B2933": { + "Api_get_users_name0_IamRolePolicyAttachment_4B78F6FC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_users_name0_IamRolePolicyAttachment_C69B2933" + "path": "root/Default/Default/Api/get_users_:name0/IamRolePolicyAttachment", + "uniqueId": "Api_get_users_name0_IamRolePolicyAttachment_4B78F6FC" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_users_name0_IamRole_2083FF03.name}" + "role": "${aws_iam_role.Api_get_users_name0_IamRole_B9DD1767.name}" } }, "aws_lambda_function": { - "cloudApi_get_path_name_age0_4031BCDB": { + "Api_get_path_name_age0_ECE6563E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/Default", - "uniqueId": "cloudApi_get_path_name_age0_4031BCDB" + "path": "root/Default/Default/Api/get_path_:name_:age0/Default", + "uniqueId": "Api_get_path_name_age0_ECE6563E" } }, "architectures": [ @@ -201,29 +201,29 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_path_-name_-age0-c8a547f8", + "WING_FUNCTION_NAME": "get_path_-name_-age0-c8e1843f", "WING_TARGET": "tf-aws" } }, - "function_name": "get_path_-name_-age0-c8a547f8", + "function_name": "get_path_-name_-age0-c8e1843f", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_path_name_age0_IamRole_6CD4A390.arn}", + "role": "${aws_iam_role.Api_get_path_name_age0_IamRole_02E21B80.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_path_name_age0_S3Object_736B48D7.key}", + "s3_key": "${aws_s3_object.Api_get_path_name_age0_S3Object_34F30D83.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_users_name0_8D4A3030": { + "Api_get_users_name0_81456D48": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/Default", - "uniqueId": "cloudApi_get_users_name0_8D4A3030" + "path": "root/Default/Default/Api/get_users_:name0/Default", + "uniqueId": "Api_get_users_name0_81456D48" } }, "architectures": [ @@ -232,18 +232,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_users_-name0-c803560d", + "WING_FUNCTION_NAME": "get_users_-name0-c8831d94", "WING_TARGET": "tf-aws" } }, - "function_name": "get_users_-name0-c803560d", + "function_name": "get_users_-name0-c8831d94", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_users_name0_IamRole_2083FF03.arn}", + "role": "${aws_iam_role.Api_get_users_name0_IamRole_B9DD1767.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_users_name0_S3Object_3EE8F66D.key}", + "s3_key": "${aws_s3_object.Api_get_users_name0_S3Object_02C47532.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -252,56 +252,56 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-26eaaef3_CF20170D": { + "Api_api_permission-GET-26eaaef3_2017F9D3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-26eaaef3", - "uniqueId": "cloudApi_api_permission-GET-26eaaef3_CF20170D" + "path": "root/Default/Default/Api/api/permission-GET-26eaaef3", + "uniqueId": "Api_api_permission-GET-26eaaef3_2017F9D3" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users_name0_8D4A3030.function_name}", + "function_name": "${aws_lambda_function.Api_get_users_name0_81456D48.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/users/permission/{name}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/users/permission/{name}", "statement_id": "AllowExecutionFromAPIGateway-GET-26eaaef3" }, - "cloudApi_api_permission-GET-35cb425d_1F0EB84A": { + "Api_api_permission-GET-35cb425d_CE77814E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-35cb425d", - "uniqueId": "cloudApi_api_permission-GET-35cb425d_1F0EB84A" + "path": "root/Default/Default/Api/api/permission-GET-35cb425d", + "uniqueId": "Api_api_permission-GET-35cb425d_CE77814E" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users_name0_8D4A3030.function_name}", + "function_name": "${aws_lambda_function.Api_get_users_name0_81456D48.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/users/{name}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/users/{name}", "statement_id": "AllowExecutionFromAPIGateway-GET-35cb425d" }, - "cloudApi_api_permission-GET-e8bcf98a_080C36F9": { + "Api_api_permission-GET-e8bcf98a_26C304C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-e8bcf98a", - "uniqueId": "cloudApi_api_permission-GET-e8bcf98a_080C36F9" + "path": "root/Default/Default/Api/api/permission-GET-e8bcf98a", + "uniqueId": "Api_api_permission-GET-e8bcf98a_26C304C4" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_path_name_age0_4031BCDB.function_name}", + "function_name": "${aws_lambda_function.Api_get_path_name_age0_ECE6563E.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/path/{name}/{age}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/path/{name}/{age}", "statement_id": "AllowExecutionFromAPIGateway-GET-e8bcf98a" }, - "cloudApi_api_permission-GET-e93953c8_FF4AD35C": { + "Api_api_permission-GET-e93953c8_90524D52": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-e93953c8", - "uniqueId": "cloudApi_api_permission-GET-e93953c8_FF4AD35C" + "path": "root/Default/Default/Api/api/permission-GET-e93953c8", + "uniqueId": "Api_api_permission-GET-e93953c8_90524D52" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users_name0_8D4A3030.function_name}", + "function_name": "${aws_lambda_function.Api_get_users_name0_81456D48.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/path/{name}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/path/{name}", "statement_id": "AllowExecutionFromAPIGateway-GET-e93953c8" } }, @@ -317,22 +317,22 @@ } }, "aws_s3_object": { - "cloudApi_get_path_name_age0_S3Object_736B48D7": { + "Api_get_path_name_age0_S3Object_34F30D83": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_path_:name_:age0/S3Object", - "uniqueId": "cloudApi_get_path_name_age0_S3Object_736B48D7" + "path": "root/Default/Default/Api/get_path_:name_:age0/S3Object", + "uniqueId": "Api_get_path_name_age0_S3Object_34F30D83" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_users_name0_S3Object_3EE8F66D": { + "Api_get_users_name0_S3Object_02C47532": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users_:name0/S3Object", - "uniqueId": "cloudApi_get_users_name0_S3Object_3EE8F66D" + "path": "root/Default/Default/Api/get_users_:name0/S3Object", + "uniqueId": "Api_get_users_name0_S3Object_02C47532" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md index faf4c3b4c56..68689f582ff 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"post\":{\"operationId\":\"post-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_path0-c8eb2906/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path\":{\"post\":{\"operationId\":\"post-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_path0-c8a546a0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_post_path0_CloudwatchLogGroup_8BB23269": { + "Api_post_path0_CloudwatchLogGroup_D36E289E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_post_path0_CloudwatchLogGroup_8BB23269" + "path": "root/Default/Default/Api/post_path0/CloudwatchLogGroup", + "uniqueId": "Api_post_path0_CloudwatchLogGroup_D36E289E" } }, - "name": "/aws/lambda/post_path0-c8eb2906", + "name": "/aws/lambda/post_path0-c8a546a0", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_post_path0_IamRole_8CD97DDD": { + "Api_post_path0_IamRole_8E1F7602": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/IamRole", - "uniqueId": "cloudApi_post_path0_IamRole_8CD97DDD" + "path": "root/Default/Default/Api/post_path0/IamRole", + "uniqueId": "Api_post_path0_IamRole_8E1F7602" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_post_path0_IamRolePolicy_0C369DDC": { + "Api_post_path0_IamRolePolicy_A6FF5A38": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/IamRolePolicy", - "uniqueId": "cloudApi_post_path0_IamRolePolicy_0C369DDC" + "path": "root/Default/Default/Api/post_path0/IamRolePolicy", + "uniqueId": "Api_post_path0_IamRolePolicy_A6FF5A38" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_post_path0_IamRole_8CD97DDD.name}" + "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_post_path0_IamRolePolicyAttachment_4D3E429E": { + "Api_post_path0_IamRolePolicyAttachment_6C1025DF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_post_path0_IamRolePolicyAttachment_4D3E429E" + "path": "root/Default/Default/Api/post_path0/IamRolePolicyAttachment", + "uniqueId": "Api_post_path0_IamRolePolicyAttachment_6C1025DF" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_post_path0_IamRole_8CD97DDD.name}" + "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.name}" } }, "aws_lambda_function": { - "cloudApi_post_path0_5E6CB7FB": { + "Api_post_path0_688B6375": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/Default", - "uniqueId": "cloudApi_post_path0_5E6CB7FB" + "path": "root/Default/Default/Api/post_path0/Default", + "uniqueId": "Api_post_path0_688B6375" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "post_path0-c8eb2906", + "WING_FUNCTION_NAME": "post_path0-c8a546a0", "WING_TARGET": "tf-aws" } }, - "function_name": "post_path0-c8eb2906", + "function_name": "post_path0-c8a546a0", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_post_path0_IamRole_8CD97DDD.arn}", + "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_post_path0_S3Object_D7A66CE6.key}", + "s3_key": "${aws_s3_object.Api_post_path0_S3Object_BDECB8C0.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-POST-e2131352_099525EE": { + "Api_api_permission-POST-e2131352_83D11BF7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-POST-e2131352", - "uniqueId": "cloudApi_api_permission-POST-e2131352_099525EE" + "path": "root/Default/Default/Api/api/permission-POST-e2131352", + "uniqueId": "Api_api_permission-POST-e2131352_83D11BF7" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_post_path0_5E6CB7FB.function_name}", + "function_name": "${aws_lambda_function.Api_post_path0_688B6375.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/POST/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/POST/path", "statement_id": "AllowExecutionFromAPIGateway-POST-e2131352" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_post_path0_S3Object_D7A66CE6": { + "Api_post_path0_S3Object_BDECB8C0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_path0/S3Object", - "uniqueId": "cloudApi_post_path0_S3Object_D7A66CE6" + "path": "root/Default/Default/Api/post_path0/S3Object", + "uniqueId": "Api_post_path0_S3Object_BDECB8C0" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_compile_tf-aws.md index 5d4eb3ae49f..013e753ae68 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/put.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,103 +57,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path/{id}/nn/{user}\":{\"put\":{\"operationId\":\"put-path/:id/nn/:user\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"user\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:put_path_-id_nn_-user0-c80f9240/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/path/{id}/nn/{user}\":{\"put\":{\"operationId\":\"put-path/:id/nn/:user\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"user\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:put_path_-id_nn_-user0-c8982eb3/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_put_path_id_nn_user0_CloudwatchLogGroup_4DA5DB81": { + "Api_put_path_id_nn_user0_CloudwatchLogGroup_6FDE8C46": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/CloudwatchLogGroup", - "uniqueId": "cloudApi_put_path_id_nn_user0_CloudwatchLogGroup_4DA5DB81" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/CloudwatchLogGroup", + "uniqueId": "Api_put_path_id_nn_user0_CloudwatchLogGroup_6FDE8C46" } }, - "name": "/aws/lambda/put_path_-id_nn_-user0-c80f9240", + "name": "/aws/lambda/put_path_-id_nn_-user0-c8982eb3", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_put_path_id_nn_user0_IamRole_7A3989FF": { + "Api_put_path_id_nn_user0_IamRole_1C9DE02F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/IamRole", - "uniqueId": "cloudApi_put_path_id_nn_user0_IamRole_7A3989FF" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/IamRole", + "uniqueId": "Api_put_path_id_nn_user0_IamRole_1C9DE02F" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_put_path_id_nn_user0_IamRolePolicy_D9EEAAC8": { + "Api_put_path_id_nn_user0_IamRolePolicy_0EB967A3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/IamRolePolicy", - "uniqueId": "cloudApi_put_path_id_nn_user0_IamRolePolicy_D9EEAAC8" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/IamRolePolicy", + "uniqueId": "Api_put_path_id_nn_user0_IamRolePolicy_0EB967A3" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_put_path_id_nn_user0_IamRole_7A3989FF.name}" + "role": "${aws_iam_role.Api_put_path_id_nn_user0_IamRole_1C9DE02F.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_put_path_id_nn_user0_IamRolePolicyAttachment_0E972F52": { + "Api_put_path_id_nn_user0_IamRolePolicyAttachment_045FFFB7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_put_path_id_nn_user0_IamRolePolicyAttachment_0E972F52" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/IamRolePolicyAttachment", + "uniqueId": "Api_put_path_id_nn_user0_IamRolePolicyAttachment_045FFFB7" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_put_path_id_nn_user0_IamRole_7A3989FF.name}" + "role": "${aws_iam_role.Api_put_path_id_nn_user0_IamRole_1C9DE02F.name}" } }, "aws_lambda_function": { - "cloudApi_put_path_id_nn_user0_9CB2C6E4": { + "Api_put_path_id_nn_user0_A9826CF0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/Default", - "uniqueId": "cloudApi_put_path_id_nn_user0_9CB2C6E4" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/Default", + "uniqueId": "Api_put_path_id_nn_user0_A9826CF0" } }, "architectures": [ @@ -162,18 +162,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "put_path_-id_nn_-user0-c80f9240", + "WING_FUNCTION_NAME": "put_path_-id_nn_-user0-c8982eb3", "WING_TARGET": "tf-aws" } }, - "function_name": "put_path_-id_nn_-user0-c80f9240", + "function_name": "put_path_-id_nn_-user0-c8982eb3", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_put_path_id_nn_user0_IamRole_7A3989FF.arn}", + "role": "${aws_iam_role.Api_put_path_id_nn_user0_IamRole_1C9DE02F.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_put_path_id_nn_user0_S3Object_72C91A0E.key}", + "s3_key": "${aws_s3_object.Api_put_path_id_nn_user0_S3Object_5E224671.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -182,17 +182,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-PUT-526849ff_B95D45FA": { + "Api_api_permission-PUT-526849ff_9087005A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-PUT-526849ff", - "uniqueId": "cloudApi_api_permission-PUT-526849ff_B95D45FA" + "path": "root/Default/Default/Api/api/permission-PUT-526849ff", + "uniqueId": "Api_api_permission-PUT-526849ff_9087005A" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_put_path_id_nn_user0_9CB2C6E4.function_name}", + "function_name": "${aws_lambda_function.Api_put_path_id_nn_user0_A9826CF0.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/PUT/path/{id}/nn/{user}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/PUT/path/{id}/nn/{user}", "statement_id": "AllowExecutionFromAPIGateway-PUT-526849ff" } }, @@ -208,11 +208,11 @@ } }, "aws_s3_object": { - "cloudApi_put_path_id_nn_user0_S3Object_72C91A0E": { + "Api_put_path_id_nn_user0_S3Object_5E224671": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/put_path_:id_nn_:user0/S3Object", - "uniqueId": "cloudApi_put_path_id_nn_user0_S3Object_72C91A0E" + "path": "root/Default/Default/Api/put_path_:id_nn_:user0/S3Object", + "uniqueId": "Api_put_path_id_nn_user0_S3Object_5E224671" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_compile_tf-aws.md index 24379b63ef4..e4719bb5745 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_file.test.w_compile_tf-aws.md @@ -18,37 +18,37 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } }, "aws_s3_object": { - "cloudBucket_S3Object-file1txt_2E641337": { + "Bucket_S3Object-file1txt_A14F86D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file1.txt", - "uniqueId": "cloudBucket_S3Object-file1txt_2E641337" + "path": "root/Default/Default/Bucket/S3Object-file1.txt", + "uniqueId": "Bucket_S3Object-file1txt_A14F86D6" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "test1", "key": "file1.txt" }, - "cloudBucket_S3Object-file2txt_C6672D6C": { + "Bucket_S3Object-file2txt_2016A6BF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file2.txt", - "uniqueId": "cloudBucket_S3Object-file2txt_C6672D6C" + "path": "root/Default/Default/Bucket/S3Object-file2.txt", + "uniqueId": "Bucket_S3Object-file2txt_2016A6BF" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "test2", "key": "file2.txt" } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_compile_tf-aws.md index b0c752ed4f8..39d223484d7 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/add_object.test.w_compile_tf-aws.md @@ -18,37 +18,37 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } }, "aws_s3_object": { - "cloudBucket_S3Object-file1json_574A6AAF": { + "Bucket_S3Object-file1json_6A4AD365": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file1.json", - "uniqueId": "cloudBucket_S3Object-file1json_574A6AAF" + "path": "root/Default/Default/Bucket/S3Object-file1.json", + "uniqueId": "Bucket_S3Object-file1json_6A4AD365" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "{\"key1\":\"value1\"}", "key": "file1.json" }, - "cloudBucket_S3Object-file2txt_C6672D6C": { + "Bucket_S3Object-file2txt_2016A6BF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file2.txt", - "uniqueId": "cloudBucket_S3Object-file2txt_C6672D6C" + "path": "root/Default/Default/Bucket/S3Object-file2.txt", + "uniqueId": "Bucket_S3Object-file2txt_2016A6BF" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "Bar", "key": "file2.txt" } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_compile_tf-aws.md index a2f79e18929..b0ed7a36d27 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/bucket_list.test.w_compile_tf-aws.md @@ -18,26 +18,26 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } }, "aws_s3_object": { - "cloudBucket_S3Object-file3txt_DFC4715B": { + "Bucket_S3Object-file3txt_6AB69768": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file3.txt", - "uniqueId": "cloudBucket_S3Object-file3txt_DFC4715B" + "path": "root/Default/Default/Bucket/S3Object-file3.txt", + "uniqueId": "Bucket_S3Object-file3txt_6AB69768" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "Baz", "key": "file3.txt" } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_compile_tf-aws.md index 675a4ef2909..16dd6f4614e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/copy.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_compile_tf-aws.md index a56496fe97d..2e1f40f16d6 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/delete.test.w_compile_tf-aws.md @@ -18,26 +18,26 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } }, "aws_s3_object": { - "cloudBucket_S3Object-file2txt_C6672D6C": { + "Bucket_S3Object-file2txt_2016A6BF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-file2.txt", - "uniqueId": "cloudBucket_S3Object-file2txt_C6672D6C" + "path": "root/Default/Default/Bucket/S3Object-file2.txt", + "uniqueId": "Bucket_S3Object-file2txt_2016A6BF" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", "content": "Bar", "key": "file2.txt" } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_compile_tf-aws.md index 2cf5c62b937..5aab097ce26 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/events.test.w_compile_tf-aws.md @@ -18,73 +18,73 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudBucket_oncreate-OnMessage0_CloudwatchLogGroup_F81FF873": { + "Bucket_oncreate-OnMessage0_CloudwatchLogGroup_9ADBAD73": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudBucket_oncreate-OnMessage0_CloudwatchLogGroup_F81FF873" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Bucket_oncreate-OnMessage0_CloudwatchLogGroup_9ADBAD73" } }, - "name": "/aws/lambda/oncreate-OnMessage0-c835636b", + "name": "/aws/lambda/oncreate-OnMessage0-c87abc21", "retention_in_days": 30 }, - "cloudBucket_oncreate-OnMessage1_CloudwatchLogGroup_FA18C2EA": { + "Bucket_oncreate-OnMessage1_CloudwatchLogGroup_37B9C8C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/CloudwatchLogGroup", - "uniqueId": "cloudBucket_oncreate-OnMessage1_CloudwatchLogGroup_FA18C2EA" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/CloudwatchLogGroup", + "uniqueId": "Bucket_oncreate-OnMessage1_CloudwatchLogGroup_37B9C8C4" } }, - "name": "/aws/lambda/oncreate-OnMessage1-c8d72382", + "name": "/aws/lambda/oncreate-OnMessage1-c800fec8", "retention_in_days": 30 }, - "cloudBucket_ondelete-OnMessage0_CloudwatchLogGroup_55334E14": { + "Bucket_ondelete-OnMessage0_CloudwatchLogGroup_5F88C98D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudBucket_ondelete-OnMessage0_CloudwatchLogGroup_55334E14" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Bucket_ondelete-OnMessage0_CloudwatchLogGroup_5F88C98D" } }, - "name": "/aws/lambda/ondelete-OnMessage0-c8308ba7", + "name": "/aws/lambda/ondelete-OnMessage0-c8a38b5a", "retention_in_days": 30 }, - "cloudBucket_ondelete-OnMessage1_CloudwatchLogGroup_AF50ED5A": { + "Bucket_ondelete-OnMessage1_CloudwatchLogGroup_AE7AA81E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/CloudwatchLogGroup", - "uniqueId": "cloudBucket_ondelete-OnMessage1_CloudwatchLogGroup_AF50ED5A" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/CloudwatchLogGroup", + "uniqueId": "Bucket_ondelete-OnMessage1_CloudwatchLogGroup_AE7AA81E" } }, - "name": "/aws/lambda/ondelete-OnMessage1-c8920f94", + "name": "/aws/lambda/ondelete-OnMessage1-c82792b8", "retention_in_days": 30 }, - "cloudBucket_onupdate-OnMessage0_CloudwatchLogGroup_98BF6B34": { + "Bucket_onupdate-OnMessage0_CloudwatchLogGroup_C8045188": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudBucket_onupdate-OnMessage0_CloudwatchLogGroup_98BF6B34" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Bucket_onupdate-OnMessage0_CloudwatchLogGroup_C8045188" } }, - "name": "/aws/lambda/onupdate-OnMessage0-c8cd54ba", + "name": "/aws/lambda/onupdate-OnMessage0-c835180c", "retention_in_days": 30 }, - "cloudBucket_onupdate-OnMessage1_CloudwatchLogGroup_7D9AC801": { + "Bucket_onupdate-OnMessage1_CloudwatchLogGroup_D6757AF5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/CloudwatchLogGroup", - "uniqueId": "cloudBucket_onupdate-OnMessage1_CloudwatchLogGroup_7D9AC801" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/CloudwatchLogGroup", + "uniqueId": "Bucket_onupdate-OnMessage1_CloudwatchLogGroup_D6757AF5" } }, - "name": "/aws/lambda/onupdate-OnMessage1-c8356ea9", + "name": "/aws/lambda/onupdate-OnMessage1-c8826493", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -95,13 +95,13 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" }, - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -112,198 +112,198 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "_id", - "name": "key-historyex.Table-c840a49c", + "name": "key-historyTable-c89b2d37", "point_in_time_recovery": { "enabled": true } } }, "aws_iam_role": { - "cloudBucket_oncreate-OnMessage0_IamRole_781D1FBC": { + "Bucket_oncreate-OnMessage0_IamRole_0DECFA72": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/IamRole", - "uniqueId": "cloudBucket_oncreate-OnMessage0_IamRole_781D1FBC" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/IamRole", + "uniqueId": "Bucket_oncreate-OnMessage0_IamRole_0DECFA72" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudBucket_oncreate-OnMessage1_IamRole_5FEF97DC": { + "Bucket_oncreate-OnMessage1_IamRole_EAFD952E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/IamRole", - "uniqueId": "cloudBucket_oncreate-OnMessage1_IamRole_5FEF97DC" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/IamRole", + "uniqueId": "Bucket_oncreate-OnMessage1_IamRole_EAFD952E" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudBucket_ondelete-OnMessage0_IamRole_32E9B6B6": { + "Bucket_ondelete-OnMessage0_IamRole_50F5B4CA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/IamRole", - "uniqueId": "cloudBucket_ondelete-OnMessage0_IamRole_32E9B6B6" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/IamRole", + "uniqueId": "Bucket_ondelete-OnMessage0_IamRole_50F5B4CA" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudBucket_ondelete-OnMessage1_IamRole_3A69AD5D": { + "Bucket_ondelete-OnMessage1_IamRole_BE60A7EC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/IamRole", - "uniqueId": "cloudBucket_ondelete-OnMessage1_IamRole_3A69AD5D" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/IamRole", + "uniqueId": "Bucket_ondelete-OnMessage1_IamRole_BE60A7EC" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudBucket_onupdate-OnMessage0_IamRole_A18E1E60": { + "Bucket_onupdate-OnMessage0_IamRole_B95F0C0C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/IamRole", - "uniqueId": "cloudBucket_onupdate-OnMessage0_IamRole_A18E1E60" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/IamRole", + "uniqueId": "Bucket_onupdate-OnMessage0_IamRole_B95F0C0C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudBucket_onupdate-OnMessage1_IamRole_F9C45633": { + "Bucket_onupdate-OnMessage1_IamRole_93BC24D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/IamRole", - "uniqueId": "cloudBucket_onupdate-OnMessage1_IamRole_F9C45633" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/IamRole", + "uniqueId": "Bucket_onupdate-OnMessage1_IamRole_93BC24D8" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudBucket_oncreate-OnMessage0_IamRolePolicy_44CBF0C5": { + "Bucket_oncreate-OnMessage0_IamRolePolicy_ED4BBB06": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/IamRolePolicy", - "uniqueId": "cloudBucket_oncreate-OnMessage0_IamRolePolicy_44CBF0C5" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/IamRolePolicy", + "uniqueId": "Bucket_oncreate-OnMessage0_IamRolePolicy_ED4BBB06" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage0_IamRole_781D1FBC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_oncreate-OnMessage0_IamRole_0DECFA72.name}" }, - "cloudBucket_oncreate-OnMessage1_IamRolePolicy_EDFB1610": { + "Bucket_oncreate-OnMessage1_IamRolePolicy_555608BE": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/IamRolePolicy", - "uniqueId": "cloudBucket_oncreate-OnMessage1_IamRolePolicy_EDFB1610" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/IamRolePolicy", + "uniqueId": "Bucket_oncreate-OnMessage1_IamRolePolicy_555608BE" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage1_IamRole_5FEF97DC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_oncreate-OnMessage1_IamRole_EAFD952E.name}" }, - "cloudBucket_ondelete-OnMessage0_IamRolePolicy_CF363F05": { + "Bucket_ondelete-OnMessage0_IamRolePolicy_EE79076B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/IamRolePolicy", - "uniqueId": "cloudBucket_ondelete-OnMessage0_IamRolePolicy_CF363F05" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/IamRolePolicy", + "uniqueId": "Bucket_ondelete-OnMessage0_IamRolePolicy_EE79076B" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage0_IamRole_32E9B6B6.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_ondelete-OnMessage0_IamRole_50F5B4CA.name}" }, - "cloudBucket_ondelete-OnMessage1_IamRolePolicy_0867305D": { + "Bucket_ondelete-OnMessage1_IamRolePolicy_517C3979": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/IamRolePolicy", - "uniqueId": "cloudBucket_ondelete-OnMessage1_IamRolePolicy_0867305D" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/IamRolePolicy", + "uniqueId": "Bucket_ondelete-OnMessage1_IamRolePolicy_517C3979" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage1_IamRole_3A69AD5D.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_ondelete-OnMessage1_IamRole_BE60A7EC.name}" }, - "cloudBucket_onupdate-OnMessage0_IamRolePolicy_1C574D04": { + "Bucket_onupdate-OnMessage0_IamRolePolicy_95CC8F41": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/IamRolePolicy", - "uniqueId": "cloudBucket_onupdate-OnMessage0_IamRolePolicy_1C574D04" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/IamRolePolicy", + "uniqueId": "Bucket_onupdate-OnMessage0_IamRolePolicy_95CC8F41" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage0_IamRole_A18E1E60.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_onupdate-OnMessage0_IamRole_B95F0C0C.name}" }, - "cloudBucket_onupdate-OnMessage1_IamRolePolicy_AF88DE22": { + "Bucket_onupdate-OnMessage1_IamRolePolicy_9C89E111": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/IamRolePolicy", - "uniqueId": "cloudBucket_onupdate-OnMessage1_IamRolePolicy_AF88DE22" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/IamRolePolicy", + "uniqueId": "Bucket_onupdate-OnMessage1_IamRolePolicy_9C89E111" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage1_IamRole_F9C45633.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Bucket_onupdate-OnMessage1_IamRole_93BC24D8.name}" } }, "aws_iam_role_policy_attachment": { - "cloudBucket_oncreate-OnMessage0_IamRolePolicyAttachment_0014344A": { + "Bucket_oncreate-OnMessage0_IamRolePolicyAttachment_1AE31BFB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_oncreate-OnMessage0_IamRolePolicyAttachment_0014344A" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Bucket_oncreate-OnMessage0_IamRolePolicyAttachment_1AE31BFB" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage0_IamRole_781D1FBC.name}" + "role": "${aws_iam_role.Bucket_oncreate-OnMessage0_IamRole_0DECFA72.name}" }, - "cloudBucket_oncreate-OnMessage1_IamRolePolicyAttachment_D98B9654": { + "Bucket_oncreate-OnMessage1_IamRolePolicyAttachment_FE0643F9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_oncreate-OnMessage1_IamRolePolicyAttachment_D98B9654" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/IamRolePolicyAttachment", + "uniqueId": "Bucket_oncreate-OnMessage1_IamRolePolicyAttachment_FE0643F9" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage1_IamRole_5FEF97DC.name}" + "role": "${aws_iam_role.Bucket_oncreate-OnMessage1_IamRole_EAFD952E.name}" }, - "cloudBucket_ondelete-OnMessage0_IamRolePolicyAttachment_51AD370B": { + "Bucket_ondelete-OnMessage0_IamRolePolicyAttachment_7C1D0962": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_ondelete-OnMessage0_IamRolePolicyAttachment_51AD370B" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Bucket_ondelete-OnMessage0_IamRolePolicyAttachment_7C1D0962" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage0_IamRole_32E9B6B6.name}" + "role": "${aws_iam_role.Bucket_ondelete-OnMessage0_IamRole_50F5B4CA.name}" }, - "cloudBucket_ondelete-OnMessage1_IamRolePolicyAttachment_175F98FB": { + "Bucket_ondelete-OnMessage1_IamRolePolicyAttachment_A21F4631": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_ondelete-OnMessage1_IamRolePolicyAttachment_175F98FB" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/IamRolePolicyAttachment", + "uniqueId": "Bucket_ondelete-OnMessage1_IamRolePolicyAttachment_A21F4631" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage1_IamRole_3A69AD5D.name}" + "role": "${aws_iam_role.Bucket_ondelete-OnMessage1_IamRole_BE60A7EC.name}" }, - "cloudBucket_onupdate-OnMessage0_IamRolePolicyAttachment_8CE952F6": { + "Bucket_onupdate-OnMessage0_IamRolePolicyAttachment_753AF495": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_onupdate-OnMessage0_IamRolePolicyAttachment_8CE952F6" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Bucket_onupdate-OnMessage0_IamRolePolicyAttachment_753AF495" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage0_IamRole_A18E1E60.name}" + "role": "${aws_iam_role.Bucket_onupdate-OnMessage0_IamRole_B95F0C0C.name}" }, - "cloudBucket_onupdate-OnMessage1_IamRolePolicyAttachment_558C639E": { + "Bucket_onupdate-OnMessage1_IamRolePolicyAttachment_A8068B10": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/IamRolePolicyAttachment", - "uniqueId": "cloudBucket_onupdate-OnMessage1_IamRolePolicyAttachment_558C639E" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/IamRolePolicyAttachment", + "uniqueId": "Bucket_onupdate-OnMessage1_IamRolePolicyAttachment_A8068B10" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage1_IamRole_F9C45633.name}" + "role": "${aws_iam_role.Bucket_onupdate-OnMessage1_IamRole_93BC24D8.name}" } }, "aws_lambda_function": { - "cloudBucket_oncreate-OnMessage0_0B1CA993": { + "Bucket_oncreate-OnMessage0_64FDCB47": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/Default", - "uniqueId": "cloudBucket_oncreate-OnMessage0_0B1CA993" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/Default", + "uniqueId": "Bucket_oncreate-OnMessage0_64FDCB47" } }, "architectures": [ @@ -311,34 +311,34 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "oncreate-OnMessage0-c835636b", + "WING_FUNCTION_NAME": "oncreate-OnMessage0-c87abc21", "WING_TARGET": "tf-aws" } }, - "function_name": "oncreate-OnMessage0-c835636b", + "function_name": "oncreate-OnMessage0-c87abc21", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage0_IamRole_781D1FBC.arn}", + "role": "${aws_iam_role.Bucket_oncreate-OnMessage0_IamRole_0DECFA72.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_oncreate-OnMessage0_S3Object_C2C8A7A9.key}", + "s3_key": "${aws_s3_object.Bucket_oncreate-OnMessage0_S3Object_F105B125.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudBucket_oncreate-OnMessage1_46B1E9AC": { + "Bucket_oncreate-OnMessage1_BC956365": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/Default", - "uniqueId": "cloudBucket_oncreate-OnMessage1_46B1E9AC" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/Default", + "uniqueId": "Bucket_oncreate-OnMessage1_BC956365" } }, "architectures": [ @@ -346,34 +346,34 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "oncreate-OnMessage1-c8d72382", + "WING_FUNCTION_NAME": "oncreate-OnMessage1-c800fec8", "WING_TARGET": "tf-aws" } }, - "function_name": "oncreate-OnMessage1-c8d72382", + "function_name": "oncreate-OnMessage1-c800fec8", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_oncreate-OnMessage1_IamRole_5FEF97DC.arn}", + "role": "${aws_iam_role.Bucket_oncreate-OnMessage1_IamRole_EAFD952E.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_oncreate-OnMessage1_S3Object_73E1B72B.key}", + "s3_key": "${aws_s3_object.Bucket_oncreate-OnMessage1_S3Object_F92E0B51.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudBucket_ondelete-OnMessage0_31BC8C5B": { + "Bucket_ondelete-OnMessage0_31A1E9E4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/Default", - "uniqueId": "cloudBucket_ondelete-OnMessage0_31BC8C5B" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/Default", + "uniqueId": "Bucket_ondelete-OnMessage0_31A1E9E4" } }, "architectures": [ @@ -381,34 +381,34 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "ondelete-OnMessage0-c8308ba7", + "WING_FUNCTION_NAME": "ondelete-OnMessage0-c8a38b5a", "WING_TARGET": "tf-aws" } }, - "function_name": "ondelete-OnMessage0-c8308ba7", + "function_name": "ondelete-OnMessage0-c8a38b5a", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage0_IamRole_32E9B6B6.arn}", + "role": "${aws_iam_role.Bucket_ondelete-OnMessage0_IamRole_50F5B4CA.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_ondelete-OnMessage0_S3Object_E710FD99.key}", + "s3_key": "${aws_s3_object.Bucket_ondelete-OnMessage0_S3Object_DE6CDD43.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudBucket_ondelete-OnMessage1_97EDDB9C": { + "Bucket_ondelete-OnMessage1_5BBC7743": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/Default", - "uniqueId": "cloudBucket_ondelete-OnMessage1_97EDDB9C" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/Default", + "uniqueId": "Bucket_ondelete-OnMessage1_5BBC7743" } }, "architectures": [ @@ -416,34 +416,34 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "ondelete-OnMessage1-c8920f94", + "WING_FUNCTION_NAME": "ondelete-OnMessage1-c82792b8", "WING_TARGET": "tf-aws" } }, - "function_name": "ondelete-OnMessage1-c8920f94", + "function_name": "ondelete-OnMessage1-c82792b8", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_ondelete-OnMessage1_IamRole_3A69AD5D.arn}", + "role": "${aws_iam_role.Bucket_ondelete-OnMessage1_IamRole_BE60A7EC.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_ondelete-OnMessage1_S3Object_83BF5AC3.key}", + "s3_key": "${aws_s3_object.Bucket_ondelete-OnMessage1_S3Object_DE98D974.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudBucket_onupdate-OnMessage0_7E23A21E": { + "Bucket_onupdate-OnMessage0_2FBE69C5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/Default", - "uniqueId": "cloudBucket_onupdate-OnMessage0_7E23A21E" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/Default", + "uniqueId": "Bucket_onupdate-OnMessage0_2FBE69C5" } }, "architectures": [ @@ -451,34 +451,34 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "onupdate-OnMessage0-c8cd54ba", + "WING_FUNCTION_NAME": "onupdate-OnMessage0-c835180c", "WING_TARGET": "tf-aws" } }, - "function_name": "onupdate-OnMessage0-c8cd54ba", + "function_name": "onupdate-OnMessage0-c835180c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage0_IamRole_A18E1E60.arn}", + "role": "${aws_iam_role.Bucket_onupdate-OnMessage0_IamRole_B95F0C0C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_onupdate-OnMessage0_S3Object_1E3DAE34.key}", + "s3_key": "${aws_s3_object.Bucket_onupdate-OnMessage0_S3Object_B4B3C51E.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudBucket_onupdate-OnMessage1_AD4C1239": { + "Bucket_onupdate-OnMessage1_DDC08FAE": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/Default", - "uniqueId": "cloudBucket_onupdate-OnMessage1_AD4C1239" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/Default", + "uniqueId": "Bucket_onupdate-OnMessage1_DDC08FAE" } }, "architectures": [ @@ -486,23 +486,23 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "_id", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"_id\":0,\"key\":0,\"operation\":0,\"source\":0}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "_id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "onupdate-OnMessage1-c8356ea9", + "WING_FUNCTION_NAME": "onupdate-OnMessage1-c8826493", "WING_TARGET": "tf-aws" } }, - "function_name": "onupdate-OnMessage1-c8356ea9", + "function_name": "onupdate-OnMessage1-c8826493", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudBucket_onupdate-OnMessage1_IamRole_F9C45633.arn}", + "role": "${aws_iam_role.Bucket_onupdate-OnMessage1_IamRole_93BC24D8.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudBucket_onupdate-OnMessage1_S3Object_0756209E.key}", + "s3_key": "${aws_s3_object.Bucket_onupdate-OnMessage1_S3Object_12D7055B.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -511,113 +511,113 @@ } }, "aws_lambda_permission": { - "cloudBucket_oncreate-OnMessage0_InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b_557C66F2": { + "Bucket_oncreate-OnMessage0_InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4_DD3AB632": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b", - "uniqueId": "cloudBucket_oncreate-OnMessage0_InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b_557C66F2" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4", + "uniqueId": "Bucket_oncreate-OnMessage0_InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4_DD3AB632" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_oncreate-OnMessage0_0B1CA993.function_name}", + "function_name": "${aws_lambda_function.Bucket_oncreate-OnMessage0_64FDCB47.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}" + "source_arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}" }, - "cloudBucket_oncreate-OnMessage1_InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b_42E7BD52": { + "Bucket_oncreate-OnMessage1_InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4_F6194849": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b", - "uniqueId": "cloudBucket_oncreate-OnMessage1_InvokePermission-c8f9c22ef33cda1b8ee1583450fa95d2a469b4ca3b_42E7BD52" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4", + "uniqueId": "Bucket_oncreate-OnMessage1_InvokePermission-c80311dcc4aadf68b1b7fbea8bf5da640f0dde68f4_F6194849" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_oncreate-OnMessage1_46B1E9AC.function_name}", + "function_name": "${aws_lambda_function.Bucket_oncreate-OnMessage1_BC956365.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}" + "source_arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}" }, - "cloudBucket_ondelete-OnMessage0_InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56_39B5412A": { + "Bucket_ondelete-OnMessage0_InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b_AFF2F4D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56", - "uniqueId": "cloudBucket_ondelete-OnMessage0_InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56_39B5412A" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b", + "uniqueId": "Bucket_ondelete-OnMessage0_InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b_AFF2F4D8" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_ondelete-OnMessage0_31BC8C5B.function_name}", + "function_name": "${aws_lambda_function.Bucket_ondelete-OnMessage0_31A1E9E4.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}" + "source_arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}" }, - "cloudBucket_ondelete-OnMessage1_InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56_55397F0C": { + "Bucket_ondelete-OnMessage1_InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b_ADE9F930": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56", - "uniqueId": "cloudBucket_ondelete-OnMessage1_InvokePermission-c82a684284f1978ef059ff478889b7d0422cd30e56_55397F0C" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b", + "uniqueId": "Bucket_ondelete-OnMessage1_InvokePermission-c8d079b3d06057215794f77e7e4bf9c5113e5b753b_ADE9F930" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_ondelete-OnMessage1_97EDDB9C.function_name}", + "function_name": "${aws_lambda_function.Bucket_ondelete-OnMessage1_5BBC7743.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}" + "source_arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}" }, - "cloudBucket_onupdate-OnMessage0_InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751_3E88DA77": { + "Bucket_onupdate-OnMessage0_InvokePermission-c83c88094423e3602c58db2402f439eb720806a401_3F79E9CA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751", - "uniqueId": "cloudBucket_onupdate-OnMessage0_InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751_3E88DA77" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/InvokePermission-c83c88094423e3602c58db2402f439eb720806a401", + "uniqueId": "Bucket_onupdate-OnMessage0_InvokePermission-c83c88094423e3602c58db2402f439eb720806a401_3F79E9CA" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_onupdate-OnMessage0_7E23A21E.function_name}", + "function_name": "${aws_lambda_function.Bucket_onupdate-OnMessage0_2FBE69C5.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}" + "source_arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}" }, - "cloudBucket_onupdate-OnMessage1_InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751_F065AB16": { + "Bucket_onupdate-OnMessage1_InvokePermission-c83c88094423e3602c58db2402f439eb720806a401_656518F7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751", - "uniqueId": "cloudBucket_onupdate-OnMessage1_InvokePermission-c8223d472543ef1fe5e1f0eacaf63338362fb1a751_F065AB16" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/InvokePermission-c83c88094423e3602c58db2402f439eb720806a401", + "uniqueId": "Bucket_onupdate-OnMessage1_InvokePermission-c83c88094423e3602c58db2402f439eb720806a401_656518F7" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudBucket_onupdate-OnMessage1_AD4C1239.function_name}", + "function_name": "${aws_lambda_function.Bucket_onupdate-OnMessage1_DDC08FAE.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}" + "source_arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}" } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_bucket_notification": { - "cloudBucket_S3BucketNotification_7C82677F": { + "Bucket_S3BucketNotification_D5E2F72C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3BucketNotification", - "uniqueId": "cloudBucket_S3BucketNotification_7C82677F" + "path": "root/Default/Default/Bucket/S3BucketNotification", + "uniqueId": "Bucket_S3BucketNotification_D5E2F72C" } }, - "bucket": "${aws_s3_bucket.cloudBucket.id}", + "bucket": "${aws_s3_bucket.Bucket.id}", "depends_on": [ - "aws_sns_topic_policy.cloudBucket_ondelete_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_F136B625", - "aws_sns_topic_policy.cloudBucket_onupdate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_76578151", - "aws_sns_topic_policy.cloudBucket_oncreate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_C1C190D3" + "aws_sns_topic_policy.Bucket_ondelete_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_ABACCC4A", + "aws_sns_topic_policy.Bucket_onupdate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_CFB72F4E", + "aws_sns_topic_policy.Bucket_oncreate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_E0552A1A" ], "topic": [ { @@ -625,86 +625,86 @@ "s3:ObjectRemoved:*" ], "id": "on-ondelete-notification", - "topic_arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}" + "topic_arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}" }, { "events": [ "s3:ObjectCreated:Post" ], "id": "on-onupdate-notification", - "topic_arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}" + "topic_arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}" }, { "events": [ "s3:ObjectCreated:Put" ], "id": "on-oncreate-notification", - "topic_arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}" + "topic_arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}" } ] } }, "aws_s3_object": { - "cloudBucket_oncreate-OnMessage0_S3Object_C2C8A7A9": { + "Bucket_oncreate-OnMessage0_S3Object_F105B125": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage0/S3Object", - "uniqueId": "cloudBucket_oncreate-OnMessage0_S3Object_C2C8A7A9" + "path": "root/Default/Default/Bucket/oncreate-OnMessage0/S3Object", + "uniqueId": "Bucket_oncreate-OnMessage0_S3Object_F105B125" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_oncreate-OnMessage1_S3Object_73E1B72B": { + "Bucket_oncreate-OnMessage1_S3Object_F92E0B51": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate-OnMessage1/S3Object", - "uniqueId": "cloudBucket_oncreate-OnMessage1_S3Object_73E1B72B" + "path": "root/Default/Default/Bucket/oncreate-OnMessage1/S3Object", + "uniqueId": "Bucket_oncreate-OnMessage1_S3Object_F92E0B51" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_ondelete-OnMessage0_S3Object_E710FD99": { + "Bucket_ondelete-OnMessage0_S3Object_DE6CDD43": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage0/S3Object", - "uniqueId": "cloudBucket_ondelete-OnMessage0_S3Object_E710FD99" + "path": "root/Default/Default/Bucket/ondelete-OnMessage0/S3Object", + "uniqueId": "Bucket_ondelete-OnMessage0_S3Object_DE6CDD43" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_ondelete-OnMessage1_S3Object_83BF5AC3": { + "Bucket_ondelete-OnMessage1_S3Object_DE98D974": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete-OnMessage1/S3Object", - "uniqueId": "cloudBucket_ondelete-OnMessage1_S3Object_83BF5AC3" + "path": "root/Default/Default/Bucket/ondelete-OnMessage1/S3Object", + "uniqueId": "Bucket_ondelete-OnMessage1_S3Object_DE98D974" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_onupdate-OnMessage0_S3Object_1E3DAE34": { + "Bucket_onupdate-OnMessage0_S3Object_B4B3C51E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage0/S3Object", - "uniqueId": "cloudBucket_onupdate-OnMessage0_S3Object_1E3DAE34" + "path": "root/Default/Default/Bucket/onupdate-OnMessage0/S3Object", + "uniqueId": "Bucket_onupdate-OnMessage0_S3Object_B4B3C51E" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_onupdate-OnMessage1_S3Object_0756209E": { + "Bucket_onupdate-OnMessage1_S3Object_12D7055B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate-OnMessage1/S3Object", - "uniqueId": "cloudBucket_onupdate-OnMessage1_S3Object_0756209E" + "path": "root/Default/Default/Bucket/onupdate-OnMessage1/S3Object", + "uniqueId": "Bucket_onupdate-OnMessage1_S3Object_12D7055B" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -713,132 +713,132 @@ } }, "aws_sns_topic": { - "cloudBucket_oncreate_BF58CCF3": { + "Bucket_oncreate_05DB4E53": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate/Default", - "uniqueId": "cloudBucket_oncreate_BF58CCF3" + "path": "root/Default/Default/Bucket/oncreate/Default", + "uniqueId": "Bucket_oncreate_05DB4E53" } }, - "name": "oncreate-c8f9c22e" + "name": "oncreate-c80311dc" }, - "cloudBucket_ondelete_5C7719AC": { + "Bucket_ondelete_7F3A2B6C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete/Default", - "uniqueId": "cloudBucket_ondelete_5C7719AC" + "path": "root/Default/Default/Bucket/ondelete/Default", + "uniqueId": "Bucket_ondelete_7F3A2B6C" } }, - "name": "ondelete-c82a6842" + "name": "ondelete-c8d079b3" }, - "cloudBucket_onupdate_34404C29": { + "Bucket_onupdate_658D07E4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate/Default", - "uniqueId": "cloudBucket_onupdate_34404C29" + "path": "root/Default/Default/Bucket/onupdate/Default", + "uniqueId": "Bucket_onupdate_658D07E4" } }, - "name": "onupdate-c8223d47" + "name": "onupdate-c83c8809" } }, "aws_sns_topic_policy": { - "cloudBucket_oncreate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_C1C190D3": { + "Bucket_oncreate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_E0552A1A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate/PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447", - "uniqueId": "cloudBucket_oncreate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_C1C190D3" + "path": "root/Default/Default/Bucket/oncreate/PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a", + "uniqueId": "Bucket_oncreate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_E0552A1A" } }, - "arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}", - "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.cloudBucket.arn}\"}}}]}" + "arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}", + "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.Bucket.arn}\"}}}]}" }, - "cloudBucket_ondelete_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_F136B625": { + "Bucket_ondelete_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_ABACCC4A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete/PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447", - "uniqueId": "cloudBucket_ondelete_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_F136B625" + "path": "root/Default/Default/Bucket/ondelete/PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a", + "uniqueId": "Bucket_ondelete_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_ABACCC4A" } }, - "arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}", - "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.cloudBucket.arn}\"}}}]}" + "arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}", + "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.Bucket.arn}\"}}}]}" }, - "cloudBucket_onupdate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_76578151": { + "Bucket_onupdate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_CFB72F4E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate/PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447", - "uniqueId": "cloudBucket_onupdate_PublishPermission-c87175e7bebeddc2b07a15f76241cf54a4d755b447_76578151" + "path": "root/Default/Default/Bucket/onupdate/PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a", + "uniqueId": "Bucket_onupdate_PublishPermission-c88fdc5f491a51d8438235500a4821fbc31357ca3a_CFB72F4E" } }, - "arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}", - "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.cloudBucket.arn}\"}}}]}" + "arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}", + "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.Bucket_onupdate_658D07E4.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.Bucket.arn}\"}}}]}" } }, "aws_sns_topic_subscription": { - "cloudBucket_oncreate_TopicSubscription0_EFE36EE4": { + "Bucket_oncreate_TopicSubscription0_02705B37": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate/TopicSubscription0", - "uniqueId": "cloudBucket_oncreate_TopicSubscription0_EFE36EE4" + "path": "root/Default/Default/Bucket/oncreate/TopicSubscription0", + "uniqueId": "Bucket_oncreate_TopicSubscription0_02705B37" } }, - "endpoint": "${aws_lambda_function.cloudBucket_oncreate-OnMessage0_0B1CA993.arn}", + "endpoint": "${aws_lambda_function.Bucket_oncreate-OnMessage0_64FDCB47.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}" + "topic_arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}" }, - "cloudBucket_oncreate_TopicSubscription1_EF79F340": { + "Bucket_oncreate_TopicSubscription1_CAD043F1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/oncreate/TopicSubscription1", - "uniqueId": "cloudBucket_oncreate_TopicSubscription1_EF79F340" + "path": "root/Default/Default/Bucket/oncreate/TopicSubscription1", + "uniqueId": "Bucket_oncreate_TopicSubscription1_CAD043F1" } }, - "endpoint": "${aws_lambda_function.cloudBucket_oncreate-OnMessage1_46B1E9AC.arn}", + "endpoint": "${aws_lambda_function.Bucket_oncreate-OnMessage1_BC956365.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_oncreate_BF58CCF3.arn}" + "topic_arn": "${aws_sns_topic.Bucket_oncreate_05DB4E53.arn}" }, - "cloudBucket_ondelete_TopicSubscription0_F0771109": { + "Bucket_ondelete_TopicSubscription0_4F3E33C7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete/TopicSubscription0", - "uniqueId": "cloudBucket_ondelete_TopicSubscription0_F0771109" + "path": "root/Default/Default/Bucket/ondelete/TopicSubscription0", + "uniqueId": "Bucket_ondelete_TopicSubscription0_4F3E33C7" } }, - "endpoint": "${aws_lambda_function.cloudBucket_ondelete-OnMessage0_31BC8C5B.arn}", + "endpoint": "${aws_lambda_function.Bucket_ondelete-OnMessage0_31A1E9E4.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}" + "topic_arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}" }, - "cloudBucket_ondelete_TopicSubscription1_012F51D5": { + "Bucket_ondelete_TopicSubscription1_575AD2C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/ondelete/TopicSubscription1", - "uniqueId": "cloudBucket_ondelete_TopicSubscription1_012F51D5" + "path": "root/Default/Default/Bucket/ondelete/TopicSubscription1", + "uniqueId": "Bucket_ondelete_TopicSubscription1_575AD2C4" } }, - "endpoint": "${aws_lambda_function.cloudBucket_ondelete-OnMessage1_97EDDB9C.arn}", + "endpoint": "${aws_lambda_function.Bucket_ondelete-OnMessage1_5BBC7743.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_ondelete_5C7719AC.arn}" + "topic_arn": "${aws_sns_topic.Bucket_ondelete_7F3A2B6C.arn}" }, - "cloudBucket_onupdate_TopicSubscription0_C5A4C94D": { + "Bucket_onupdate_TopicSubscription0_7ED55DE3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate/TopicSubscription0", - "uniqueId": "cloudBucket_onupdate_TopicSubscription0_C5A4C94D" + "path": "root/Default/Default/Bucket/onupdate/TopicSubscription0", + "uniqueId": "Bucket_onupdate_TopicSubscription0_7ED55DE3" } }, - "endpoint": "${aws_lambda_function.cloudBucket_onupdate-OnMessage0_7E23A21E.arn}", + "endpoint": "${aws_lambda_function.Bucket_onupdate-OnMessage0_2FBE69C5.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}" + "topic_arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}" }, - "cloudBucket_onupdate_TopicSubscription1_257D0F81": { + "Bucket_onupdate_TopicSubscription1_8652ABA3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/onupdate/TopicSubscription1", - "uniqueId": "cloudBucket_onupdate_TopicSubscription1_257D0F81" + "path": "root/Default/Default/Bucket/onupdate/TopicSubscription1", + "uniqueId": "Bucket_onupdate_TopicSubscription1_8652ABA3" } }, - "endpoint": "${aws_lambda_function.cloudBucket_onupdate-OnMessage1_AD4C1239.arn}", + "endpoint": "${aws_lambda_function.Bucket_onupdate-OnMessage1_DDC08FAE.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudBucket_onupdate_34404C29.arn}" + "topic_arn": "${aws_sns_topic.Bucket_onupdate_658D07E4.arn}" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_compile_tf-aws.md index 513efaf3612..6c160682628 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/exists.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_compile_tf-aws.md index be6de0f8579..ee3ae6ed087 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/get.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_compile_tf-aws.md index 426268cd776..f95c803b170 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/load_test.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_compile_tf-aws.md index 682aa53622e..ebe3bc13b71 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/metadata.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_compile_tf-aws.md index eb54f11832e..b7d5f0c24cf 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_compile_tf-aws.md index 7f5eddfe08c..ac7d745cd28 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/put_json.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_compile_tf-aws.md index 37d315a84fb..ec66ecf7068 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/rename.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_compile_tf-aws.md index 9f9a637500d..6001289d985 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md index 7077ec09dc1..d4444e5eb1f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/signed_url.test.w_test_sim.md @@ -2,7 +2,7 @@ ## stdout.log ```log -Error: Resource root/env0/cloud.Bucket does not support inflight operation signedUrl. +Error: Resource root/env0/Bucket does not support inflight operation signedUrl. It might not be implemented yet. diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_compile_tf-aws.md index 690d973f74e..2fa8598b48c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_delete.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_compile_tf-aws.md index 53de4cbf25f..df48dc834e2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_compile_tf-aws.md index 1c2a3f51586..ca4e8be7014 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/bucket/try_get_json.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_compile_tf-aws.md index 8dfd903e125..74e68f778f2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/counter/peek.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/global-secondary-index.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/global-secondary-index.test.w_compile_tf-aws.md index ca9212d54a0..77bc788ebb9 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/global-secondary-index.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/global-secondary-index.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "blog2": { + "DynamodbTable": { "//": { "metadata": { - "path": "root/Default/Default/blog2/Default", - "uniqueId": "blog2" + "path": "root/Default/Default/DynamodbTable/Default", + "uniqueId": "DynamodbTable" } }, "attribute": [ @@ -33,25 +33,30 @@ { "name": "id", "type": "S" + }, + { + "name": "createdAt", + "type": "N" } ], "billing_mode": "PAY_PER_REQUEST", "global_secondary_index": [ { "hash_key": "type", - "name": "TypeIndex", - "projection_type": "ALL" + "name": "CreatedAtIndex", + "projection_type": "ALL", + "range_key": "createdAt" } ], "hash_key": "type", - "name": "blog2blog2-c861757e", + "name": "blogDynamodbTable-c84d1506", "range_key": "id" }, - "exDynamodbTable": { + "blog2": { "//": { "metadata": { - "path": "root/Default/Default/ex.DynamodbTable/Default", - "uniqueId": "exDynamodbTable" + "path": "root/Default/Default/blog2/Default", + "uniqueId": "blog2" } }, "attribute": [ @@ -62,23 +67,18 @@ { "name": "id", "type": "S" - }, - { - "name": "createdAt", - "type": "N" } ], "billing_mode": "PAY_PER_REQUEST", "global_secondary_index": [ { "hash_key": "type", - "name": "CreatedAtIndex", - "projection_type": "ALL", - "range_key": "createdAt" + "name": "TypeIndex", + "projection_type": "ALL" } ], "hash_key": "type", - "name": "blogex.DynamodbTable-c8d9b5e7", + "name": "blog2blog2-c861757e", "range_key": "id" } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/query.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/query.test.w_compile_tf-aws.md index c9da4b93b9e..bbedc13c750 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/query.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/query.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exDynamodbTable": { + "DynamodbTable": { "//": { "metadata": { - "path": "root/Default/Default/ex.DynamodbTable/Default", - "uniqueId": "exDynamodbTable" + "path": "root/Default/Default/DynamodbTable/Default", + "uniqueId": "DynamodbTable" } }, "attribute": [ @@ -37,7 +37,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "k1", - "name": "test1ex.DynamodbTable-c8d9b5e7", + "name": "test1DynamodbTable-c84d1506", "range_key": "k2" } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/transaction.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/transaction.test.w_compile_tf-aws.md index 361c92effe3..0f52f912c13 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/transaction.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/dynamodb-table/transaction.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exDynamodbTable": { + "DynamodbTable": { "//": { "metadata": { - "path": "root/Default/Default/ex.DynamodbTable/Default", - "uniqueId": "exDynamodbTable" + "path": "root/Default/Default/DynamodbTable/Default", + "uniqueId": "DynamodbTable" } }, "attribute": [ @@ -37,7 +37,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "k1", - "name": "test1ex.DynamodbTable-c8d9b5e7", + "name": "test1DynamodbTable-c84d1506", "range_key": "k2" } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_compile_tf-aws.md index 6a218f48108..558271074a4 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/endpoint/url.test.w_compile_tf-aws.md @@ -13,13 +13,13 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } }, - "cloud.Endpoint": { - "Url": "cloudEndpoint_Url_824C5F1B" + "Endpoint": { + "Url": "Endpoint_Url_8925A732" } } } @@ -49,11 +49,11 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" }, - "cloudEndpoint_Url_824C5F1B": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Endpoint_Url_8925A732": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -63,103 +63,103 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c8ca9349/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c86d29bb/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_0_CloudwatchLogGroup_9D02C16C": { + "Api_get_0_CloudwatchLogGroup_196DE719": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_0_CloudwatchLogGroup_9D02C16C" + "path": "root/Default/Default/Api/get_0/CloudwatchLogGroup", + "uniqueId": "Api_get_0_CloudwatchLogGroup_196DE719" } }, - "name": "/aws/lambda/get_0-c8ca9349", + "name": "/aws/lambda/get_0-c86d29bb", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_0_IamRole_111BBD82": { + "Api_get_0_IamRole_2FAC475D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRole", - "uniqueId": "cloudApi_get_0_IamRole_111BBD82" + "path": "root/Default/Default/Api/get_0/IamRole", + "uniqueId": "Api_get_0_IamRole_2FAC475D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_0_IamRolePolicy_6778B83A": { + "Api_get_0_IamRolePolicy_D9FB373B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicy", - "uniqueId": "cloudApi_get_0_IamRolePolicy_6778B83A" + "path": "root/Default/Default/Api/get_0/IamRolePolicy", + "uniqueId": "Api_get_0_IamRolePolicy_D9FB373B" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_0_IamRolePolicyAttachment_1A88E668": { + "Api_get_0_IamRolePolicyAttachment_AEF1DC01": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_0_IamRolePolicyAttachment_1A88E668" + "path": "root/Default/Default/Api/get_0/IamRolePolicyAttachment", + "uniqueId": "Api_get_0_IamRolePolicyAttachment_AEF1DC01" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_lambda_function": { - "cloudApi_get_0_B857C178": { + "Api_get_0_244A7BA4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/Default", - "uniqueId": "cloudApi_get_0_B857C178" + "path": "root/Default/Default/Api/get_0/Default", + "uniqueId": "Api_get_0_244A7BA4" } }, "architectures": [ @@ -168,18 +168,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_0-c8ca9349", + "WING_FUNCTION_NAME": "get_0-c86d29bb", "WING_TARGET": "tf-aws" } }, - "function_name": "get_0-c8ca9349", + "function_name": "get_0-c86d29bb", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.arn}", + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_0_S3Object_67E48DD4.key}", + "s3_key": "${aws_s3_object.Api_get_0_S3Object_D1844823.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -188,17 +188,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89": { + "Api_api_permission-GET-c2e3ffa8_5BF93889": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-c2e3ffa8", - "uniqueId": "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89" + "path": "root/Default/Default/Api/api/permission-GET-c2e3ffa8", + "uniqueId": "Api_api_permission-GET-c2e3ffa8_5BF93889" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_0_B857C178.function_name}", + "function_name": "${aws_lambda_function.Api_get_0_244A7BA4.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/", "statement_id": "AllowExecutionFromAPIGateway-GET-c2e3ffa8" } }, @@ -214,11 +214,11 @@ } }, "aws_s3_object": { - "cloudApi_get_0_S3Object_67E48DD4": { + "Api_get_0_S3Object_D1844823": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/S3Object", - "uniqueId": "cloudApi_get_0_S3Object_67E48DD4" + "path": "root/Default/Default/Api/get_0/S3Object", + "uniqueId": "Api_get_0_S3Object_D1844823" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_compile_tf-aws.md new file mode 100644 index 00000000000..e18a196c5f3 --- /dev/null +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_compile_tf-aws.md @@ -0,0 +1,21 @@ +# [concurrency.test.w](../../../../../../examples/tests/sdk_tests/function/concurrency.test.w) | compile | tf-aws + +## main.tf.json +```json +{ + "//": { + "metadata": { + "backend": "local", + "stackName": "root", + "version": "0.20.3" + }, + "outputs": {} + }, + "provider": { + "aws": [ + {} + ] + } +} +``` + diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md new file mode 100644 index 00000000000..88532cc5473 --- /dev/null +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/concurrency.test.w_test_sim.md @@ -0,0 +1,14 @@ +# [concurrency.test.w](../../../../../../examples/tests/sdk_tests/function/concurrency.test.w) | test | sim + +## stdout.log +```log +pass ─ concurrency.test.wsim » root/env0/test:f1 concurrency limit reached +pass ┌ concurrency.test.wsim » root/env1/test:queue applies backpressure to functions with limited concurrency + └ c: 3 + + +Tests 2 passed (2) +Test Files 1 passed (1) +Duration +``` + diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_compile_tf-aws.md index a5a24661737..dcc67738bc2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/env.test.w_compile_tf-aws.md @@ -18,58 +18,58 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -80,18 +80,18 @@ "FOO1": "bar", "FOO2": "baz", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -111,11 +111,11 @@ } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_compile_tf-aws.md index d8325f9f7a6..9596a7ffdef 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 }, "f2_CloudwatchLogGroup_D231AE41": { @@ -50,11 +50,11 @@ } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" @@ -79,15 +79,15 @@ } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, "f2_IamRolePolicy_4B68F2E2": { "//": { @@ -111,15 +111,15 @@ } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, "f2_IamRolePolicyAttachment_E65452F9": { "//": { @@ -143,11 +143,11 @@ } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -156,18 +156,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -249,11 +249,11 @@ } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_compile_tf-aws.md index 5a3eb80329f..4c068818e22 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/invoke_async.test.w_compile_tf-aws.md @@ -18,23 +18,23 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -45,50 +45,50 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -96,20 +96,20 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -129,11 +129,11 @@ } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_compile_tf-aws.md index 603d3682b92..0b3aa6739d6 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/function/memory_and_env.test.w_compile_tf-aws.md @@ -40,11 +40,11 @@ } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -55,7 +55,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { @@ -86,7 +86,7 @@ "uniqueId": "envfn_IamRolePolicy_63955289" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.envfn_IamRole_88E952E6.name}" }, "memoryfn_IamRolePolicy_5DA20EF5": { @@ -96,7 +96,7 @@ "uniqueId": "memoryfn_IamRolePolicy_5DA20EF5" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.memoryfn_IamRole_87751238.name}" } }, @@ -135,7 +135,7 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "env-fn-c8a226dd", "WING_TARGET": "tf-aws", @@ -169,7 +169,7 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "memory-fn-c844bdf7", "WING_TARGET": "tf-aws" @@ -191,24 +191,24 @@ } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_compile_tf-aws.md index 6a3b3fd52ad..f3daa02bf13 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/http/fetch.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,142 +57,142 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/redirect\":{\"get\":{\"operationId\":\"get-redirect\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_redirect0-c80b05b9/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/target\":{\"get\":{\"operationId\":\"get-target\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_target0-c829fcc5/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/redirect\":{\"get\":{\"operationId\":\"get-redirect\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_redirect0-c8014f2b/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/target\":{\"get\":{\"operationId\":\"get-target\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_target0-c8691704/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_redirect0_CloudwatchLogGroup_090FF4BA": { + "Api_get_redirect0_CloudwatchLogGroup_241B5139": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_redirect0_CloudwatchLogGroup_090FF4BA" + "path": "root/Default/Default/Api/get_redirect0/CloudwatchLogGroup", + "uniqueId": "Api_get_redirect0_CloudwatchLogGroup_241B5139" } }, - "name": "/aws/lambda/get_redirect0-c80b05b9", + "name": "/aws/lambda/get_redirect0-c8014f2b", "retention_in_days": 30 }, - "cloudApi_get_target0_CloudwatchLogGroup_D804A722": { + "Api_get_target0_CloudwatchLogGroup_7566BF70": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_target0_CloudwatchLogGroup_D804A722" + "path": "root/Default/Default/Api/get_target0/CloudwatchLogGroup", + "uniqueId": "Api_get_target0_CloudwatchLogGroup_7566BF70" } }, - "name": "/aws/lambda/get_target0-c829fcc5", + "name": "/aws/lambda/get_target0-c8691704", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_redirect0_IamRole_4CE147E2": { + "Api_get_redirect0_IamRole_C9E5BF5A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/IamRole", - "uniqueId": "cloudApi_get_redirect0_IamRole_4CE147E2" + "path": "root/Default/Default/Api/get_redirect0/IamRole", + "uniqueId": "Api_get_redirect0_IamRole_C9E5BF5A" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_target0_IamRole_88D877F6": { + "Api_get_target0_IamRole_865D04CC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/IamRole", - "uniqueId": "cloudApi_get_target0_IamRole_88D877F6" + "path": "root/Default/Default/Api/get_target0/IamRole", + "uniqueId": "Api_get_target0_IamRole_865D04CC" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_redirect0_IamRolePolicy_698DEE73": { + "Api_get_redirect0_IamRolePolicy_63A30C78": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/IamRolePolicy", - "uniqueId": "cloudApi_get_redirect0_IamRolePolicy_698DEE73" + "path": "root/Default/Default/Api/get_redirect0/IamRolePolicy", + "uniqueId": "Api_get_redirect0_IamRolePolicy_63A30C78" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_get_redirect0_IamRole_4CE147E2.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_get_redirect0_IamRole_C9E5BF5A.name}" }, - "cloudApi_get_target0_IamRolePolicy_382AEF42": { + "Api_get_target0_IamRolePolicy_575248B9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/IamRolePolicy", - "uniqueId": "cloudApi_get_target0_IamRolePolicy_382AEF42" + "path": "root/Default/Default/Api/get_target0/IamRolePolicy", + "uniqueId": "Api_get_target0_IamRolePolicy_575248B9" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_target0_IamRole_88D877F6.name}" + "role": "${aws_iam_role.Api_get_target0_IamRole_865D04CC.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_redirect0_IamRolePolicyAttachment_CAE36443": { + "Api_get_redirect0_IamRolePolicyAttachment_5ABDB8D1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_redirect0_IamRolePolicyAttachment_CAE36443" + "path": "root/Default/Default/Api/get_redirect0/IamRolePolicyAttachment", + "uniqueId": "Api_get_redirect0_IamRolePolicyAttachment_5ABDB8D1" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_redirect0_IamRole_4CE147E2.name}" + "role": "${aws_iam_role.Api_get_redirect0_IamRole_C9E5BF5A.name}" }, - "cloudApi_get_target0_IamRolePolicyAttachment_1695CE06": { + "Api_get_target0_IamRolePolicyAttachment_6DA6B250": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_target0_IamRolePolicyAttachment_1695CE06" + "path": "root/Default/Default/Api/get_target0/IamRolePolicyAttachment", + "uniqueId": "Api_get_target0_IamRolePolicyAttachment_6DA6B250" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_target0_IamRole_88D877F6.name}" + "role": "${aws_iam_role.Api_get_target0_IamRole_865D04CC.name}" } }, "aws_lambda_function": { - "cloudApi_get_redirect0_43C4892F": { + "Api_get_redirect0_61A02C26": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/Default", - "uniqueId": "cloudApi_get_redirect0_43C4892F" + "path": "root/Default/Default/Api/get_redirect0/Default", + "uniqueId": "Api_get_redirect0_61A02C26" } }, "architectures": [ @@ -200,31 +200,31 @@ ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_redirect0-c80b05b9", + "WING_FUNCTION_NAME": "get_redirect0-c8014f2b", "WING_TARGET": "tf-aws" } }, - "function_name": "get_redirect0-c80b05b9", + "function_name": "get_redirect0-c8014f2b", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_redirect0_IamRole_4CE147E2.arn}", + "role": "${aws_iam_role.Api_get_redirect0_IamRole_C9E5BF5A.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_redirect0_S3Object_DF4A7DAF.key}", + "s3_key": "${aws_s3_object.Api_get_redirect0_S3Object_16202317.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_target0_6FD7500E": { + "Api_get_target0_6A24458B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/Default", - "uniqueId": "cloudApi_get_target0_6FD7500E" + "path": "root/Default/Default/Api/get_target0/Default", + "uniqueId": "Api_get_target0_6A24458B" } }, "architectures": [ @@ -233,18 +233,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_target0-c829fcc5", + "WING_FUNCTION_NAME": "get_target0-c8691704", "WING_TARGET": "tf-aws" } }, - "function_name": "get_target0-c829fcc5", + "function_name": "get_target0-c8691704", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_target0_IamRole_88D877F6.arn}", + "role": "${aws_iam_role.Api_get_target0_IamRole_865D04CC.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_target0_S3Object_A6AC5D23.key}", + "s3_key": "${aws_s3_object.Api_get_target0_S3Object_0643C629.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -253,86 +253,86 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-163e950c_E222C78F": { + "Api_api_permission-GET-163e950c_45F5C5BB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-163e950c", - "uniqueId": "cloudApi_api_permission-GET-163e950c_E222C78F" + "path": "root/Default/Default/Api/api/permission-GET-163e950c", + "uniqueId": "Api_api_permission-GET-163e950c_45F5C5BB" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_redirect0_43C4892F.function_name}", + "function_name": "${aws_lambda_function.Api_get_redirect0_61A02C26.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/redirect", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/redirect", "statement_id": "AllowExecutionFromAPIGateway-GET-163e950c" }, - "cloudApi_api_permission-GET-5fe9bc05_21C70546": { + "Api_api_permission-GET-5fe9bc05_7EDAB6BF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-5fe9bc05", - "uniqueId": "cloudApi_api_permission-GET-5fe9bc05_21C70546" + "path": "root/Default/Default/Api/api/permission-GET-5fe9bc05", + "uniqueId": "Api_api_permission-GET-5fe9bc05_7EDAB6BF" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_target0_6FD7500E.function_name}", + "function_name": "${aws_lambda_function.Api_get_target0_6A24458B.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/target", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/target", "statement_id": "AllowExecutionFromAPIGateway-GET-5fe9bc05" } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "cloudApi_get_redirect0_S3Object_DF4A7DAF": { + "Api_get_redirect0_S3Object_16202317": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_redirect0/S3Object", - "uniqueId": "cloudApi_get_redirect0_S3Object_DF4A7DAF" + "path": "root/Default/Default/Api/get_redirect0/S3Object", + "uniqueId": "Api_get_redirect0_S3Object_16202317" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_target0_S3Object_A6AC5D23": { + "Api_get_target0_S3Object_0643C629": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_target0/S3Object", - "uniqueId": "cloudApi_get_target0_S3Object_A6AC5D23" + "path": "root/Default/Default/Api/get_target0/S3Object", + "uniqueId": "Api_get_target0_S3Object_0643C629" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudBucket_S3Object-urltxt_186C27E6": { + "Bucket_S3Object-urltxt_54506D60": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/S3Object-url.txt", - "uniqueId": "cloudBucket_S3Object-urltxt_186C27E6" + "path": "root/Default/Default/Bucket/S3Object-url.txt", + "uniqueId": "Bucket_S3Object-urltxt_54506D60" } }, - "bucket": "${aws_s3_bucket.cloudBucket.bucket}", - "content": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}", + "bucket": "${aws_s3_bucket.Bucket.bucket}", + "content": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}", "key": "url.txt" } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_compile_tf-aws.md index 79565a406ce..e9a3f061e97 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/misc/empty-actions.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -46,8 +46,8 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -57,142 +57,142 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/foo\":{\"get\":{\"operationId\":\"get-foo\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_foo0-c857c617/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/bar\":{\"get\":{\"operationId\":\"get-bar\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_bar0-c860413a/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/foo\":{\"get\":{\"operationId\":\"get-foo\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_foo0-c8fedbc0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/bar\":{\"get\":{\"operationId\":\"get-bar\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_bar0-c8c593ee/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_bar0_CloudwatchLogGroup_62F08B62": { + "Api_get_bar0_CloudwatchLogGroup_94D5A69E": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_bar0_CloudwatchLogGroup_62F08B62" + "path": "root/Default/Default/Api/get_bar0/CloudwatchLogGroup", + "uniqueId": "Api_get_bar0_CloudwatchLogGroup_94D5A69E" } }, - "name": "/aws/lambda/get_bar0-c860413a", + "name": "/aws/lambda/get_bar0-c8c593ee", "retention_in_days": 30 }, - "cloudApi_get_foo0_CloudwatchLogGroup_A3B51365": { + "Api_get_foo0_CloudwatchLogGroup_DB4D118A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_foo0_CloudwatchLogGroup_A3B51365" + "path": "root/Default/Default/Api/get_foo0/CloudwatchLogGroup", + "uniqueId": "Api_get_foo0_CloudwatchLogGroup_DB4D118A" } }, - "name": "/aws/lambda/get_foo0-c857c617", + "name": "/aws/lambda/get_foo0-c8fedbc0", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_bar0_IamRole_55C24513": { + "Api_get_bar0_IamRole_0AE7D598": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/IamRole", - "uniqueId": "cloudApi_get_bar0_IamRole_55C24513" + "path": "root/Default/Default/Api/get_bar0/IamRole", + "uniqueId": "Api_get_bar0_IamRole_0AE7D598" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_foo0_IamRole_54682B1A": { + "Api_get_foo0_IamRole_B1AE8E5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRole", - "uniqueId": "cloudApi_get_foo0_IamRole_54682B1A" + "path": "root/Default/Default/Api/get_foo0/IamRole", + "uniqueId": "Api_get_foo0_IamRole_B1AE8E5D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_bar0_IamRolePolicy_5C1EB16B": { + "Api_get_bar0_IamRolePolicy_7133AAD7": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/IamRolePolicy", - "uniqueId": "cloudApi_get_bar0_IamRolePolicy_5C1EB16B" + "path": "root/Default/Default/Api/get_bar0/IamRolePolicy", + "uniqueId": "Api_get_bar0_IamRolePolicy_7133AAD7" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_bar0_IamRole_55C24513.name}" + "role": "${aws_iam_role.Api_get_bar0_IamRole_0AE7D598.name}" }, - "cloudApi_get_foo0_IamRolePolicy_5FEC283C": { + "Api_get_foo0_IamRolePolicy_F8C7A0FA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRolePolicy", - "uniqueId": "cloudApi_get_foo0_IamRolePolicy_5FEC283C" + "path": "root/Default/Default/Api/get_foo0/IamRolePolicy", + "uniqueId": "Api_get_foo0_IamRolePolicy_F8C7A0FA" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.A_cloudBucket_DFCC9367.arn}\",\"${aws_s3_bucket.A_cloudBucket_DFCC9367.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.A_Bucket_EB05527C.arn}\",\"${aws_s3_bucket.A_Bucket_EB05527C.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_bar0_IamRolePolicyAttachment_8D978EBA": { + "Api_get_bar0_IamRolePolicyAttachment_879A7521": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_bar0_IamRolePolicyAttachment_8D978EBA" + "path": "root/Default/Default/Api/get_bar0/IamRolePolicyAttachment", + "uniqueId": "Api_get_bar0_IamRolePolicyAttachment_879A7521" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_bar0_IamRole_55C24513.name}" + "role": "${aws_iam_role.Api_get_bar0_IamRole_0AE7D598.name}" }, - "cloudApi_get_foo0_IamRolePolicyAttachment_1ACDC421": { + "Api_get_foo0_IamRolePolicyAttachment_1ED86FF6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_foo0_IamRolePolicyAttachment_1ACDC421" + "path": "root/Default/Default/Api/get_foo0/IamRolePolicyAttachment", + "uniqueId": "Api_get_foo0_IamRolePolicyAttachment_1ED86FF6" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.name}" + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.name}" } }, "aws_lambda_function": { - "cloudApi_get_bar0_15FE1B0A": { + "Api_get_bar0_28E127E8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/Default", - "uniqueId": "cloudApi_get_bar0_15FE1B0A" + "path": "root/Default/Default/Api/get_bar0/Default", + "uniqueId": "Api_get_bar0_28E127E8" } }, "architectures": [ @@ -200,31 +200,31 @@ ], "environment": { "variables": { - "BUCKET_NAME_5c35566c": "${aws_s3_bucket.A_cloudBucket_DFCC9367.bucket}", + "BUCKET_NAME_8cb07fb3": "${aws_s3_bucket.A_Bucket_EB05527C.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_bar0-c860413a", + "WING_FUNCTION_NAME": "get_bar0-c8c593ee", "WING_TARGET": "tf-aws" } }, - "function_name": "get_bar0-c860413a", + "function_name": "get_bar0-c8c593ee", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_bar0_IamRole_55C24513.arn}", + "role": "${aws_iam_role.Api_get_bar0_IamRole_0AE7D598.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_bar0_S3Object_F8EFFEAE.key}", + "s3_key": "${aws_s3_object.Api_get_bar0_S3Object_CBF78AB9.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_foo0_8DAB9111": { + "Api_get_foo0_2DF5B57F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/Default", - "uniqueId": "cloudApi_get_foo0_8DAB9111" + "path": "root/Default/Default/Api/get_foo0/Default", + "uniqueId": "Api_get_foo0_2DF5B57F" } }, "architectures": [ @@ -232,20 +232,20 @@ ], "environment": { "variables": { - "BUCKET_NAME_5c35566c": "${aws_s3_bucket.A_cloudBucket_DFCC9367.bucket}", + "BUCKET_NAME_8cb07fb3": "${aws_s3_bucket.A_Bucket_EB05527C.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_foo0-c857c617", + "WING_FUNCTION_NAME": "get_foo0-c8fedbc0", "WING_TARGET": "tf-aws" } }, - "function_name": "get_foo0-c857c617", + "function_name": "get_foo0-c8fedbc0", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.arn}", + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_foo0_S3Object_5B231348.key}", + "s3_key": "${aws_s3_object.Api_get_foo0_S3Object_A8BEB597.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -254,42 +254,42 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-2d589ee9_3D8411D8": { + "Api_api_permission-GET-2d589ee9_E7DEBAD5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-2d589ee9", - "uniqueId": "cloudApi_api_permission-GET-2d589ee9_3D8411D8" + "path": "root/Default/Default/Api/api/permission-GET-2d589ee9", + "uniqueId": "Api_api_permission-GET-2d589ee9_E7DEBAD5" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_bar0_15FE1B0A.function_name}", + "function_name": "${aws_lambda_function.Api_get_bar0_28E127E8.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/bar", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/bar", "statement_id": "AllowExecutionFromAPIGateway-GET-2d589ee9" }, - "cloudApi_api_permission-GET-4273ae49_974F3EC5": { + "Api_api_permission-GET-4273ae49_725CFBAA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-4273ae49", - "uniqueId": "cloudApi_api_permission-GET-4273ae49_974F3EC5" + "path": "root/Default/Default/Api/api/permission-GET-4273ae49", + "uniqueId": "Api_api_permission-GET-4273ae49_725CFBAA" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_foo0_8DAB9111.function_name}", + "function_name": "${aws_lambda_function.Api_get_foo0_2DF5B57F.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/foo", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/foo", "statement_id": "AllowExecutionFromAPIGateway-GET-4273ae49" } }, "aws_s3_bucket": { - "A_cloudBucket_DFCC9367": { + "A_Bucket_EB05527C": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Bucket/Default", - "uniqueId": "A_cloudBucket_DFCC9367" + "path": "root/Default/Default/A/Bucket/Default", + "uniqueId": "A_Bucket_EB05527C" } }, - "bucket_prefix": "cloud-bucket-c8eec589-", + "bucket_prefix": "bucket-c8e1d537-", "force_destroy": false }, "Code": { @@ -303,22 +303,22 @@ } }, "aws_s3_object": { - "cloudApi_get_bar0_S3Object_F8EFFEAE": { + "Api_get_bar0_S3Object_CBF78AB9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_bar0/S3Object", - "uniqueId": "cloudApi_get_bar0_S3Object_F8EFFEAE" + "path": "root/Default/Default/Api/get_bar0/S3Object", + "uniqueId": "Api_get_bar0_S3Object_CBF78AB9" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_foo0_S3Object_5B231348": { + "Api_get_foo0_S3Object_A8BEB597": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/S3Object", - "uniqueId": "cloudApi_get_foo0_S3Object_5B231348" + "path": "root/Default/Default/Api/get_foo0/S3Object", + "uniqueId": "Api_get_foo0_S3Object_A8BEB597" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_compile_tf-aws.md index adf4eac2969..c0393e01129 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/on_deploy/execute_after.test.w_compile_tf-aws.md @@ -74,11 +74,11 @@ } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -89,7 +89,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { @@ -120,7 +120,7 @@ "uniqueId": "init1_Function_IamRolePolicy_19694F39" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.init1_Function_IamRole_3B884CB0.name}" }, "init2_Function_IamRolePolicy_BC283A7E": { @@ -130,7 +130,7 @@ "uniqueId": "init2_Function_IamRolePolicy_BC283A7E" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.init2_Function_IamRole_A05B341B.name}" } }, @@ -169,7 +169,7 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "Function-c899c2a8", "WING_TARGET": "tf-aws" @@ -201,7 +201,7 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "Function-c86c3d88", "WING_TARGET": "tf-aws" diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_compile_tf-aws.md index 0ada1b92db9..f688c872133 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/pop.test.w_compile_tf-aws.md @@ -18,15 +18,15 @@ }, "resource": { "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 3 } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_compile_tf-aws.md index ca874587b6f..5a16918438b 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/purge.test.w_compile_tf-aws.md @@ -18,15 +18,15 @@ }, "resource": { "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_compile_tf-aws.md index 8c6ddad5a80..f70ffc92a1f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/push.test.w_compile_tf-aws.md @@ -18,15 +18,15 @@ }, "resource": { "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_compile_tf-aws.md index 734609f36ef..61c408281a5 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/retention_period.main.w_compile_tf-aws.md @@ -18,15 +18,15 @@ }, "resource": { "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 60, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_compile_tf-aws.md index 45a49669b30..49733defe43 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/queue/set_consumer.test.w_compile_tf-aws.md @@ -18,23 +18,23 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -45,63 +45,63 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -109,21 +109,21 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] @@ -142,11 +142,11 @@ } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -155,15 +155,15 @@ } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_compile_tf-aws.md index 2a2a4535a5f..1e68df87e0e 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/array.test.w_compile_tf-aws.md @@ -18,14 +18,14 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false }, "myBucket": { diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_compile_tf-aws.md index 370896207e5..49526bce222 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/std/node.test.w_compile_tf-aws.md @@ -18,24 +18,24 @@ }, "resource": { "aws_s3_bucket": { - "SingletonBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/SingletonBucket/Default", - "uniqueId": "SingletonBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "singletonbucket-c8ac9620-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false }, - "cloudBucket": { + "SingletonBucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/SingletonBucket/Default", + "uniqueId": "SingletonBucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "singletonbucket-c8ac9620-", "force_destroy": false } }, diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_compile_tf-aws.md index 2a6c10b2a19..27da3eb1c30 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/add_row.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,34 +33,34 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "name", - "name": "usersex.Table-c840a49c", + "name": "usersTable-c89b2d37", "point_in_time_recovery": { "enabled": true } } }, "aws_dynamodb_table_item": { - "exTable_DynamodbTableItem-mario_1CD163AB": { + "Table_DynamodbTableItem-mario_6E16BC1F": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/DynamodbTableItem-mario", - "uniqueId": "exTable_DynamodbTableItem-mario_1CD163AB" + "path": "root/Default/Default/Table/DynamodbTableItem-mario", + "uniqueId": "Table_DynamodbTableItem-mario_6E16BC1F" } }, - "hash_key": "${aws_dynamodb_table.exTable.hash_key}", + "hash_key": "${aws_dynamodb_table.Table.hash_key}", "item": "{\"name\":{\"S\":\"mario\"},\"gender\":{\"S\":\"male\"},\"role\":{\"S\":\"plumber\"}}", - "table_name": "${aws_dynamodb_table.exTable.name}" + "table_name": "${aws_dynamodb_table.Table.name}" }, - "exTable_DynamodbTableItem-peach_C3D57BF1": { + "Table_DynamodbTableItem-peach_FD7A7AE1": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/DynamodbTableItem-peach", - "uniqueId": "exTable_DynamodbTableItem-peach_C3D57BF1" + "path": "root/Default/Default/Table/DynamodbTableItem-peach", + "uniqueId": "Table_DynamodbTableItem-peach_FD7A7AE1" } }, - "hash_key": "${aws_dynamodb_table.exTable.hash_key}", + "hash_key": "${aws_dynamodb_table.Table.hash_key}", "item": "{\"name\":{\"S\":\"peach\"},\"gender\":{\"S\":\"female\"},\"role\":{\"S\":\"princess\"}}", - "table_name": "${aws_dynamodb_table.exTable.name}" + "table_name": "${aws_dynamodb_table.Table.name}" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_compile_tf-aws.md index 5880c1a22fa..b1285932d9c 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/get.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "name", - "name": "usersex.Table-c840a49c", + "name": "usersTable-c89b2d37", "point_in_time_recovery": { "enabled": true } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_compile_tf-aws.md index 2dba5603cf3..1e43be52fd2 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/list.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "name", - "name": "usersex.Table-c840a49c", + "name": "usersTable-c89b2d37", "point_in_time_recovery": { "enabled": true } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_compile_tf-aws.md index f4d4c22b7b6..aecf17b8a05 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/try_get.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "name", - "name": "usersex.Table-c840a49c", + "name": "usersTable-c89b2d37", "point_in_time_recovery": { "enabled": true } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_compile_tf-aws.md index ed90187917f..7c86738a100 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/table/upsert.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,34 +33,34 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "name", - "name": "usersex.Table-c840a49c", + "name": "usersTable-c89b2d37", "point_in_time_recovery": { "enabled": true } } }, "aws_dynamodb_table_item": { - "exTable_DynamodbTableItem-luigi_6628CD6F": { + "Table_DynamodbTableItem-luigi_46B8F6CB": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/DynamodbTableItem-luigi", - "uniqueId": "exTable_DynamodbTableItem-luigi_6628CD6F" + "path": "root/Default/Default/Table/DynamodbTableItem-luigi", + "uniqueId": "Table_DynamodbTableItem-luigi_46B8F6CB" } }, - "hash_key": "${aws_dynamodb_table.exTable.hash_key}", + "hash_key": "${aws_dynamodb_table.Table.hash_key}", "item": "{\"name\":{\"S\":\"luigi\"},\"gender\":{\"S\":\"male\"},\"role\":{\"S\":\"plumber\"}}", - "table_name": "${aws_dynamodb_table.exTable.name}" + "table_name": "${aws_dynamodb_table.Table.name}" }, - "exTable_DynamodbTableItem-mario_1CD163AB": { + "Table_DynamodbTableItem-mario_6E16BC1F": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/DynamodbTableItem-mario", - "uniqueId": "exTable_DynamodbTableItem-mario_1CD163AB" + "path": "root/Default/Default/Table/DynamodbTableItem-mario", + "uniqueId": "Table_DynamodbTableItem-mario_6E16BC1F" } }, - "hash_key": "${aws_dynamodb_table.exTable.hash_key}", + "hash_key": "${aws_dynamodb_table.Table.hash_key}", "item": "{\"name\":{\"S\":\"mario\"},\"gender\":{\"S\":\"male\"},\"role\":{\"S\":\"plumber\"}}", - "table_name": "${aws_dynamodb_table.exTable.name}" + "table_name": "${aws_dynamodb_table.Table.name}" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_compile_tf-aws.md index 6a64aa0ff7d..394bb49b81f 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/no_blocking.test.w_compile_tf-aws.md @@ -18,23 +18,23 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3": { + "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3" + "path": "root/Default/Default/Topic-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage0-c81c4559", + "name": "/aws/lambda/Topic-OnMessage0-c85d7820", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -45,50 +45,50 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "cloudTopic-OnMessage0_IamRole_A9AB13E2": { + "Topic-OnMessage0_IamRole_64DD36FA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRole", - "uniqueId": "cloudTopic-OnMessage0_IamRole_A9AB13E2" + "path": "root/Default/Default/Topic-OnMessage0/IamRole", + "uniqueId": "Topic-OnMessage0_IamRole_64DD36FA" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F": { + "Topic-OnMessage0_IamRolePolicy_F5EE09D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicy", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicy", + "uniqueId": "Topic-OnMessage0_IamRolePolicy_F5EE09D8" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" } }, "aws_iam_role_policy_attachment": { - "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4": { + "Topic-OnMessage0_IamRolePolicyAttachment_091E665D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Topic-OnMessage0_IamRolePolicyAttachment_091E665D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" } }, "aws_lambda_function": { - "cloudTopic-OnMessage0": { + "Topic-OnMessage0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/Default", - "uniqueId": "cloudTopic-OnMessage0" + "path": "root/Default/Default/Topic-OnMessage0/Default", + "uniqueId": "Topic-OnMessage0" } }, "architectures": [ @@ -96,20 +96,20 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage0-c81c4559", + "WING_FUNCTION_NAME": "Topic-OnMessage0-c85d7820", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage0-c81c4559", + "function_name": "Topic-OnMessage0-c85d7820", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.arn}", + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudTopic-OnMessage0_S3Object_751FA064.key}", + "s3_key": "${aws_s3_object.Topic-OnMessage0_S3Object_D41E9C10.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -118,17 +118,17 @@ } }, "aws_lambda_permission": { - "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D": { + "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b", - "uniqueId": "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D" + "path": "root/Default/Default/Topic-OnMessage0/InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2", + "uniqueId": "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudTopic-OnMessage0.function_name}", + "function_name": "${aws_lambda_function.Topic-OnMessage0.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudTopic.arn}" + "source_arn": "${aws_sns_topic.Topic.arn}" } }, "aws_s3_bucket": { @@ -143,11 +143,11 @@ } }, "aws_s3_object": { - "cloudTopic-OnMessage0_S3Object_751FA064": { + "Topic-OnMessage0_S3Object_D41E9C10": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/S3Object", - "uniqueId": "cloudTopic-OnMessage0_S3Object_751FA064" + "path": "root/Default/Default/Topic-OnMessage0/S3Object", + "uniqueId": "Topic-OnMessage0_S3Object_D41E9C10" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -156,27 +156,27 @@ } }, "aws_sns_topic": { - "cloudTopic": { + "Topic": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/Default", - "uniqueId": "cloudTopic" + "path": "root/Default/Default/Topic/Default", + "uniqueId": "Topic" } }, - "name": "cloud-Topic-c82b57aa" + "name": "Topic-c8228fb7" } }, "aws_sns_topic_subscription": { - "cloudTopic_TopicSubscription0_D19DE229": { + "Topic_TopicSubscription0_0EA5CC90": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/TopicSubscription0", - "uniqueId": "cloudTopic_TopicSubscription0_D19DE229" + "path": "root/Default/Default/Topic/TopicSubscription0", + "uniqueId": "Topic_TopicSubscription0_0EA5CC90" } }, - "endpoint": "${aws_lambda_function.cloudTopic-OnMessage0.arn}", + "endpoint": "${aws_lambda_function.Topic-OnMessage0.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudTopic.arn}" + "topic_arn": "${aws_sns_topic.Topic.arn}" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_compile_tf-aws.md index 1818480e3d5..7aaf444dfd8 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/topic/on_message.test.w_compile_tf-aws.md @@ -18,33 +18,33 @@ }, "resource": { "aws_cloudwatch_log_group": { - "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3": { + "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3" + "path": "root/Default/Default/Topic-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage0-c81c4559", + "name": "/aws/lambda/Topic-OnMessage0-c85d7820", "retention_in_days": 30 }, - "cloudTopic-OnMessage1_CloudwatchLogGroup_50FF3467": { + "Topic-OnMessage1_CloudwatchLogGroup_90B37BB1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/CloudwatchLogGroup", - "uniqueId": "cloudTopic-OnMessage1_CloudwatchLogGroup_50FF3467" + "path": "root/Default/Default/Topic-OnMessage1/CloudwatchLogGroup", + "uniqueId": "Topic-OnMessage1_CloudwatchLogGroup_90B37BB1" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage1-c8da402d", + "name": "/aws/lambda/Topic-OnMessage1-c8763765", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -55,79 +55,79 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "cloudTopic-OnMessage0_IamRole_A9AB13E2": { + "Topic-OnMessage0_IamRole_64DD36FA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRole", - "uniqueId": "cloudTopic-OnMessage0_IamRole_A9AB13E2" + "path": "root/Default/Default/Topic-OnMessage0/IamRole", + "uniqueId": "Topic-OnMessage0_IamRole_64DD36FA" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudTopic-OnMessage1_IamRole_8052D72E": { + "Topic-OnMessage1_IamRole_6EE8D90C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/IamRole", - "uniqueId": "cloudTopic-OnMessage1_IamRole_8052D72E" + "path": "root/Default/Default/Topic-OnMessage1/IamRole", + "uniqueId": "Topic-OnMessage1_IamRole_6EE8D90C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F": { + "Topic-OnMessage0_IamRolePolicy_F5EE09D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicy", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicy", + "uniqueId": "Topic-OnMessage0_IamRolePolicy_F5EE09D8" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" }, - "cloudTopic-OnMessage1_IamRolePolicy_B541E262": { + "Topic-OnMessage1_IamRolePolicy_AFCBFBCB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/IamRolePolicy", - "uniqueId": "cloudTopic-OnMessage1_IamRolePolicy_B541E262" + "path": "root/Default/Default/Topic-OnMessage1/IamRolePolicy", + "uniqueId": "Topic-OnMessage1_IamRolePolicy_AFCBFBCB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudTopic-OnMessage1_IamRole_8052D72E.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Topic-OnMessage1_IamRole_6EE8D90C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4": { + "Topic-OnMessage0_IamRolePolicyAttachment_091E665D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Topic-OnMessage0_IamRolePolicyAttachment_091E665D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" }, - "cloudTopic-OnMessage1_IamRolePolicyAttachment_059688CF": { + "Topic-OnMessage1_IamRolePolicyAttachment_822D6E28": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/IamRolePolicyAttachment", - "uniqueId": "cloudTopic-OnMessage1_IamRolePolicyAttachment_059688CF" + "path": "root/Default/Default/Topic-OnMessage1/IamRolePolicyAttachment", + "uniqueId": "Topic-OnMessage1_IamRolePolicyAttachment_822D6E28" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudTopic-OnMessage1_IamRole_8052D72E.name}" + "role": "${aws_iam_role.Topic-OnMessage1_IamRole_6EE8D90C.name}" } }, "aws_lambda_function": { - "cloudTopic-OnMessage0": { + "Topic-OnMessage0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/Default", - "uniqueId": "cloudTopic-OnMessage0" + "path": "root/Default/Default/Topic-OnMessage0/Default", + "uniqueId": "Topic-OnMessage0" } }, "architectures": [ @@ -135,31 +135,31 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage0-c81c4559", + "WING_FUNCTION_NAME": "Topic-OnMessage0-c85d7820", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage0-c81c4559", + "function_name": "Topic-OnMessage0-c85d7820", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.arn}", + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudTopic-OnMessage0_S3Object_751FA064.key}", + "s3_key": "${aws_s3_object.Topic-OnMessage0_S3Object_D41E9C10.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudTopic-OnMessage1": { + "Topic-OnMessage1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/Default", - "uniqueId": "cloudTopic-OnMessage1" + "path": "root/Default/Default/Topic-OnMessage1/Default", + "uniqueId": "Topic-OnMessage1" } }, "architectures": [ @@ -167,20 +167,20 @@ ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage1-c8da402d", + "WING_FUNCTION_NAME": "Topic-OnMessage1-c8763765", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage1-c8da402d", + "function_name": "Topic-OnMessage1-c8763765", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudTopic-OnMessage1_IamRole_8052D72E.arn}", + "role": "${aws_iam_role.Topic-OnMessage1_IamRole_6EE8D90C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudTopic-OnMessage1_S3Object_C2572EFD.key}", + "s3_key": "${aws_s3_object.Topic-OnMessage1_S3Object_F90CC803.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -189,29 +189,29 @@ } }, "aws_lambda_permission": { - "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D": { + "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b", - "uniqueId": "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D" + "path": "root/Default/Default/Topic-OnMessage0/InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2", + "uniqueId": "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudTopic-OnMessage0.function_name}", + "function_name": "${aws_lambda_function.Topic-OnMessage0.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudTopic.arn}" + "source_arn": "${aws_sns_topic.Topic.arn}" }, - "cloudTopic-OnMessage1_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_3F1C0938": { + "Topic-OnMessage1_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_A7FB5FA3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b", - "uniqueId": "cloudTopic-OnMessage1_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_3F1C0938" + "path": "root/Default/Default/Topic-OnMessage1/InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2", + "uniqueId": "Topic-OnMessage1_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_A7FB5FA3" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudTopic-OnMessage1.function_name}", + "function_name": "${aws_lambda_function.Topic-OnMessage1.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudTopic.arn}" + "source_arn": "${aws_sns_topic.Topic.arn}" } }, "aws_s3_bucket": { @@ -226,22 +226,22 @@ } }, "aws_s3_object": { - "cloudTopic-OnMessage0_S3Object_751FA064": { + "Topic-OnMessage0_S3Object_D41E9C10": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/S3Object", - "uniqueId": "cloudTopic-OnMessage0_S3Object_751FA064" + "path": "root/Default/Default/Topic-OnMessage0/S3Object", + "uniqueId": "Topic-OnMessage0_S3Object_D41E9C10" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudTopic-OnMessage1_S3Object_C2572EFD": { + "Topic-OnMessage1_S3Object_F90CC803": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage1/S3Object", - "uniqueId": "cloudTopic-OnMessage1_S3Object_C2572EFD" + "path": "root/Default/Default/Topic-OnMessage1/S3Object", + "uniqueId": "Topic-OnMessage1_S3Object_F90CC803" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -250,38 +250,38 @@ } }, "aws_sns_topic": { - "cloudTopic": { + "Topic": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/Default", - "uniqueId": "cloudTopic" + "path": "root/Default/Default/Topic/Default", + "uniqueId": "Topic" } }, - "name": "cloud-Topic-c82b57aa" + "name": "Topic-c8228fb7" } }, "aws_sns_topic_subscription": { - "cloudTopic_TopicSubscription0_D19DE229": { + "Topic_TopicSubscription0_0EA5CC90": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/TopicSubscription0", - "uniqueId": "cloudTopic_TopicSubscription0_D19DE229" + "path": "root/Default/Default/Topic/TopicSubscription0", + "uniqueId": "Topic_TopicSubscription0_0EA5CC90" } }, - "endpoint": "${aws_lambda_function.cloudTopic-OnMessage0.arn}", + "endpoint": "${aws_lambda_function.Topic-OnMessage0.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudTopic.arn}" + "topic_arn": "${aws_sns_topic.Topic.arn}" }, - "cloudTopic_TopicSubscription1_BD9D6BB9": { + "Topic_TopicSubscription1_7AA173DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/TopicSubscription1", - "uniqueId": "cloudTopic_TopicSubscription1_BD9D6BB9" + "path": "root/Default/Default/Topic/TopicSubscription1", + "uniqueId": "Topic_TopicSubscription1_7AA173DC" } }, - "endpoint": "${aws_lambda_function.cloudTopic-OnMessage1.arn}", + "endpoint": "${aws_lambda_function.Topic-OnMessage1.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudTopic.arn}" + "topic_arn": "${aws_sns_topic.Topic.arn}" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_compile_tf-aws.md index d5ba69434f0..8d2643ac397 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/ui/section.test.w_compile_tf-aws.md @@ -18,33 +18,33 @@ }, "resource": { "aws_cloudwatch_log_group": { - "WidgetService_uiButton_Handler_CloudwatchLogGroup_181B65EF": { + "WidgetService_Button_Handler_CloudwatchLogGroup_A9F35A47": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/CloudwatchLogGroup", - "uniqueId": "WidgetService_uiButton_Handler_CloudwatchLogGroup_181B65EF" + "path": "root/Default/Default/WidgetService/Button/Handler/CloudwatchLogGroup", + "uniqueId": "WidgetService_Button_Handler_CloudwatchLogGroup_A9F35A47" } }, - "name": "/aws/lambda/Handler-c82f982f", + "name": "/aws/lambda/Handler-c8ba9e97", "retention_in_days": 30 }, - "WidgetService_uiField_Handler_CloudwatchLogGroup_82BCED02": { + "WidgetService_Field_Handler_CloudwatchLogGroup_5D72B206": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/CloudwatchLogGroup", - "uniqueId": "WidgetService_uiField_Handler_CloudwatchLogGroup_82BCED02" + "path": "root/Default/Default/WidgetService/Field/Handler/CloudwatchLogGroup", + "uniqueId": "WidgetService_Field_Handler_CloudwatchLogGroup_5D72B206" } }, - "name": "/aws/lambda/Handler-c876ab08", + "name": "/aws/lambda/Handler-c8fa6fbe", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "WidgetService_cloudCounter_5741B0CD": { + "WidgetService_Counter_07B65A41": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/cloud.Counter/Default", - "uniqueId": "WidgetService_cloudCounter_5741B0CD" + "path": "root/Default/Default/WidgetService/Counter/Default", + "uniqueId": "WidgetService_Counter_07B65A41" } }, "attribute": [ @@ -55,79 +55,79 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c8a16ecd" + "name": "wing-counter-Counter-c8a52f2e" } }, "aws_iam_role": { - "WidgetService_uiButton_Handler_IamRole_6B3512D4": { + "WidgetService_Button_Handler_IamRole_B297B278": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/IamRole", - "uniqueId": "WidgetService_uiButton_Handler_IamRole_6B3512D4" + "path": "root/Default/Default/WidgetService/Button/Handler/IamRole", + "uniqueId": "WidgetService_Button_Handler_IamRole_B297B278" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "WidgetService_uiField_Handler_IamRole_F0F1B44A": { + "WidgetService_Field_Handler_IamRole_A196F9F2": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/IamRole", - "uniqueId": "WidgetService_uiField_Handler_IamRole_F0F1B44A" + "path": "root/Default/Default/WidgetService/Field/Handler/IamRole", + "uniqueId": "WidgetService_Field_Handler_IamRole_A196F9F2" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "WidgetService_uiButton_Handler_IamRolePolicy_E258A8AD": { + "WidgetService_Button_Handler_IamRolePolicy_6B60FF83": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/IamRolePolicy", - "uniqueId": "WidgetService_uiButton_Handler_IamRolePolicy_E258A8AD" + "path": "root/Default/Default/WidgetService/Button/Handler/IamRolePolicy", + "uniqueId": "WidgetService_Button_Handler_IamRolePolicy_6B60FF83" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.WidgetService_cloudCounter_5741B0CD.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.arn}\",\"${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.WidgetService_uiButton_Handler_IamRole_6B3512D4.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.WidgetService_Counter_07B65A41.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.WidgetService_Bucket_125C963C.arn}\",\"${aws_s3_bucket.WidgetService_Bucket_125C963C.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.WidgetService_Button_Handler_IamRole_B297B278.name}" }, - "WidgetService_uiField_Handler_IamRolePolicy_5A8ECF8B": { + "WidgetService_Field_Handler_IamRolePolicy_4CA2797D": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/IamRolePolicy", - "uniqueId": "WidgetService_uiField_Handler_IamRolePolicy_5A8ECF8B" + "path": "root/Default/Default/WidgetService/Field/Handler/IamRolePolicy", + "uniqueId": "WidgetService_Field_Handler_IamRolePolicy_4CA2797D" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.arn}\",\"${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.WidgetService_uiField_Handler_IamRole_F0F1B44A.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.WidgetService_Bucket_125C963C.arn}\",\"${aws_s3_bucket.WidgetService_Bucket_125C963C.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.WidgetService_Field_Handler_IamRole_A196F9F2.name}" } }, "aws_iam_role_policy_attachment": { - "WidgetService_uiButton_Handler_IamRolePolicyAttachment_B7C6F2E8": { + "WidgetService_Button_Handler_IamRolePolicyAttachment_FFFE7BCD": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/IamRolePolicyAttachment", - "uniqueId": "WidgetService_uiButton_Handler_IamRolePolicyAttachment_B7C6F2E8" + "path": "root/Default/Default/WidgetService/Button/Handler/IamRolePolicyAttachment", + "uniqueId": "WidgetService_Button_Handler_IamRolePolicyAttachment_FFFE7BCD" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.WidgetService_uiButton_Handler_IamRole_6B3512D4.name}" + "role": "${aws_iam_role.WidgetService_Button_Handler_IamRole_B297B278.name}" }, - "WidgetService_uiField_Handler_IamRolePolicyAttachment_7E7212B5": { + "WidgetService_Field_Handler_IamRolePolicyAttachment_57C2FA54": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/IamRolePolicyAttachment", - "uniqueId": "WidgetService_uiField_Handler_IamRolePolicyAttachment_7E7212B5" + "path": "root/Default/Default/WidgetService/Field/Handler/IamRolePolicyAttachment", + "uniqueId": "WidgetService_Field_Handler_IamRolePolicyAttachment_57C2FA54" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.WidgetService_uiField_Handler_IamRole_F0F1B44A.name}" + "role": "${aws_iam_role.WidgetService_Field_Handler_IamRole_A196F9F2.name}" } }, "aws_lambda_function": { - "WidgetService_uiButton_Handler_B4965FCF": { + "WidgetService_Button_Handler_23F2D2EE": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/Default", - "uniqueId": "WidgetService_uiButton_Handler_B4965FCF" + "path": "root/Default/Default/WidgetService/Button/Handler/Default", + "uniqueId": "WidgetService_Button_Handler_23F2D2EE" } }, "architectures": [ @@ -135,32 +135,32 @@ ], "environment": { "variables": { - "BUCKET_NAME_c70730ce": "${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.bucket}", - "DYNAMODB_TABLE_NAME_fa6d1fc4": "${aws_dynamodb_table.WidgetService_cloudCounter_5741B0CD.name}", + "BUCKET_NAME_d47f60fd": "${aws_s3_bucket.WidgetService_Bucket_125C963C.bucket}", + "DYNAMODB_TABLE_NAME_e2f7658b": "${aws_dynamodb_table.WidgetService_Counter_07B65A41.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "Handler-c82f982f", + "WING_FUNCTION_NAME": "Handler-c8ba9e97", "WING_TARGET": "tf-aws" } }, - "function_name": "Handler-c82f982f", + "function_name": "Handler-c8ba9e97", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.WidgetService_uiButton_Handler_IamRole_6B3512D4.arn}", + "role": "${aws_iam_role.WidgetService_Button_Handler_IamRole_B297B278.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.WidgetService_uiButton_Handler_S3Object_EB849EC3.key}", + "s3_key": "${aws_s3_object.WidgetService_Button_Handler_S3Object_277180FD.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "WidgetService_uiField_Handler_A0505032": { + "WidgetService_Field_Handler_0963A3DE": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/Default", - "uniqueId": "WidgetService_uiField_Handler_A0505032" + "path": "root/Default/Default/WidgetService/Field/Handler/Default", + "uniqueId": "WidgetService_Field_Handler_0963A3DE" } }, "architectures": [ @@ -168,21 +168,21 @@ ], "environment": { "variables": { - "BUCKET_NAME_c70730ce": "${aws_s3_bucket.WidgetService_cloudBucket_4055DD59.bucket}", - "DYNAMODB_TABLE_NAME_fa6d1fc4": "${aws_dynamodb_table.WidgetService_cloudCounter_5741B0CD.name}", + "BUCKET_NAME_d47f60fd": "${aws_s3_bucket.WidgetService_Bucket_125C963C.bucket}", + "DYNAMODB_TABLE_NAME_e2f7658b": "${aws_dynamodb_table.WidgetService_Counter_07B65A41.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "Handler-c876ab08", + "WING_FUNCTION_NAME": "Handler-c8fa6fbe", "WING_TARGET": "tf-aws" } }, - "function_name": "Handler-c876ab08", + "function_name": "Handler-c8fa6fbe", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.WidgetService_uiField_Handler_IamRole_F0F1B44A.arn}", + "role": "${aws_iam_role.WidgetService_Field_Handler_IamRole_A196F9F2.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.WidgetService_uiField_Handler_S3Object_86A8EAFA.key}", + "s3_key": "${aws_s3_object.WidgetService_Field_Handler_S3Object_9825B672.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -200,34 +200,34 @@ }, "bucket_prefix": "code-c84a50b1-" }, - "WidgetService_cloudBucket_4055DD59": { + "WidgetService_Bucket_125C963C": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/cloud.Bucket/Default", - "uniqueId": "WidgetService_cloudBucket_4055DD59" + "path": "root/Default/Default/WidgetService/Bucket/Default", + "uniqueId": "WidgetService_Bucket_125C963C" } }, - "bucket_prefix": "cloud-bucket-c801fba9-", + "bucket_prefix": "bucket-c8203287-", "force_destroy": false } }, "aws_s3_object": { - "WidgetService_uiButton_Handler_S3Object_EB849EC3": { + "WidgetService_Button_Handler_S3Object_277180FD": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Button/Handler/S3Object", - "uniqueId": "WidgetService_uiButton_Handler_S3Object_EB849EC3" + "path": "root/Default/Default/WidgetService/Button/Handler/S3Object", + "uniqueId": "WidgetService_Button_Handler_S3Object_277180FD" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "WidgetService_uiField_Handler_S3Object_86A8EAFA": { + "WidgetService_Field_Handler_S3Object_9825B672": { "//": { "metadata": { - "path": "root/Default/Default/WidgetService/ui.Field/Handler/S3Object", - "uniqueId": "WidgetService_uiField_Handler_S3Object_86A8EAFA" + "path": "root/Default/Default/WidgetService/Field/Handler/S3Object", + "uniqueId": "WidgetService_Field_Handler_S3Object_9825B672" } }, "bucket": "${aws_s3_bucket.Code.bucket}", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_compile_tf-aws.md index be77c2f41ed..034c384db14 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/util/wait-until.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } } } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_compile_tf-aws.md index 9bba92b7192..61601ff1da6 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/react-app.test.w_compile_tf-aws.md @@ -13,15 +13,15 @@ "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } }, - "ex.ReactApp": { - "ex.ReactApp-host": { + "ReactApp": { + "ReactApp-host": { "Endpoint": { - "Url": "exReactApp_exReactApp-host_Endpoint_Url_CC674145" + "Url": "ReactApp_ReactApp-host_Endpoint_Url_62B1895E" } } } @@ -42,11 +42,11 @@ } }, "aws_iam_policy_document": { - "exReactApp_exReactApp-host_AllowDistributionReadOnly_449FAF0F": { + "ReactApp_ReactApp-host_AllowDistributionReadOnly_372196CD": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/AllowDistributionReadOnly", - "uniqueId": "exReactApp_exReactApp-host_AllowDistributionReadOnly_449FAF0F" + "path": "root/Default/Default/ReactApp/ReactApp-host/AllowDistributionReadOnly", + "uniqueId": "ReactApp_ReactApp-host_AllowDistributionReadOnly_372196CD" } }, "statement": [ @@ -58,7 +58,7 @@ { "test": "StringEquals", "values": [ - "${aws_cloudfront_distribution.exReactApp_exReactApp-host_Distribution_FE9291B1.arn}" + "${aws_cloudfront_distribution.ReactApp_ReactApp-host_Distribution_D777C7AA.arn}" ], "variable": "AWS:SourceArn" } @@ -72,7 +72,7 @@ } ], "resources": [ - "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.arn}/*" + "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.arn}/*" ] } ] @@ -90,11 +90,11 @@ } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" }, - "exReactApp_exReactApp-host_Endpoint_Url_CC674145": { - "value": "https://${aws_cloudfront_distribution.exReactApp_exReactApp-host_Distribution_FE9291B1.domain_name}" + "ReactApp_ReactApp-host_Endpoint_Url_62B1895E": { + "value": "https://${aws_cloudfront_distribution.ReactApp_ReactApp-host_Distribution_D777C7AA.domain_name}" } }, "provider": { @@ -104,56 +104,56 @@ }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c8ca9349/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c86d29bb/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudfront_distribution": { - "exReactApp_exReactApp-host_Distribution_FE9291B1": { + "ReactApp_ReactApp-host_Distribution_D777C7AA": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/Distribution", - "uniqueId": "exReactApp_exReactApp-host_Distribution_FE9291B1" + "path": "root/Default/Default/ReactApp/ReactApp-host/Distribution", + "uniqueId": "ReactApp_ReactApp-host_Distribution_D777C7AA" } }, "custom_error_response": [ @@ -194,8 +194,8 @@ "enabled": true, "origin": [ { - "domain_name": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.bucket_regional_domain_name}", - "origin_access_control_id": "${aws_cloudfront_origin_access_control.exReactApp_exReactApp-host_CloudfrontOac_B85B4BF9.id}", + "domain_name": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.bucket_regional_domain_name}", + "origin_access_control_id": "${aws_cloudfront_origin_access_control.ReactApp_ReactApp-host_CloudfrontOac_A9CBE717.id}", "origin_id": "s3Origin" } ], @@ -212,72 +212,72 @@ } }, "aws_cloudfront_origin_access_control": { - "exReactApp_exReactApp-host_CloudfrontOac_B85B4BF9": { + "ReactApp_ReactApp-host_CloudfrontOac_A9CBE717": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/CloudfrontOac", - "uniqueId": "exReactApp_exReactApp-host_CloudfrontOac_B85B4BF9" + "path": "root/Default/Default/ReactApp/ReactApp-host/CloudfrontOac", + "uniqueId": "ReactApp_ReactApp-host_CloudfrontOac_A9CBE717" } }, - "name": "ex-React-c8e2f35e-cloudfront-oac", + "name": "ReactApp-c8d263a6-cloudfront-oac", "origin_access_control_origin_type": "s3", "signing_behavior": "always", "signing_protocol": "sigv4" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_0_CloudwatchLogGroup_9D02C16C": { + "Api_get_0_CloudwatchLogGroup_196DE719": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_0_CloudwatchLogGroup_9D02C16C" + "path": "root/Default/Default/Api/get_0/CloudwatchLogGroup", + "uniqueId": "Api_get_0_CloudwatchLogGroup_196DE719" } }, - "name": "/aws/lambda/get_0-c8ca9349", + "name": "/aws/lambda/get_0-c86d29bb", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_0_IamRole_111BBD82": { + "Api_get_0_IamRole_2FAC475D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRole", - "uniqueId": "cloudApi_get_0_IamRole_111BBD82" + "path": "root/Default/Default/Api/get_0/IamRole", + "uniqueId": "Api_get_0_IamRole_2FAC475D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_0_IamRolePolicy_6778B83A": { + "Api_get_0_IamRolePolicy_D9FB373B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicy", - "uniqueId": "cloudApi_get_0_IamRolePolicy_6778B83A" + "path": "root/Default/Default/Api/get_0/IamRolePolicy", + "uniqueId": "Api_get_0_IamRolePolicy_D9FB373B" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_0_IamRolePolicyAttachment_1A88E668": { + "Api_get_0_IamRolePolicyAttachment_AEF1DC01": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_0_IamRolePolicyAttachment_1A88E668" + "path": "root/Default/Default/Api/get_0/IamRolePolicyAttachment", + "uniqueId": "Api_get_0_IamRolePolicyAttachment_AEF1DC01" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_lambda_function": { - "cloudApi_get_0_B857C178": { + "Api_get_0_244A7BA4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/Default", - "uniqueId": "cloudApi_get_0_B857C178" + "path": "root/Default/Default/Api/get_0/Default", + "uniqueId": "Api_get_0_244A7BA4" } }, "architectures": [ @@ -286,18 +286,18 @@ "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_0-c8ca9349", + "WING_FUNCTION_NAME": "get_0-c86d29bb", "WING_TARGET": "tf-aws" } }, - "function_name": "get_0-c8ca9349", + "function_name": "get_0-c86d29bb", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.arn}", + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_0_S3Object_67E48DD4.key}", + "s3_key": "${aws_s3_object.Api_get_0_S3Object_D1844823.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -306,17 +306,17 @@ } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89": { + "Api_api_permission-GET-c2e3ffa8_5BF93889": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-c2e3ffa8", - "uniqueId": "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89" + "path": "root/Default/Default/Api/api/permission-GET-c2e3ffa8", + "uniqueId": "Api_api_permission-GET-c2e3ffa8_5BF93889" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_0_B857C178.function_name}", + "function_name": "${aws_lambda_function.Api_get_0_244A7BA4.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/", "statement_id": "AllowExecutionFromAPIGateway-GET-c2e3ffa8" } }, @@ -330,38 +330,38 @@ }, "bucket_prefix": "code-c84a50b1-" }, - "exReactApp_exReactApp-host_WebsiteBucket_FE5E163A": { + "ReactApp_ReactApp-host_WebsiteBucket_89CDC093": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/WebsiteBucket", - "uniqueId": "exReactApp_exReactApp-host_WebsiteBucket_FE5E163A" + "path": "root/Default/Default/ReactApp/ReactApp-host/WebsiteBucket", + "uniqueId": "ReactApp_ReactApp-host_WebsiteBucket_89CDC093" } }, - "bucket_prefix": "ex-reactapp-host-c8e2f35e-", + "bucket_prefix": "reactapp-host-c8d263a6-", "force_destroy": false } }, "aws_s3_bucket_policy": { - "exReactApp_exReactApp-host_DistributionS3BucketPolicy_2BAB64DC": { + "ReactApp_ReactApp-host_DistributionS3BucketPolicy_83FDF6F5": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/DistributionS3BucketPolicy", - "uniqueId": "exReactApp_exReactApp-host_DistributionS3BucketPolicy_2BAB64DC" + "path": "root/Default/Default/ReactApp/ReactApp-host/DistributionS3BucketPolicy", + "uniqueId": "ReactApp_ReactApp-host_DistributionS3BucketPolicy_83FDF6F5" } }, - "bucket": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.id}", - "policy": "${data.aws_iam_policy_document.exReactApp_exReactApp-host_AllowDistributionReadOnly_449FAF0F.json}" + "bucket": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.id}", + "policy": "${data.aws_iam_policy_document.ReactApp_ReactApp-host_AllowDistributionReadOnly_372196CD.json}" } }, "aws_s3_bucket_website_configuration": { - "exReactApp_exReactApp-host_BucketWebsiteConfiguration_BDF89618": { + "ReactApp_ReactApp-host_BucketWebsiteConfiguration_7CEC9155": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/BucketWebsiteConfiguration", - "uniqueId": "exReactApp_exReactApp-host_BucketWebsiteConfiguration_BDF89618" + "path": "root/Default/Default/ReactApp/ReactApp-host/BucketWebsiteConfiguration", + "uniqueId": "ReactApp_ReactApp-host_BucketWebsiteConfiguration_7CEC9155" } }, - "bucket": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.bucket}", + "bucket": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.bucket}", "error_document": { "key": "index.html" }, @@ -371,61 +371,61 @@ } }, "aws_s3_object": { - "cloudApi_get_0_S3Object_67E48DD4": { + "Api_get_0_S3Object_D1844823": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/S3Object", - "uniqueId": "cloudApi_get_0_S3Object_67E48DD4" + "path": "root/Default/Default/Api/get_0/S3Object", + "uniqueId": "Api_get_0_S3Object_D1844823" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "exReactApp_exReactApp-host_File--indexhtml_B6124CA6": { + "ReactApp_ReactApp-host_File--indexhtml_5D49E05F": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/File--index.html", - "uniqueId": "exReactApp_exReactApp-host_File--indexhtml_B6124CA6" + "path": "root/Default/Default/ReactApp/ReactApp-host/File--index.html", + "uniqueId": "ReactApp_ReactApp-host_File--indexhtml_5D49E05F" } }, - "bucket": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.bucket}", + "bucket": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A" + "aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093" ], "key": "/index.html", "source": "", "source_hash": "${filemd5()}" }, - "exReactApp_exReactApp-host_File--indexjs_212AAA99": { + "ReactApp_ReactApp-host_File--indexjs_1DE8B5B1": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/File--index.js", - "uniqueId": "exReactApp_exReactApp-host_File--indexjs_212AAA99" + "path": "root/Default/Default/ReactApp/ReactApp-host/File--index.js", + "uniqueId": "ReactApp_ReactApp-host_File--indexjs_1DE8B5B1" } }, - "bucket": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.bucket}", + "bucket": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.bucket}", "content_type": "application/javascript; charset=utf-8", "depends_on": [ - "aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A" + "aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093" ], "key": "/index.js", "source": "", "source_hash": "${filemd5()}" }, - "exReactApp_exReactApp-host_File-wingjs_43F0A844": { + "ReactApp_ReactApp-host_File-wingjs_2C73E578": { "//": { "metadata": { - "path": "root/Default/Default/ex.ReactApp/ex.ReactApp-host/File-wing.js", - "uniqueId": "exReactApp_exReactApp-host_File-wingjs_43F0A844" + "path": "root/Default/Default/ReactApp/ReactApp-host/File-wing.js", + "uniqueId": "ReactApp_ReactApp-host_File-wingjs_2C73E578" } }, - "bucket": "${aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A.bucket}", - "content": "// This file is generated by wing\nwindow.wingEnv = {\n \"apiUrl\": \"https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}\",\n \"anotherEnvVar\": \"preflight variable\"\n};", + "bucket": "${aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093.bucket}", + "content": "// This file is generated by wing\nwindow.wingEnv = {\n \"apiUrl\": \"https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}\",\n \"anotherEnvVar\": \"preflight variable\"\n};", "content_type": "text/javascript", "depends_on": [ - "aws_s3_bucket.exReactApp_exReactApp-host_WebsiteBucket_FE5E163A" + "aws_s3_bucket.ReactApp_ReactApp-host_WebsiteBucket_89CDC093" ], "key": "wing.js" } diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_compile_tf-aws.md index d10b3d65dd6..27628368c3d 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/two_websites.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Website": { + "Website": { "Endpoint": { - "Url": "cloudWebsite_Endpoint_Url_31589343" + "Url": "Website_Endpoint_Url_0CC0343F" } }, "website-2": { @@ -30,11 +30,11 @@ }, "data": { "aws_iam_policy_document": { - "cloudWebsite_AllowDistributionReadOnly_89DC4FD0": { + "Website_AllowDistributionReadOnly_24CFF6C0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/AllowDistributionReadOnly", - "uniqueId": "cloudWebsite_AllowDistributionReadOnly_89DC4FD0" + "path": "root/Default/Default/Website/AllowDistributionReadOnly", + "uniqueId": "Website_AllowDistributionReadOnly_24CFF6C0" } }, "statement": [ @@ -46,7 +46,7 @@ { "test": "StringEquals", "values": [ - "${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.arn}" + "${aws_cloudfront_distribution.Website_Distribution_5E840E42.arn}" ], "variable": "AWS:SourceArn" } @@ -60,7 +60,7 @@ } ], "resources": [ - "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.arn}/*" + "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.arn}/*" ] } ] @@ -103,8 +103,8 @@ } }, "output": { - "cloudWebsite_Endpoint_Url_31589343": { - "value": "https://${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.domain_name}" + "Website_Endpoint_Url_0CC0343F": { + "value": "https://${aws_cloudfront_distribution.Website_Distribution_5E840E42.domain_name}" }, "website-2_Endpoint_Url_B3891500": { "value": "https://${aws_cloudfront_distribution.website-2_Distribution_F1FA4680.domain_name}" @@ -117,11 +117,11 @@ }, "resource": { "aws_cloudfront_distribution": { - "cloudWebsite_Distribution_083B5AF9": { + "Website_Distribution_5E840E42": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/Distribution", - "uniqueId": "cloudWebsite_Distribution_083B5AF9" + "path": "root/Default/Default/Website/Distribution", + "uniqueId": "Website_Distribution_5E840E42" } }, "default_cache_behavior": { @@ -150,8 +150,8 @@ "enabled": true, "origin": [ { - "domain_name": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket_regional_domain_name}", - "origin_access_control_id": "${aws_cloudfront_origin_access_control.cloudWebsite_CloudfrontOac_C956968B.id}", + "domain_name": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket_regional_domain_name}", + "origin_access_control_id": "${aws_cloudfront_origin_access_control.Website_CloudfrontOac_756836A4.id}", "origin_id": "s3Origin" } ], @@ -217,14 +217,14 @@ } }, "aws_cloudfront_origin_access_control": { - "cloudWebsite_CloudfrontOac_C956968B": { + "Website_CloudfrontOac_756836A4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/CloudfrontOac", - "uniqueId": "cloudWebsite_CloudfrontOac_C956968B" + "path": "root/Default/Default/Website/CloudfrontOac", + "uniqueId": "Website_CloudfrontOac_756836A4" } }, - "name": "cloud-We-c8e58765-cloudfront-oac", + "name": "Website-c80d509a-cloudfront-oac", "origin_access_control_origin_type": "s3", "signing_behavior": "always", "signing_protocol": "sigv4" @@ -243,14 +243,14 @@ } }, "aws_s3_bucket": { - "cloudWebsite_WebsiteBucket_EB03D355": { + "Website_WebsiteBucket_3C0321F0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/WebsiteBucket", - "uniqueId": "cloudWebsite_WebsiteBucket_EB03D355" + "path": "root/Default/Default/Website/WebsiteBucket", + "uniqueId": "Website_WebsiteBucket_3C0321F0" } }, - "bucket_prefix": "cloud-website-c8e58765-", + "bucket_prefix": "website-c80d509a-", "force_destroy": false }, "website-2_WebsiteBucket_59576A0C": { @@ -265,15 +265,15 @@ } }, "aws_s3_bucket_policy": { - "cloudWebsite_DistributionS3BucketPolicy_32B029AE": { + "Website_DistributionS3BucketPolicy_09AE0BCA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/DistributionS3BucketPolicy", - "uniqueId": "cloudWebsite_DistributionS3BucketPolicy_32B029AE" + "path": "root/Default/Default/Website/DistributionS3BucketPolicy", + "uniqueId": "Website_DistributionS3BucketPolicy_09AE0BCA" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.id}", - "policy": "${data.aws_iam_policy_document.cloudWebsite_AllowDistributionReadOnly_89DC4FD0.json}" + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.id}", + "policy": "${data.aws_iam_policy_document.Website_AllowDistributionReadOnly_24CFF6C0.json}" }, "website-2_DistributionS3BucketPolicy_C89BC83B": { "//": { @@ -287,14 +287,14 @@ } }, "aws_s3_bucket_website_configuration": { - "cloudWebsite_BucketWebsiteConfiguration_920E8E41": { + "Website_BucketWebsiteConfiguration_58F891B4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/BucketWebsiteConfiguration", - "uniqueId": "cloudWebsite_BucketWebsiteConfiguration_920E8E41" + "path": "root/Default/Default/Website/BucketWebsiteConfiguration", + "uniqueId": "Website_BucketWebsiteConfiguration_58F891B4" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "index_document": { "suffix": "index.html" } @@ -313,49 +313,49 @@ } }, "aws_s3_object": { - "cloudWebsite_File--errorhtml_C6A94F52": { + "Website_File--errorhtml_702870FC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--error.html", - "uniqueId": "cloudWebsite_File--errorhtml_C6A94F52" + "path": "root/Default/Default/Website/File--error.html", + "uniqueId": "Website_File--errorhtml_702870FC" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/error.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File--indexhtml_2A2AE13C": { + "Website_File--indexhtml_864F8C36": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--index.html", - "uniqueId": "cloudWebsite_File--indexhtml_2A2AE13C" + "path": "root/Default/Default/Website/File--index.html", + "uniqueId": "Website_File--indexhtml_864F8C36" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/index.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File--inner-folder--otherhtml_72DA631C": { + "Website_File--inner-folder--otherhtml_3FCEBB4A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--inner-folder--other.html", - "uniqueId": "cloudWebsite_File--inner-folder--otherhtml_72DA631C" + "path": "root/Default/Default/Website/File--inner-folder--other.html", + "uniqueId": "Website_File--inner-folder--otherhtml_3FCEBB4A" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/inner-folder/other.html", "source": "", diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_compile_tf-aws.md index 51913e49e45..962bd1d1f03 100644 --- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/website/website.test.w_compile_tf-aws.md @@ -13,9 +13,9 @@ "root": { "Default": { "Default": { - "cloud.Website": { + "Website": { "Endpoint": { - "Url": "cloudWebsite_Endpoint_Url_31589343" + "Url": "Website_Endpoint_Url_0CC0343F" } } } @@ -25,11 +25,11 @@ }, "data": { "aws_iam_policy_document": { - "cloudWebsite_AllowDistributionReadOnly_89DC4FD0": { + "Website_AllowDistributionReadOnly_24CFF6C0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/AllowDistributionReadOnly", - "uniqueId": "cloudWebsite_AllowDistributionReadOnly_89DC4FD0" + "path": "root/Default/Default/Website/AllowDistributionReadOnly", + "uniqueId": "Website_AllowDistributionReadOnly_24CFF6C0" } }, "statement": [ @@ -41,7 +41,7 @@ { "test": "StringEquals", "values": [ - "${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.arn}" + "${aws_cloudfront_distribution.Website_Distribution_5E840E42.arn}" ], "variable": "AWS:SourceArn" } @@ -55,7 +55,7 @@ } ], "resources": [ - "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.arn}/*" + "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.arn}/*" ] } ] @@ -63,8 +63,8 @@ } }, "output": { - "cloudWebsite_Endpoint_Url_31589343": { - "value": "https://${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.domain_name}" + "Website_Endpoint_Url_0CC0343F": { + "value": "https://${aws_cloudfront_distribution.Website_Distribution_5E840E42.domain_name}" } }, "provider": { @@ -74,11 +74,11 @@ }, "resource": { "aws_cloudfront_distribution": { - "cloudWebsite_Distribution_083B5AF9": { + "Website_Distribution_5E840E42": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/Distribution", - "uniqueId": "cloudWebsite_Distribution_083B5AF9" + "path": "root/Default/Default/Website/Distribution", + "uniqueId": "Website_Distribution_5E840E42" } }, "custom_error_response": [ @@ -119,8 +119,8 @@ "enabled": true, "origin": [ { - "domain_name": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket_regional_domain_name}", - "origin_access_control_id": "${aws_cloudfront_origin_access_control.cloudWebsite_CloudfrontOac_C956968B.id}", + "domain_name": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket_regional_domain_name}", + "origin_access_control_id": "${aws_cloudfront_origin_access_control.Website_CloudfrontOac_756836A4.id}", "origin_id": "s3Origin" } ], @@ -137,52 +137,52 @@ } }, "aws_cloudfront_origin_access_control": { - "cloudWebsite_CloudfrontOac_C956968B": { + "Website_CloudfrontOac_756836A4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/CloudfrontOac", - "uniqueId": "cloudWebsite_CloudfrontOac_C956968B" + "path": "root/Default/Default/Website/CloudfrontOac", + "uniqueId": "Website_CloudfrontOac_756836A4" } }, - "name": "cloud-We-c8e58765-cloudfront-oac", + "name": "Website-c80d509a-cloudfront-oac", "origin_access_control_origin_type": "s3", "signing_behavior": "always", "signing_protocol": "sigv4" } }, "aws_s3_bucket": { - "cloudWebsite_WebsiteBucket_EB03D355": { + "Website_WebsiteBucket_3C0321F0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/WebsiteBucket", - "uniqueId": "cloudWebsite_WebsiteBucket_EB03D355" + "path": "root/Default/Default/Website/WebsiteBucket", + "uniqueId": "Website_WebsiteBucket_3C0321F0" } }, - "bucket_prefix": "cloud-website-c8e58765-", + "bucket_prefix": "website-c80d509a-", "force_destroy": false } }, "aws_s3_bucket_policy": { - "cloudWebsite_DistributionS3BucketPolicy_32B029AE": { + "Website_DistributionS3BucketPolicy_09AE0BCA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/DistributionS3BucketPolicy", - "uniqueId": "cloudWebsite_DistributionS3BucketPolicy_32B029AE" + "path": "root/Default/Default/Website/DistributionS3BucketPolicy", + "uniqueId": "Website_DistributionS3BucketPolicy_09AE0BCA" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.id}", - "policy": "${data.aws_iam_policy_document.cloudWebsite_AllowDistributionReadOnly_89DC4FD0.json}" + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.id}", + "policy": "${data.aws_iam_policy_document.Website_AllowDistributionReadOnly_24CFF6C0.json}" } }, "aws_s3_bucket_website_configuration": { - "cloudWebsite_BucketWebsiteConfiguration_920E8E41": { + "Website_BucketWebsiteConfiguration_58F891B4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/BucketWebsiteConfiguration", - "uniqueId": "cloudWebsite_BucketWebsiteConfiguration_920E8E41" + "path": "root/Default/Default/Website/BucketWebsiteConfiguration", + "uniqueId": "Website_BucketWebsiteConfiguration_58F891B4" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "error_document": { "key": "error.html" }, @@ -192,81 +192,81 @@ } }, "aws_s3_object": { - "cloudWebsite_File--errorhtml_C6A94F52": { + "Website_File--errorhtml_702870FC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--error.html", - "uniqueId": "cloudWebsite_File--errorhtml_C6A94F52" + "path": "root/Default/Default/Website/File--error.html", + "uniqueId": "Website_File--errorhtml_702870FC" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/error.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File--indexhtml_2A2AE13C": { + "Website_File--indexhtml_864F8C36": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--index.html", - "uniqueId": "cloudWebsite_File--indexhtml_2A2AE13C" + "path": "root/Default/Default/Website/File--index.html", + "uniqueId": "Website_File--indexhtml_864F8C36" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/index.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File--inner-folder--otherhtml_72DA631C": { + "Website_File--inner-folder--otherhtml_3FCEBB4A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--inner-folder--other.html", - "uniqueId": "cloudWebsite_File--inner-folder--otherhtml_72DA631C" + "path": "root/Default/Default/Website/File--inner-folder--other.html", + "uniqueId": "Website_File--inner-folder--otherhtml_3FCEBB4A" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/inner-folder/other.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File-another-filehtml_C41CE440": { + "Website_File-another-filehtml_3A96640F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File-another-file.html", - "uniqueId": "cloudWebsite_File-another-filehtml_C41CE440" + "path": "root/Default/Default/Website/File-another-file.html", + "uniqueId": "Website_File-another-filehtml_3A96640F" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content": "Hello World!", "content_type": "text/html", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "another-file.html" }, - "cloudWebsite_File-configjson_591A81BA": { + "Website_File-configjson_1F1498B9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File-config.json", - "uniqueId": "cloudWebsite_File-configjson_591A81BA" + "path": "root/Default/Default/Website/File-config.json", + "uniqueId": "Website_File-configjson_1F1498B9" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content": "{\"json\":1}", "content_type": "application/json", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "config.json" } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md index ed29f5add7f..6ad6d9d1031 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api.test.w_compile_tf-aws.md @@ -93,15 +93,15 @@ module.exports = function({ }) { "Default": { "Default": { "A": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "A_cloudApi_Endpoint_Url_77CB2098" + "Url": "A_Api_Endpoint_Url_37336ACA" } } }, - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -132,11 +132,11 @@ module.exports = function({ }) { } }, "output": { - "A_cloudApi_Endpoint_Url_77CB2098": { - "value": "https://${aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.A_cloudApi_api_stage_6D822CCE.stage_name}" + "A_Api_Endpoint_Url_37336ACA": { + "value": "https://${aws_api_gateway_rest_api.A_Api_api_06466CBC.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.A_Api_api_stage_75CEFF9A.stage_name}" }, - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -146,117 +146,117 @@ module.exports = function({ }) { }, "resource": { "aws_api_gateway_deployment": { - "A_cloudApi_api_deployment_8CFEA08D": { + "A_Api_api_deployment_7EBFB334": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/api/deployment", - "uniqueId": "A_cloudApi_api_deployment_8CFEA08D" + "path": "root/Default/Default/A/Api/api/deployment", + "uniqueId": "A_Api_api_deployment_7EBFB334" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.id}", + "rest_api_id": "${aws_api_gateway_rest_api.A_Api_api_06466CBC.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.A_Api_api_06466CBC.body)}" } }, - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "A_cloudApi_api_37FCEF91": { + "A_Api_api_06466CBC": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/api/api", - "uniqueId": "A_cloudApi_api_37FCEF91" + "path": "root/Default/Default/A/Api/api/api", + "uniqueId": "A_Api_api_06466CBC" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/endpoint1\":{\"get\":{\"operationId\":\"get-endpoint1\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_endpoint10-c85d0b50/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/endpoint1\":{\"get\":{\"operationId\":\"get-endpoint1\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_endpoint10-c8e91512/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c8c7a7a3" + "name": "api-c8c28c28" }, - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello/world\":{\"get\":{\"operationId\":\"get-hello/world\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello_world0-c8d20d3c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello/world\":{\"get\":{\"operationId\":\"get-hello/world\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello_world0-c8808650/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "A_cloudApi_api_stage_6D822CCE": { + "A_Api_api_stage_75CEFF9A": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/api/stage", - "uniqueId": "A_cloudApi_api_stage_6D822CCE" + "path": "root/Default/Default/A/Api/api/stage", + "uniqueId": "A_Api_api_stage_75CEFF9A" } }, - "deployment_id": "${aws_api_gateway_deployment.A_cloudApi_api_deployment_8CFEA08D.id}", - "rest_api_id": "${aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.id}", + "deployment_id": "${aws_api_gateway_deployment.A_Api_api_deployment_7EBFB334.id}", + "rest_api_id": "${aws_api_gateway_rest_api.A_Api_api_06466CBC.id}", "stage_name": "prod" }, - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "A_cloudApi_get_endpoint10_CloudwatchLogGroup_4BD4AFFD": { + "A_Api_get_endpoint10_CloudwatchLogGroup_88A9F9FB": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/CloudwatchLogGroup", - "uniqueId": "A_cloudApi_get_endpoint10_CloudwatchLogGroup_4BD4AFFD" + "path": "root/Default/Default/A/Api/get_endpoint10/CloudwatchLogGroup", + "uniqueId": "A_Api_get_endpoint10_CloudwatchLogGroup_88A9F9FB" } }, - "name": "/aws/lambda/get_endpoint10-c85d0b50", + "name": "/aws/lambda/get_endpoint10-c8e91512", "retention_in_days": 30 }, - "cloudApi_get_hello_world0_CloudwatchLogGroup_29C4F429": { + "Api_get_hello_world0_CloudwatchLogGroup_6629DDA5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_hello_world0_CloudwatchLogGroup_29C4F429" + "path": "root/Default/Default/Api/get_hello_world0/CloudwatchLogGroup", + "uniqueId": "Api_get_hello_world0_CloudwatchLogGroup_6629DDA5" } }, - "name": "/aws/lambda/get_hello_world0-c8d20d3c", + "name": "/aws/lambda/get_hello_world0-c8808650", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -267,79 +267,79 @@ module.exports = function({ }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "A_cloudApi_get_endpoint10_IamRole_9ABC6EDD": { + "A_Api_get_endpoint10_IamRole_656A5EFF": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/IamRole", - "uniqueId": "A_cloudApi_get_endpoint10_IamRole_9ABC6EDD" + "path": "root/Default/Default/A/Api/get_endpoint10/IamRole", + "uniqueId": "A_Api_get_endpoint10_IamRole_656A5EFF" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_hello_world0_IamRole_E302D75D": { + "Api_get_hello_world0_IamRole_BE6EA0B6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRole", - "uniqueId": "cloudApi_get_hello_world0_IamRole_E302D75D" + "path": "root/Default/Default/Api/get_hello_world0/IamRole", + "uniqueId": "Api_get_hello_world0_IamRole_BE6EA0B6" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "A_cloudApi_get_endpoint10_IamRolePolicy_8DF88DF1": { + "A_Api_get_endpoint10_IamRolePolicy_CEEF8626": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/IamRolePolicy", - "uniqueId": "A_cloudApi_get_endpoint10_IamRolePolicy_8DF88DF1" + "path": "root/Default/Default/A/Api/get_endpoint10/IamRolePolicy", + "uniqueId": "A_Api_get_endpoint10_IamRolePolicy_CEEF8626" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.A_cloudApi_get_endpoint10_IamRole_9ABC6EDD.name}" + "role": "${aws_iam_role.A_Api_get_endpoint10_IamRole_656A5EFF.name}" }, - "cloudApi_get_hello_world0_IamRolePolicy_56CA9635": { + "Api_get_hello_world0_IamRolePolicy_EA874D77": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRolePolicy", - "uniqueId": "cloudApi_get_hello_world0_IamRolePolicy_56CA9635" + "path": "root/Default/Default/Api/get_hello_world0/IamRolePolicy", + "uniqueId": "Api_get_hello_world0_IamRolePolicy_EA874D77" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.name}" } }, "aws_iam_role_policy_attachment": { - "A_cloudApi_get_endpoint10_IamRolePolicyAttachment_1D18524A": { + "A_Api_get_endpoint10_IamRolePolicyAttachment_E367997D": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/IamRolePolicyAttachment", - "uniqueId": "A_cloudApi_get_endpoint10_IamRolePolicyAttachment_1D18524A" + "path": "root/Default/Default/A/Api/get_endpoint10/IamRolePolicyAttachment", + "uniqueId": "A_Api_get_endpoint10_IamRolePolicyAttachment_E367997D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.A_cloudApi_get_endpoint10_IamRole_9ABC6EDD.name}" + "role": "${aws_iam_role.A_Api_get_endpoint10_IamRole_656A5EFF.name}" }, - "cloudApi_get_hello_world0_IamRolePolicyAttachment_861BE130": { + "Api_get_hello_world0_IamRolePolicyAttachment_E570C504": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_hello_world0_IamRolePolicyAttachment_861BE130" + "path": "root/Default/Default/Api/get_hello_world0/IamRolePolicyAttachment", + "uniqueId": "Api_get_hello_world0_IamRolePolicyAttachment_E570C504" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.name}" + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.name}" } }, "aws_lambda_function": { - "A_cloudApi_get_endpoint10_4C55BA1A": { + "A_Api_get_endpoint10_5345135D": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/Default", - "uniqueId": "A_cloudApi_get_endpoint10_4C55BA1A" + "path": "root/Default/Default/A/Api/get_endpoint10/Default", + "uniqueId": "A_Api_get_endpoint10_5345135D" } }, "architectures": [ @@ -348,30 +348,30 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_endpoint10-c85d0b50", + "WING_FUNCTION_NAME": "get_endpoint10-c8e91512", "WING_TARGET": "tf-aws", - "WING_TOKEN_HTTPS_TFTOKEN_TOKEN_33_EXECUTE_API_TFTOKEN_TOKEN_25_AMAZONAWS_COM_TFTOKEN_TOKEN_34": "${jsonencode(\"https://${aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.A_cloudApi_api_stage_6D822CCE.stage_name}\")}" + "WING_TOKEN_HTTPS_TFTOKEN_TOKEN_33_EXECUTE_API_TFTOKEN_TOKEN_25_AMAZONAWS_COM_TFTOKEN_TOKEN_34": "${jsonencode(\"https://${aws_api_gateway_rest_api.A_Api_api_06466CBC.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.A_Api_api_stage_75CEFF9A.stage_name}\")}" } }, - "function_name": "get_endpoint10-c85d0b50", + "function_name": "get_endpoint10-c8e91512", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.A_cloudApi_get_endpoint10_IamRole_9ABC6EDD.arn}", + "role": "${aws_iam_role.A_Api_get_endpoint10_IamRole_656A5EFF.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.A_cloudApi_get_endpoint10_S3Object_0D156109.key}", + "s3_key": "${aws_s3_object.A_Api_get_endpoint10_S3Object_C3F8C059.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_get_hello_world0_5CAA6AF9": { + "Api_get_hello_world0_56F26C26": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/Default", - "uniqueId": "cloudApi_get_hello_world0_5CAA6AF9" + "path": "root/Default/Default/Api/get_hello_world0/Default", + "uniqueId": "Api_get_hello_world0_56F26C26" } }, "architectures": [ @@ -379,20 +379,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_hello_world0-c8d20d3c", + "WING_FUNCTION_NAME": "get_hello_world0-c8808650", "WING_TARGET": "tf-aws" } }, - "function_name": "get_hello_world0-c8d20d3c", + "function_name": "get_hello_world0-c8808650", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.arn}", + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_hello_world0_S3Object_07DCCF6D.key}", + "s3_key": "${aws_s3_object.Api_get_hello_world0_S3Object_F6755FB0.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -401,30 +401,30 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "A_cloudApi_api_permission-GET-1454206f_5CDB71B7": { + "A_Api_api_permission-GET-1454206f_98E9910C": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/api/permission-GET-1454206f", - "uniqueId": "A_cloudApi_api_permission-GET-1454206f_5CDB71B7" + "path": "root/Default/Default/A/Api/api/permission-GET-1454206f", + "uniqueId": "A_Api_api_permission-GET-1454206f_98E9910C" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.A_cloudApi_get_endpoint10_4C55BA1A.function_name}", + "function_name": "${aws_lambda_function.A_Api_get_endpoint10_5345135D.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.A_cloudApi_api_37FCEF91.execution_arn}/*/GET/endpoint1", + "source_arn": "${aws_api_gateway_rest_api.A_Api_api_06466CBC.execution_arn}/*/GET/endpoint1", "statement_id": "AllowExecutionFromAPIGateway-GET-1454206f" }, - "cloudApi_api_permission-GET-ceca4943_9997DB29": { + "Api_api_permission-GET-ceca4943_731ED984": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-ceca4943", - "uniqueId": "cloudApi_api_permission-GET-ceca4943_9997DB29" + "path": "root/Default/Default/Api/api/permission-GET-ceca4943", + "uniqueId": "Api_api_permission-GET-ceca4943_731ED984" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_hello_world0_5CAA6AF9.function_name}", + "function_name": "${aws_lambda_function.Api_get_hello_world0_56F26C26.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/hello/world", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/hello/world", "statement_id": "AllowExecutionFromAPIGateway-GET-ceca4943" } }, @@ -440,22 +440,22 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "A_cloudApi_get_endpoint10_S3Object_0D156109": { + "A_Api_get_endpoint10_S3Object_C3F8C059": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Api/get_endpoint10/S3Object", - "uniqueId": "A_cloudApi_get_endpoint10_S3Object_0D156109" + "path": "root/Default/Default/A/Api/get_endpoint10/S3Object", + "uniqueId": "A_Api_get_endpoint10_S3Object_C3F8C059" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_get_hello_world0_S3Object_07DCCF6D": { + "Api_get_hello_world0_S3Object_F6755FB0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/S3Object", - "uniqueId": "cloudApi_get_hello_world0_S3Object_07DCCF6D" + "path": "root/Default/Default/Api/get_hello_world0/S3Object", + "uniqueId": "Api_get_hello_world0_S3Object_F6755FB0" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -554,7 +554,7 @@ class $Root extends $stdlib.std.Resource { class A extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + this.api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); const __parent_this_3 = this; class $Closure3 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); @@ -617,8 +617,8 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); - const counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); + const counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); const handler = new $Closure1(this, "$Closure1"); (api.get("/hello/world", handler)); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:api url", new $Closure2(this, "$Closure2")); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md index a855ebae484..cd249f46ecd 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_custom.test.w_compile_tf-aws.md @@ -112,9 +112,9 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -145,8 +145,8 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -156,103 +156,103 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c86dec9c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'winglang.io'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Custom-Header'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c82bfbcd/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'winglang.io'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Custom-Header'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9": { + "Api_get_users0_CloudwatchLogGroup_6649CB35": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9" + "path": "root/Default/Default/Api/get_users0/CloudwatchLogGroup", + "uniqueId": "Api_get_users0_CloudwatchLogGroup_6649CB35" } }, - "name": "/aws/lambda/get_users0-c86dec9c", + "name": "/aws/lambda/get_users0-c82bfbcd", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_users0_IamRole_5BFD476C": { + "Api_get_users0_IamRole_950ACE40": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRole", - "uniqueId": "cloudApi_get_users0_IamRole_5BFD476C" + "path": "root/Default/Default/Api/get_users0/IamRole", + "uniqueId": "Api_get_users0_IamRole_950ACE40" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_users0_IamRolePolicy_295FFAAE": { + "Api_get_users0_IamRolePolicy_1C96E6D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicy", - "uniqueId": "cloudApi_get_users0_IamRolePolicy_295FFAAE" + "path": "root/Default/Default/Api/get_users0/IamRolePolicy", + "uniqueId": "Api_get_users0_IamRolePolicy_1C96E6D8" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04": { + "Api_get_users0_IamRolePolicyAttachment_EB78BB64": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04" + "path": "root/Default/Default/Api/get_users0/IamRolePolicyAttachment", + "uniqueId": "Api_get_users0_IamRolePolicyAttachment_EB78BB64" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" } }, "aws_lambda_function": { - "cloudApi_get_users0_483BD7DE": { + "Api_get_users0_F1BDFB04": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/Default", - "uniqueId": "cloudApi_get_users0_483BD7DE" + "path": "root/Default/Default/Api/get_users0/Default", + "uniqueId": "Api_get_users0_F1BDFB04" } }, "architectures": [ @@ -261,18 +261,18 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_users0-c86dec9c", + "WING_FUNCTION_NAME": "get_users0-c82bfbcd", "WING_TARGET": "tf-aws" } }, - "function_name": "get_users0-c86dec9c", + "function_name": "get_users0-c82bfbcd", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.arn}", + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_users0_S3Object_513E5470.key}", + "s3_key": "${aws_s3_object.Api_get_users0_S3Object_5E4DF6D1.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -281,17 +281,17 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0": { + "Api_api_permission-GET-41f0e61d_AD17285B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-41f0e61d", - "uniqueId": "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0" + "path": "root/Default/Default/Api/api/permission-GET-41f0e61d", + "uniqueId": "Api_api_permission-GET-41f0e61d_AD17285B" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users0_483BD7DE.function_name}", + "function_name": "${aws_lambda_function.Api_get_users0_F1BDFB04.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/users", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/users", "statement_id": "AllowExecutionFromAPIGateway-GET-41f0e61d" } }, @@ -307,11 +307,11 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "aws_s3_object": { - "cloudApi_get_users0_S3Object_513E5470": { + "Api_get_users0_S3Object_5E4DF6D1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/S3Object", - "uniqueId": "cloudApi_get_users0_S3Object_513E5470" + "path": "root/Default/Default/Api/get_users0/S3Object", + "uniqueId": "Api_get_users0_S3Object_5E4DF6D1" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -484,7 +484,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api", { cors: true, corsOptions: ({"allowOrigin": "winglang.io", "allowMethods": [cloud.HttpMethod.GET, cloud.HttpMethod.POST, cloud.HttpMethod.OPTIONS], "allowHeaders": ["Content-Type", "Authorization", "X-Custom-Header"], "allowCredentials": true, "exposeHeaders": ["Content-Type"]}) }); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api", { cors: true, corsOptions: ({"allowOrigin": "winglang.io", "allowMethods": [cloud.HttpMethod.GET, cloud.HttpMethod.POST, cloud.HttpMethod.OPTIONS], "allowHeaders": ["Content-Type", "Authorization", "X-Custom-Header"], "allowCredentials": true, "exposeHeaders": ["Content-Type"]}) }); (api.get("/users", new $Closure1(this, "$Closure1"))); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:GET /users has cors headers", new $Closure2(this, "$Closure2")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:OPTIONS /users has cors headers", new $Closure3(this, "$Closure3")); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md index a5867e097de..19c14ca5b84 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_cors_default.test.w_compile_tf-aws.md @@ -87,9 +87,9 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -120,8 +120,8 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -131,103 +131,103 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c86dec9c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,PUT,DELETE,HEAD,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Requested-With'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c82bfbcd/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,PUT,DELETE,HEAD,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type,Authorization,X-Requested-With'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9": { + "Api_get_users0_CloudwatchLogGroup_6649CB35": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9" + "path": "root/Default/Default/Api/get_users0/CloudwatchLogGroup", + "uniqueId": "Api_get_users0_CloudwatchLogGroup_6649CB35" } }, - "name": "/aws/lambda/get_users0-c86dec9c", + "name": "/aws/lambda/get_users0-c82bfbcd", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_users0_IamRole_5BFD476C": { + "Api_get_users0_IamRole_950ACE40": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRole", - "uniqueId": "cloudApi_get_users0_IamRole_5BFD476C" + "path": "root/Default/Default/Api/get_users0/IamRole", + "uniqueId": "Api_get_users0_IamRole_950ACE40" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_users0_IamRolePolicy_295FFAAE": { + "Api_get_users0_IamRolePolicy_1C96E6D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicy", - "uniqueId": "cloudApi_get_users0_IamRolePolicy_295FFAAE" + "path": "root/Default/Default/Api/get_users0/IamRolePolicy", + "uniqueId": "Api_get_users0_IamRolePolicy_1C96E6D8" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04": { + "Api_get_users0_IamRolePolicyAttachment_EB78BB64": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04" + "path": "root/Default/Default/Api/get_users0/IamRolePolicyAttachment", + "uniqueId": "Api_get_users0_IamRolePolicyAttachment_EB78BB64" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" } }, "aws_lambda_function": { - "cloudApi_get_users0_483BD7DE": { + "Api_get_users0_F1BDFB04": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/Default", - "uniqueId": "cloudApi_get_users0_483BD7DE" + "path": "root/Default/Default/Api/get_users0/Default", + "uniqueId": "Api_get_users0_F1BDFB04" } }, "architectures": [ @@ -236,18 +236,18 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_users0-c86dec9c", + "WING_FUNCTION_NAME": "get_users0-c82bfbcd", "WING_TARGET": "tf-aws" } }, - "function_name": "get_users0-c86dec9c", + "function_name": "get_users0-c82bfbcd", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.arn}", + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_users0_S3Object_513E5470.key}", + "s3_key": "${aws_s3_object.Api_get_users0_S3Object_5E4DF6D1.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -256,17 +256,17 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0": { + "Api_api_permission-GET-41f0e61d_AD17285B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-41f0e61d", - "uniqueId": "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0" + "path": "root/Default/Default/Api/api/permission-GET-41f0e61d", + "uniqueId": "Api_api_permission-GET-41f0e61d_AD17285B" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users0_483BD7DE.function_name}", + "function_name": "${aws_lambda_function.Api_get_users0_F1BDFB04.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/users", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/users", "statement_id": "AllowExecutionFromAPIGateway-GET-41f0e61d" } }, @@ -282,11 +282,11 @@ module.exports = function({ $apiDefaultCors_url, $expect_Util, $http_HttpMethod, } }, "aws_s3_object": { - "cloudApi_get_users0_S3Object_513E5470": { + "Api_get_users0_S3Object_5E4DF6D1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/S3Object", - "uniqueId": "cloudApi_get_users0_S3Object_513E5470" + "path": "root/Default/Default/Api/get_users0/S3Object", + "uniqueId": "Api_get_users0_S3Object_5E4DF6D1" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -421,7 +421,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const apiDefaultCors = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api", { cors: true }); + const apiDefaultCors = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api", { cors: true }); (apiDefaultCors.get("/users", new $Closure1(this, "$Closure1"))); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:GET /users has default cors headers", new $Closure2(this, "$Closure2")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:OPTIONS /users has default cors headers", new $Closure3(this, "$Closure3")); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md index 794f4a0e2b9..23ab6fc2fc1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md @@ -33,9 +33,9 @@ module.exports = function({ }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -66,8 +66,8 @@ module.exports = function({ }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -77,103 +77,103 @@ module.exports = function({ }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/test/path\":{\"get\":{\"operationId\":\"get-test/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/alphanumer1cPa_th\":{\"get\":{\"operationId\":\"get-test/alphanumer1cPa_th\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path\":{\"get\":{\"operationId\":\"get-test/regular/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6\":{\"get\":{\"operationId\":\"get-test/pa-th/:with/two/:variable_s/f?bla=5&b=6\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"with\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"variable_s\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/param/is/{last}\":{\"get\":{\"operationId\":\"get-test/param/is/:last\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"last\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/{param}\":{\"get\":{\"operationId\":\"get-test/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{param}\":{\"get\":{\"operationId\":\"get-:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/t/{param}\":{\"get\":{\"operationId\":\"get-t/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path/{param}\":{\"get\":{\"operationId\":\"get-test/regular/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/{param1}/segment2?query1=value1?query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/:param1/segment2?query1=value1?query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param1\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/segment2?query=value1&query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/segment2?query=value1&query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path.withDots\":{\"get\":{\"operationId\":\"get-test/path.withDots\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/.withDots/{param}/{param-dash}/x\":{\"get\":{\"operationId\":\"get-test/path/.withDots/:param/:param-dash/x\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"param-dash\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8152120/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/test/path\":{\"get\":{\"operationId\":\"get-test/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/alphanumer1cPa_th\":{\"get\":{\"operationId\":\"get-test/alphanumer1cPa_th\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path\":{\"get\":{\"operationId\":\"get-test/regular/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6\":{\"get\":{\"operationId\":\"get-test/pa-th/:with/two/:variable_s/f?bla=5&b=6\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"with\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"variable_s\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/param/is/{last}\":{\"get\":{\"operationId\":\"get-test/param/is/:last\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"last\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/{param}\":{\"get\":{\"operationId\":\"get-test/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{param}\":{\"get\":{\"operationId\":\"get-:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/t/{param}\":{\"get\":{\"operationId\":\"get-t/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path/{param}\":{\"get\":{\"operationId\":\"get-test/regular/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/{param1}/segment2?query1=value1?query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/:param1/segment2?query1=value1?query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param1\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/segment2?query=value1&query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/segment2?query=value1&query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path.withDots\":{\"get\":{\"operationId\":\"get-test/path.withDots\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/.withDots/{param}/{param-dash}/x\":{\"get\":{\"operationId\":\"get-test/path/.withDots/:param/:param-dash/x\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"param-dash\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_test_path0_CloudwatchLogGroup_54E5E90D": { + "Api_get_test_path0_CloudwatchLogGroup_409E5E8A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_test_path0_CloudwatchLogGroup_54E5E90D" + "path": "root/Default/Default/Api/get_test_path0/CloudwatchLogGroup", + "uniqueId": "Api_get_test_path0_CloudwatchLogGroup_409E5E8A" } }, - "name": "/aws/lambda/get_test_path0-c8152120", + "name": "/aws/lambda/get_test_path0-c8bdb226", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_test_path0_IamRole_C2933341": { + "Api_get_test_path0_IamRole_C41D1174": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/IamRole", - "uniqueId": "cloudApi_get_test_path0_IamRole_C2933341" + "path": "root/Default/Default/Api/get_test_path0/IamRole", + "uniqueId": "Api_get_test_path0_IamRole_C41D1174" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_test_path0_IamRolePolicy_250BA805": { + "Api_get_test_path0_IamRolePolicy_871429E4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/IamRolePolicy", - "uniqueId": "cloudApi_get_test_path0_IamRolePolicy_250BA805" + "path": "root/Default/Default/Api/get_test_path0/IamRolePolicy", + "uniqueId": "Api_get_test_path0_IamRolePolicy_871429E4" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_test_path0_IamRole_C2933341.name}" + "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_test_path0_IamRolePolicyAttachment_CB038D54": { + "Api_get_test_path0_IamRolePolicyAttachment_E6813A4F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_test_path0_IamRolePolicyAttachment_CB038D54" + "path": "root/Default/Default/Api/get_test_path0/IamRolePolicyAttachment", + "uniqueId": "Api_get_test_path0_IamRolePolicyAttachment_E6813A4F" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_test_path0_IamRole_C2933341.name}" + "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.name}" } }, "aws_lambda_function": { - "cloudApi_get_test_path0_6E56C4FC": { + "Api_get_test_path0_645426B9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/Default", - "uniqueId": "cloudApi_get_test_path0_6E56C4FC" + "path": "root/Default/Default/Api/get_test_path0/Default", + "uniqueId": "Api_get_test_path0_645426B9" } }, "architectures": [ @@ -182,18 +182,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_test_path0-c8152120", + "WING_FUNCTION_NAME": "get_test_path0-c8bdb226", "WING_TARGET": "tf-aws" } }, - "function_name": "get_test_path0-c8152120", + "function_name": "get_test_path0-c8bdb226", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_test_path0_IamRole_C2933341.arn}", + "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_test_path0_S3Object_13991E03.key}", + "s3_key": "${aws_s3_object.Api_get_test_path0_S3Object_F8C2A41F.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -202,173 +202,173 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-07205281_7BCD05F4": { + "Api_api_permission-GET-07205281_2EFE8EB1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-07205281", - "uniqueId": "cloudApi_api_permission-GET-07205281_7BCD05F4" + "path": "root/Default/Default/Api/api/permission-GET-07205281", + "uniqueId": "Api_api_permission-GET-07205281_2EFE8EB1" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/t/{param}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/t/{param}", "statement_id": "AllowExecutionFromAPIGateway-GET-07205281" }, - "cloudApi_api_permission-GET-16d10b32_CE016FD4": { + "Api_api_permission-GET-16d10b32_C81601CA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-16d10b32", - "uniqueId": "cloudApi_api_permission-GET-16d10b32_CE016FD4" + "path": "root/Default/Default/Api/api/permission-GET-16d10b32", + "uniqueId": "Api_api_permission-GET-16d10b32_C81601CA" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/path/.withDots/{param}/{param-dash}/x", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path/.withDots/{param}/{param-dash}/x", "statement_id": "AllowExecutionFromAPIGateway-GET-16d10b32" }, - "cloudApi_api_permission-GET-1dad4331_94C4E99B": { + "Api_api_permission-GET-1dad4331_32F54094": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-1dad4331", - "uniqueId": "cloudApi_api_permission-GET-1dad4331_94C4E99B" + "path": "root/Default/Default/Api/api/permission-GET-1dad4331", + "uniqueId": "Api_api_permission-GET-1dad4331_32F54094" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/{param}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/{param}", "statement_id": "AllowExecutionFromAPIGateway-GET-1dad4331" }, - "cloudApi_api_permission-GET-4835e6c5_11B675C1": { + "Api_api_permission-GET-4835e6c5_6B499B93": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-4835e6c5", - "uniqueId": "cloudApi_api_permission-GET-4835e6c5_11B675C1" + "path": "root/Default/Default/Api/api/permission-GET-4835e6c5", + "uniqueId": "Api_api_permission-GET-4835e6c5_6B499B93" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/path/{param}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path/{param}", "statement_id": "AllowExecutionFromAPIGateway-GET-4835e6c5" }, - "cloudApi_api_permission-GET-525feabe_D7999357": { + "Api_api_permission-GET-525feabe_2C6C9790": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-525feabe", - "uniqueId": "cloudApi_api_permission-GET-525feabe_D7999357" + "path": "root/Default/Default/Api/api/permission-GET-525feabe", + "uniqueId": "Api_api_permission-GET-525feabe_2C6C9790" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/param/is/{last}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/param/is/{last}", "statement_id": "AllowExecutionFromAPIGateway-GET-525feabe" }, - "cloudApi_api_permission-GET-815194c4_CF55A67A": { + "Api_api_permission-GET-815194c4_25BC69FF": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-815194c4", - "uniqueId": "cloudApi_api_permission-GET-815194c4_CF55A67A" + "path": "root/Default/Default/Api/api/permission-GET-815194c4", + "uniqueId": "Api_api_permission-GET-815194c4_25BC69FF" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6", "statement_id": "AllowExecutionFromAPIGateway-GET-815194c4" }, - "cloudApi_api_permission-GET-83a11f17_B40DCB9A": { + "Api_api_permission-GET-83a11f17_56732227": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-83a11f17", - "uniqueId": "cloudApi_api_permission-GET-83a11f17_B40DCB9A" + "path": "root/Default/Default/Api/api/permission-GET-83a11f17", + "uniqueId": "Api_api_permission-GET-83a11f17_56732227" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path", "statement_id": "AllowExecutionFromAPIGateway-GET-83a11f17" }, - "cloudApi_api_permission-GET-8d6a8a39_7FDACFF5": { + "Api_api_permission-GET-8d6a8a39_19EE1671": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-8d6a8a39", - "uniqueId": "cloudApi_api_permission-GET-8d6a8a39_7FDACFF5" + "path": "root/Default/Default/Api/api/permission-GET-8d6a8a39", + "uniqueId": "Api_api_permission-GET-8d6a8a39_19EE1671" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/regular/path", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/regular/path", "statement_id": "AllowExecutionFromAPIGateway-GET-8d6a8a39" }, - "cloudApi_api_permission-GET-8dfdf611_E63657D8": { + "Api_api_permission-GET-8dfdf611_2D4250A0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-8dfdf611", - "uniqueId": "cloudApi_api_permission-GET-8dfdf611_E63657D8" + "path": "root/Default/Default/Api/api/permission-GET-8dfdf611", + "uniqueId": "Api_api_permission-GET-8dfdf611_2D4250A0" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/alphanumer1cPa_th", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/alphanumer1cPa_th", "statement_id": "AllowExecutionFromAPIGateway-GET-8dfdf611" }, - "cloudApi_api_permission-GET-b171b58d_9FC71DD1": { + "Api_api_permission-GET-b171b58d_9A7757E3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-b171b58d", - "uniqueId": "cloudApi_api_permission-GET-b171b58d_9FC71DD1" + "path": "root/Default/Default/Api/api/permission-GET-b171b58d", + "uniqueId": "Api_api_permission-GET-b171b58d_9A7757E3" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/segment1/segment2?query=value1&query2=value2", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/segment1/segment2?query=value1&query2=value2", "statement_id": "AllowExecutionFromAPIGateway-GET-b171b58d" }, - "cloudApi_api_permission-GET-d0938f9f_D3A8DFED": { + "Api_api_permission-GET-d0938f9f_157E2FB0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-d0938f9f", - "uniqueId": "cloudApi_api_permission-GET-d0938f9f_D3A8DFED" + "path": "root/Default/Default/Api/api/permission-GET-d0938f9f", + "uniqueId": "Api_api_permission-GET-d0938f9f_157E2FB0" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/regular/path/{param}", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/regular/path/{param}", "statement_id": "AllowExecutionFromAPIGateway-GET-d0938f9f" }, - "cloudApi_api_permission-GET-ecbc2deb_13109BA2": { + "Api_api_permission-GET-ecbc2deb_702B770C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-ecbc2deb", - "uniqueId": "cloudApi_api_permission-GET-ecbc2deb_13109BA2" + "path": "root/Default/Default/Api/api/permission-GET-ecbc2deb", + "uniqueId": "Api_api_permission-GET-ecbc2deb_702B770C" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/segment1/{param1}/segment2?query1=value1?query2=value2", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/segment1/{param1}/segment2?query1=value1?query2=value2", "statement_id": "AllowExecutionFromAPIGateway-GET-ecbc2deb" }, - "cloudApi_api_permission-GET-f2bb7c42_70EF6671": { + "Api_api_permission-GET-f2bb7c42_E8380F56": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-f2bb7c42", - "uniqueId": "cloudApi_api_permission-GET-f2bb7c42_70EF6671" + "path": "root/Default/Default/Api/api/permission-GET-f2bb7c42", + "uniqueId": "Api_api_permission-GET-f2bb7c42_E8380F56" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_test_path0_6E56C4FC.function_name}", + "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/test/path.withDots", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path.withDots", "statement_id": "AllowExecutionFromAPIGateway-GET-f2bb7c42" } }, @@ -384,11 +384,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudApi_get_test_path0_S3Object_13991E03": { + "Api_get_test_path0_S3Object_F8C2A41F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_test_path0/S3Object", - "uniqueId": "cloudApi_get_test_path0_S3Object_13991E03" + "path": "root/Default/Default/Api/get_test_path0/S3Object", + "uniqueId": "Api_get_test_path0_S3Object_F8C2A41F" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -445,7 +445,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); const handler = new $Closure1(this, "$Closure1"); const testInvalidPath = ((path) => { let error = ""; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md index 1644a8d4fdf..9c8e87c2191 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/asynchronous_model_implicit_await_in_functions.test.w_compile_tf-aws.md @@ -244,15 +244,15 @@ module.exports = function({ $strToStr }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -340,7 +340,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); const strToStr = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "strToStr", new $Closure1(this, "$Closure1")); const func = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "func", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md index cfe10ad2108..46bfe35b984 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_cdk8s.test.w_compile_tf-aws.md @@ -34,8 +34,8 @@ class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); const app = this.node.root.new("cdk8s.App", cdk8s.App, ); - const chart = this.node.root.new("cdk8s.Chart", cdk8s.Chart, this, "cdk8s.Chart"); - const deploy = ($scope => $scope.node.root.new("cdk8s-plus-27.Deployment", kplus.Deployment, $scope, "kplus.Deployment"))(chart); + const chart = this.node.root.new("cdk8s.Chart", cdk8s.Chart, this, "Chart"); + const deploy = ($scope => $scope.node.root.new("cdk8s-plus-27.Deployment", kplus.Deployment, $scope, "Deployment"))(chart); (deploy.addContainer(({"image": "hashicorp/http-echo", "args": ["-text", "text"], "portNumber": 5678}))); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md index f4f0f550957..31d9e298877 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local.test.w_compile_tf-aws.md @@ -130,15 +130,15 @@ module.exports = function({ }) { }, "data": { "aws_lambda_invocation": { - "file1Store_cloudOnDeploy_Invocation_0E6A2A64": { + "Store_OnDeploy_Invocation_E9660D82": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Invocation", - "uniqueId": "file1Store_cloudOnDeploy_Invocation_0E6A2A64" + "path": "root/Default/Default/Store/OnDeploy/Invocation", + "uniqueId": "Store_OnDeploy_Invocation_E9660D82" } }, "depends_on": [], - "function_name": "${aws_lambda_function.file1Store_cloudOnDeploy_Function_9539541F.function_name}", + "function_name": "${aws_lambda_function.Store_OnDeploy_Function_6D11EEE6.function_name}", "input": "{}" } } @@ -150,58 +150,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "file1Store_cloudOnDeploy_Function_CloudwatchLogGroup_624FDE3C": { + "Store_OnDeploy_Function_CloudwatchLogGroup_74529587": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/CloudwatchLogGroup", - "uniqueId": "file1Store_cloudOnDeploy_Function_CloudwatchLogGroup_624FDE3C" + "path": "root/Default/Default/Store/OnDeploy/Function/CloudwatchLogGroup", + "uniqueId": "Store_OnDeploy_Function_CloudwatchLogGroup_74529587" } }, - "name": "/aws/lambda/Function-c8b7b48c", + "name": "/aws/lambda/Function-c81a83fe", "retention_in_days": 30 } }, "aws_iam_role": { - "file1Store_cloudOnDeploy_Function_IamRole_233573CC": { + "Store_OnDeploy_Function_IamRole_CD090388": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/IamRole", - "uniqueId": "file1Store_cloudOnDeploy_Function_IamRole_233573CC" + "path": "root/Default/Default/Store/OnDeploy/Function/IamRole", + "uniqueId": "Store_OnDeploy_Function_IamRole_CD090388" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "file1Store_cloudOnDeploy_Function_IamRolePolicy_8C128884": { + "Store_OnDeploy_Function_IamRolePolicy_C32885AE": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/IamRolePolicy", - "uniqueId": "file1Store_cloudOnDeploy_Function_IamRolePolicy_8C128884" + "path": "root/Default/Default/Store/OnDeploy/Function/IamRolePolicy", + "uniqueId": "Store_OnDeploy_Function_IamRolePolicy_C32885AE" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.file1Store_cloudBucket_86CE87B1.arn}\",\"${aws_s3_bucket.file1Store_cloudBucket_86CE87B1.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.file1Store_cloudOnDeploy_Function_IamRole_233573CC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.Store_Bucket_42A4CEFB.arn}\",\"${aws_s3_bucket.Store_Bucket_42A4CEFB.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Store_OnDeploy_Function_IamRole_CD090388.name}" } }, "aws_iam_role_policy_attachment": { - "file1Store_cloudOnDeploy_Function_IamRolePolicyAttachment_20F1BD40": { + "Store_OnDeploy_Function_IamRolePolicyAttachment_0AFCF1E8": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/IamRolePolicyAttachment", - "uniqueId": "file1Store_cloudOnDeploy_Function_IamRolePolicyAttachment_20F1BD40" + "path": "root/Default/Default/Store/OnDeploy/Function/IamRolePolicyAttachment", + "uniqueId": "Store_OnDeploy_Function_IamRolePolicyAttachment_0AFCF1E8" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.file1Store_cloudOnDeploy_Function_IamRole_233573CC.name}" + "role": "${aws_iam_role.Store_OnDeploy_Function_IamRole_CD090388.name}" } }, "aws_lambda_function": { - "file1Store_cloudOnDeploy_Function_9539541F": { + "Store_OnDeploy_Function_6D11EEE6": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/Default", - "uniqueId": "file1Store_cloudOnDeploy_Function_9539541F" + "path": "root/Default/Default/Store/OnDeploy/Function/Default", + "uniqueId": "Store_OnDeploy_Function_6D11EEE6" } }, "architectures": [ @@ -209,20 +209,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_94dc4b3e": "${aws_s3_bucket.file1Store_cloudBucket_86CE87B1.bucket}", + "BUCKET_NAME_af11ee62": "${aws_s3_bucket.Store_Bucket_42A4CEFB.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "Function-c8b7b48c", + "WING_FUNCTION_NAME": "Function-c81a83fe", "WING_TARGET": "tf-aws" } }, - "function_name": "Function-c8b7b48c", + "function_name": "Function-c81a83fe", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.file1Store_cloudOnDeploy_Function_IamRole_233573CC.arn}", + "role": "${aws_iam_role.Store_OnDeploy_Function_IamRole_CD090388.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.file1Store_cloudOnDeploy_Function_S3Object_CBBF816B.key}", + "s3_key": "${aws_s3_object.Store_OnDeploy_Function_S3Object_95484A56.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -240,23 +240,23 @@ module.exports = function({ }) { }, "bucket_prefix": "code-c84a50b1-" }, - "file1Store_cloudBucket_86CE87B1": { + "Store_Bucket_42A4CEFB": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.Bucket/Default", - "uniqueId": "file1Store_cloudBucket_86CE87B1" + "path": "root/Default/Default/Store/Bucket/Default", + "uniqueId": "Store_Bucket_42A4CEFB" } }, - "bucket_prefix": "cloud-bucket-c8b6ef02-", + "bucket_prefix": "bucket-c843dbb0-", "force_destroy": false } }, "aws_s3_object": { - "file1Store_cloudOnDeploy_Function_S3Object_CBBF816B": { + "Store_OnDeploy_Function_S3Object_95484A56": { "//": { "metadata": { - "path": "root/Default/Default/file1.Store/cloud.OnDeploy/Function/S3Object", - "uniqueId": "file1Store_cloudOnDeploy_Function_S3Object_CBBF816B" + "path": "root/Default/Default/Store/OnDeploy/Function/S3Object", + "uniqueId": "Store_OnDeploy_Function_S3Object_95484A56" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -388,8 +388,8 @@ class $Root extends $stdlib.std.Resource { }); } } - const store = new file1.Store(this, "file1.Store"); - const q = new file2.Q(this, "file2.Q"); + const store = new file1.Store(this, "Store"); + const q = new file2.Q(this, "Q"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:add data to store", new $Closure1(this, "$Closure1")); const s = ({"x": 1, "y": 2}); const c = file1.Color.BLUE; @@ -414,9 +414,9 @@ const math = $stdlib.math; const cloud = $stdlib.cloud; const Color = (function (tmp) { - tmp[tmp["RED"] = 0] = ",RED"; - tmp[tmp["GREEN"] = 1] = ",GREEN"; - tmp[tmp["BLUE"] = 2] = ",BLUE"; + tmp["RED"] = "RED"; + tmp["GREEN"] = "GREEN"; + tmp["BLUE"] = "BLUE"; return tmp; })({}) ; @@ -451,7 +451,7 @@ class Util extends $stdlib.std.Resource { class Store extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const __parent_this_1 = this; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); @@ -488,7 +488,7 @@ class Store extends $stdlib.std.Resource { }); } } - const prefill = this.node.root.new("@winglang/sdk.cloud.OnDeploy", cloud.OnDeploy, this, "cloud.OnDeploy", new $Closure1(this, "$Closure1")); + const prefill = this.node.root.new("@winglang/sdk.cloud.OnDeploy", cloud.OnDeploy, this, "OnDeploy", new $Closure1(this, "$Closure1")); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md index ada06984301..6c886da472f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_local_dir.test.w_compile_tf-aws.md @@ -219,13 +219,13 @@ const subdir = require("./preflight.subdir2-5.js"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); - const widget1 = new w.Widget(this, "w.Widget"); + const widget1 = new w.Widget(this, "widget1"); $helpers.assert($helpers.eq((widget1.compute()), 42), "widget1.compute() == 42"); - const foo = new subdir.Foo(this, "subdir.Foo"); + const foo = new subdir.Foo(this, "Foo"); $helpers.assert($helpers.eq((foo.foo()), "foo"), "foo.foo() == \"foo\""); - const bar = new subdir.Bar(this, "subdir.Bar"); + const bar = new subdir.Bar(this, "Bar"); $helpers.assert($helpers.eq((bar.bar()), "bar"), "bar.bar() == \"bar\""); - const widget2 = new subdir.inner.Widget(this, "subdir.inner.Widget"); + const widget2 = new subdir.inner.Widget(this, "widget2"); $helpers.assert($helpers.eq((widget2.compute()), 42), "widget2.compute() == 42"); $helpers.assert($helpers.eq((foo.checkWidget(widget2)), 1379), "foo.checkWidget(widget2) == 1379"); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md index bb2ccef7815..f84aa366922 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bring_wing_library.test.w_compile_tf-aws.md @@ -83,14 +83,14 @@ module.exports = function({ }) { }, "resource": { "aws_s3_bucket": { - "fixtureStore_cloudBucket_0EE75A93": { + "Store_Bucket_42A4CEFB": { "//": { "metadata": { - "path": "root/Default/Default/fixture.Store/cloud.Bucket/Default", - "uniqueId": "fixtureStore_cloudBucket_0EE75A93" + "path": "root/Default/Default/Store/Bucket/Default", + "uniqueId": "Store_Bucket_42A4CEFB" } }, - "bucket_prefix": "cloud-bucket-c8afb3a9-", + "bucket_prefix": "bucket-c843dbb0-", "force_destroy": false } } @@ -106,8 +106,8 @@ const std = $stdlib.std; const $helpers = $stdlib.helpers; const FavoriteNumbers = (function (tmp) { - tmp[tmp["SEVEN"] = 0] = ",SEVEN"; - tmp[tmp["FORTY_TWO"] = 1] = ",FORTY_TWO"; + tmp["SEVEN"] = "SEVEN"; + tmp["FORTY_TWO"] = "FORTY_TWO"; return tmp; })({}) ; @@ -165,7 +165,7 @@ class $Root extends $stdlib.std.Resource { }); } } - new fixture.Store(this, "fixture.Store"); + new fixture.Store(this, "Store"); const fave_num = fixture.FavoriteNumbers.SEVEN; const fave_num2 = testfixture.FavoriteNumbers.SEVEN; const fave_num3 = testfixture2.FavoriteNumbers.SEVEN; @@ -190,7 +190,7 @@ const myutil = require("./preflight.util-2.js"); class Store extends $stdlib.std.Resource { constructor($scope, $id, options) { super($scope, $id); - this.data = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.data = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.handlers = []; } static makeKey(name) { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md index a1426148281..6ba9a4aed63 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/bucket_keys.test.w_compile_tf-aws.md @@ -48,14 +48,14 @@ module.exports = function({ $b }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -111,7 +111,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md index 84f09a64f48..665a6651af6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_in_binary.test.w_compile_tf-aws.md @@ -40,14 +40,14 @@ module.exports = function({ $b, $x }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -106,7 +106,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const x = 12; this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:binary expressions", new $Closure1(this, "$Closure1")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md index bce8aa991b2..152dd93eff5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_primitives.test.w_compile_tf-aws.md @@ -52,58 +52,58 @@ module.exports = function({ $myBool, $myDur_hours, $myDur_minutes, $myDur_second }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -112,18 +112,18 @@ module.exports = function({ $myBool, $myDur_hours, $myDur_minutes, $myDur_second "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -143,11 +143,11 @@ module.exports = function({ $myBool, $myDur_hours, $myDur_minutes, $myDur_second } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -231,7 +231,7 @@ class $Root extends $stdlib.std.Resource { const mySecondBool = false; const myDur = (std.Duration.fromSeconds(600)); const handler = new $Closure1(this, "$Closure1"); - this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", handler); + this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", handler); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md index 87117af957f..5deaa47678a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_reassigable_class_field.test.w_compile_tf-aws.md @@ -129,14 +129,14 @@ module.exports = function({ }) { } }, "aws_s3_bucket": { - "KeyValueStore_cloudBucket_D9D365FD": { + "KeyValueStore_Bucket_EBBCDEA3": { "//": { "metadata": { - "path": "root/Default/Default/KeyValueStore/cloud.Bucket/Default", - "uniqueId": "KeyValueStore_cloudBucket_D9D365FD" + "path": "root/Default/Default/KeyValueStore/Bucket/Default", + "uniqueId": "KeyValueStore_Bucket_EBBCDEA3" } }, - "bucket_prefix": "cloud-bucket-c8a9ef69-", + "bucket_prefix": "bucket-c8da6031-", "force_destroy": false } } @@ -161,7 +161,7 @@ class $Root extends $stdlib.std.Resource { class KeyValueStore extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const __parent_this_1 = this; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md index 28c3925110d..32b4e74448c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_and_data.test.w_compile_tf-aws.md @@ -41,27 +41,27 @@ module.exports = function({ $data_size, $queue, $res }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -124,8 +124,8 @@ class $Root extends $stdlib.std.Resource { } } const data = new Set([1, 2, 3]); - const res = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const res = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:resource and data", new $Closure1(this, "$Closure1")); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md index 134097174d6..879f332bb77 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_resource_with_no_inflight.test.w_compile_tf-aws.md @@ -59,11 +59,11 @@ module.exports = function({ }) { }, "resource": { "aws_dynamodb_table": { - "A_cloudCounter_1CAB7DAD": { + "A_Counter_2B28E8C1": { "//": { "metadata": { - "path": "root/Default/Default/A/cloud.Counter/Default", - "uniqueId": "A_cloudCounter_1CAB7DAD" + "path": "root/Default/Default/A/Counter/Default", + "uniqueId": "A_Counter_2B28E8C1" } }, "attribute": [ @@ -74,7 +74,7 @@ module.exports = function({ }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c88d0b81" + "name": "wing-counter-Counter-c87bf366" } } } @@ -98,7 +98,7 @@ class $Root extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); this.field = "hey"; - this.counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + this.counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md index eabfbbc44fa..4854c34282c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/capture_tokens.test.w_compile_tf-aws.md @@ -77,17 +77,17 @@ module.exports = function({ }) { "root": { "Default": { "Default": { + "Api": { + "Endpoint": { + "Url": "Api_Endpoint_Url_473FEE9F" + } + }, "MyResource": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "MyResource_cloudApi_Endpoint_Url_02924D7C" + "Url": "MyResource_Api_Endpoint_Url_62C4AC1C" } } - }, - "cloud.Api": { - "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" - } } } } @@ -117,11 +117,11 @@ module.exports = function({ }) { } }, "output": { - "MyResource_cloudApi_Endpoint_Url_02924D7C": { - "value": "https://${aws_api_gateway_rest_api.MyResource_cloudApi_api_4CB9B8E3.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.MyResource_cloudApi_api_stage_A26656F9.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" }, - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "MyResource_Api_Endpoint_Url_62C4AC1C": { + "value": "https://${aws_api_gateway_rest_api.MyResource_Api_api_35C6C5EE.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.MyResource_Api_api_stage_4DA77656.stage_name}" } }, "provider": { @@ -131,86 +131,86 @@ module.exports = function({ }) { }, "resource": { "aws_api_gateway_deployment": { - "MyResource_cloudApi_api_deployment_6DBAED7F": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Api/api/deployment", - "uniqueId": "MyResource_cloudApi_api_deployment_6DBAED7F" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.MyResource_cloudApi_api_4CB9B8E3.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.MyResource_cloudApi_api_4CB9B8E3.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } }, - "cloudApi_api_deployment_545514BF": { + "MyResource_Api_api_deployment_9749D61B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/MyResource/Api/api/deployment", + "uniqueId": "MyResource_Api_api_deployment_9749D61B" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.MyResource_Api_api_35C6C5EE.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.MyResource_Api_api_35C6C5EE.body)}" } } }, "aws_api_gateway_rest_api": { - "MyResource_cloudApi_api_4CB9B8E3": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Api/api/api", - "uniqueId": "MyResource_cloudApi_api_4CB9B8E3" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c8ef4b64" + "name": "api-c8f613f0" }, - "cloudApi_api_2B334D75": { + "MyResource_Api_api_35C6C5EE": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/MyResource/Api/api/api", + "uniqueId": "MyResource_Api_api_35C6C5EE" } }, "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c801136d" } }, "aws_api_gateway_stage": { - "MyResource_cloudApi_api_stage_A26656F9": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Api/api/stage", - "uniqueId": "MyResource_cloudApi_api_stage_A26656F9" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.MyResource_cloudApi_api_deployment_6DBAED7F.id}", - "rest_api_id": "${aws_api_gateway_rest_api.MyResource_cloudApi_api_4CB9B8E3.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" }, - "cloudApi_api_stage_BBB283E4": { + "MyResource_Api_api_stage_4DA77656": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/MyResource/Api/api/stage", + "uniqueId": "MyResource_Api_api_stage_4DA77656" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.MyResource_Api_api_deployment_9749D61B.id}", + "rest_api_id": "${aws_api_gateway_rest_api.MyResource_Api_api_35C6C5EE.id}", "stage_name": "prod" } } @@ -234,7 +234,7 @@ class $Root extends $stdlib.std.Resource { class MyResource extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + this.api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); this.url = this.api.url; } static _toInflightType() { @@ -355,7 +355,7 @@ class $Root extends $stdlib.std.Resource { } const r = new MyResource(this, "MyResource"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:inflight class", new $Closure1(this, "$Closure1")); - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); const url = api.url; this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:inflight globals", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md index 43a026bf863..b0c89a46799 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/captures.test.w_compile_tf-aws.md @@ -87,9 +87,9 @@ module.exports = function({ $headers }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -120,8 +120,8 @@ module.exports = function({ $headers }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -131,47 +131,47 @@ module.exports = function({ $headers }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello\":{\"get\":{\"operationId\":\"get-hello\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello0-c8a0ae61/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello\":{\"get\":{\"operationId\":\"get-hello\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello0-c8557c1a/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, @@ -186,34 +186,34 @@ module.exports = function({ $headers }) { "name": "/aws/lambda/AnotherFunction-c88d2a81", "retention_in_days": 30 }, - "cloudApi_get_hello0_CloudwatchLogGroup_25A0C74E": { + "Api_get_hello0_CloudwatchLogGroup_1025B41C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_hello0_CloudwatchLogGroup_25A0C74E" + "path": "root/Default/Default/Api/get_hello0/CloudwatchLogGroup", + "uniqueId": "Api_get_hello0_CloudwatchLogGroup_1025B41C" } }, - "name": "/aws/lambda/get_hello0-c8a0ae61", + "name": "/aws/lambda/get_hello0-c8557c1a", "retention_in_days": 30 }, - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 }, - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, @@ -227,29 +227,29 @@ module.exports = function({ $headers }) { }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_get_hello0_IamRole_55903A67": { + "Api_get_hello0_IamRole_1E6956F6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRole", - "uniqueId": "cloudApi_get_hello0_IamRole_55903A67" + "path": "root/Default/Default/Api/get_hello0/IamRole", + "uniqueId": "Api_get_hello0_IamRole_1E6956F6" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" @@ -263,38 +263,38 @@ module.exports = function({ $headers }) { "uniqueId": "AnotherFunction_IamRolePolicy_5A9BEFB1" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.AnotherFunction_IamRole_74447271.name}" }, - "cloudApi_get_hello0_IamRolePolicy_7E9CA094": { + "Api_get_hello0_IamRolePolicy_CFA96C73": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRolePolicy", - "uniqueId": "cloudApi_get_hello0_IamRolePolicy_7E9CA094" + "path": "root/Default/Default/Api/get_hello0/IamRolePolicy", + "uniqueId": "Api_get_hello0_IamRolePolicy_CFA96C73" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.name}" + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.name}" }, - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:PutObject*\",\"s3:Abort*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\",\"s3:GetBucketPublicAccessBlock\"],\"Resource\":[\"${aws_s3_bucket.PublicBucket.arn}\",\"${aws_s3_bucket.PublicBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.PrivateBucket.arn}\",\"${aws_s3_bucket.PrivateBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { @@ -308,48 +308,48 @@ module.exports = function({ $headers }) { "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", "role": "${aws_iam_role.AnotherFunction_IamRole_74447271.name}" }, - "cloudApi_get_hello0_IamRolePolicyAttachment_B5AC70C0": { + "Api_get_hello0_IamRolePolicyAttachment_2CF40947": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_hello0_IamRolePolicyAttachment_B5AC70C0" + "path": "root/Default/Default/Api/get_hello0/IamRolePolicyAttachment", + "uniqueId": "Api_get_hello0_IamRolePolicyAttachment_2CF40947" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.name}" + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.name}" }, - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 5, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { @@ -366,8 +366,8 @@ module.exports = function({ $headers }) { "environment": { "variables": { "BUCKET_NAME_0c557d45": "${aws_s3_bucket.PrivateBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "BUCKET_NAME_21bd2572": "${aws_s3_bucket.PublicBucket.bucket}", - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "AnotherFunction-c88d2a81", "WING_TARGET": "tf-aws" @@ -387,11 +387,11 @@ module.exports = function({ $headers }) { "subnet_ids": [] } }, - "cloudApi_get_hello0_FD9AD345": { + "Api_get_hello0_910B8B13": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/Default", - "uniqueId": "cloudApi_get_hello0_FD9AD345" + "path": "root/Default/Default/Api/get_hello0/Default", + "uniqueId": "Api_get_hello0_910B8B13" } }, "architectures": [ @@ -400,29 +400,29 @@ module.exports = function({ $headers }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_hello0-c8a0ae61", + "WING_FUNCTION_NAME": "get_hello0-c8557c1a", "WING_TARGET": "tf-aws" } }, - "function_name": "get_hello0-c8a0ae61", + "function_name": "get_hello0-c8557c1a", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_hello0_IamRole_55903A67.arn}", + "role": "${aws_iam_role.Api_get_hello0_IamRole_1E6956F6.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_hello0_S3Object_771D5C96.key}", + "s3_key": "${aws_s3_object.Api_get_hello0_S3Object_6B43B0B3.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -431,32 +431,32 @@ module.exports = function({ $headers }) { "environment": { "variables": { "BUCKET_NAME_0c557d45": "${aws_s3_bucket.PrivateBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "BUCKET_NAME_21bd2572": "${aws_s3_bucket.PublicBucket.bucket}", - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -465,22 +465,22 @@ module.exports = function({ $headers }) { "environment": { "variables": { "BUCKET_NAME_0c557d45": "${aws_s3_bucket.PrivateBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "BUCKET_NAME_21bd2572": "${aws_s3_bucket.PublicBucket.bucket}", - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] @@ -488,21 +488,31 @@ module.exports = function({ $headers }) { } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-df16733f_0EEF8FF5": { + "Api_api_permission-GET-df16733f_BE6D5FC5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-df16733f", - "uniqueId": "cloudApi_api_permission-GET-df16733f_0EEF8FF5" + "path": "root/Default/Default/Api/api/permission-GET-df16733f", + "uniqueId": "Api_api_permission-GET-df16733f_BE6D5FC5" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_hello0_FD9AD345.function_name}", + "function_name": "${aws_lambda_function.Api_get_hello0_910B8B13.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/hello", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/hello", "statement_id": "AllowExecutionFromAPIGateway-GET-df16733f" } }, "aws_s3_bucket": { + "Bucket": { + "//": { + "metadata": { + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" + } + }, + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false + }, "Code": { "//": { "metadata": { @@ -531,16 +541,6 @@ module.exports = function({ $headers }) { }, "bucket_prefix": "publicbucket-c8fea5d9-", "force_destroy": false - }, - "cloudBucket": { - "//": { - "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" - } - }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false } }, "aws_s3_bucket_policy": { @@ -585,33 +585,33 @@ module.exports = function({ $headers }) { "key": "", "source": "" }, - "cloudApi_get_hello0_S3Object_771D5C96": { + "Api_get_hello0_S3Object_6B43B0B3": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello0/S3Object", - "uniqueId": "cloudApi_get_hello0_S3Object_771D5C96" + "path": "root/Default/Default/Api/get_hello0/S3Object", + "uniqueId": "Api_get_hello0_S3Object_6B43B0B3" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -620,15 +620,15 @@ module.exports = function({ $headers }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -760,17 +760,17 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket1 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket1 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const bucket2 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "PublicBucket", ({"public": true})); const bucket3 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "PrivateBucket", { public: false }); - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); const handler = new $Closure1(this, "$Closure1"); (queue.setConsumer(new $Closure2(this, "$Closure2"), { batchSize: 5 })); - this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", handler, { env: ({}) }); + this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", handler, { env: ({}) }); const emptyEnv = ({}); this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "AnotherFunction", handler, { env: emptyEnv }); const headers = ({["my-fancy-header"]: "my-fancy-value", ["not-even-real\""]: "wow` !"}); - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); (api.get("/hello", new $Closure3(this, "$Closure3"))); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md index 6e4743da08c..d1ae57839b3 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/casting.test.w_compile_tf-aws.md @@ -23,11 +23,11 @@ }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, "bucket_prefix": "my-prefix-", @@ -53,7 +53,7 @@ const aws = require("@cdktf/provider-aws"); class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); if ($helpers.eq((util.Util.env("WING_TARGET")), "tf-aws")) { const s3Bucket = (b.node.findChild("Default")); (s3Bucket.addOverride("bucket_prefix", "my-prefix-")); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md index aa3c7b80f0c..f2eeb61c26a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_compile_tf-aws.md @@ -32,11 +32,11 @@ module.exports = function({ }) { }, "resource": { "aws_sqs_queue": { - "awssqsQueueSqsQueue": { + "SqsQueue": { "//": { "metadata": { - "path": "root/Default/Default/aws.sqsQueue.SqsQueue", - "uniqueId": "awssqsQueueSqsQueue" + "path": "root/Default/Default/SqsQueue", + "uniqueId": "SqsQueue" } } } @@ -95,7 +95,7 @@ class $Root extends $stdlib.std.Resource { const getDisplayName = ((r) => { return $helpers.nodeof(r).title; }); - const q = this.node.root.new("@cdktf/provider-aws.sqsQueue.SqsQueue", aws.sqsQueue.SqsQueue, this, "aws.sqsQueue.SqsQueue"); + const q = this.node.root.new("@cdktf/provider-aws.sqsQueue.SqsQueue", aws.sqsQueue.SqsQueue, this, "SqsQueue"); const wr = new WingResource(this, "WingResource"); const another_resource = wr; console.log(String.raw({ raw: ["path of sqs.queue: ", ""] }, (getPath(q)))); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md index 53c7c8f3103..4d5d3e5f824 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/construct-base.test.w_test_sim.md @@ -3,7 +3,7 @@ ## stdout.log ```log my id is WingResource -path of sqs.queue: root/env0/aws.sqsQueue.SqsQueue +path of sqs.queue: root/env0/SqsQueue path of wing resource: root/env0/WingResource display name of wing resource: no display name pass ─ construct-base.test.wsim (no tests) diff --git a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md index 89bfae66bfe..cf1c82bb414 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/debug_env.test.w_compile_tf-aws.md @@ -49,7 +49,7 @@ class $Root extends $stdlib.std.Resource { class A extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md index bc1cf3e9f5d..276a41c4637 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/double_reference.test.w_compile_tf-aws.md @@ -77,11 +77,11 @@ module.exports = function({ $initCount }) { }, "resource": { "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -92,7 +92,7 @@ module.exports = function({ $initCount }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } } } @@ -219,7 +219,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const initCount = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + const initCount = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); const bar = new Bar(this, "Bar"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:hello", new $Closure1(this, "$Closure1")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md index 472350b3b79..b7235cd308d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/doubler.test.w_compile_tf-aws.md @@ -12,7 +12,7 @@ module.exports = function({ }) { return $obj; } async handle(m) { - return String.raw({ raw: ["Hello ", "!"] }, m); + return String.raw({ raw: ["Hello ", "!"] }, (m ?? "nil")); } } return $Closure1; @@ -136,58 +136,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "Doubler2_cloudFunction_CloudwatchLogGroup_517BCD05": { + "Doubler2_Function_CloudwatchLogGroup_53963378": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/CloudwatchLogGroup", - "uniqueId": "Doubler2_cloudFunction_CloudwatchLogGroup_517BCD05" + "path": "root/Default/Default/Doubler2/Function/CloudwatchLogGroup", + "uniqueId": "Doubler2_Function_CloudwatchLogGroup_53963378" } }, - "name": "/aws/lambda/cloud-Function-c8d4b6f0", + "name": "/aws/lambda/Function-c892ab6d", "retention_in_days": 30 } }, "aws_iam_role": { - "Doubler2_cloudFunction_IamRole_3E4BED38": { + "Doubler2_Function_IamRole_66AECEFB": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/IamRole", - "uniqueId": "Doubler2_cloudFunction_IamRole_3E4BED38" + "path": "root/Default/Default/Doubler2/Function/IamRole", + "uniqueId": "Doubler2_Function_IamRole_66AECEFB" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "Doubler2_cloudFunction_IamRolePolicy_0E850719": { + "Doubler2_Function_IamRolePolicy_B68B51AD": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/IamRolePolicy", - "uniqueId": "Doubler2_cloudFunction_IamRolePolicy_0E850719" + "path": "root/Default/Default/Doubler2/Function/IamRolePolicy", + "uniqueId": "Doubler2_Function_IamRolePolicy_B68B51AD" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.Doubler2_cloudFunction_IamRole_3E4BED38.name}" + "role": "${aws_iam_role.Doubler2_Function_IamRole_66AECEFB.name}" } }, "aws_iam_role_policy_attachment": { - "Doubler2_cloudFunction_IamRolePolicyAttachment_A02FB4B1": { + "Doubler2_Function_IamRolePolicyAttachment_4191B8F8": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "Doubler2_cloudFunction_IamRolePolicyAttachment_A02FB4B1" + "path": "root/Default/Default/Doubler2/Function/IamRolePolicyAttachment", + "uniqueId": "Doubler2_Function_IamRolePolicyAttachment_4191B8F8" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.Doubler2_cloudFunction_IamRole_3E4BED38.name}" + "role": "${aws_iam_role.Doubler2_Function_IamRole_66AECEFB.name}" } }, "aws_lambda_function": { - "Doubler2_cloudFunction_402CDAA3": { + "Doubler2_Function_235483AB": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/Default", - "uniqueId": "Doubler2_cloudFunction_402CDAA3" + "path": "root/Default/Default/Doubler2/Function/Default", + "uniqueId": "Doubler2_Function_235483AB" } }, "architectures": [ @@ -196,18 +196,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d4b6f0", + "WING_FUNCTION_NAME": "Function-c892ab6d", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d4b6f0", + "function_name": "Function-c892ab6d", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.Doubler2_cloudFunction_IamRole_3E4BED38.arn}", + "role": "${aws_iam_role.Doubler2_Function_IamRole_66AECEFB.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.Doubler2_cloudFunction_S3Object_8029A145.key}", + "s3_key": "${aws_s3_object.Doubler2_Function_S3Object_4A795FD9.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -227,11 +227,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "Doubler2_cloudFunction_S3Object_8029A145": { + "Doubler2_Function_S3Object_4A795FD9": { "//": { "metadata": { - "path": "root/Default/Default/Doubler2/cloud.Function/S3Object", - "uniqueId": "Doubler2_cloudFunction_S3Object_8029A145" + "path": "root/Default/Default/Doubler2/Function/S3Object", + "uniqueId": "Doubler2_Function_S3Object_4A795FD9" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -365,7 +365,7 @@ class $Root extends $stdlib.std.Resource { }); } } - return this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new $Closure2(this, "$Closure2")); + return this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure2(this, "$Closure2")); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md index e2fcf6db175..de7ed1c4b16 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_compile_tf-aws.md @@ -21,6 +21,28 @@ module.exports = function({ $SomeEnum, $one, $two }) { //# sourceMappingURL=inflight.$Closure1-1.js.map ``` +## inflight.$Closure2-1.js +```js +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $SomeEnum }) { + class $Closure2 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, $SomeEnum.ONE), "ONE"), "\"{SomeEnum.ONE}\" == \"ONE\""); + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, $SomeEnum.TWO), "TWO"), "\"{SomeEnum.TWO}\" == \"TWO\""); + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, $SomeEnum.THREE), "THREE"), "\"{SomeEnum.THREE}\" == \"THREE\""); + } + } + return $Closure2; +} +//# sourceMappingURL=inflight.$Closure2-1.js.map +``` + ## main.tf.json ```json { @@ -54,9 +76,9 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); const SomeEnum = (function (tmp) { - tmp[tmp["ONE"] = 0] = ",ONE"; - tmp[tmp["TWO"] = 1] = ",TWO"; - tmp[tmp["THREE"] = 2] = ",THREE"; + tmp["ONE"] = "ONE"; + tmp["TWO"] = "TWO"; + tmp["THREE"] = "THREE"; return tmp; })({}) ; @@ -99,11 +121,48 @@ class $Root extends $stdlib.std.Resource { }); } } + class $Closure2 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure2-1.js")({ + $SomeEnum: ${$stdlib.core.liftObject(SomeEnum)}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure2Client = ${$Closure2._toInflightType()}; + const client = new $Closure2Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + ], + "$inflight_init": [ + ], + }); + } + } const opt = undefined; const three = SomeEnum.THREE; const one = SomeEnum.ONE; const two = SomeEnum.TWO; this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:inflight", new $Closure1(this, "$Closure1")); + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, SomeEnum.ONE), "ONE"), "\"{SomeEnum.ONE}\" == \"ONE\""); + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, SomeEnum.TWO), "TWO"), "\"{SomeEnum.TWO}\" == \"TWO\""); + $helpers.assert($helpers.eq(String.raw({ raw: ["", ""] }, SomeEnum.THREE), "THREE"), "\"{SomeEnum.THREE}\" == \"THREE\""); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:toStr inflight", new $Closure2(this, "$Closure2")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md index 815da02ba38..bb941688c7a 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/enums.test.w_test_sim.md @@ -2,10 +2,11 @@ ## stdout.log ```log -pass ─ enums.test.wsim » root/env0/test:inflight +pass ─ enums.test.wsim » root/env0/test:inflight +pass ─ enums.test.wsim » root/env1/test:toStr inflight -Tests 1 passed (1) +Tests 2 passed (2) Test Files 1 passed (1) Duration ``` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md index 96ec75add65..d2365ae3fd4 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/file_counter.test.w_compile_tf-aws.md @@ -40,23 +40,23 @@ module.exports = function({ $bucket, $counter }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -67,63 +67,63 @@ module.exports = function({ $bucket, $counter }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -131,22 +131,22 @@ module.exports = function({ $bucket, $counter }) { ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] @@ -154,32 +154,32 @@ module.exports = function({ $bucket, $counter }) { } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -188,15 +188,15 @@ module.exports = function({ $bucket, $counter }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -255,9 +255,9 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); - const counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter", { initial: 100 }); - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); + const counter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter", { initial: 100 }); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); const handler = new $Closure1(this, "$Closure1"); (queue.setConsumer(handler)); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md index 8592243007f..91828fb8d8b 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/for_loop.test.w_compile_tf-aws.md @@ -61,58 +61,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -121,18 +121,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -152,11 +152,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -382,7 +382,7 @@ class $Root extends $stdlib.std.Resource { $helpers.assert((x > 0), "x > 0"); console.log(String.raw({ raw: ["", ""] }, x)); } - this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md index 850e0196d33..24272c467d1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/hello.test.w_compile_tf-aws.md @@ -38,71 +38,71 @@ module.exports = function({ $bucket }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -110,21 +110,21 @@ module.exports = function({ $bucket }) { ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] @@ -132,32 +132,32 @@ module.exports = function({ $bucket }) { } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -166,15 +166,15 @@ module.exports = function({ $bucket }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -230,8 +230,8 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); (queue.setConsumer(new $Closure1(this, "$Closure1"))); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md index 0339a9ae482..29b2d9868ae 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/in_scope_construct.test.w_compile_tf-aws.md @@ -74,7 +74,7 @@ class $Root extends $stdlib.std.Resource { }); } } - new MyClass(this.node.root.new("constructs.Construct", c.Construct, this, "c.Construct"), "MyClass"); + new MyClass(this.node.root.new("constructs.Construct", c.Construct, this, "Construct"), "MyClass"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md index d1bc0040cdd..e33800c8251 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inference.test.w_compile_tf-aws.md @@ -33,9 +33,9 @@ module.exports = function({ }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -66,8 +66,8 @@ module.exports = function({ }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -77,103 +77,103 @@ module.exports = function({ }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello/world\":{\"get\":{\"operationId\":\"get-hello/world\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello_world0-c8d20d3c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/hello/world\":{\"get\":{\"operationId\":\"get-hello/world\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_hello_world0-c8808650/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_hello_world0_CloudwatchLogGroup_29C4F429": { + "Api_get_hello_world0_CloudwatchLogGroup_6629DDA5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_hello_world0_CloudwatchLogGroup_29C4F429" + "path": "root/Default/Default/Api/get_hello_world0/CloudwatchLogGroup", + "uniqueId": "Api_get_hello_world0_CloudwatchLogGroup_6629DDA5" } }, - "name": "/aws/lambda/get_hello_world0-c8d20d3c", + "name": "/aws/lambda/get_hello_world0-c8808650", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_hello_world0_IamRole_E302D75D": { + "Api_get_hello_world0_IamRole_BE6EA0B6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRole", - "uniqueId": "cloudApi_get_hello_world0_IamRole_E302D75D" + "path": "root/Default/Default/Api/get_hello_world0/IamRole", + "uniqueId": "Api_get_hello_world0_IamRole_BE6EA0B6" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_hello_world0_IamRolePolicy_56CA9635": { + "Api_get_hello_world0_IamRolePolicy_EA874D77": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRolePolicy", - "uniqueId": "cloudApi_get_hello_world0_IamRolePolicy_56CA9635" + "path": "root/Default/Default/Api/get_hello_world0/IamRolePolicy", + "uniqueId": "Api_get_hello_world0_IamRolePolicy_EA874D77" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.name}" + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_hello_world0_IamRolePolicyAttachment_861BE130": { + "Api_get_hello_world0_IamRolePolicyAttachment_E570C504": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_hello_world0_IamRolePolicyAttachment_861BE130" + "path": "root/Default/Default/Api/get_hello_world0/IamRolePolicyAttachment", + "uniqueId": "Api_get_hello_world0_IamRolePolicyAttachment_E570C504" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.name}" + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.name}" } }, "aws_lambda_function": { - "cloudApi_get_hello_world0_5CAA6AF9": { + "Api_get_hello_world0_56F26C26": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/Default", - "uniqueId": "cloudApi_get_hello_world0_5CAA6AF9" + "path": "root/Default/Default/Api/get_hello_world0/Default", + "uniqueId": "Api_get_hello_world0_56F26C26" } }, "architectures": [ @@ -182,18 +182,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_hello_world0-c8d20d3c", + "WING_FUNCTION_NAME": "get_hello_world0-c8808650", "WING_TARGET": "tf-aws" } }, - "function_name": "get_hello_world0-c8d20d3c", + "function_name": "get_hello_world0-c8808650", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_hello_world0_IamRole_E302D75D.arn}", + "role": "${aws_iam_role.Api_get_hello_world0_IamRole_BE6EA0B6.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_hello_world0_S3Object_07DCCF6D.key}", + "s3_key": "${aws_s3_object.Api_get_hello_world0_S3Object_F6755FB0.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -202,17 +202,17 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-ceca4943_9997DB29": { + "Api_api_permission-GET-ceca4943_731ED984": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-ceca4943", - "uniqueId": "cloudApi_api_permission-GET-ceca4943_9997DB29" + "path": "root/Default/Default/Api/api/permission-GET-ceca4943", + "uniqueId": "Api_api_permission-GET-ceca4943_731ED984" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_hello_world0_5CAA6AF9.function_name}", + "function_name": "${aws_lambda_function.Api_get_hello_world0_56F26C26.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/hello/world", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/hello/world", "statement_id": "AllowExecutionFromAPIGateway-GET-ceca4943" } }, @@ -228,11 +228,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudApi_get_hello_world0_S3Object_07DCCF6D": { + "Api_get_hello_world0_S3Object_F6755FB0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_hello_world0/S3Object", - "uniqueId": "cloudApi_get_hello_world0_S3Object_07DCCF6D" + "path": "root/Default/Default/Api/get_hello_world0/S3Object", + "uniqueId": "Api_get_hello_world0_S3Object_F6755FB0" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -310,7 +310,7 @@ class $Root extends $stdlib.std.Resource { const emptySet = new Set([((arr, index) => { if (index < 0 || index >= arr.length) throw new Error("Index out of bounds"); return arr[index]; })(clonedArray2, 2)]); const clonedSet = new Set(emptySet); (clonedSet.add(4)); - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); const func = new $Closure1(this, "$Closure1"); (api.get("/hello/world", func)); const argReturn = ((n) => { diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md index a643c357f1c..f7698753a4c 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight-subscribers.test.w_compile_tf-aws.md @@ -58,110 +58,110 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 }, - "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3": { + "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/CloudwatchLogGroup", - "uniqueId": "cloudTopic-OnMessage0_CloudwatchLogGroup_EE5F97B3" + "path": "root/Default/Default/Topic-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Topic-OnMessage0_CloudwatchLogGroup_DE4DF0A1" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage0-c81c4559", + "name": "/aws/lambda/Topic-OnMessage0-c85d7820", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudTopic-OnMessage0_IamRole_A9AB13E2": { + "Topic-OnMessage0_IamRole_64DD36FA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRole", - "uniqueId": "cloudTopic-OnMessage0_IamRole_A9AB13E2" + "path": "root/Default/Default/Topic-OnMessage0/IamRole", + "uniqueId": "Topic-OnMessage0_IamRole_64DD36FA" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" }, - "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F": { + "Topic-OnMessage0_IamRolePolicy_F5EE09D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicy", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicy_38E6FB0F" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicy", + "uniqueId": "Topic-OnMessage0_IamRolePolicy_F5EE09D8" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" }, - "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4": { + "Topic-OnMessage0_IamRolePolicyAttachment_091E665D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "cloudTopic-OnMessage0_IamRolePolicyAttachment_0E97F0D4" + "path": "root/Default/Default/Topic-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Topic-OnMessage0_IamRolePolicyAttachment_091E665D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.name}" + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -170,29 +170,29 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudTopic-OnMessage0": { + "Topic-OnMessage0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/Default", - "uniqueId": "cloudTopic-OnMessage0" + "path": "root/Default/Default/Topic-OnMessage0/Default", + "uniqueId": "Topic-OnMessage0" } }, "architectures": [ @@ -201,18 +201,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage0-c81c4559", + "WING_FUNCTION_NAME": "Topic-OnMessage0-c85d7820", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage0-c81c4559", + "function_name": "Topic-OnMessage0-c85d7820", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudTopic-OnMessage0_IamRole_A9AB13E2.arn}", + "role": "${aws_iam_role.Topic-OnMessage0_IamRole_64DD36FA.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudTopic-OnMessage0_S3Object_751FA064.key}", + "s3_key": "${aws_s3_object.Topic-OnMessage0_S3Object_D41E9C10.key}", "timeout": 180, "vpc_config": { "security_group_ids": [], @@ -221,17 +221,17 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D": { + "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b", - "uniqueId": "cloudTopic-OnMessage0_InvokePermission-c82b57aa3e58b626b884e8374e59ec192cf61df91b_91E7486D" + "path": "root/Default/Default/Topic-OnMessage0/InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2", + "uniqueId": "Topic-OnMessage0_InvokePermission-c8228fb70d825c2a5610c610e5246d5313ea6bd1a2_2E2D0106" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudTopic-OnMessage0.function_name}", + "function_name": "${aws_lambda_function.Topic-OnMessage0.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.cloudTopic.arn}" + "source_arn": "${aws_sns_topic.Topic.arn}" } }, "aws_s3_bucket": { @@ -246,22 +246,22 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudTopic-OnMessage0_S3Object_751FA064": { + "Topic-OnMessage0_S3Object_D41E9C10": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic-OnMessage0/S3Object", - "uniqueId": "cloudTopic-OnMessage0_S3Object_751FA064" + "path": "root/Default/Default/Topic-OnMessage0/S3Object", + "uniqueId": "Topic-OnMessage0_S3Object_D41E9C10" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -270,39 +270,39 @@ module.exports = function({ }) { } }, "aws_sns_topic": { - "cloudTopic": { + "Topic": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/Default", - "uniqueId": "cloudTopic" + "path": "root/Default/Default/Topic/Default", + "uniqueId": "Topic" } }, - "name": "cloud-Topic-c82b57aa" + "name": "Topic-c8228fb7" } }, "aws_sns_topic_subscription": { - "cloudTopic_TopicSubscription0_D19DE229": { + "Topic_TopicSubscription0_0EA5CC90": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Topic/TopicSubscription0", - "uniqueId": "cloudTopic_TopicSubscription0_D19DE229" + "path": "root/Default/Default/Topic/TopicSubscription0", + "uniqueId": "Topic_TopicSubscription0_0EA5CC90" } }, - "endpoint": "${aws_lambda_function.cloudTopic-OnMessage0.arn}", + "endpoint": "${aws_lambda_function.Topic-OnMessage0.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.cloudTopic.arn}" + "topic_arn": "${aws_sns_topic.Topic.arn}" } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -387,8 +387,8 @@ class $Root extends $stdlib.std.Resource { }); } } - (this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "cloud.Topic").onMessage(new $Closure1(this, "$Closure1"), { timeout: (std.Duration.fromSeconds(180)) })); - (this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue").setConsumer(new $Closure2(this, "$Closure2"), { timeout: (std.Duration.fromSeconds(180)) })); + (this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "Topic").onMessage(new $Closure1(this, "$Closure1"), { timeout: (std.Duration.fromSeconds(180)) })); + (this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue").setConsumer(new $Closure2(this, "$Closure2"), { timeout: (std.Duration.fromSeconds(180)) })); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md index 6d6e1eb790f..7e78f1baa6e 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_class_inside_inflight_closure.test.w_compile_tf-aws.md @@ -112,58 +112,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "PreflightClass_cloudFunction_CloudwatchLogGroup_0BDDEF5D": { + "PreflightClass_Function_CloudwatchLogGroup_06161414": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/CloudwatchLogGroup", - "uniqueId": "PreflightClass_cloudFunction_CloudwatchLogGroup_0BDDEF5D" + "path": "root/Default/Default/PreflightClass/Function/CloudwatchLogGroup", + "uniqueId": "PreflightClass_Function_CloudwatchLogGroup_06161414" } }, - "name": "/aws/lambda/cloud-Function-c8db99e3", + "name": "/aws/lambda/Function-c8565504", "retention_in_days": 30 } }, "aws_iam_role": { - "PreflightClass_cloudFunction_IamRole_60AD4A3B": { + "PreflightClass_Function_IamRole_A6FFCAE6": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/IamRole", - "uniqueId": "PreflightClass_cloudFunction_IamRole_60AD4A3B" + "path": "root/Default/Default/PreflightClass/Function/IamRole", + "uniqueId": "PreflightClass_Function_IamRole_A6FFCAE6" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "PreflightClass_cloudFunction_IamRolePolicy_B064DBB3": { + "PreflightClass_Function_IamRolePolicy_6D810369": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/IamRolePolicy", - "uniqueId": "PreflightClass_cloudFunction_IamRolePolicy_B064DBB3" + "path": "root/Default/Default/PreflightClass/Function/IamRolePolicy", + "uniqueId": "PreflightClass_Function_IamRolePolicy_6D810369" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.PreflightClass_cloudBucket_05421049.arn}\",\"${aws_s3_bucket.PreflightClass_cloudBucket_05421049.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.PreflightClass_cloudFunction_IamRole_60AD4A3B.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.PreflightClass_Bucket_93EC74D7.arn}\",\"${aws_s3_bucket.PreflightClass_Bucket_93EC74D7.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.PreflightClass_Function_IamRole_A6FFCAE6.name}" } }, "aws_iam_role_policy_attachment": { - "PreflightClass_cloudFunction_IamRolePolicyAttachment_008B87A9": { + "PreflightClass_Function_IamRolePolicyAttachment_87F27E90": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "PreflightClass_cloudFunction_IamRolePolicyAttachment_008B87A9" + "path": "root/Default/Default/PreflightClass/Function/IamRolePolicyAttachment", + "uniqueId": "PreflightClass_Function_IamRolePolicyAttachment_87F27E90" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.PreflightClass_cloudFunction_IamRole_60AD4A3B.name}" + "role": "${aws_iam_role.PreflightClass_Function_IamRole_A6FFCAE6.name}" } }, "aws_lambda_function": { - "PreflightClass_cloudFunction_9F7C6688": { + "PreflightClass_Function_5A515406": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/Default", - "uniqueId": "PreflightClass_cloudFunction_9F7C6688" + "path": "root/Default/Default/PreflightClass/Function/Default", + "uniqueId": "PreflightClass_Function_5A515406" } }, "architectures": [ @@ -171,20 +171,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_70ca4fed": "${aws_s3_bucket.PreflightClass_cloudBucket_05421049.bucket}", + "BUCKET_NAME_5318ec22": "${aws_s3_bucket.PreflightClass_Bucket_93EC74D7.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8db99e3", + "WING_FUNCTION_NAME": "Function-c8565504", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8db99e3", + "function_name": "Function-c8565504", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.PreflightClass_cloudFunction_IamRole_60AD4A3B.arn}", + "role": "${aws_iam_role.PreflightClass_Function_IamRole_A6FFCAE6.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.PreflightClass_cloudFunction_S3Object_D4E803CB.key}", + "s3_key": "${aws_s3_object.PreflightClass_Function_S3Object_84DFAC83.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -202,23 +202,23 @@ module.exports = function({ }) { }, "bucket_prefix": "code-c84a50b1-" }, - "PreflightClass_cloudBucket_05421049": { + "PreflightClass_Bucket_93EC74D7": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Bucket/Default", - "uniqueId": "PreflightClass_cloudBucket_05421049" + "path": "root/Default/Default/PreflightClass/Bucket/Default", + "uniqueId": "PreflightClass_Bucket_93EC74D7" } }, - "bucket_prefix": "cloud-bucket-c8bbe938-", + "bucket_prefix": "bucket-c8739e77-", "force_destroy": false } }, "aws_s3_object": { - "PreflightClass_cloudFunction_S3Object_D4E803CB": { + "PreflightClass_Function_S3Object_84DFAC83": { "//": { "metadata": { - "path": "root/Default/Default/PreflightClass/cloud.Function/S3Object", - "uniqueId": "PreflightClass_cloudFunction_S3Object_D4E803CB" + "path": "root/Default/Default/PreflightClass/Function/S3Object", + "uniqueId": "PreflightClass_Function_S3Object_84DFAC83" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -246,7 +246,7 @@ class $Root extends $stdlib.std.Resource { class PreflightClass extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } preflight_method() { const __parent_this_1 = this; @@ -286,7 +286,7 @@ class $Root extends $stdlib.std.Resource { } } const inflight_closure = new $Closure1(this, "$Closure1"); - return this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", inflight_closure); + return this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", inflight_closure); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md index 3e87c254ad7..2400f91c48d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_compile_tf-aws.md @@ -46,7 +46,7 @@ module.exports = function({ $foo }) { ```js "use strict"; const $helpers = require("@winglang/sdk/lib/helpers"); -module.exports = function({ $expect_Util, $fn, $fn2 }) { +module.exports = function({ $expect_Util, $fn, $fn2, $sim }) { class $Closure3 { constructor({ }) { const $obj = (...args) => this.handle(...args); @@ -58,8 +58,11 @@ module.exports = function({ $expect_Util, $fn, $fn2 }) { const y = (await $fn.invoke("")); const z = (await $fn2.invoke("")); (await $expect_Util.equal(x, "100")); + if ($sim) { + (await $expect_Util.equal(y, "101")); + console.log("client has been reused"); + } (await $expect_Util.equal(z, "100-fn2")); - $helpers.assert(($helpers.eq(y, "100") || $helpers.eq(y, "101")), "y == \"100\" || y == \"101\""); } } return $Closure3; @@ -67,6 +70,50 @@ module.exports = function({ $expect_Util, $fn, $fn2 }) { //# sourceMappingURL=inflight.$Closure3-1.js.map ``` +## inflight.$Closure4-1.js +```js +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $foo, $std_Duration, $util_Util }) { + class $Closure4 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + const n = (await $foo.inc()); + (await $util_Util.sleep((await $std_Duration.fromSeconds(3)))); + $helpers.assert($helpers.eq(n, (await $foo.get())), "n == foo.get()"); + } + } + return $Closure4; +} +//# sourceMappingURL=inflight.$Closure4-1.js.map +``` + +## inflight.$Closure5-1.js +```js +"use strict"; +const $helpers = require("@winglang/sdk/lib/helpers"); +module.exports = function({ $fn3, $std_Duration, $util_Util }) { + class $Closure5 { + constructor({ }) { + const $obj = (...args) => this.handle(...args); + Object.setPrototypeOf($obj, this); + return $obj; + } + async handle() { + (await $fn3.invokeAsync("")); + (await $util_Util.sleep((await $std_Duration.fromSeconds(1)))); + (await $fn3.invoke("")); + } + } + return $Closure5; +} +//# sourceMappingURL=inflight.$Closure5-1.js.map +``` + ## inflight.Foo-1.js ```js "use strict"; @@ -79,6 +126,9 @@ module.exports = function({ }) { this.n += 1; return this.n; } + async get() { + return this.n; + } async $inflight_init() { this.n = 99; } @@ -106,14 +156,14 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 }, "fn2_CloudwatchLogGroup_CEBA055E": { @@ -125,14 +175,24 @@ module.exports = function({ }) { }, "name": "/aws/lambda/fn2-c892a4c6", "retention_in_days": 30 + }, + "fn3_CloudwatchLogGroup_C39A85FE": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/CloudwatchLogGroup", + "uniqueId": "fn3_CloudwatchLogGroup_C39A85FE" + } + }, + "name": "/aws/lambda/fn3-c856234e", + "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" @@ -145,18 +205,27 @@ module.exports = function({ }) { } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" + }, + "fn3_IamRole_B0C65815": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/IamRole", + "uniqueId": "fn3_IamRole_B0C65815" + } + }, + "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, "fn2_IamRolePolicy_3FE5A930": { "//": { @@ -167,18 +236,28 @@ module.exports = function({ }) { }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", "role": "${aws_iam_role.fn2_IamRole_DE8D96D2.name}" + }, + "fn3_IamRolePolicy_AE0DB40A": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/IamRolePolicy", + "uniqueId": "fn3_IamRolePolicy_AE0DB40A" + } + }, + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", + "role": "${aws_iam_role.fn3_IamRole_B0C65815.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" }, "fn2_IamRolePolicyAttachment_FC7F59A6": { "//": { @@ -189,14 +268,24 @@ module.exports = function({ }) { }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", "role": "${aws_iam_role.fn2_IamRole_DE8D96D2.name}" + }, + "fn3_IamRolePolicyAttachment_9C4A07E9": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/IamRolePolicyAttachment", + "uniqueId": "fn3_IamRolePolicyAttachment_9C4A07E9" + } + }, + "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", + "role": "${aws_iam_role.fn3_IamRole_B0C65815.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -205,18 +294,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -253,6 +342,37 @@ module.exports = function({ }) { "security_group_ids": [], "subnet_ids": [] } + }, + "fn3": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/Default", + "uniqueId": "fn3" + } + }, + "architectures": [ + "arm64" + ], + "environment": { + "variables": { + "NODE_OPTIONS": "--enable-source-maps", + "WING_FUNCTION_NAME": "fn3-c856234e", + "WING_TARGET": "tf-aws" + } + }, + "function_name": "fn3-c856234e", + "handler": "index.handler", + "memory_size": 1024, + "publish": true, + "role": "${aws_iam_role.fn3_IamRole_B0C65815.arn}", + "runtime": "nodejs20.x", + "s3_bucket": "${aws_s3_bucket.Code.bucket}", + "s3_key": "${aws_s3_object.fn3_S3Object_4E99C117.key}", + "timeout": 60, + "vpc_config": { + "security_group_ids": [], + "subnet_ids": [] + } } }, "aws_s3_bucket": { @@ -267,11 +387,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -288,6 +408,17 @@ module.exports = function({ }) { "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" + }, + "fn3_S3Object_4E99C117": { + "//": { + "metadata": { + "path": "root/Default/Default/fn3/S3Object", + "uniqueId": "fn3_S3Object_4E99C117" + } + }, + "bucket": "${aws_s3_bucket.Code.bucket}", + "key": "", + "source": "" } } } @@ -334,6 +465,8 @@ class $Root extends $stdlib.std.Resource { return ({ "inc": [ ], + "get": [ + ], "$inflight_init": [ ], "n": [ @@ -423,6 +556,7 @@ class $Root extends $stdlib.std.Resource { $expect_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(expect.Util, "@winglang/sdk/expect", "Util"))}, $fn: ${$stdlib.core.liftObject(fn)}, $fn2: ${$stdlib.core.liftObject(fn2)}, + $sim: ${$stdlib.core.liftObject(sim)}, }) `; } @@ -442,19 +576,97 @@ class $Root extends $stdlib.std.Resource { "handle": [ [fn, ["invoke"]], [fn2, ["invoke"]], + [sim, []], ], "$inflight_init": [ [fn, []], [fn2, []], + [sim, []], + ], + }); + } + } + class $Closure4 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure4-1.js")({ + $foo: ${$stdlib.core.liftObject(foo)}, + $std_Duration: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(std.Duration, "@winglang/sdk/std", "Duration"))}, + $util_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(util.Util, "@winglang/sdk/util", "Util"))}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure4Client = ${$Closure4._toInflightType()}; + const client = new $Closure4Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + [foo, ["get", "inc"]], + ], + "$inflight_init": [ + [foo, []], + ], + }); + } + } + class $Closure5 extends $stdlib.std.AutoIdResource { + _id = $stdlib.core.closureId(); + constructor($scope, $id, ) { + super($scope, $id); + $helpers.nodeof(this).hidden = true; + } + static _toInflightType() { + return ` + require("${$helpers.normalPath(__dirname)}/inflight.$Closure5-1.js")({ + $fn3: ${$stdlib.core.liftObject(fn3)}, + $std_Duration: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(std.Duration, "@winglang/sdk/std", "Duration"))}, + $util_Util: ${$stdlib.core.liftObject($stdlib.core.toLiftableModuleType(util.Util, "@winglang/sdk/util", "Util"))}, + }) + `; + } + _toInflight() { + return ` + (await (async () => { + const $Closure5Client = ${$Closure5._toInflightType()}; + const client = new $Closure5Client({ + }); + if (client.$inflight_init) { await client.$inflight_init(); } + return client; + })()) + `; + } + get _liftMap() { + return ({ + "handle": [ + [fn3, ["invoke", "invokeAsync"]], + ], + "$inflight_init": [ + [fn3, []], ], }); } } const foo = new Foo(this, "Foo"); - const fn = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new $Closure1(this, "$Closure1")); + const fn = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); const fn2 = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "fn2", new $Closure2(this, "$Closure2")); const sim = $helpers.eq((util.Util.env("WING_TARGET")), "sim"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:single instance of Foo", new $Closure3(this, "$Closure3")); + const fn3 = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "fn3", new $Closure4(this, "$Closure4")); + this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:Foo state is not shared between function invocations", new $Closure5(this, "$Closure5")); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md index 8c3752eb01a..3bd3576e346 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflight_handler_singleton.test.w_test_sim.md @@ -2,10 +2,12 @@ ## stdout.log ```log -pass ─ inflight_handler_singleton.test.wsim » root/env0/test:single instance of Foo +pass ┌ inflight_handler_singleton.test.wsim » root/env0/test:single instance of Foo + └ client has been reused +pass ─ inflight_handler_singleton.test.wsim » root/env1/test:Foo state is not shared between function invocations -Tests 1 passed (1) +Tests 2 passed (2) Test Files 1 passed (1) Duration ``` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md index d020d00770e..2c95549d432 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/inflights_calling_inflights.test.w_compile_tf-aws.md @@ -175,7 +175,7 @@ module.exports = function({ }) { "uniqueId": "func1_IamRolePolicy_B533BD74" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"}]}", "role": "${aws_iam_role.func1_IamRole_31EC29DC.name}" } }, @@ -204,7 +204,7 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", "WING_FUNCTION_NAME": "func1-c899062d", "WING_TARGET": "tf-aws" @@ -226,24 +226,24 @@ module.exports = function({ }) { } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { @@ -489,7 +489,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const storeInBucket = new $Closure1(this, "$Closure1"); const handler1 = new $Closure2(this, "$Closure2"); const func1 = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "func1", handler1); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md index 61820dadc95..69c9f1556b5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/issue_2889.test.w_compile_tf-aws.md @@ -57,9 +57,9 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -90,8 +90,8 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -101,103 +101,103 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/foo\":{\"get\":{\"operationId\":\"get-foo\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_foo0-c857c617/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/foo\":{\"get\":{\"operationId\":\"get-foo\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_foo0-c8fedbc0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_foo0_CloudwatchLogGroup_A3B51365": { + "Api_get_foo0_CloudwatchLogGroup_DB4D118A": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_foo0_CloudwatchLogGroup_A3B51365" + "path": "root/Default/Default/Api/get_foo0/CloudwatchLogGroup", + "uniqueId": "Api_get_foo0_CloudwatchLogGroup_DB4D118A" } }, - "name": "/aws/lambda/get_foo0-c857c617", + "name": "/aws/lambda/get_foo0-c8fedbc0", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_foo0_IamRole_54682B1A": { + "Api_get_foo0_IamRole_B1AE8E5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRole", - "uniqueId": "cloudApi_get_foo0_IamRole_54682B1A" + "path": "root/Default/Default/Api/get_foo0/IamRole", + "uniqueId": "Api_get_foo0_IamRole_B1AE8E5D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_foo0_IamRolePolicy_5FEC283C": { + "Api_get_foo0_IamRolePolicy_F8C7A0FA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRolePolicy", - "uniqueId": "cloudApi_get_foo0_IamRolePolicy_5FEC283C" + "path": "root/Default/Default/Api/get_foo0/IamRolePolicy", + "uniqueId": "Api_get_foo0_IamRolePolicy_F8C7A0FA" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.name}" + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_foo0_IamRolePolicyAttachment_1ACDC421": { + "Api_get_foo0_IamRolePolicyAttachment_1ED86FF6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_foo0_IamRolePolicyAttachment_1ACDC421" + "path": "root/Default/Default/Api/get_foo0/IamRolePolicyAttachment", + "uniqueId": "Api_get_foo0_IamRolePolicyAttachment_1ED86FF6" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.name}" + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.name}" } }, "aws_lambda_function": { - "cloudApi_get_foo0_8DAB9111": { + "Api_get_foo0_2DF5B57F": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/Default", - "uniqueId": "cloudApi_get_foo0_8DAB9111" + "path": "root/Default/Default/Api/get_foo0/Default", + "uniqueId": "Api_get_foo0_2DF5B57F" } }, "architectures": [ @@ -206,18 +206,18 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_foo0-c857c617", + "WING_FUNCTION_NAME": "get_foo0-c8fedbc0", "WING_TARGET": "tf-aws" } }, - "function_name": "get_foo0-c857c617", + "function_name": "get_foo0-c8fedbc0", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_foo0_IamRole_54682B1A.arn}", + "role": "${aws_iam_role.Api_get_foo0_IamRole_B1AE8E5D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_foo0_S3Object_5B231348.key}", + "s3_key": "${aws_s3_object.Api_get_foo0_S3Object_A8BEB597.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -226,17 +226,17 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-4273ae49_974F3EC5": { + "Api_api_permission-GET-4273ae49_725CFBAA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-4273ae49", - "uniqueId": "cloudApi_api_permission-GET-4273ae49_974F3EC5" + "path": "root/Default/Default/Api/api/permission-GET-4273ae49", + "uniqueId": "Api_api_permission-GET-4273ae49_725CFBAA" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_foo0_8DAB9111.function_name}", + "function_name": "${aws_lambda_function.Api_get_foo0_2DF5B57F.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/foo", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/foo", "statement_id": "AllowExecutionFromAPIGateway-GET-4273ae49" } }, @@ -252,11 +252,11 @@ module.exports = function({ $api_url, $http_Util, $std_Json }) { } }, "aws_s3_object": { - "cloudApi_get_foo0_S3Object_5B231348": { + "Api_get_foo0_S3Object_A8BEB597": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_foo0/S3Object", - "uniqueId": "cloudApi_get_foo0_S3Object_5B231348" + "path": "root/Default/Default/Api/get_foo0/S3Object", + "uniqueId": "Api_get_foo0_S3Object_A8BEB597" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -352,7 +352,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); (api.get("/foo", new $Closure1(this, "$Closure1"))); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:api should return a valid stringified json", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md index 79f8b5a88f3..e9e68a40a80 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json.test.w_compile_tf-aws.md @@ -32,14 +32,14 @@ module.exports = function({ }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -217,7 +217,7 @@ class $Root extends $stdlib.std.Resource { const notJsonMissingField = ({"foo": "bar", "stuff": []}); const notJson = ({"foo": "bar", "stuff": [1, 2, 3], "maybe": ({"good": true, "inner_stuff": [({"hi": 1, "base": "base"})]})}); let mutableJson = ({"foo": "bar", "stuff": [1, 2, 3], "maybe": ({"good": true, "inner_stuff": [({"hi": 1, "base": "base"})]})}); - const hasBucket = ({"a": ({"a": this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket")})}); + const hasBucket = ({"a": ({"a": this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket")})}); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md index fe425b2384b..ef2cb5efcd1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/json_bucket.test.w_compile_tf-aws.md @@ -60,58 +60,58 @@ module.exports = function({ $b, $fileName, $getJson, $j }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -119,20 +119,20 @@ module.exports = function({ $b, $fileName, $getJson, $j }) { ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -141,32 +141,32 @@ module.exports = function({ $b, $fileName, $getJson, $j }) { } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -273,10 +273,10 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const fileName = "file.json"; const j = ({"persons": [({"age": 30, "name": "hasan", "fears": ["heights", "failure"]})]}); - const getJson = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new $Closure1(this, "$Closure1")); + const getJson = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:put", new $Closure2(this, "$Closure2")); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md index 94df348d327..61e7430e370 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_shared_resource.test.w_compile_tf-aws.md @@ -74,9 +74,9 @@ module.exports = function({ }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -107,8 +107,8 @@ module.exports = function({ }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -118,103 +118,103 @@ module.exports = function({ }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c8ca9349/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c86d29bb/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_0_CloudwatchLogGroup_9D02C16C": { + "Api_get_0_CloudwatchLogGroup_196DE719": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_0_CloudwatchLogGroup_9D02C16C" + "path": "root/Default/Default/Api/get_0/CloudwatchLogGroup", + "uniqueId": "Api_get_0_CloudwatchLogGroup_196DE719" } }, - "name": "/aws/lambda/get_0-c8ca9349", + "name": "/aws/lambda/get_0-c86d29bb", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudApi_get_0_IamRole_111BBD82": { + "Api_get_0_IamRole_2FAC475D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRole", - "uniqueId": "cloudApi_get_0_IamRole_111BBD82" + "path": "root/Default/Default/Api/get_0/IamRole", + "uniqueId": "Api_get_0_IamRole_2FAC475D" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_0_IamRolePolicy_6778B83A": { + "Api_get_0_IamRolePolicy_D9FB373B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicy", - "uniqueId": "cloudApi_get_0_IamRolePolicy_6778B83A" + "path": "root/Default/Default/Api/get_0/IamRolePolicy", + "uniqueId": "Api_get_0_IamRolePolicy_D9FB373B" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.cloudBucket.arn}\",\"${aws_s3_bucket.cloudBucket.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:List*\",\"s3:GetObject*\",\"s3:GetBucket*\"],\"Resource\":[\"${aws_s3_bucket.Bucket.arn}\",\"${aws_s3_bucket.Bucket.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_0_IamRolePolicyAttachment_1A88E668": { + "Api_get_0_IamRolePolicyAttachment_AEF1DC01": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_0_IamRolePolicyAttachment_1A88E668" + "path": "root/Default/Default/Api/get_0/IamRolePolicyAttachment", + "uniqueId": "Api_get_0_IamRolePolicyAttachment_AEF1DC01" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.name}" + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.name}" } }, "aws_lambda_function": { - "cloudApi_get_0_B857C178": { + "Api_get_0_244A7BA4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/Default", - "uniqueId": "cloudApi_get_0_B857C178" + "path": "root/Default/Default/Api/get_0/Default", + "uniqueId": "Api_get_0_244A7BA4" } }, "architectures": [ @@ -222,20 +222,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_d755b447": "${aws_s3_bucket.cloudBucket.bucket}", + "BUCKET_NAME_1357ca3a": "${aws_s3_bucket.Bucket.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_0-c8ca9349", + "WING_FUNCTION_NAME": "get_0-c86d29bb", "WING_TARGET": "tf-aws" } }, - "function_name": "get_0-c8ca9349", + "function_name": "get_0-c86d29bb", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_0_IamRole_111BBD82.arn}", + "role": "${aws_iam_role.Api_get_0_IamRole_2FAC475D.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_0_S3Object_67E48DD4.key}", + "s3_key": "${aws_s3_object.Api_get_0_S3Object_D1844823.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -244,47 +244,47 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89": { + "Api_api_permission-GET-c2e3ffa8_5BF93889": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-c2e3ffa8", - "uniqueId": "cloudApi_api_permission-GET-c2e3ffa8_37FA5D89" + "path": "root/Default/Default/Api/api/permission-GET-c2e3ffa8", + "uniqueId": "Api_api_permission-GET-c2e3ffa8_5BF93889" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_0_B857C178.function_name}", + "function_name": "${aws_lambda_function.Api_get_0_244A7BA4.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/", "statement_id": "AllowExecutionFromAPIGateway-GET-c2e3ffa8" } }, "aws_s3_bucket": { - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "cloudApi_get_0_S3Object_67E48DD4": { + "Api_get_0_S3Object_D1844823": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_0/S3Object", - "uniqueId": "cloudApi_get_0_S3Object_67E48DD4" + "path": "root/Default/Default/Api/get_0/S3Object", + "uniqueId": "Api_get_0_S3Object_D1844823" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -418,10 +418,10 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const b1 = new MyBucket(this, "b1", bucket); const b2 = new MyBucket(this, "b2", bucket); - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); (api.get("/", new $Closure1(this, "$Closure1"))); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call endpoint", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md index 6bac55efbe6..35f36be1c68 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure.test.w_compile_tf-aws.md @@ -111,24 +111,24 @@ module.exports = function({ $bucket2 }) { }, "resource": { "aws_s3_bucket": { - "MyClosure_cloudBucket_4DAD12C0": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/MyClosure/cloud.Bucket/Default", - "uniqueId": "MyClosure_cloudBucket_4DAD12C0" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c8b87a6b-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false }, - "cloudBucket": { + "MyClosure_Bucket_874B5056": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/MyClosure/Bucket/Default", + "uniqueId": "MyClosure_Bucket_874B5056" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c8fe564c-", "force_destroy": false } } @@ -188,7 +188,7 @@ class $Root extends $stdlib.std.Resource { _id = $stdlib.core.closureId(); constructor($scope, $id, ) { super($scope, $id); - this.bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` @@ -304,7 +304,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket2 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket2 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const fn = new $Closure1(this, "$Closure1"); const fn2 = new MyClosure(this, "MyClosure"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:call synthetic closure class as a function", new $Closure2(this, "$Closure2")); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md index 2c42b7c01ea..6d24606cee0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/lift_via_closure_explicit.test.w_compile_tf-aws.md @@ -59,15 +59,15 @@ module.exports = function({ }) { }, "resource": { "aws_sqs_queue": { - "MyClosure_cloudQueue_465FD228": { + "MyClosure_Queue_7DFF9F76": { "//": { "metadata": { - "path": "root/Default/Default/MyClosure/cloud.Queue/Default", - "uniqueId": "MyClosure_cloudQueue_465FD228" + "path": "root/Default/Default/MyClosure/Queue/Default", + "uniqueId": "MyClosure_Queue_7DFF9F76" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c8cccb9b", + "name": "Queue-c832d7dc", "visibility_timeout_seconds": 30 } } @@ -92,7 +92,7 @@ class $Root extends $stdlib.std.Resource { _id = $stdlib.core.closureId(); constructor($scope, $id, ) { super($scope, $id); - this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md index 476794764a3..97c0553a06d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/mutation_after_class_init.test.w_compile_tf-aws.md @@ -121,23 +121,23 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "Queue_cloudBucket_oncreate-OnMessage0_CloudwatchLogGroup_78BA3607": { + "Queue_Bucket_oncreate-OnMessage0_CloudwatchLogGroup_9C74780C": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/CloudwatchLogGroup", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_CloudwatchLogGroup_78BA3607" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/CloudwatchLogGroup", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_CloudwatchLogGroup_9C74780C" } }, - "name": "/aws/lambda/oncreate-OnMessage0-c8a3d864", + "name": "/aws/lambda/oncreate-OnMessage0-c8eb573e", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -148,50 +148,50 @@ module.exports = function({ }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } }, "aws_iam_role": { - "Queue_cloudBucket_oncreate-OnMessage0_IamRole_B18EBA00": { + "Queue_Bucket_oncreate-OnMessage0_IamRole_9A71BD20": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/IamRole", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_IamRole_B18EBA00" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/IamRole", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_IamRole_9A71BD20" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "Queue_cloudBucket_oncreate-OnMessage0_IamRolePolicy_BB4A7F9B": { + "Queue_Bucket_oncreate-OnMessage0_IamRolePolicy_DA330440": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/IamRolePolicy", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_IamRolePolicy_BB4A7F9B" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/IamRolePolicy", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_IamRolePolicy_DA330440" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.Queue_cloudBucket_oncreate-OnMessage0_IamRole_B18EBA00.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue_Bucket_oncreate-OnMessage0_IamRole_9A71BD20.name}" } }, "aws_iam_role_policy_attachment": { - "Queue_cloudBucket_oncreate-OnMessage0_IamRolePolicyAttachment_E343A2A6": { + "Queue_Bucket_oncreate-OnMessage0_IamRolePolicyAttachment_C9B56BC6": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_IamRolePolicyAttachment_E343A2A6" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_IamRolePolicyAttachment_C9B56BC6" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.Queue_cloudBucket_oncreate-OnMessage0_IamRole_B18EBA00.name}" + "role": "${aws_iam_role.Queue_Bucket_oncreate-OnMessage0_IamRole_9A71BD20.name}" } }, "aws_lambda_function": { - "Queue_cloudBucket_oncreate-OnMessage0_FD912CD5": { + "Queue_Bucket_oncreate-OnMessage0_E6447040": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/Default", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_FD912CD5" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/Default", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_E6447040" } }, "architectures": [ @@ -199,20 +199,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "oncreate-OnMessage0-c8a3d864", + "WING_FUNCTION_NAME": "oncreate-OnMessage0-c8eb573e", "WING_TARGET": "tf-aws" } }, - "function_name": "oncreate-OnMessage0-c8a3d864", + "function_name": "oncreate-OnMessage0-c8eb573e", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.Queue_cloudBucket_oncreate-OnMessage0_IamRole_B18EBA00.arn}", + "role": "${aws_iam_role.Queue_Bucket_oncreate-OnMessage0_IamRole_9A71BD20.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.Queue_cloudBucket_oncreate-OnMessage0_S3Object_B43B9942.key}", + "s3_key": "${aws_s3_object.Queue_Bucket_oncreate-OnMessage0_S3Object_25BC6E4D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -221,17 +221,17 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "Queue_cloudBucket_oncreate-OnMessage0_InvokePermission-c851fe19a411010d18454128930197e51456417e85_C80FDF61": { + "Queue_Bucket_oncreate-OnMessage0_InvokePermission-c8dcd31783c1522bf1463bb2ca490732c273cb2aa5_8197A736": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/InvokePermission-c851fe19a411010d18454128930197e51456417e85", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_InvokePermission-c851fe19a411010d18454128930197e51456417e85_C80FDF61" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/InvokePermission-c8dcd31783c1522bf1463bb2ca490732c273cb2aa5", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_InvokePermission-c8dcd31783c1522bf1463bb2ca490732c273cb2aa5_8197A736" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.Queue_cloudBucket_oncreate-OnMessage0_FD912CD5.function_name}", + "function_name": "${aws_lambda_function.Queue_Bucket_oncreate-OnMessage0_E6447040.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.Queue_cloudBucket_oncreate_5E96074E.arn}" + "source_arn": "${aws_sns_topic.Queue_Bucket_oncreate_793B52C5.arn}" } }, "aws_s3_bucket": { @@ -244,28 +244,28 @@ module.exports = function({ }) { }, "bucket_prefix": "code-c84a50b1-" }, - "Queue_cloudBucket_D034B6BF": { + "Queue_Bucket_A87615FF": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/Default", - "uniqueId": "Queue_cloudBucket_D034B6BF" + "path": "root/Default/Default/Queue/Bucket/Default", + "uniqueId": "Queue_Bucket_A87615FF" } }, - "bucket_prefix": "cloud-bucket-c8060195-", + "bucket_prefix": "bucket-c81048e6-", "force_destroy": false } }, "aws_s3_bucket_notification": { - "Queue_cloudBucket_S3BucketNotification_9CE123DD": { + "Queue_Bucket_S3BucketNotification_B826201B": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/S3BucketNotification", - "uniqueId": "Queue_cloudBucket_S3BucketNotification_9CE123DD" + "path": "root/Default/Default/Queue/Bucket/S3BucketNotification", + "uniqueId": "Queue_Bucket_S3BucketNotification_B826201B" } }, - "bucket": "${aws_s3_bucket.Queue_cloudBucket_D034B6BF.id}", + "bucket": "${aws_s3_bucket.Queue_Bucket_A87615FF.id}", "depends_on": [ - "aws_sns_topic_policy.Queue_cloudBucket_oncreate_PublishPermission-c8060195e8963c2cff1db2c9e82897cfcd8f3f7da7_C9113ED7" + "aws_sns_topic_policy.Queue_Bucket_oncreate_PublishPermission-c81048e6ea798f253db9714095de7ff4c76c443489_27F9C442" ], "topic": [ { @@ -273,17 +273,17 @@ module.exports = function({ }) { "s3:ObjectCreated:Put" ], "id": "on-oncreate-notification", - "topic_arn": "${aws_sns_topic.Queue_cloudBucket_oncreate_5E96074E.arn}" + "topic_arn": "${aws_sns_topic.Queue_Bucket_oncreate_793B52C5.arn}" } ] } }, "aws_s3_object": { - "Queue_cloudBucket_oncreate-OnMessage0_S3Object_B43B9942": { + "Queue_Bucket_oncreate-OnMessage0_S3Object_25BC6E4D": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate-OnMessage0/S3Object", - "uniqueId": "Queue_cloudBucket_oncreate-OnMessage0_S3Object_B43B9942" + "path": "root/Default/Default/Queue/Bucket/oncreate-OnMessage0/S3Object", + "uniqueId": "Queue_Bucket_oncreate-OnMessage0_S3Object_25BC6E4D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -292,39 +292,39 @@ module.exports = function({ }) { } }, "aws_sns_topic": { - "Queue_cloudBucket_oncreate_5E96074E": { + "Queue_Bucket_oncreate_793B52C5": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate/Default", - "uniqueId": "Queue_cloudBucket_oncreate_5E96074E" + "path": "root/Default/Default/Queue/Bucket/oncreate/Default", + "uniqueId": "Queue_Bucket_oncreate_793B52C5" } }, - "name": "oncreate-c851fe19" + "name": "oncreate-c8dcd317" } }, "aws_sns_topic_policy": { - "Queue_cloudBucket_oncreate_PublishPermission-c8060195e8963c2cff1db2c9e82897cfcd8f3f7da7_C9113ED7": { + "Queue_Bucket_oncreate_PublishPermission-c81048e6ea798f253db9714095de7ff4c76c443489_27F9C442": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate/PublishPermission-c8060195e8963c2cff1db2c9e82897cfcd8f3f7da7", - "uniqueId": "Queue_cloudBucket_oncreate_PublishPermission-c8060195e8963c2cff1db2c9e82897cfcd8f3f7da7_C9113ED7" + "path": "root/Default/Default/Queue/Bucket/oncreate/PublishPermission-c81048e6ea798f253db9714095de7ff4c76c443489", + "uniqueId": "Queue_Bucket_oncreate_PublishPermission-c81048e6ea798f253db9714095de7ff4c76c443489_27F9C442" } }, - "arn": "${aws_sns_topic.Queue_cloudBucket_oncreate_5E96074E.arn}", - "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.Queue_cloudBucket_oncreate_5E96074E.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.Queue_cloudBucket_D034B6BF.arn}\"}}}]}" + "arn": "${aws_sns_topic.Queue_Bucket_oncreate_793B52C5.arn}", + "policy": "{\"Statement\":[{\"Effect\":\"Allow\",\"Principal\":{\"Service\":\"s3.amazonaws.com\"},\"Action\":\"sns:Publish\",\"Resource\":\"${aws_sns_topic.Queue_Bucket_oncreate_793B52C5.arn}\",\"Condition\":{\"ArnEquals\":{\"aws:SourceArn\":\"${aws_s3_bucket.Queue_Bucket_A87615FF.arn}\"}}}]}" } }, "aws_sns_topic_subscription": { - "Queue_cloudBucket_oncreate_TopicSubscription0_019229E8": { + "Queue_Bucket_oncreate_TopicSubscription0_1F6BA14E": { "//": { "metadata": { - "path": "root/Default/Default/Queue/cloud.Bucket/oncreate/TopicSubscription0", - "uniqueId": "Queue_cloudBucket_oncreate_TopicSubscription0_019229E8" + "path": "root/Default/Default/Queue/Bucket/oncreate/TopicSubscription0", + "uniqueId": "Queue_Bucket_oncreate_TopicSubscription0_1F6BA14E" } }, - "endpoint": "${aws_lambda_function.Queue_cloudBucket_oncreate-OnMessage0_FD912CD5.arn}", + "endpoint": "${aws_lambda_function.Queue_Bucket_oncreate-OnMessage0_E6447040.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.Queue_cloudBucket_oncreate_5E96074E.arn}" + "topic_arn": "${aws_sns_topic.Queue_Bucket_oncreate_793B52C5.arn}" } } } @@ -348,7 +348,7 @@ class $Root extends $stdlib.std.Resource { class Queue extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.data = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.data = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const __parent_this_1 = this; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); @@ -528,7 +528,7 @@ class $Root extends $stdlib.std.Resource { } } const q = new Queue(this, "Queue"); - const c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + const c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); (q.setConsumer(new $Closure3(this, "$Closure3"))); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:hi", new $Closure4(this, "$Closure4")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md index 8c1752e8762..812c64b86e6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_in_static.test.w_compile_tf-aws.md @@ -52,6 +52,16 @@ module.exports = function({ }) { }, "resource": { "aws_s3_bucket": { + "Construct_Bucket_2C7B19D9": { + "//": { + "metadata": { + "path": "root/Default/Default/Construct/Bucket/Default", + "uniqueId": "Construct_Bucket_2C7B19D9" + } + }, + "bucket_prefix": "bucket-c8186214-", + "force_destroy": false + }, "b1": { "//": { "metadata": { @@ -71,16 +81,6 @@ module.exports = function({ }) { }, "bucket_prefix": "b2-c844cd88-", "force_destroy": false - }, - "cConstruct_cloudBucket_63D47E7B": { - "//": { - "metadata": { - "path": "root/Default/Default/c.Construct/cloud.Bucket/Default", - "uniqueId": "cConstruct_cloudBucket_63D47E7B" - } - }, - "bucket_prefix": "cloud-bucket-c8e0ff1c-", - "force_destroy": false } } } @@ -106,7 +106,7 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); } static createBucket(scope) { - return ($scope => $scope.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, $scope, "cloud.Bucket"))(scope); + return ($scope => $scope.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, $scope, "Bucket"))(scope); } static createMyClass(scope) { return new MyClass(scope, "MyClass"); @@ -176,7 +176,7 @@ class $Root extends $stdlib.std.Resource { if (true) { this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "b2"); } - const scope = this.node.root.new("constructs.Construct", c.Construct, this, "c.Construct"); + const scope = this.node.root.new("constructs.Construct", c.Construct, this, "Construct"); const bucket = (MyClass.createBucket(scope)); const bucket2 = (createBucket()); const my = (MyClass.createMyClass(scope)); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md index e39c7072f21..29296103f08 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/new_jsii.test.w_compile_tf-aws.md @@ -32,14 +32,14 @@ module.exports = function({ }) { }, "resource": { "aws_s3_bucket": { - "CustomScope_cloudBucket_17614466": { + "CustomScope_Bucket_8BBB89A4": { "//": { "metadata": { - "path": "root/Default/Default/CustomScope/cloud.Bucket/Default", - "uniqueId": "CustomScope_cloudBucket_17614466" + "path": "root/Default/Default/CustomScope/Bucket/Default", + "uniqueId": "CustomScope_Bucket_8BBB89A4" } }, - "bucket_prefix": "cloud-bucket-c89807a1-", + "bucket_prefix": "bucket-c830af09-", "force_destroy": false } } @@ -90,7 +90,7 @@ class $Root extends $stdlib.std.Resource { } } let count = 0; - ($scope => $scope.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, $scope, "cloud.Bucket"))(new CustomScope(this, "CustomScope")); + ($scope => $scope.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, $scope, "Bucket"))(new CustomScope(this, "CustomScope")); $helpers.assert($helpers.eq(count, 1), "count == 1"); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md index c0208f67097..c6507b47de5 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/phase_independent_method_on_string.test.w_compile_tf-aws.md @@ -35,9 +35,9 @@ module.exports = function({ $api_url, $regex_Util, $token_len, $url_regex }) { "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } } } @@ -68,8 +68,8 @@ module.exports = function({ $api_url, $regex_Util, $token_len, $url_regex }) { } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" } }, "provider": { @@ -79,47 +79,47 @@ module.exports = function({ $api_url, $regex_Util, $token_len, $url_regex }) { }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } } @@ -183,7 +183,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api"); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api"); const url_regex = "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256\}\\.[a-zA-Z0-9()]{1,6\}\\b([-a-zA-Z0-9()@:%_\\+.~#?&//=]*)"; $helpers.assert((!(regex.Util.match(url_regex, api.url))), "!regex.match(url_regex, api.url)"); const token_len = api.url.length; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md index f7c8c629102..17853cd2844 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/redis.test.w_compile_tf-aws.md @@ -39,7 +39,7 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { (await $util_Util.waitUntil((async () => { return $helpers.neq((await $r.get("hello")), undefined); }))); - $helpers.assert($helpers.eq("world!", String.raw({ raw: ["", ""] }, (await $r.get("hello")))), "\"world!\" == \"{r.get(\"hello\")}\""); + $helpers.assert($helpers.eq("world!", String.raw({ raw: ["", ""] }, ((await $r.get("hello")) ?? "nil"))), "\"world!\" == \"{r.get(\"hello\") ?? \"nil\"}\""); } } return $Closure2; @@ -77,14 +77,14 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, @@ -99,24 +99,24 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_elasticache_cluster": { - "exRedis_RedisCluster_3C9A5882": { + "Redis_RedisCluster_F55D8A3B": { "//": { "metadata": { - "path": "root/Default/Default/ex.Redis/RedisCluster", - "uniqueId": "exRedis_RedisCluster_3C9A5882" + "path": "root/Default/Default/Redis/RedisCluster", + "uniqueId": "Redis_RedisCluster_F55D8A3B" } }, "availability_zone": "${aws_subnet.PrivateSubnet.availability_zone}", - "cluster_id": "ex-redis-c8a27ec9", + "cluster_id": "redis-c8cdb969", "engine": "redis", "engine_version": "6.2", "node_type": "cache.t4g.small", "num_cache_nodes": 1, "parameter_group_name": "default.redis6.x", "security_group_ids": [ - "${aws_security_group.exRedis_KEN15securityGroup_3840F345.id}" + "${aws_security_group.Redis_KEN15securityGroup_9FF06889.id}" ], - "subnet_group_name": "${aws_elasticache_subnet_group.exRedis_RedisSubnetGroup_EE9BBE48.name}" + "subnet_group_name": "${aws_elasticache_subnet_group.Redis_RedisSubnetGroup_E7D796E2.name}" }, "r2_RedisCluster_C6087F40": { "//": { @@ -139,14 +139,14 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_elasticache_subnet_group": { - "exRedis_RedisSubnetGroup_EE9BBE48": { + "Redis_RedisSubnetGroup_E7D796E2": { "//": { "metadata": { - "path": "root/Default/Default/ex.Redis/RedisSubnetGroup", - "uniqueId": "exRedis_RedisSubnetGroup_EE9BBE48" + "path": "root/Default/Default/Redis/RedisSubnetGroup", + "uniqueId": "Redis_RedisSubnetGroup_E7D796E2" } }, - "name": "ex-redis-c8a27ec9-subnetGroup", + "name": "redis-c8cdb969-subnetGroup", "subnet_ids": [ "${aws_subnet.PrivateSubnet.id}" ] @@ -165,38 +165,38 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"elasticache:Describe*\"],\"Resource\":[\"${aws_elasticache_cluster.exRedis_RedisCluster_3C9A5882.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"ec2:CreateNetworkInterface\",\"ec2:DescribeNetworkInterfaces\",\"ec2:DeleteNetworkInterface\",\"ec2:DescribeSubnets\",\"ec2:DescribeSecurityGroups\"],\"Resource\":[\"*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"elasticache:Describe*\"],\"Resource\":[\"${aws_elasticache_cluster.Redis_RedisCluster_F55D8A3B.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"ec2:CreateNetworkInterface\",\"ec2:DescribeNetworkInterfaces\",\"ec2:DeleteNetworkInterface\",\"ec2:DescribeSubnets\",\"ec2:DescribeSecurityGroups\"],\"Resource\":[\"*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_internet_gateway": { @@ -214,24 +214,24 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -240,23 +240,23 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "REDIS_CLUSTER_ID_89baf91f": "${aws_elasticache_cluster.exRedis_RedisCluster_3C9A5882.cluster_id}", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "REDIS_CLUSTER_ID_3542402a": "${aws_elasticache_cluster.Redis_RedisCluster_F55D8A3B.cluster_id}", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [ - "${aws_security_group.exRedis_KEN15securityGroup_3840F345.id}" + "${aws_security_group.Redis_KEN15securityGroup_9FF06889.id}" ], "subnet_ids": [ "${aws_subnet.PrivateSubnet.id}" @@ -373,11 +373,11 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -386,11 +386,11 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_security_group": { - "exRedis_KEN15securityGroup_3840F345": { + "Redis_KEN15securityGroup_9FF06889": { "//": { "metadata": { - "path": "root/Default/Default/ex.Redis/KEN.15]}securityGroup", - "uniqueId": "exRedis_KEN15securityGroup_3840F345" + "path": "root/Default/Default/Redis/KEN.15]}securityGroup", + "uniqueId": "Redis_KEN15securityGroup_9FF06889" } }, "egress": [ @@ -423,7 +423,7 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { "to_port": 6379 } ], - "name": "89baf91f-securityGroup", + "name": "3542402a-securityGroup", "vpc_id": "${aws_vpc.VPC.id}" }, "r2_KEN24securityGroup_AFC21ADF": { @@ -468,15 +468,15 @@ module.exports = function({ $queue, $r, $r2, $util_Util }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } }, @@ -622,9 +622,9 @@ class $Root extends $stdlib.std.Resource { }); } } - const r = this.node.root.new("@winglang/sdk.ex.Redis", ex.Redis, this, "ex.Redis"); + const r = this.node.root.new("@winglang/sdk.ex.Redis", ex.Redis, this, "Redis"); const r2 = this.node.root.new("@winglang/sdk.ex.Redis", ex.Redis, this, "r2"); - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); (queue.setConsumer(new $Closure1(this, "$Closure1"), { timeout: (std.Duration.fromSeconds(3)) })); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:testing Redis", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md index 330d67a68f1..d0d8e26abdb 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource.test.w_compile_tf-aws.md @@ -240,43 +240,43 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "BigPublisher_b2_oncreate-OnMessage0_CloudwatchLogGroup_E98CA40A": { + "BigPublisher_Queue-SetConsumer0_CloudwatchLogGroup_59DF8618": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/CloudwatchLogGroup", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_CloudwatchLogGroup_E98CA40A" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "BigPublisher_Queue-SetConsumer0_CloudwatchLogGroup_59DF8618" } }, - "name": "/aws/lambda/oncreate-OnMessage0-c8946df1", + "name": "/aws/lambda/Queue-SetConsumer0-c8931d51", "retention_in_days": 30 }, - "BigPublisher_cloudQueue-SetConsumer0_CloudwatchLogGroup_36322340": { + "BigPublisher_Topic-OnMessage0_CloudwatchLogGroup_7B9F7944": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_CloudwatchLogGroup_36322340" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/CloudwatchLogGroup", + "uniqueId": "BigPublisher_Topic-OnMessage0_CloudwatchLogGroup_7B9F7944" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8aaa844", + "name": "/aws/lambda/Topic-OnMessage0-c8bea057", "retention_in_days": 30 }, - "BigPublisher_cloudTopic-OnMessage0_CloudwatchLogGroup_4012D30C": { + "BigPublisher_b2_oncreate-OnMessage0_CloudwatchLogGroup_E98CA40A": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/CloudwatchLogGroup", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_CloudwatchLogGroup_4012D30C" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/CloudwatchLogGroup", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_CloudwatchLogGroup_E98CA40A" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage0-c85e2df7", + "name": "/aws/lambda/oncreate-OnMessage0-c8946df1", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "Bar_Foo_cloudCounter_DF879883": { + "Bar_Foo_Counter_0BF3941D": { "//": { "metadata": { - "path": "root/Default/Default/Bar/Foo/cloud.Counter/Default", - "uniqueId": "Bar_Foo_cloudCounter_DF879883" + "path": "root/Default/Default/Bar/Foo/Counter/Default", + "uniqueId": "Bar_Foo_Counter_0BF3941D" } }, "attribute": [ @@ -287,121 +287,121 @@ module.exports = function({ }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c8ef80ad" + "name": "wing-counter-Counter-c8066681" } }, "aws_iam_role": { - "BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497": { + "BigPublisher_Queue-SetConsumer0_IamRole_D38B87EE": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRole", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRole", + "uniqueId": "BigPublisher_Queue-SetConsumer0_IamRole_D38B87EE" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "BigPublisher_cloudQueue-SetConsumer0_IamRole_80E6DDE5": { + "BigPublisher_Topic-OnMessage0_IamRole_FEF4CFBB": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_IamRole_80E6DDE5" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRole", + "uniqueId": "BigPublisher_Topic-OnMessage0_IamRole_FEF4CFBB" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "BigPublisher_cloudTopic-OnMessage0_IamRole_818FEA46": { + "BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRole", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_IamRole_818FEA46" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRole", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicy_983EC08F": { + "BigPublisher_Queue-SetConsumer0_IamRolePolicy_AC1DBF7E": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicy", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicy_983EC08F" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "BigPublisher_Queue-SetConsumer0_IamRolePolicy_AC1DBF7E" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:SendMessage\"],\"Resource\":[\"${aws_sqs_queue.BigPublisher_cloudQueue_2EE8871A.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.BigPublisher_Queue_2C024F97.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.arn}\",\"${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.BigPublisher_Queue-SetConsumer0_IamRole_D38B87EE.name}" }, - "BigPublisher_cloudQueue-SetConsumer0_IamRolePolicy_14C69404": { + "BigPublisher_Topic-OnMessage0_IamRolePolicy_6D3D4F05": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_IamRolePolicy_14C69404" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRolePolicy", + "uniqueId": "BigPublisher_Topic-OnMessage0_IamRolePolicy_6D3D4F05" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.BigPublisher_cloudQueue_2EE8871A.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.arn}\",\"${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.BigPublisher_cloudQueue-SetConsumer0_IamRole_80E6DDE5.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.arn}\",\"${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.arn}/*\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.BigPublisher_Topic-OnMessage0_IamRole_FEF4CFBB.name}" }, - "BigPublisher_cloudTopic-OnMessage0_IamRolePolicy_D8E5365A": { + "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicy_983EC08F": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRolePolicy", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_IamRolePolicy_D8E5365A" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicy", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicy_983EC08F" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"s3:PutObject*\",\"s3:Abort*\"],\"Resource\":[\"${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.arn}\",\"${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.arn}/*\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.BigPublisher_cloudTopic-OnMessage0_IamRole_818FEA46.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:SendMessage\"],\"Resource\":[\"${aws_sqs_queue.BigPublisher_Queue_2C024F97.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.name}" } }, "aws_iam_role_policy_attachment": { - "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicyAttachment_7DE224FF": { + "BigPublisher_Queue-SetConsumer0_IamRolePolicyAttachment_263D5243": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicyAttachment_7DE224FF" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "BigPublisher_Queue-SetConsumer0_IamRolePolicyAttachment_263D5243" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.name}" + "role": "${aws_iam_role.BigPublisher_Queue-SetConsumer0_IamRole_D38B87EE.name}" }, - "BigPublisher_cloudQueue-SetConsumer0_IamRolePolicyAttachment_21DA4843": { + "BigPublisher_Topic-OnMessage0_IamRolePolicyAttachment_9752C0C1": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_IamRolePolicyAttachment_21DA4843" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "BigPublisher_Topic-OnMessage0_IamRolePolicyAttachment_9752C0C1" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.BigPublisher_cloudQueue-SetConsumer0_IamRole_80E6DDE5.name}" + "role": "${aws_iam_role.BigPublisher_Topic-OnMessage0_IamRole_FEF4CFBB.name}" }, - "BigPublisher_cloudTopic-OnMessage0_IamRolePolicyAttachment_22B5615B": { + "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicyAttachment_7DE224FF": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_IamRolePolicyAttachment_22B5615B" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_IamRolePolicyAttachment_7DE224FF" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.BigPublisher_cloudTopic-OnMessage0_IamRole_818FEA46.name}" + "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.name}" } }, "aws_lambda_event_source_mapping": { - "BigPublisher_cloudQueue_EventSourceMapping_D1299C34": { + "BigPublisher_Queue_EventSourceMapping_D3253A7F": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue/EventSourceMapping", - "uniqueId": "BigPublisher_cloudQueue_EventSourceMapping_D1299C34" + "path": "root/Default/Default/BigPublisher/Queue/EventSourceMapping", + "uniqueId": "BigPublisher_Queue_EventSourceMapping_D3253A7F" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.BigPublisher_cloudQueue_2EE8871A.arn}", - "function_name": "${aws_lambda_function.BigPublisher_cloudQueue-SetConsumer0_903099C9.function_name}" + "event_source_arn": "${aws_sqs_queue.BigPublisher_Queue_2C024F97.arn}", + "function_name": "${aws_lambda_function.BigPublisher_Queue-SetConsumer0_55896C65.function_name}" } }, "aws_lambda_function": { - "BigPublisher_b2_oncreate-OnMessage0_3ECAAB35": { + "BigPublisher_Queue-SetConsumer0_55896C65": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Default", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_3ECAAB35" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/Default", + "uniqueId": "BigPublisher_Queue-SetConsumer0_55896C65" } }, "architectures": [ @@ -409,31 +409,31 @@ module.exports = function({ }) { ], "environment": { "variables": { + "BUCKET_NAME_82fe1f9e": "${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "QUEUE_URL_b0ba884c": "${aws_sqs_queue.BigPublisher_cloudQueue_2EE8871A.url}", - "WING_FUNCTION_NAME": "oncreate-OnMessage0-c8946df1", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c8931d51", "WING_TARGET": "tf-aws" } }, - "function_name": "oncreate-OnMessage0-c8946df1", + "function_name": "Queue-SetConsumer0-c8931d51", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.arn}", + "role": "${aws_iam_role.BigPublisher_Queue-SetConsumer0_IamRole_D38B87EE.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104.key}", - "timeout": 60, + "s3_key": "${aws_s3_object.BigPublisher_Queue-SetConsumer0_S3Object_21F398A2.key}", + "timeout": "${aws_sqs_queue.BigPublisher_Queue_2C024F97.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "BigPublisher_cloudQueue-SetConsumer0_903099C9": { + "BigPublisher_Topic-OnMessage0_A623A9EA": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/Default", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_903099C9" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/Default", + "uniqueId": "BigPublisher_Topic-OnMessage0_A623A9EA" } }, "architectures": [ @@ -441,31 +441,31 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_7ef741f5": "${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.bucket}", + "BUCKET_NAME_82fe1f9e": "${aws_s3_bucket.BigPublisher_Bucket_F4CC95F6.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8aaa844", + "WING_FUNCTION_NAME": "Topic-OnMessage0-c8bea057", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8aaa844", + "function_name": "Topic-OnMessage0-c8bea057", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.BigPublisher_cloudQueue-SetConsumer0_IamRole_80E6DDE5.arn}", + "role": "${aws_iam_role.BigPublisher_Topic-OnMessage0_IamRole_FEF4CFBB.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.BigPublisher_cloudQueue-SetConsumer0_S3Object_BC15A90B.key}", - "timeout": "${aws_sqs_queue.BigPublisher_cloudQueue_2EE8871A.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.BigPublisher_Topic-OnMessage0_S3Object_3B80DE9B.key}", + "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "BigPublisher_cloudTopic-OnMessage0_EB3C5802": { + "BigPublisher_b2_oncreate-OnMessage0_3ECAAB35": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/Default", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_EB3C5802" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Default", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_3ECAAB35" } }, "architectures": [ @@ -473,20 +473,20 @@ module.exports = function({ }) { ], "environment": { "variables": { - "BUCKET_NAME_7ef741f5": "${aws_s3_bucket.BigPublisher_cloudBucket_ABF95118.bucket}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage0-c85e2df7", + "QUEUE_URL_cb1bcecf": "${aws_sqs_queue.BigPublisher_Queue_2C024F97.url}", + "WING_FUNCTION_NAME": "oncreate-OnMessage0-c8946df1", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage0-c85e2df7", + "function_name": "oncreate-OnMessage0-c8946df1", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.BigPublisher_cloudTopic-OnMessage0_IamRole_818FEA46.arn}", + "role": "${aws_iam_role.BigPublisher_b2_oncreate-OnMessage0_IamRole_FF154497.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.BigPublisher_cloudTopic-OnMessage0_S3Object_A4DC7356.key}", + "s3_key": "${aws_s3_object.BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -495,32 +495,42 @@ module.exports = function({ }) { } }, "aws_lambda_permission": { - "BigPublisher_b2_oncreate-OnMessage0_InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a_9E58F097": { + "BigPublisher_Topic-OnMessage0_InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a_EFD91A7E": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a_9E58F097" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a", + "uniqueId": "BigPublisher_Topic-OnMessage0_InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a_EFD91A7E" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.BigPublisher_b2_oncreate-OnMessage0_3ECAAB35.function_name}", + "function_name": "${aws_lambda_function.BigPublisher_Topic-OnMessage0_A623A9EA.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.BigPublisher_b2_oncreate_44F68983.arn}" + "source_arn": "${aws_sns_topic.BigPublisher_Topic_F8E12E52.arn}" }, - "BigPublisher_cloudTopic-OnMessage0_InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec_1514C2B7": { + "BigPublisher_b2_oncreate-OnMessage0_InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a_9E58F097": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec_1514C2B7" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a_9E58F097" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.BigPublisher_cloudTopic-OnMessage0_EB3C5802.function_name}", + "function_name": "${aws_lambda_function.BigPublisher_b2_oncreate-OnMessage0_3ECAAB35.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.BigPublisher_cloudTopic_61DC7B63.arn}" + "source_arn": "${aws_sns_topic.BigPublisher_b2_oncreate_44F68983.arn}" } }, "aws_s3_bucket": { + "BigPublisher_Bucket_F4CC95F6": { + "//": { + "metadata": { + "path": "root/Default/Default/BigPublisher/Bucket/Default", + "uniqueId": "BigPublisher_Bucket_F4CC95F6" + } + }, + "bucket_prefix": "bucket-c8856dc5-", + "force_destroy": false + }, "BigPublisher_b2_702AC841": { "//": { "metadata": { @@ -531,14 +541,14 @@ module.exports = function({ }) { "bucket_prefix": "b2-c851683a-", "force_destroy": false }, - "BigPublisher_cloudBucket_ABF95118": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Bucket/Default", - "uniqueId": "BigPublisher_cloudBucket_ABF95118" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c82f13dc-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false }, "Code": { @@ -549,16 +559,6 @@ module.exports = function({ }) { } }, "bucket_prefix": "code-c84a50b1-" - }, - "cloudBucket": { - "//": { - "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" - } - }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false } }, "aws_s3_bucket_notification": { @@ -585,33 +585,33 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104": { + "BigPublisher_Queue-SetConsumer0_S3Object_21F398A2": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/S3Object", - "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104" + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/S3Object", + "uniqueId": "BigPublisher_Queue-SetConsumer0_S3Object_21F398A2" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "BigPublisher_cloudQueue-SetConsumer0_S3Object_BC15A90B": { + "BigPublisher_Topic-OnMessage0_S3Object_3B80DE9B": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "BigPublisher_cloudQueue-SetConsumer0_S3Object_BC15A90B" + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/S3Object", + "uniqueId": "BigPublisher_Topic-OnMessage0_S3Object_3B80DE9B" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "BigPublisher_cloudTopic-OnMessage0_S3Object_A4DC7356": { + "BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/S3Object", - "uniqueId": "BigPublisher_cloudTopic-OnMessage0_S3Object_A4DC7356" + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/S3Object", + "uniqueId": "BigPublisher_b2_oncreate-OnMessage0_S3Object_1489E104" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -620,23 +620,23 @@ module.exports = function({ }) { } }, "aws_sns_topic": { - "BigPublisher_b2_oncreate_44F68983": { + "BigPublisher_Topic_F8E12E52": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate/Default", - "uniqueId": "BigPublisher_b2_oncreate_44F68983" + "path": "root/Default/Default/BigPublisher/Topic/Default", + "uniqueId": "BigPublisher_Topic_F8E12E52" } }, - "name": "oncreate-c849e824" + "name": "Topic-c884cd53" }, - "BigPublisher_cloudTopic_61DC7B63": { + "BigPublisher_b2_oncreate_44F68983": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic/Default", - "uniqueId": "BigPublisher_cloudTopic_61DC7B63" + "path": "root/Default/Default/BigPublisher/b2/oncreate/Default", + "uniqueId": "BigPublisher_b2_oncreate_44F68983" } }, - "name": "cloud-Topic-c86b6469" + "name": "oncreate-c849e824" } }, "aws_sns_topic_policy": { @@ -652,39 +652,39 @@ module.exports = function({ }) { } }, "aws_sns_topic_subscription": { - "BigPublisher_b2_oncreate_TopicSubscription0_692E956B": { + "BigPublisher_Topic_TopicSubscription0_5DDBA778": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/b2/oncreate/TopicSubscription0", - "uniqueId": "BigPublisher_b2_oncreate_TopicSubscription0_692E956B" + "path": "root/Default/Default/BigPublisher/Topic/TopicSubscription0", + "uniqueId": "BigPublisher_Topic_TopicSubscription0_5DDBA778" } }, - "endpoint": "${aws_lambda_function.BigPublisher_b2_oncreate-OnMessage0_3ECAAB35.arn}", + "endpoint": "${aws_lambda_function.BigPublisher_Topic-OnMessage0_A623A9EA.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.BigPublisher_b2_oncreate_44F68983.arn}" + "topic_arn": "${aws_sns_topic.BigPublisher_Topic_F8E12E52.arn}" }, - "BigPublisher_cloudTopic_TopicSubscription0_8CB7D4D8": { + "BigPublisher_b2_oncreate_TopicSubscription0_692E956B": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Topic/TopicSubscription0", - "uniqueId": "BigPublisher_cloudTopic_TopicSubscription0_8CB7D4D8" + "path": "root/Default/Default/BigPublisher/b2/oncreate/TopicSubscription0", + "uniqueId": "BigPublisher_b2_oncreate_TopicSubscription0_692E956B" } }, - "endpoint": "${aws_lambda_function.BigPublisher_cloudTopic-OnMessage0_EB3C5802.arn}", + "endpoint": "${aws_lambda_function.BigPublisher_b2_oncreate-OnMessage0_3ECAAB35.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.BigPublisher_cloudTopic_61DC7B63.arn}" + "topic_arn": "${aws_sns_topic.BigPublisher_b2_oncreate_44F68983.arn}" } }, "aws_sqs_queue": { - "BigPublisher_cloudQueue_2EE8871A": { + "BigPublisher_Queue_2C024F97": { "//": { "metadata": { - "path": "root/Default/Default/BigPublisher/cloud.Queue/Default", - "uniqueId": "BigPublisher_cloudQueue_2EE8871A" + "path": "root/Default/Default/BigPublisher/Queue/Default", + "uniqueId": "BigPublisher_Queue_2C024F97" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c890dd9f", + "name": "Queue-c852a48d", "visibility_timeout_seconds": 30 } } @@ -707,16 +707,16 @@ class $Root extends $stdlib.std.Resource { super($scope, $id); const MyEnum = (function (tmp) { - tmp[tmp["A"] = 0] = ",A"; - tmp[tmp["B"] = 1] = ",B"; - tmp[tmp["C"] = 2] = ",C"; + tmp["A"] = "A"; + tmp["B"] = "B"; + tmp["C"] = "C"; return tmp; })({}) ; class Foo extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + this.c = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); } static _toInflightType() { return ` @@ -860,10 +860,10 @@ class $Root extends $stdlib.std.Resource { class BigPublisher extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.b2 = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "b2"); - this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); - this.t = this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "cloud.Topic"); + this.q = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); + this.t = this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "Topic"); const __parent_this_2 = this; class $Closure2 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); @@ -1121,7 +1121,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const bucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const res = new Bar(this, "Bar", "Arr", bucket, MyEnum.B); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); const bigOlPublisher = new BigPublisher(this, "BigPublisher"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md index d2a521a0213..fb476c2c0b0 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_as_inflight_literal.test.w_compile_tf-aws.md @@ -58,58 +58,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudFunction_CloudwatchLogGroup_7399B890": { + "Function_CloudwatchLogGroup_ABDCF4C4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/CloudwatchLogGroup", - "uniqueId": "cloudFunction_CloudwatchLogGroup_7399B890" + "path": "root/Default/Default/Function/CloudwatchLogGroup", + "uniqueId": "Function_CloudwatchLogGroup_ABDCF4C4" } }, - "name": "/aws/lambda/cloud-Function-c8d2eca1", + "name": "/aws/lambda/Function-c852aba6", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudFunction_IamRole_5A4430DC": { + "Function_IamRole_678BE84C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRole", - "uniqueId": "cloudFunction_IamRole_5A4430DC" + "path": "root/Default/Default/Function/IamRole", + "uniqueId": "Function_IamRole_678BE84C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudFunction_IamRolePolicy_618BF987": { + "Function_IamRolePolicy_E3B26607": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicy", - "uniqueId": "cloudFunction_IamRolePolicy_618BF987" + "path": "root/Default/Default/Function/IamRolePolicy", + "uniqueId": "Function_IamRolePolicy_E3B26607" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudFunction_IamRolePolicyAttachment_288B9653": { + "Function_IamRolePolicyAttachment_CACE1358": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "cloudFunction_IamRolePolicyAttachment_288B9653" + "path": "root/Default/Default/Function/IamRolePolicyAttachment", + "uniqueId": "Function_IamRolePolicyAttachment_CACE1358" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.name}" + "role": "${aws_iam_role.Function_IamRole_678BE84C.name}" } }, "aws_lambda_function": { - "cloudFunction": { + "Function": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/Default", - "uniqueId": "cloudFunction" + "path": "root/Default/Default/Function/Default", + "uniqueId": "Function" } }, "architectures": [ @@ -118,18 +118,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8d2eca1", + "WING_FUNCTION_NAME": "Function-c852aba6", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8d2eca1", + "function_name": "Function-c852aba6", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudFunction_IamRole_5A4430DC.arn}", + "role": "${aws_iam_role.Function_IamRole_678BE84C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudFunction_S3Object_71908BAD.key}", + "s3_key": "${aws_s3_object.Function_S3Object_C62A0C2D.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -149,11 +149,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudFunction_S3Object_71908BAD": { + "Function_S3Object_C62A0C2D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Function/S3Object", - "uniqueId": "cloudFunction_S3Object_71908BAD" + "path": "root/Default/Default/Function/S3Object", + "uniqueId": "Function_S3Object_C62A0C2D" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -244,7 +244,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const fn = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new Foo(this, "Foo")); + const fn = this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new Foo(this, "Foo")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md index cdb12005f71..d34d302e4e1 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_call_static.test.w_compile_tf-aws.md @@ -55,11 +55,11 @@ module.exports = function({ $globalCounter }) { }, "resource": { "aws_dynamodb_table": { - "cloudCounter": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -70,7 +70,7 @@ module.exports = function({ $globalCounter }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c824ef62" } } } @@ -162,7 +162,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const globalCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + const globalCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:access cloud resource through static methods only", new $Closure1(this, "$Closure1")); } } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md index 5e72e991cf2..a1cb4c1c64f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures.test.w_compile_tf-aws.md @@ -169,11 +169,11 @@ module.exports = function({ }) { }, "resource": { "aws_dynamodb_table": { - "MyResource_cloudCounter_0782991D": { + "MyResource_Counter_D9D84476": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Counter/Default", - "uniqueId": "MyResource_cloudCounter_0782991D" + "path": "root/Default/Default/MyResource/Counter/Default", + "uniqueId": "MyResource_Counter_D9D84476" } }, "attribute": [ @@ -184,51 +184,51 @@ module.exports = function({ }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c87187fa" + "name": "wing-counter-Counter-c8736322" } }, "aws_s3_bucket": { - "MyResource_Another_First_cloudBucket_5C44A510": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/Another/First/cloud.Bucket/Default", - "uniqueId": "MyResource_Another_First_cloudBucket_5C44A510" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c8e81a49-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false }, - "MyResource_cloudBucket_B5E6C951": { + "MyResource_Another_First_Bucket_1DA21BC0": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Bucket/Default", - "uniqueId": "MyResource_cloudBucket_B5E6C951" + "path": "root/Default/Default/MyResource/Another/First/Bucket/Default", + "uniqueId": "MyResource_Another_First_Bucket_1DA21BC0" } }, - "bucket_prefix": "cloud-bucket-c8f3d54f-", + "bucket_prefix": "bucket-c859322f-", "force_destroy": false }, - "cloudBucket": { + "MyResource_Bucket_0DE6FCB5": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/MyResource/Bucket/Default", + "uniqueId": "MyResource_Bucket_0DE6FCB5" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c87b43ba-", "force_destroy": false } }, "aws_sqs_queue": { - "MyResource_cloudQueue_E7A2C0F4": { + "MyResource_Queue_C2F2FBE5": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Queue/Default", - "uniqueId": "MyResource_cloudQueue_E7A2C0F4" + "path": "root/Default/Default/MyResource/Queue/Default", + "uniqueId": "MyResource_Queue_C2F2FBE5" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c8185458", + "name": "Queue-c84748c7", "visibility_timeout_seconds": 30 } } @@ -252,7 +252,7 @@ class $Root extends $stdlib.std.Resource { class First extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` @@ -315,7 +315,7 @@ class $Root extends $stdlib.std.Resource { class MyResource extends $stdlib.std.Resource { constructor($scope, $id, externalBucket, externalNum) { super($scope, $id); - this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.myStr = "myString"; this.myNum = 42; this.myBool = true; @@ -324,10 +324,10 @@ class $Root extends $stdlib.std.Resource { this.mapOfNum = ({["k1"]: 11, ["k2"]: 22}); this.setOfStr = new Set(["s1", "s2", "s1"]); this.another = new Another(this, "Another"); - this.myQueue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + this.myQueue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); this.extBucket = externalBucket; this.extNum = externalNum; - this.unusedResource = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + this.unusedResource = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); } helloPreflight() { return this.another; @@ -474,7 +474,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const r = new MyResource(this, "MyResource", b, 12); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:test", new $Closure1(this, "$Closure1")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md index 3ecd553aac8..c4cbc019215 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/resource_captures_globals.test.w_compile_tf-aws.md @@ -146,23 +146,23 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { }, "resource": { "aws_cloudwatch_log_group": { - "MyResource_cloudTopic-OnMessage0_CloudwatchLogGroup_51183C3F": { + "MyResource_Topic-OnMessage0_CloudwatchLogGroup_AE327804": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/CloudwatchLogGroup", - "uniqueId": "MyResource_cloudTopic-OnMessage0_CloudwatchLogGroup_51183C3F" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/CloudwatchLogGroup", + "uniqueId": "MyResource_Topic-OnMessage0_CloudwatchLogGroup_AE327804" } }, - "name": "/aws/lambda/cloud-Topic-OnMessage0-c8316e5b", + "name": "/aws/lambda/Topic-OnMessage0-c8bb74dc", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "MyResource_cloudCounter_0782991D": { + "Counter": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Counter/Default", - "uniqueId": "MyResource_cloudCounter_0782991D" + "path": "root/Default/Default/Counter/Default", + "uniqueId": "Counter" } }, "attribute": [ @@ -173,13 +173,13 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c87187fa" + "name": "wing-counter-Counter-c824ef62" }, - "cloudCounter": { + "MyResource_Counter_D9D84476": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Counter/Default", - "uniqueId": "cloudCounter" + "path": "root/Default/Default/MyResource/Counter/Default", + "uniqueId": "MyResource_Counter_D9D84476" } }, "attribute": [ @@ -190,50 +190,50 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "wing-counter-cloud.Counter-c866f225" + "name": "wing-counter-Counter-c8736322" } }, "aws_iam_role": { - "MyResource_cloudTopic-OnMessage0_IamRole_961468EB": { + "MyResource_Topic-OnMessage0_IamRole_CFB3A523": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/IamRole", - "uniqueId": "MyResource_cloudTopic-OnMessage0_IamRole_961468EB" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/IamRole", + "uniqueId": "MyResource_Topic-OnMessage0_IamRole_CFB3A523" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "MyResource_cloudTopic-OnMessage0_IamRolePolicy_FFC9A778": { + "MyResource_Topic-OnMessage0_IamRolePolicy_0A01161C": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/IamRolePolicy", - "uniqueId": "MyResource_cloudTopic-OnMessage0_IamRolePolicy_FFC9A778" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/IamRolePolicy", + "uniqueId": "MyResource_Topic-OnMessage0_IamRolePolicy_0A01161C" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.MyResource_cloudCounter_0782991D.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.cloudCounter.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.MyResource_cloudTopic-OnMessage0_IamRole_961468EB.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.MyResource_Counter_D9D84476.arn}\"],\"Effect\":\"Allow\"},{\"Action\":[\"dynamodb:UpdateItem\"],\"Resource\":[\"${aws_dynamodb_table.Counter.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.MyResource_Topic-OnMessage0_IamRole_CFB3A523.name}" } }, "aws_iam_role_policy_attachment": { - "MyResource_cloudTopic-OnMessage0_IamRolePolicyAttachment_26007303": { + "MyResource_Topic-OnMessage0_IamRolePolicyAttachment_D50F7CD0": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/IamRolePolicyAttachment", - "uniqueId": "MyResource_cloudTopic-OnMessage0_IamRolePolicyAttachment_26007303" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/IamRolePolicyAttachment", + "uniqueId": "MyResource_Topic-OnMessage0_IamRolePolicyAttachment_D50F7CD0" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.MyResource_cloudTopic-OnMessage0_IamRole_961468EB.name}" + "role": "${aws_iam_role.MyResource_Topic-OnMessage0_IamRole_CFB3A523.name}" } }, "aws_lambda_function": { - "MyResource_cloudTopic-OnMessage0_F8F986EA": { + "MyResource_Topic-OnMessage0_E4479D24": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/Default", - "uniqueId": "MyResource_cloudTopic-OnMessage0_F8F986EA" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/Default", + "uniqueId": "MyResource_Topic-OnMessage0_E4479D24" } }, "architectures": [ @@ -241,21 +241,21 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_49baa65c": "${aws_dynamodb_table.cloudCounter.name}", - "DYNAMODB_TABLE_NAME_5afed199": "${aws_dynamodb_table.MyResource_cloudCounter_0782991D.name}", + "DYNAMODB_TABLE_NAME_2aca4cc2": "${aws_dynamodb_table.MyResource_Counter_D9D84476.name}", + "DYNAMODB_TABLE_NAME_6cb5a3a4": "${aws_dynamodb_table.Counter.name}", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Topic-OnMessage0-c8316e5b", + "WING_FUNCTION_NAME": "Topic-OnMessage0-c8bb74dc", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Topic-OnMessage0-c8316e5b", + "function_name": "Topic-OnMessage0-c8bb74dc", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.MyResource_cloudTopic-OnMessage0_IamRole_961468EB.arn}", + "role": "${aws_iam_role.MyResource_Topic-OnMessage0_IamRole_CFB3A523.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.MyResource_cloudTopic-OnMessage0_S3Object_720C2491.key}", + "s3_key": "${aws_s3_object.MyResource_Topic-OnMessage0_S3Object_80106925.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -264,56 +264,56 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { } }, "aws_lambda_permission": { - "MyResource_cloudTopic-OnMessage0_InvokePermission-c8f2c43e88c72aa87b4192974983c81bf653de52bf_913E405C": { + "MyResource_Topic-OnMessage0_InvokePermission-c83f0429eb66f0735813ef826c23f64489a7bdf635_2A49C462": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/InvokePermission-c8f2c43e88c72aa87b4192974983c81bf653de52bf", - "uniqueId": "MyResource_cloudTopic-OnMessage0_InvokePermission-c8f2c43e88c72aa87b4192974983c81bf653de52bf_913E405C" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/InvokePermission-c83f0429eb66f0735813ef826c23f64489a7bdf635", + "uniqueId": "MyResource_Topic-OnMessage0_InvokePermission-c83f0429eb66f0735813ef826c23f64489a7bdf635_2A49C462" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.MyResource_cloudTopic-OnMessage0_F8F986EA.function_name}", + "function_name": "${aws_lambda_function.MyResource_Topic-OnMessage0_E4479D24.function_name}", "principal": "sns.amazonaws.com", - "source_arn": "${aws_sns_topic.MyResource_cloudTopic_1F3310C3.arn}" + "source_arn": "${aws_sns_topic.MyResource_Topic_08B3CB09.arn}" } }, "aws_s3_bucket": { - "Another_First_cloudBucket_DB822B7C": { + "Another_First_Bucket_490007B4": { "//": { "metadata": { - "path": "root/Default/Default/Another/First/cloud.Bucket/Default", - "uniqueId": "Another_First_cloudBucket_DB822B7C" + "path": "root/Default/Default/Another/First/Bucket/Default", + "uniqueId": "Another_First_Bucket_490007B4" } }, - "bucket_prefix": "cloud-bucket-c84d72a1-", + "bucket_prefix": "bucket-c8b9b2e9-", "force_destroy": false }, - "Code": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Code", - "uniqueId": "Code" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "code-c84a50b1-" + "bucket_prefix": "bucket-c88fdc5f-", + "force_destroy": false }, - "cloudBucket": { + "Code": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Code", + "uniqueId": "Code" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", - "force_destroy": false + "bucket_prefix": "code-c84a50b1-" } }, "aws_s3_object": { - "MyResource_cloudTopic-OnMessage0_S3Object_720C2491": { + "MyResource_Topic-OnMessage0_S3Object_80106925": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic-OnMessage0/S3Object", - "uniqueId": "MyResource_cloudTopic-OnMessage0_S3Object_720C2491" + "path": "root/Default/Default/MyResource/Topic-OnMessage0/S3Object", + "uniqueId": "MyResource_Topic-OnMessage0_S3Object_80106925" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -322,27 +322,27 @@ module.exports = function({ $_parentThis_localCounter, $globalCounter }) { } }, "aws_sns_topic": { - "MyResource_cloudTopic_1F3310C3": { + "MyResource_Topic_08B3CB09": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic/Default", - "uniqueId": "MyResource_cloudTopic_1F3310C3" + "path": "root/Default/Default/MyResource/Topic/Default", + "uniqueId": "MyResource_Topic_08B3CB09" } }, - "name": "cloud-Topic-c8f2c43e" + "name": "Topic-c83f0429" } }, "aws_sns_topic_subscription": { - "MyResource_cloudTopic_TopicSubscription0_4C261870": { + "MyResource_Topic_TopicSubscription0_46151CAE": { "//": { "metadata": { - "path": "root/Default/Default/MyResource/cloud.Topic/TopicSubscription0", - "uniqueId": "MyResource_cloudTopic_TopicSubscription0_4C261870" + "path": "root/Default/Default/MyResource/Topic/TopicSubscription0", + "uniqueId": "MyResource_Topic_TopicSubscription0_46151CAE" } }, - "endpoint": "${aws_lambda_function.MyResource_cloudTopic-OnMessage0_F8F986EA.arn}", + "endpoint": "${aws_lambda_function.MyResource_Topic-OnMessage0_E4479D24.arn}", "protocol": "lambda", - "topic_arn": "${aws_sns_topic.MyResource_cloudTopic_1F3310C3.arn}" + "topic_arn": "${aws_sns_topic.MyResource_Topic_08B3CB09.arn}" } } } @@ -365,7 +365,7 @@ class $Root extends $stdlib.std.Resource { class First extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.myResource = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); } static _toInflightType() { return ` @@ -436,8 +436,8 @@ class $Root extends $stdlib.std.Resource { class MyResource extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.localTopic = this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "cloud.Topic"); - this.localCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + this.localTopic = this.node.root.new("@winglang/sdk.cloud.Topic", cloud.Topic, this, "Topic"); + this.localCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); const $parentThis = this; class R extends $stdlib.std.Resource { _id = $stdlib.core.closureId(); @@ -610,8 +610,8 @@ class $Root extends $stdlib.std.Resource { }); } } - const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); - const globalCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "cloud.Counter"); + const globalBucket = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); + const globalCounter = this.node.root.new("@winglang/sdk.cloud.Counter", cloud.Counter, this, "Counter"); const globalStr = "hello"; const globalBool = true; const globalNum = 42; diff --git a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md index b257310a107..d4cbd27ae3f 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/store.w_compile_tf-aws.md @@ -73,9 +73,9 @@ const math = $stdlib.math; const cloud = $stdlib.cloud; const Color = (function (tmp) { - tmp[tmp["RED"] = 0] = ",RED"; - tmp[tmp["GREEN"] = 1] = ",GREEN"; - tmp[tmp["BLUE"] = 2] = ",BLUE"; + tmp["RED"] = "RED"; + tmp["GREEN"] = "GREEN"; + tmp["BLUE"] = "BLUE"; return tmp; })({}) ; @@ -110,7 +110,7 @@ class Util extends $stdlib.std.Resource { class Store extends $stdlib.std.Resource { constructor($scope, $id, ) { super($scope, $id); - this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + this.b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const __parent_this_1 = this; class $Closure1 extends $stdlib.std.AutoIdResource { _id = $stdlib.core.closureId(); @@ -147,7 +147,7 @@ class Store extends $stdlib.std.Resource { }); } } - const prefill = this.node.root.new("@winglang/sdk.cloud.OnDeploy", cloud.OnDeploy, this, "cloud.OnDeploy", new $Closure1(this, "$Closure1")); + const prefill = this.node.root.new("@winglang/sdk.cloud.OnDeploy", cloud.OnDeploy, this, "OnDeploy", new $Closure1(this, "$Closure1")); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md index 47498b9856d..26f928a21ed 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/struct_from_json.test.w_compile_tf-aws.md @@ -496,7 +496,7 @@ class $Root extends $stdlib.std.Resource { (std.Number.fromJson("cool", { unsafe: true })); Student._fromJson(({"obviously": "not a student"}), { unsafe: true }); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:unsafe flight", new $Closure5(this, "$Closure5")); - new otherExternalStructs.UsesStructInImportedFile(this, "otherExternalStructs.UsesStructInImportedFile"); + new otherExternalStructs.UsesStructInImportedFile(this, "UsesStructInImportedFile"); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md index 7721774194c..85080f4a312 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/super_call.test.w_compile_tf-aws.md @@ -199,14 +199,14 @@ module.exports = function({ $InflightA }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -583,7 +583,7 @@ class $Root extends $stdlib.std.Resource { const e = new E(this, "E"); (expect.Util.equal((e.description()), "E extends C extends B")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:super call inflight", new $Closure1(this, "$Closure1")); - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const extended = new ExtendedClass(this, "ExtendedClass"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:super call sets binding permissions", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md index a61b66b9336..37141d7a0b7 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/table.test.w_compile_tf-aws.md @@ -18,11 +18,11 @@ }, "resource": { "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -33,7 +33,7 @@ ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "simple-tableex.Table-c840a49c", + "name": "simple-tableTable-c89b2d37", "point_in_time_recovery": { "enabled": true } @@ -56,7 +56,7 @@ const ex = $stdlib.ex; class $Root extends $stdlib.std.Resource { constructor($scope, $id) { super($scope, $id); - const t = this.node.root.new("@winglang/sdk.ex.Table", ex.Table, this, "ex.Table", { name: "simple-table", primaryKey: "id", columns: ({["id"]: ex.ColumnType.STRING, ["name"]: ex.ColumnType.STRING, ["age"]: ex.ColumnType.NUMBER}) }); + const t = this.node.root.new("@winglang/sdk.ex.Table", ex.Table, this, "Table", { name: "simple-table", primaryKey: "id", columns: ({["id"]: ex.ColumnType.STRING, ["name"]: ex.ColumnType.STRING, ["age"]: ex.ColumnType.NUMBER}) }); } } const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms}); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md index cdf882ac17d..d262a72910d 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/test_bucket.test.w_compile_tf-aws.md @@ -61,14 +61,14 @@ module.exports = function({ $b }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -159,7 +159,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:put", new $Closure1(this, "$Closure1")); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:get", new $Closure2(this, "$Closure2")); } diff --git a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md index c10893533ba..50c8d6d9d97 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/unused_lift.test.w_compile_tf-aws.md @@ -96,14 +96,14 @@ module.exports = function({ $b }) { }, "resource": { "aws_s3_bucket": { - "cloudBucket": { + "Bucket": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Bucket/Default", - "uniqueId": "cloudBucket" + "path": "root/Default/Default/Bucket/Default", + "uniqueId": "Bucket" } }, - "bucket_prefix": "cloud-bucket-c87175e7-", + "bucket_prefix": "bucket-c88fdc5f-", "force_destroy": false } } @@ -268,7 +268,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "cloud.Bucket"); + const b = this.node.root.new("@winglang/sdk.cloud.Bucket", cloud.Bucket, this, "Bucket"); const f = new Foo(this, "Foo"); this.node.root.new("@winglang/sdk.std.Test", std.Test, this, "test:Use class but not method that access lifted object", new $Closure1(this, "$Closure1")); const bar = new Bar(this, "Bar"); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md index d51102719cf..98fe50ecdac 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/use_inflight_method_inside_init_closure.test.w_compile_tf-aws.md @@ -54,58 +54,58 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "Foo_cloudFunction_CloudwatchLogGroup_B531638C": { + "Foo_Function_CloudwatchLogGroup_1EA3CEF7": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/CloudwatchLogGroup", - "uniqueId": "Foo_cloudFunction_CloudwatchLogGroup_B531638C" + "path": "root/Default/Default/Foo/Function/CloudwatchLogGroup", + "uniqueId": "Foo_Function_CloudwatchLogGroup_1EA3CEF7" } }, - "name": "/aws/lambda/cloud-Function-c8858302", + "name": "/aws/lambda/Function-c8e9a190", "retention_in_days": 30 } }, "aws_iam_role": { - "Foo_cloudFunction_IamRole_037E9FB3": { + "Foo_Function_IamRole_F86A3AD2": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/IamRole", - "uniqueId": "Foo_cloudFunction_IamRole_037E9FB3" + "path": "root/Default/Default/Foo/Function/IamRole", + "uniqueId": "Foo_Function_IamRole_F86A3AD2" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "Foo_cloudFunction_IamRolePolicy_70B25789": { + "Foo_Function_IamRolePolicy_6E60CEA6": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/IamRolePolicy", - "uniqueId": "Foo_cloudFunction_IamRolePolicy_70B25789" + "path": "root/Default/Default/Foo/Function/IamRolePolicy", + "uniqueId": "Foo_Function_IamRolePolicy_6E60CEA6" } }, "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}", - "role": "${aws_iam_role.Foo_cloudFunction_IamRole_037E9FB3.name}" + "role": "${aws_iam_role.Foo_Function_IamRole_F86A3AD2.name}" } }, "aws_iam_role_policy_attachment": { - "Foo_cloudFunction_IamRolePolicyAttachment_E775DFDC": { + "Foo_Function_IamRolePolicyAttachment_3B82E0B3": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/IamRolePolicyAttachment", - "uniqueId": "Foo_cloudFunction_IamRolePolicyAttachment_E775DFDC" + "path": "root/Default/Default/Foo/Function/IamRolePolicyAttachment", + "uniqueId": "Foo_Function_IamRolePolicyAttachment_3B82E0B3" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.Foo_cloudFunction_IamRole_037E9FB3.name}" + "role": "${aws_iam_role.Foo_Function_IamRole_F86A3AD2.name}" } }, "aws_lambda_function": { - "Foo_cloudFunction_E4309ED7": { + "Foo_Function_A6241043": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/Default", - "uniqueId": "Foo_cloudFunction_E4309ED7" + "path": "root/Default/Default/Foo/Function/Default", + "uniqueId": "Foo_Function_A6241043" } }, "architectures": [ @@ -114,18 +114,18 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Function-c8858302", + "WING_FUNCTION_NAME": "Function-c8e9a190", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Function-c8858302", + "function_name": "Function-c8e9a190", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.Foo_cloudFunction_IamRole_037E9FB3.arn}", + "role": "${aws_iam_role.Foo_Function_IamRole_F86A3AD2.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.Foo_cloudFunction_S3Object_B910EE1D.key}", + "s3_key": "${aws_s3_object.Foo_Function_S3Object_790E7779.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -145,11 +145,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "Foo_cloudFunction_S3Object_B910EE1D": { + "Foo_Function_S3Object_790E7779": { "//": { "metadata": { - "path": "root/Default/Default/Foo/cloud.Function/S3Object", - "uniqueId": "Foo_cloudFunction_S3Object_B910EE1D" + "path": "root/Default/Default/Foo/Function/S3Object", + "uniqueId": "Foo_Function_S3Object_790E7779" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -213,7 +213,7 @@ class $Root extends $stdlib.std.Resource { }); } } - this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "cloud.Function", new $Closure1(this, "$Closure1")); + this.node.root.new("@winglang/sdk.cloud.Function", cloud.Function, this, "Function", new $Closure1(this, "$Closure1")); } static _toInflightType() { return ` diff --git a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md index ed042e83088..f8c315489d6 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/website_with_api.test.w_compile_tf-aws.md @@ -109,14 +109,14 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util "root": { "Default": { "Default": { - "cloud.Api": { + "Api": { "Endpoint": { - "Url": "cloudApi_Endpoint_Url_CD8AC9A6" + "Url": "Api_Endpoint_Url_473FEE9F" } }, - "cloud.Website": { + "Website": { "Endpoint": { - "Url": "cloudWebsite_Endpoint_Url_31589343" + "Url": "Website_Endpoint_Url_0CC0343F" } } } @@ -136,11 +136,11 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "aws_iam_policy_document": { - "cloudWebsite_AllowDistributionReadOnly_89DC4FD0": { + "Website_AllowDistributionReadOnly_24CFF6C0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/AllowDistributionReadOnly", - "uniqueId": "cloudWebsite_AllowDistributionReadOnly_89DC4FD0" + "path": "root/Default/Default/Website/AllowDistributionReadOnly", + "uniqueId": "Website_AllowDistributionReadOnly_24CFF6C0" } }, "statement": [ @@ -152,7 +152,7 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util { "test": "StringEquals", "values": [ - "${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.arn}" + "${aws_cloudfront_distribution.Website_Distribution_5E840E42.arn}" ], "variable": "AWS:SourceArn" } @@ -166,7 +166,7 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } ], "resources": [ - "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.arn}/*" + "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.arn}/*" ] } ] @@ -184,11 +184,11 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "output": { - "cloudApi_Endpoint_Url_CD8AC9A6": { - "value": "https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}" + "Api_Endpoint_Url_473FEE9F": { + "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}" }, - "cloudWebsite_Endpoint_Url_31589343": { - "value": "https://${aws_cloudfront_distribution.cloudWebsite_Distribution_083B5AF9.domain_name}" + "Website_Endpoint_Url_0CC0343F": { + "value": "https://${aws_cloudfront_distribution.Website_Distribution_5E840E42.domain_name}" } }, "provider": { @@ -198,56 +198,56 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util }, "resource": { "aws_api_gateway_deployment": { - "cloudApi_api_deployment_545514BF": { + "Api_api_deployment_7FB64CC4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/deployment", - "uniqueId": "cloudApi_api_deployment_545514BF" + "path": "root/Default/Default/Api/api/deployment", + "uniqueId": "Api_api_deployment_7FB64CC4" } }, "lifecycle": { "create_before_destroy": true }, - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "triggers": { - "redeployment": "${sha256(aws_api_gateway_rest_api.cloudApi_api_2B334D75.body)}" + "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}" } } }, "aws_api_gateway_rest_api": { - "cloudApi_api_2B334D75": { + "Api_api_91C07D84": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/api", - "uniqueId": "cloudApi_api_2B334D75" + "path": "root/Default/Default/Api/api/api", + "uniqueId": "Api_api_91C07D84" } }, - "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c86dec9c/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"post\":{\"operationId\":\"post-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_users0-c8ecbd27/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", + "body": "{\"openapi\":\"3.0.3\",\"paths\":{\"/users\":{\"get\":{\"operationId\":\"get-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_users0-c82bfbcd/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}},\"post\":{\"operationId\":\"post-users\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{},\"headers\":{\"Access-Control-Allow-Origin\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Methods\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Allow-Headers\":{\"schema\":{\"type\":\"string\"}},\"Access-Control-Max-Age\":{\"schema\":{\"type\":\"string\"}}}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_users0-c8ae30d9/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n #if ($context.httpMethod == \\\"OPTIONS\\\")\\n {\\\"statusCode\\\": 204}\\n #else\\n {\\\"statusCode\\\": 404}\\n #end\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"204\":{\"statusCode\":\"204\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\",\"method.response.header.Access-Control-Allow-Origin\":\"'*'\",\"method.response.header.Access-Control-Allow-Methods\":\"'GET,POST,OPTIONS'\",\"method.response.header.Access-Control-Allow-Headers\":\"'Content-Type'\"},\"responseTemplates\":{\"application/json\":\"{}\"}},\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"204\":{\"description\":\"204 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"},\"Access-Control-Allow-Origin\":{\"type\":\"string\"},\"Access-Control-Allow-Methods\":{\"type\":\"string\"},\"Access-Control-Allow-Headers\":{\"type\":\"string\"}}},\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}}}", "lifecycle": { "create_before_destroy": true }, - "name": "api-c895068c" + "name": "api-c8f613f0" } }, "aws_api_gateway_stage": { - "cloudApi_api_stage_BBB283E4": { + "Api_api_stage_E0FA39D6": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/stage", - "uniqueId": "cloudApi_api_stage_BBB283E4" + "path": "root/Default/Default/Api/api/stage", + "uniqueId": "Api_api_stage_E0FA39D6" } }, - "deployment_id": "${aws_api_gateway_deployment.cloudApi_api_deployment_545514BF.id}", - "rest_api_id": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}", + "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}", + "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}", "stage_name": "prod" } }, "aws_cloudfront_distribution": { - "cloudWebsite_Distribution_083B5AF9": { + "Website_Distribution_5E840E42": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/Distribution", - "uniqueId": "cloudWebsite_Distribution_083B5AF9" + "path": "root/Default/Default/Website/Distribution", + "uniqueId": "Website_Distribution_5E840E42" } }, "default_cache_behavior": { @@ -276,8 +276,8 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util "enabled": true, "origin": [ { - "domain_name": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket_regional_domain_name}", - "origin_access_control_id": "${aws_cloudfront_origin_access_control.cloudWebsite_CloudfrontOac_C956968B.id}", + "domain_name": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket_regional_domain_name}", + "origin_access_control_id": "${aws_cloudfront_origin_access_control.Website_CloudfrontOac_756836A4.id}", "origin_id": "s3Origin" } ], @@ -294,47 +294,47 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "aws_cloudfront_origin_access_control": { - "cloudWebsite_CloudfrontOac_C956968B": { + "Website_CloudfrontOac_756836A4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/CloudfrontOac", - "uniqueId": "cloudWebsite_CloudfrontOac_C956968B" + "path": "root/Default/Default/Website/CloudfrontOac", + "uniqueId": "Website_CloudfrontOac_756836A4" } }, - "name": "cloud-We-c8e58765-cloudfront-oac", + "name": "Website-c80d509a-cloudfront-oac", "origin_access_control_origin_type": "s3", "signing_behavior": "always", "signing_protocol": "sigv4" } }, "aws_cloudwatch_log_group": { - "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9": { + "Api_get_users0_CloudwatchLogGroup_6649CB35": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/CloudwatchLogGroup", - "uniqueId": "cloudApi_get_users0_CloudwatchLogGroup_78A5F1D9" + "path": "root/Default/Default/Api/get_users0/CloudwatchLogGroup", + "uniqueId": "Api_get_users0_CloudwatchLogGroup_6649CB35" } }, - "name": "/aws/lambda/get_users0-c86dec9c", + "name": "/aws/lambda/get_users0-c82bfbcd", "retention_in_days": 30 }, - "cloudApi_post_users0_CloudwatchLogGroup_92BF479A": { + "Api_post_users0_CloudwatchLogGroup_9A416640": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/CloudwatchLogGroup", - "uniqueId": "cloudApi_post_users0_CloudwatchLogGroup_92BF479A" + "path": "root/Default/Default/Api/post_users0/CloudwatchLogGroup", + "uniqueId": "Api_post_users0_CloudwatchLogGroup_9A416640" } }, - "name": "/aws/lambda/post_users0-c8ecbd27", + "name": "/aws/lambda/post_users0-c8ae30d9", "retention_in_days": 30 } }, "aws_dynamodb_table": { - "exTable": { + "Table": { "//": { "metadata": { - "path": "root/Default/Default/ex.Table/Default", - "uniqueId": "exTable" + "path": "root/Default/Default/Table/Default", + "uniqueId": "Table" } }, "attribute": [ @@ -345,82 +345,82 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util ], "billing_mode": "PAY_PER_REQUEST", "hash_key": "id", - "name": "users-tableex.Table-c840a49c", + "name": "users-tableTable-c89b2d37", "point_in_time_recovery": { "enabled": true } } }, "aws_iam_role": { - "cloudApi_get_users0_IamRole_5BFD476C": { + "Api_get_users0_IamRole_950ACE40": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRole", - "uniqueId": "cloudApi_get_users0_IamRole_5BFD476C" + "path": "root/Default/Default/Api/get_users0/IamRole", + "uniqueId": "Api_get_users0_IamRole_950ACE40" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" }, - "cloudApi_post_users0_IamRole_1AA38212": { + "Api_post_users0_IamRole_B6E18B7C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/IamRole", - "uniqueId": "cloudApi_post_users0_IamRole_1AA38212" + "path": "root/Default/Default/Api/post_users0/IamRole", + "uniqueId": "Api_post_users0_IamRole_B6E18B7C" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudApi_get_users0_IamRolePolicy_295FFAAE": { + "Api_get_users0_IamRolePolicy_1C96E6D8": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicy", - "uniqueId": "cloudApi_get_users0_IamRolePolicy_295FFAAE" + "path": "root/Default/Default/Api/get_users0/IamRolePolicy", + "uniqueId": "Api_get_users0_IamRolePolicy_1C96E6D8" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:Scan\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:Scan\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" }, - "cloudApi_post_users0_IamRolePolicy_DDC149F9": { + "Api_post_users0_IamRolePolicy_32ED25A9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/IamRolePolicy", - "uniqueId": "cloudApi_post_users0_IamRolePolicy_DDC149F9" + "path": "root/Default/Default/Api/post_users0/IamRolePolicy", + "uniqueId": "Api_post_users0_IamRolePolicy_32ED25A9" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.exTable.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudApi_post_users0_IamRole_1AA38212.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"dynamodb:PutItem\"],\"Resource\":[\"${aws_dynamodb_table.Table.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Api_post_users0_IamRole_B6E18B7C.name}" } }, "aws_iam_role_policy_attachment": { - "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04": { + "Api_get_users0_IamRolePolicyAttachment_EB78BB64": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_get_users0_IamRolePolicyAttachment_9E738C04" + "path": "root/Default/Default/Api/get_users0/IamRolePolicyAttachment", + "uniqueId": "Api_get_users0_IamRolePolicyAttachment_EB78BB64" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.name}" + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.name}" }, - "cloudApi_post_users0_IamRolePolicyAttachment_A2A2EBFE": { + "Api_post_users0_IamRolePolicyAttachment_F08ACD31": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/IamRolePolicyAttachment", - "uniqueId": "cloudApi_post_users0_IamRolePolicyAttachment_A2A2EBFE" + "path": "root/Default/Default/Api/post_users0/IamRolePolicyAttachment", + "uniqueId": "Api_post_users0_IamRolePolicyAttachment_F08ACD31" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudApi_post_users0_IamRole_1AA38212.name}" + "role": "${aws_iam_role.Api_post_users0_IamRole_B6E18B7C.name}" } }, "aws_lambda_function": { - "cloudApi_get_users0_483BD7DE": { + "Api_get_users0_F1BDFB04": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/Default", - "uniqueId": "cloudApi_get_users0_483BD7DE" + "path": "root/Default/Default/Api/get_users0/Default", + "uniqueId": "Api_get_users0_F1BDFB04" } }, "architectures": [ @@ -428,33 +428,33 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"id\":0,\"name\":0,\"age\":1}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "id", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"id\":0,\"name\":0,\"age\":1}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "get_users0-c86dec9c", + "WING_FUNCTION_NAME": "get_users0-c82bfbcd", "WING_TARGET": "tf-aws" } }, - "function_name": "get_users0-c86dec9c", + "function_name": "get_users0-c82bfbcd", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_get_users0_IamRole_5BFD476C.arn}", + "role": "${aws_iam_role.Api_get_users0_IamRole_950ACE40.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_get_users0_S3Object_513E5470.key}", + "s3_key": "${aws_s3_object.Api_get_users0_S3Object_5E4DF6D1.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], "subnet_ids": [] } }, - "cloudApi_post_users0_F312F0EB": { + "Api_post_users0_7459F559": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/Default", - "uniqueId": "cloudApi_post_users0_F312F0EB" + "path": "root/Default/Default/Api/post_users0/Default", + "uniqueId": "Api_post_users0_7459F559" } }, "architectures": [ @@ -462,22 +462,22 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util ], "environment": { "variables": { - "DYNAMODB_TABLE_NAME_d5d44f18": "${aws_dynamodb_table.exTable.name}", - "DYNAMODB_TABLE_NAME_d5d44f18_COLUMNS": "{\"id\":0,\"name\":0,\"age\":1}", - "DYNAMODB_TABLE_NAME_d5d44f18_PRIMARY_KEY": "id", + "DYNAMODB_TABLE_NAME_e7245baa": "${aws_dynamodb_table.Table.name}", + "DYNAMODB_TABLE_NAME_e7245baa_COLUMNS": "{\"id\":0,\"name\":0,\"age\":1}", + "DYNAMODB_TABLE_NAME_e7245baa_PRIMARY_KEY": "id", "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "post_users0-c8ecbd27", + "WING_FUNCTION_NAME": "post_users0-c8ae30d9", "WING_TARGET": "tf-aws" } }, - "function_name": "post_users0-c8ecbd27", + "function_name": "post_users0-c8ae30d9", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudApi_post_users0_IamRole_1AA38212.arn}", + "role": "${aws_iam_role.Api_post_users0_IamRole_B6E18B7C.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudApi_post_users0_S3Object_6AC8FFCE.key}", + "s3_key": "${aws_s3_object.Api_post_users0_S3Object_8FA5AEB9.key}", "timeout": 60, "vpc_config": { "security_group_ids": [], @@ -486,30 +486,30 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util } }, "aws_lambda_permission": { - "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0": { + "Api_api_permission-GET-41f0e61d_AD17285B": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-GET-41f0e61d", - "uniqueId": "cloudApi_api_permission-GET-41f0e61d_DD9B4FD0" + "path": "root/Default/Default/Api/api/permission-GET-41f0e61d", + "uniqueId": "Api_api_permission-GET-41f0e61d_AD17285B" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_get_users0_483BD7DE.function_name}", + "function_name": "${aws_lambda_function.Api_get_users0_F1BDFB04.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/GET/users", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/users", "statement_id": "AllowExecutionFromAPIGateway-GET-41f0e61d" }, - "cloudApi_api_permission-POST-41f0e61d_743604B6": { + "Api_api_permission-POST-41f0e61d_3C9809C9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/api/permission-POST-41f0e61d", - "uniqueId": "cloudApi_api_permission-POST-41f0e61d_743604B6" + "path": "root/Default/Default/Api/api/permission-POST-41f0e61d", + "uniqueId": "Api_api_permission-POST-41f0e61d_3C9809C9" } }, "action": "lambda:InvokeFunction", - "function_name": "${aws_lambda_function.cloudApi_post_users0_F312F0EB.function_name}", + "function_name": "${aws_lambda_function.Api_post_users0_7459F559.function_name}", "principal": "apigateway.amazonaws.com", - "source_arn": "${aws_api_gateway_rest_api.cloudApi_api_2B334D75.execution_arn}/*/POST/users", + "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/POST/users", "statement_id": "AllowExecutionFromAPIGateway-POST-41f0e61d" } }, @@ -523,94 +523,94 @@ module.exports = function({ $api_url, $expect_Util, $http_HttpMethod, $http_Util }, "bucket_prefix": "code-c84a50b1-" }, - "cloudWebsite_WebsiteBucket_EB03D355": { + "Website_WebsiteBucket_3C0321F0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/WebsiteBucket", - "uniqueId": "cloudWebsite_WebsiteBucket_EB03D355" + "path": "root/Default/Default/Website/WebsiteBucket", + "uniqueId": "Website_WebsiteBucket_3C0321F0" } }, - "bucket_prefix": "cloud-website-c8e58765-", + "bucket_prefix": "website-c80d509a-", "force_destroy": false } }, "aws_s3_bucket_policy": { - "cloudWebsite_DistributionS3BucketPolicy_32B029AE": { + "Website_DistributionS3BucketPolicy_09AE0BCA": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/DistributionS3BucketPolicy", - "uniqueId": "cloudWebsite_DistributionS3BucketPolicy_32B029AE" + "path": "root/Default/Default/Website/DistributionS3BucketPolicy", + "uniqueId": "Website_DistributionS3BucketPolicy_09AE0BCA" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.id}", - "policy": "${data.aws_iam_policy_document.cloudWebsite_AllowDistributionReadOnly_89DC4FD0.json}" + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.id}", + "policy": "${data.aws_iam_policy_document.Website_AllowDistributionReadOnly_24CFF6C0.json}" } }, "aws_s3_bucket_website_configuration": { - "cloudWebsite_BucketWebsiteConfiguration_920E8E41": { + "Website_BucketWebsiteConfiguration_58F891B4": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/BucketWebsiteConfiguration", - "uniqueId": "cloudWebsite_BucketWebsiteConfiguration_920E8E41" + "path": "root/Default/Default/Website/BucketWebsiteConfiguration", + "uniqueId": "Website_BucketWebsiteConfiguration_58F891B4" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "index_document": { "suffix": "index.html" } } }, "aws_s3_object": { - "cloudApi_get_users0_S3Object_513E5470": { + "Api_get_users0_S3Object_5E4DF6D1": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/get_users0/S3Object", - "uniqueId": "cloudApi_get_users0_S3Object_513E5470" + "path": "root/Default/Default/Api/get_users0/S3Object", + "uniqueId": "Api_get_users0_S3Object_5E4DF6D1" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudApi_post_users0_S3Object_6AC8FFCE": { + "Api_post_users0_S3Object_8FA5AEB9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Api/post_users0/S3Object", - "uniqueId": "cloudApi_post_users0_S3Object_6AC8FFCE" + "path": "root/Default/Default/Api/post_users0/S3Object", + "uniqueId": "Api_post_users0_S3Object_8FA5AEB9" } }, "bucket": "${aws_s3_bucket.Code.bucket}", "key": "", "source": "" }, - "cloudWebsite_File--indexhtml_2A2AE13C": { + "Website_File--indexhtml_864F8C36": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File--index.html", - "uniqueId": "cloudWebsite_File--indexhtml_2A2AE13C" + "path": "root/Default/Default/Website/File--index.html", + "uniqueId": "Website_File--indexhtml_864F8C36" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", "content_type": "text/html; charset=utf-8", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "/index.html", "source": "", "source_hash": "${filemd5()}" }, - "cloudWebsite_File-configjson_591A81BA": { + "Website_File-configjson_1F1498B9": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Website/File-config.json", - "uniqueId": "cloudWebsite_File-configjson_591A81BA" + "path": "root/Default/Default/Website/File-config.json", + "uniqueId": "Website_File-configjson_1F1498B9" } }, - "bucket": "${aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355.bucket}", - "content": "{\"apiUrl\":\"https://${aws_api_gateway_rest_api.cloudApi_api_2B334D75.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.cloudApi_api_stage_BBB283E4.stage_name}\"}", + "bucket": "${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}", + "content": "{\"apiUrl\":\"https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}\"}", "content_type": "application/json", "depends_on": [ - "aws_s3_bucket.cloudWebsite_WebsiteBucket_EB03D355" + "aws_s3_bucket.Website_WebsiteBucket_3C0321F0" ], "key": "config.json" } @@ -783,9 +783,9 @@ class $Root extends $stdlib.std.Resource { }); } } - const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "cloud.Api", { cors: true, corsOptions: ({"allowOrigin": "*", "allowMethods": [cloud.HttpMethod.GET, cloud.HttpMethod.POST, cloud.HttpMethod.OPTIONS], "allowHeaders": ["Content-Type"], "allowCredentials": false, "exposeHeaders": ["Content-Type"], "maxAge": (std.Duration.fromSeconds(600))}) }); - const website = this.node.root.new("@winglang/sdk.cloud.Website", cloud.Website, this, "cloud.Website", { path: "./website_with_api" }); - const usersTable = this.node.root.new("@winglang/sdk.ex.Table", ex.Table, this, "ex.Table", { name: "users-table", primaryKey: "id", columns: ({["id"]: ex.ColumnType.STRING, ["name"]: ex.ColumnType.STRING, ["age"]: ex.ColumnType.NUMBER}) }); + const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api", { cors: true, corsOptions: ({"allowOrigin": "*", "allowMethods": [cloud.HttpMethod.GET, cloud.HttpMethod.POST, cloud.HttpMethod.OPTIONS], "allowHeaders": ["Content-Type"], "allowCredentials": false, "exposeHeaders": ["Content-Type"], "maxAge": (std.Duration.fromSeconds(600))}) }); + const website = this.node.root.new("@winglang/sdk.cloud.Website", cloud.Website, this, "Website", { path: "./website_with_api" }); + const usersTable = this.node.root.new("@winglang/sdk.ex.Table", ex.Table, this, "Table", { name: "users-table", primaryKey: "id", columns: ({["id"]: ex.ColumnType.STRING, ["name"]: ex.ColumnType.STRING, ["age"]: ex.ColumnType.NUMBER}) }); const getHandler = new $Closure1(this, "$Closure1"); const postHandler = new $Closure2(this, "$Closure2"); (api.get("/users", getHandler)); diff --git a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md index 788e241bf91..69368e988ee 100644 --- a/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md +++ b/tools/hangar/__snapshots__/test_corpus/valid/while_loop_await.test.w_compile_tf-aws.md @@ -44,71 +44,71 @@ module.exports = function({ }) { }, "resource": { "aws_cloudwatch_log_group": { - "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419": { + "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/CloudwatchLogGroup", - "uniqueId": "cloudQueue-SetConsumer0_CloudwatchLogGroup_FCFCF419" + "path": "root/Default/Default/Queue-SetConsumer0/CloudwatchLogGroup", + "uniqueId": "Queue-SetConsumer0_CloudwatchLogGroup_56C2891C" } }, - "name": "/aws/lambda/cloud-Queue-SetConsumer0-c8b576c9", + "name": "/aws/lambda/Queue-SetConsumer0-c83c303c", "retention_in_days": 30 } }, "aws_iam_role": { - "cloudQueue-SetConsumer0_IamRole_968DB138": { + "Queue-SetConsumer0_IamRole_7F9ED9ED": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRole", - "uniqueId": "cloudQueue-SetConsumer0_IamRole_968DB138" + "path": "root/Default/Default/Queue-SetConsumer0/IamRole", + "uniqueId": "Queue-SetConsumer0_IamRole_7F9ED9ED" } }, "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}" } }, "aws_iam_role_policy": { - "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517": { + "Queue-SetConsumer0_IamRolePolicy_0299B5AB": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicy", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicy_3E29E517" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicy", + "uniqueId": "Queue-SetConsumer0_IamRolePolicy_0299B5AB" } }, - "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.cloudQueue.arn}\"],\"Effect\":\"Allow\"}]}", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":[\"sqs:ReceiveMessage\",\"sqs:ChangeMessageVisibility\",\"sqs:GetQueueUrl\",\"sqs:DeleteMessage\",\"sqs:GetQueueAttributes\"],\"Resource\":[\"${aws_sqs_queue.Queue.arn}\"],\"Effect\":\"Allow\"}]}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_iam_role_policy_attachment": { - "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A": { + "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", - "uniqueId": "cloudQueue-SetConsumer0_IamRolePolicyAttachment_B207137A" + "path": "root/Default/Default/Queue-SetConsumer0/IamRolePolicyAttachment", + "uniqueId": "Queue-SetConsumer0_IamRolePolicyAttachment_4A4C5C5D" } }, "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole", - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.name}" + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.name}" } }, "aws_lambda_event_source_mapping": { - "cloudQueue_EventSourceMapping_41814136": { + "Queue_EventSourceMapping_8332F7DC": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/EventSourceMapping", - "uniqueId": "cloudQueue_EventSourceMapping_41814136" + "path": "root/Default/Default/Queue/EventSourceMapping", + "uniqueId": "Queue_EventSourceMapping_8332F7DC" } }, "batch_size": 1, - "event_source_arn": "${aws_sqs_queue.cloudQueue.arn}", - "function_name": "${aws_lambda_function.cloudQueue-SetConsumer0.function_name}" + "event_source_arn": "${aws_sqs_queue.Queue.arn}", + "function_name": "${aws_lambda_function.Queue-SetConsumer0.function_name}" } }, "aws_lambda_function": { - "cloudQueue-SetConsumer0": { + "Queue-SetConsumer0": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/Default", - "uniqueId": "cloudQueue-SetConsumer0" + "path": "root/Default/Default/Queue-SetConsumer0/Default", + "uniqueId": "Queue-SetConsumer0" } }, "architectures": [ @@ -117,19 +117,19 @@ module.exports = function({ }) { "environment": { "variables": { "NODE_OPTIONS": "--enable-source-maps", - "WING_FUNCTION_NAME": "cloud-Queue-SetConsumer0-c8b576c9", + "WING_FUNCTION_NAME": "Queue-SetConsumer0-c83c303c", "WING_TARGET": "tf-aws" } }, - "function_name": "cloud-Queue-SetConsumer0-c8b576c9", + "function_name": "Queue-SetConsumer0-c83c303c", "handler": "index.handler", "memory_size": 1024, "publish": true, - "role": "${aws_iam_role.cloudQueue-SetConsumer0_IamRole_968DB138.arn}", + "role": "${aws_iam_role.Queue-SetConsumer0_IamRole_7F9ED9ED.arn}", "runtime": "nodejs20.x", "s3_bucket": "${aws_s3_bucket.Code.bucket}", - "s3_key": "${aws_s3_object.cloudQueue-SetConsumer0_S3Object_52D070FF.key}", - "timeout": "${aws_sqs_queue.cloudQueue.visibility_timeout_seconds}", + "s3_key": "${aws_s3_object.Queue-SetConsumer0_S3Object_2AD0A795.key}", + "timeout": "${aws_sqs_queue.Queue.visibility_timeout_seconds}", "vpc_config": { "security_group_ids": [], "subnet_ids": [] @@ -148,11 +148,11 @@ module.exports = function({ }) { } }, "aws_s3_object": { - "cloudQueue-SetConsumer0_S3Object_52D070FF": { + "Queue-SetConsumer0_S3Object_2AD0A795": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue-SetConsumer0/S3Object", - "uniqueId": "cloudQueue-SetConsumer0_S3Object_52D070FF" + "path": "root/Default/Default/Queue-SetConsumer0/S3Object", + "uniqueId": "Queue-SetConsumer0_S3Object_2AD0A795" } }, "bucket": "${aws_s3_bucket.Code.bucket}", @@ -161,15 +161,15 @@ module.exports = function({ }) { } }, "aws_sqs_queue": { - "cloudQueue": { + "Queue": { "//": { "metadata": { - "path": "root/Default/Default/cloud.Queue/Default", - "uniqueId": "cloudQueue" + "path": "root/Default/Default/Queue/Default", + "uniqueId": "Queue" } }, "message_retention_seconds": 3600, - "name": "cloud-Queue-c86e03d8", + "name": "Queue-c822c726", "visibility_timeout_seconds": 30 } } @@ -222,7 +222,7 @@ class $Root extends $stdlib.std.Resource { }); } } - const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "cloud.Queue"); + const queue = this.node.root.new("@winglang/sdk.cloud.Queue", cloud.Queue, this, "Queue"); const handler = new $Closure1(this, "$Closure1"); (queue.setConsumer(handler)); } diff --git a/tools/hangar/__snapshots__/tree_json.ts.snap b/tools/hangar/__snapshots__/tree_json.ts.snap index 500e9f6bd89..88e2f15bb11 100644 --- a/tools/hangar/__snapshots__/tree_json.ts.snap +++ b/tools/hangar/__snapshots__/tree_json.ts.snap @@ -44,7 +44,7 @@ exports[`tree.json for an app with many resources 1`] = ` "children": { "Foo": { "children": { - "cloud.Counter": { + "Counter": { "children": { "Default": { "constructInfo": { @@ -52,7 +52,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/Bar/Foo/cloud.Counter/Default", + "path": "root/Default/Default/Bar/Foo/Counter/Default", }, }, "constructInfo": { @@ -63,8 +63,8 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A distributed atomic counter", "title": "Counter", }, - "id": "cloud.Counter", - "path": "root/Default/Default/Bar/Foo/cloud.Counter", + "id": "Counter", + "path": "root/Default/Default/Bar/Foo/Counter", }, }, "constructInfo": { @@ -119,153 +119,7 @@ exports[`tree.json for an app with many resources 1`] = ` "id": "$Closure4_0", "path": "root/Default/Default/BigPublisher/$Closure4_0", }, - "b2": { - "children": { - "Default": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "Default", - "path": "root/Default/Default/BigPublisher/b2/Default", - }, - "S3BucketNotification": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "S3BucketNotification", - "path": "root/Default/Default/BigPublisher/b2/S3BucketNotification", - }, - "oncreate": { - "children": { - "Default": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "Default", - "path": "root/Default/Default/BigPublisher/b2/oncreate/Default", - }, - "PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad", - "path": "root/Default/Default/BigPublisher/b2/oncreate/PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad", - }, - "TopicSubscription0": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "TopicSubscription0", - "path": "root/Default/Default/BigPublisher/b2/oncreate/TopicSubscription0", - }, - }, - "constructInfo": { - "fqn": "@winglang/sdk.cloud.Topic", - "version": "0.0.0", - }, - "display": { - "description": "A pub/sub notification topic", - "title": "Topic", - }, - "id": "oncreate", - "path": "root/Default/Default/BigPublisher/b2/oncreate", - }, - "oncreate-OnMessage0": { - "children": { - "Asset": { - "constructInfo": { - "fqn": "cdktf.TerraformAsset", - "version": "0.20.3", - }, - "id": "Asset", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Asset", - }, - "CloudwatchLogGroup": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "CloudwatchLogGroup", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/CloudwatchLogGroup", - }, - "Default": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "Default", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Default", - }, - "IamRole": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "IamRole", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRole", - }, - "IamRolePolicy": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "IamRolePolicy", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicy", - }, - "IamRolePolicyAttachment": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "IamRolePolicyAttachment", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicyAttachment", - }, - "InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", - }, - "S3Object": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "S3Object", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/S3Object", - }, - }, - "constructInfo": { - "fqn": "@winglang/sdk.cloud.Function", - "version": "0.0.0", - }, - "display": { - "description": "A cloud function (FaaS)", - "title": "Function", - }, - "id": "oncreate-OnMessage0", - "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0", - }, - }, - "constructInfo": { - "fqn": "@winglang/sdk.cloud.Bucket", - "version": "0.0.0", - }, - "display": { - "description": "A cloud object store", - "title": "Bucket", - }, - "id": "b2", - "path": "root/Default/Default/BigPublisher/b2", - }, - "cloud.Bucket": { + "Bucket": { "children": { "Default": { "constructInfo": { @@ -273,7 +127,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/BigPublisher/cloud.Bucket/Default", + "path": "root/Default/Default/BigPublisher/Bucket/Default", }, }, "constructInfo": { @@ -284,10 +138,10 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A cloud object store", "title": "Bucket", }, - "id": "cloud.Bucket", - "path": "root/Default/Default/BigPublisher/cloud.Bucket", + "id": "Bucket", + "path": "root/Default/Default/BigPublisher/Bucket", }, - "cloud.Queue": { + "Queue": { "children": { "Default": { "constructInfo": { @@ -295,7 +149,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/BigPublisher/cloud.Queue/Default", + "path": "root/Default/Default/BigPublisher/Queue/Default", }, "EventSourceMapping": { "constructInfo": { @@ -303,7 +157,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "EventSourceMapping", - "path": "root/Default/Default/BigPublisher/cloud.Queue/EventSourceMapping", + "path": "root/Default/Default/BigPublisher/Queue/EventSourceMapping", }, }, "constructInfo": { @@ -314,10 +168,10 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A distributed message queue", "title": "Queue", }, - "id": "cloud.Queue", - "path": "root/Default/Default/BigPublisher/cloud.Queue", + "id": "Queue", + "path": "root/Default/Default/BigPublisher/Queue", }, - "cloud.Queue-SetConsumer0": { + "Queue-SetConsumer0": { "children": { "Asset": { "constructInfo": { @@ -325,7 +179,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Asset", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/Asset", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/Asset", }, "CloudwatchLogGroup": { "constructInfo": { @@ -333,7 +187,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "CloudwatchLogGroup", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/CloudwatchLogGroup", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/CloudwatchLogGroup", }, "Default": { "constructInfo": { @@ -341,7 +195,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/Default", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/Default", }, "IamRole": { "constructInfo": { @@ -349,7 +203,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRole", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRole", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRole", }, "IamRolePolicy": { "constructInfo": { @@ -357,7 +211,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRolePolicy", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRolePolicy", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRolePolicy", }, "IamRolePolicyAttachment": { "constructInfo": { @@ -365,7 +219,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRolePolicyAttachment", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/IamRolePolicyAttachment", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/IamRolePolicyAttachment", }, "S3Object": { "constructInfo": { @@ -373,7 +227,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "S3Object", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0/S3Object", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0/S3Object", }, }, "constructInfo": { @@ -384,10 +238,10 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A cloud function (FaaS)", "title": "Function", }, - "id": "cloud.Queue-SetConsumer0", - "path": "root/Default/Default/BigPublisher/cloud.Queue-SetConsumer0", + "id": "Queue-SetConsumer0", + "path": "root/Default/Default/BigPublisher/Queue-SetConsumer0", }, - "cloud.Topic": { + "Topic": { "children": { "Default": { "constructInfo": { @@ -395,7 +249,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/BigPublisher/cloud.Topic/Default", + "path": "root/Default/Default/BigPublisher/Topic/Default", }, "TopicSubscription0": { "constructInfo": { @@ -403,7 +257,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "TopicSubscription0", - "path": "root/Default/Default/BigPublisher/cloud.Topic/TopicSubscription0", + "path": "root/Default/Default/BigPublisher/Topic/TopicSubscription0", }, }, "constructInfo": { @@ -414,10 +268,10 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A pub/sub notification topic", "title": "Topic", }, - "id": "cloud.Topic", - "path": "root/Default/Default/BigPublisher/cloud.Topic", + "id": "Topic", + "path": "root/Default/Default/BigPublisher/Topic", }, - "cloud.Topic-OnMessage0": { + "Topic-OnMessage0": { "children": { "Asset": { "constructInfo": { @@ -425,7 +279,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Asset", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/Asset", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/Asset", }, "CloudwatchLogGroup": { "constructInfo": { @@ -433,7 +287,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "CloudwatchLogGroup", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/CloudwatchLogGroup", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/CloudwatchLogGroup", }, "Default": { "constructInfo": { @@ -441,7 +295,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "Default", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/Default", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/Default", }, "IamRole": { "constructInfo": { @@ -449,7 +303,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRole", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRole", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRole", }, "IamRolePolicy": { "constructInfo": { @@ -457,7 +311,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRolePolicy", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRolePolicy", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRolePolicy", }, "IamRolePolicyAttachment": { "constructInfo": { @@ -465,15 +319,15 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "IamRolePolicyAttachment", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/IamRolePolicyAttachment", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/IamRolePolicyAttachment", }, - "InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec": { + "InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a": { "constructInfo": { "fqn": "cdktf.TerraformResource", "version": "0.20.3", }, - "id": "InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/InvokePermission-c86b6469dec0edbe23d2827b4ea7006182eb0072ec", + "id": "InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/InvokePermission-c884cd53ef51dde6112319447c29f4ea9473f19e6a", }, "S3Object": { "constructInfo": { @@ -481,7 +335,7 @@ exports[`tree.json for an app with many resources 1`] = ` "version": "0.20.3", }, "id": "S3Object", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0/S3Object", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0/S3Object", }, }, "constructInfo": { @@ -492,8 +346,154 @@ exports[`tree.json for an app with many resources 1`] = ` "description": "A cloud function (FaaS)", "title": "Function", }, - "id": "cloud.Topic-OnMessage0", - "path": "root/Default/Default/BigPublisher/cloud.Topic-OnMessage0", + "id": "Topic-OnMessage0", + "path": "root/Default/Default/BigPublisher/Topic-OnMessage0", + }, + "b2": { + "children": { + "Default": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "Default", + "path": "root/Default/Default/BigPublisher/b2/Default", + }, + "S3BucketNotification": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "S3BucketNotification", + "path": "root/Default/Default/BigPublisher/b2/S3BucketNotification", + }, + "oncreate": { + "children": { + "Default": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "Default", + "path": "root/Default/Default/BigPublisher/b2/oncreate/Default", + }, + "PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad", + "path": "root/Default/Default/BigPublisher/b2/oncreate/PublishPermission-c851683a81379a8ef8351c83fe31924055584271ad", + }, + "TopicSubscription0": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "TopicSubscription0", + "path": "root/Default/Default/BigPublisher/b2/oncreate/TopicSubscription0", + }, + }, + "constructInfo": { + "fqn": "@winglang/sdk.cloud.Topic", + "version": "0.0.0", + }, + "display": { + "description": "A pub/sub notification topic", + "title": "Topic", + }, + "id": "oncreate", + "path": "root/Default/Default/BigPublisher/b2/oncreate", + }, + "oncreate-OnMessage0": { + "children": { + "Asset": { + "constructInfo": { + "fqn": "cdktf.TerraformAsset", + "version": "0.20.3", + }, + "id": "Asset", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Asset", + }, + "CloudwatchLogGroup": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "CloudwatchLogGroup", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/CloudwatchLogGroup", + }, + "Default": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "Default", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/Default", + }, + "IamRole": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "IamRole", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRole", + }, + "IamRolePolicy": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "IamRolePolicy", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicy", + }, + "IamRolePolicyAttachment": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "IamRolePolicyAttachment", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/IamRolePolicyAttachment", + }, + "InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/InvokePermission-c849e824f9ffcc17825860cf0b7344a60826b3ba1a", + }, + "S3Object": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "S3Object", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0/S3Object", + }, + }, + "constructInfo": { + "fqn": "@winglang/sdk.cloud.Function", + "version": "0.0.0", + }, + "display": { + "description": "A cloud function (FaaS)", + "title": "Function", + }, + "id": "oncreate-OnMessage0", + "path": "root/Default/Default/BigPublisher/b2/oncreate-OnMessage0", + }, + }, + "constructInfo": { + "fqn": "@winglang/sdk.cloud.Bucket", + "version": "0.0.0", + }, + "display": { + "description": "A cloud object store", + "title": "Bucket", + }, + "id": "b2", + "path": "root/Default/Default/BigPublisher/b2", }, }, "constructInfo": { @@ -504,6 +504,28 @@ exports[`tree.json for an app with many resources 1`] = ` "id": "BigPublisher", "path": "root/Default/Default/BigPublisher", }, + "Bucket": { + "children": { + "Default": { + "constructInfo": { + "fqn": "cdktf.TerraformResource", + "version": "0.20.3", + }, + "id": "Default", + "path": "root/Default/Default/Bucket/Default", + }, + }, + "constructInfo": { + "fqn": "@winglang/sdk.cloud.Bucket", + "version": "0.0.0", + }, + "display": { + "description": "A cloud object store", + "title": "Bucket", + }, + "id": "Bucket", + "path": "root/Default/Default/Bucket", + }, "ScopeAndIdTestClass": { "children": { "Dummy": { @@ -584,28 +606,6 @@ exports[`tree.json for an app with many resources 1`] = ` "id": "ScopeAndIdTestClass", "path": "root/Default/Default/ScopeAndIdTestClass", }, - "cloud.Bucket": { - "children": { - "Default": { - "constructInfo": { - "fqn": "cdktf.TerraformResource", - "version": "0.20.3", - }, - "id": "Default", - "path": "root/Default/Default/cloud.Bucket/Default", - }, - }, - "constructInfo": { - "fqn": "@winglang/sdk.cloud.Bucket", - "version": "0.0.0", - }, - "display": { - "description": "A cloud object store", - "title": "Bucket", - }, - "id": "cloud.Bucket", - "path": "root/Default/Default/cloud.Bucket", - }, "test:dependency cycles": { "constructInfo": { "fqn": "@winglang/sdk.std.Test", diff --git a/tools/hangar/src/platform.test.ts b/tools/hangar/src/platform.test.ts index 40f8e4e6639..e8a919752be 100644 --- a/tools/hangar/src/platform.test.ts +++ b/tools/hangar/src/platform.test.ts @@ -402,3 +402,157 @@ describe("Platform examples", () => { }); }); }); + +describe("Implicit platform files", () => { + const platformParameters = { + type: "object", + properties: { + foo: { + type: "string", + } + }, + required: ["foo"] + } + + // Simple platform with a required parameter + const platformCode = ` + exports.Platform = class Platform { + target = "*"; + parameters = ${JSON.stringify(platformParameters)}; + } + ` + + describe("can be defined", () => { + test("in the source directory", async () => { + // GIVEN + const wingCode = ` + bring cloud; + + let b = new cloud.Bucket(); + ` + const args = ["compile"]; + const tempdir = fs.mkdtempSync(path.join(tmpdir(), "platform-parameters")); + + fs.writeFileSync(path.join(tempdir, "main.w"), wingCode); + fs.writeFileSync(path.join(tempdir, "wplatform.js"), platformCode); + + // WHEN + const output = await runWingCommand({ + cwd: tempdir, + wingFile: path.join(tempdir, "main.w"), + args, + expectFailure: true + }); + + // THEN + expect(output.stderr).toContain("Parameter validation errors:"); + expect(output.stderr).toContain("- must have required property 'foo'"); + }) + + test("with a .wplatform.js extension", async () => { + // GIVEN + const wingCode = ` + bring cloud; + + let b = new cloud.Bucket(); + ` + const args = ["compile"]; + const tempdir = fs.mkdtempSync(path.join(tmpdir(), "platform-parameters")); + + fs.writeFileSync(path.join(tempdir, "main.w"), wingCode); + fs.writeFileSync(path.join(tempdir, "whatever.wplatform.js"), platformCode); + + // WHEN + const output = await runWingCommand({ + cwd: tempdir, + wingFile: path.join(tempdir, "main.w"), + args, + expectFailure: true + }); + + console.log("STDOUT: ", output.stdout); + console.log("STDERR: ", output.stderr); + + // THEN + expect(output.stderr).toContain("Parameter validation errors:"); + expect(output.stderr).toContain("- must have required property 'foo'"); + }); + + test("imported directory", async () => { + // GIVEN + const wingCode = ` + bring cloud; + bring "./lib" as myLib; + + let b = new cloud.Bucket(); + ` + + const args = ["compile"]; + const tempdir = fs.mkdtempSync(path.join(tmpdir(), "platform-parameters")); + fs.mkdirSync(path.join(tempdir, "lib")); + fs.writeFileSync(path.join(tempdir, "main.w"), wingCode); + fs.writeFileSync(path.join(tempdir, "lib", "dummy.w"), ""); + fs.writeFileSync(path.join(tempdir, "lib", "wplatform.js"), platformCode); + + // WHEN + const output = await runWingCommand({ + cwd: tempdir, + wingFile: path.join(tempdir, "main.w"), + args, + expectFailure: true + }); + + // THEN + expect(output.stderr).toContain("Parameter validation errors:"); + expect(output.stderr).toContain("- must have required property 'foo'"); + }); + + test("in multiple imported directories", async () => { + // GIVEN + const wingCode = ` + bring cloud; + bring "./lib" as myLib; + bring "./lib2" as myLib2; + + let b = new cloud.Bucket(); + ` + const otherPlatformCode = ` + exports.Platform = class Platform { + target = "*"; + parameters = { + type: "object", + properties: { + bar: { + type: "string", + } + }, + required: ["bar"] + } + } + ` + const args = ["compile"]; + const tempdir = fs.mkdtempSync(path.join(tmpdir(), "platform-parameters")); + fs.mkdirSync(path.join(tempdir, "lib")); + fs.mkdirSync(path.join(tempdir, "lib2")); + fs.writeFileSync(path.join(tempdir, "main.w"), wingCode); + fs.writeFileSync(path.join(tempdir, "lib", "dummy.w"), ""); + fs.writeFileSync(path.join(tempdir, "lib", "wplatform.js"), platformCode); + fs.writeFileSync(path.join(tempdir, "lib2", "dummy.w"), ""); + fs.writeFileSync(path.join(tempdir, "lib2", "wplatform.js"), otherPlatformCode); + + + // WHEN + const output = await runWingCommand({ + cwd: tempdir, + wingFile: path.join(tempdir, "main.w"), + args, + expectFailure: true + }); + + // THEN + expect(output.stderr).toContain("Parameter validation errors:"); + expect(output.stderr).toContain("- must have required property 'foo'"); + expect(output.stderr).toContain("- must have required property 'bar'"); + }); + }) +})