Skip to content

Commit 141f6d3

Browse files
committed
refactor(schemas): migrate to aws-sdk v3
1 parent d8bc4a3 commit 141f6d3

File tree

7 files changed

+259
-79
lines changed

7 files changed

+259
-79
lines changed

package-lock.json

Lines changed: 145 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/core/package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -533,11 +533,11 @@
533533
"@types/sinon": "^10.0.5",
534534
"@types/sinonjs__fake-timers": "^8.1.2",
535535
"@types/stream-buffers": "^3.0.7",
536+
"@types/svgdom": "^0.1.2",
536537
"@types/tcp-port-used": "^1.0.1",
537538
"@types/uuid": "^9.0.1",
538539
"@types/whatwg-url": "^11.0.4",
539540
"@types/xml2js": "^0.4.11",
540-
"@types/svgdom": "^0.1.2",
541541
"@vue/compiler-sfc": "^3.3.2",
542542
"c8": "^9.0.0",
543543
"circular-dependency-plugin": "^5.2.2",
@@ -566,7 +566,6 @@
566566
"@amzn/amazon-q-developer-streaming-client": "file:../../src.gen/@amzn/amazon-q-developer-streaming-client",
567567
"@amzn/codewhisperer-streaming": "file:../../src.gen/@amzn/codewhisperer-streaming",
568568
"@amzn/sagemaker-client": "file:../../src.gen/@amzn/sagemaker-client/1.0.0.tgz",
569-
"@aws-sdk/credential-providers": "<3.731.0",
570569
"@aws-sdk/client-api-gateway": "<3.731.0",
571570
"@aws-sdk/client-apprunner": "<3.731.0",
572571
"@aws-sdk/client-cloudcontrol": "<3.731.0",
@@ -584,13 +583,15 @@
584583
"@aws-sdk/client-s3": "<3.731.0",
585584
"@aws-sdk/client-s3-control": "^3.830.0",
586585
"@aws-sdk/client-sagemaker": "<3.696.0",
586+
"@aws-sdk/client-schemas": "~3.693.0",
587+
"@aws-sdk/client-sfn": "<3.731.0",
587588
"@aws-sdk/client-ssm": "<3.731.0",
588589
"@aws-sdk/client-sso": "<3.731.0",
589590
"@aws-sdk/client-sso-oidc": "<3.731.0",
590-
"@aws-sdk/client-sfn": "<3.731.0",
591591
"@aws-sdk/credential-provider-env": "<3.731.0",
592592
"@aws-sdk/credential-provider-process": "<3.731.0",
593593
"@aws-sdk/credential-provider-sso": "<3.731.0",
594+
"@aws-sdk/credential-providers": "<3.731.0",
594595
"@aws-sdk/lib-storage": "<3.731.0",
595596
"@aws-sdk/property-provider": "<3.731.0",
596597
"@aws-sdk/protocol-http": "<3.731.0",
@@ -607,6 +608,7 @@
607608
"@smithy/service-error-classification": "^4.0.1",
608609
"@smithy/shared-ini-file-loader": "^4.0.0",
609610
"@smithy/util-retry": "^4.0.1",
611+
"@svgdotjs/svg.js": "^3.0.16",
610612
"@vscode/debugprotocol": "^1.57.0",
611613
"@zip.js/zip.js": "^2.7.41",
612614
"adm-zip": "^0.5.10",
@@ -625,6 +627,7 @@
625627
"http2": "^3.3.6",
626628
"i18n-ts": "^1.0.5",
627629
"immutable": "^4.3.0",
630+
"jaro-winkler": "^0.2.8",
628631
"jose": "5.4.1",
629632
"js-yaml": "^4.1.0",
630633
"jsonc-parser": "^3.2.0",
@@ -634,9 +637,11 @@
634637
"mime-types": "^2.1.32",
635638
"node-fetch": "^2.7.0",
636639
"portfinder": "^1.0.32",
640+
"protobufjs": "^7.2.6",
637641
"semver": "^7.5.4",
638642
"stream-buffers": "^3.0.2",
639643
"strip-ansi": "^5.2.0",
644+
"svgdom": "^0.1.0",
640645
"tcp-port-used": "^1.0.1",
641646
"vscode-languageclient": "^6.1.4",
642647
"vscode-languageserver": "^6.1.1",
@@ -649,11 +654,7 @@
649654
"winston-transport": "^4.6.0",
650655
"ws": "^8.16.0",
651656
"xml2js": "^0.6.1",
652-
"yaml-cfn": "^0.3.2",
653-
"protobufjs": "^7.2.6",
654-
"@svgdotjs/svg.js": "^3.0.16",
655-
"svgdom": "^0.1.0",
656-
"jaro-winkler": "^0.2.8"
657+
"yaml-cfn": "^0.3.2"
657658
},
658659
"overrides": {
659660
"webfont": {

packages/core/src/eventSchemas/commands/downloadSchemaItemCode.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
8-
import { Schemas } from 'aws-sdk'
8+
import { PutCodeBindingResponse } from '@aws-sdk/client-schemas'
99
import fs = require('fs')
1010
import path = require('path')
1111
import * as vscode from 'vscode'
@@ -180,10 +180,8 @@ export class SchemaCodeDownloader {
180180
export class CodeGenerator {
181181
public constructor(public client: SchemaClient) {}
182182

183-
public async generate(
184-
codeDownloadRequest: SchemaCodeDownloadRequestDetails
185-
): Promise<Schemas.PutCodeBindingResponse> {
186-
let response: Schemas.PutCodeBindingResponse
183+
public async generate(codeDownloadRequest: SchemaCodeDownloadRequestDetails): Promise<PutCodeBindingResponse> {
184+
let response: PutCodeBindingResponse
187185
try {
188186
response = await this.client.putCodeBinding(
189187
codeDownloadRequest.language,
@@ -268,12 +266,18 @@ export class CodeDownloader {
268266
codeDownloadRequest.schemaName,
269267
codeDownloadRequest.schemaVersion
270268
)
269+
// eslint-disable-next-line aws-toolkits/no-console-log
270+
console.log({ response })
271271

272272
if (Buffer.isBuffer(response.Body)) {
273273
const zipContents = response.Body!.buffer
274+
// eslint-disable-next-line aws-toolkits/no-console-log
275+
console.log({ zipContents })
274276

275277
return zipContents
276278
} else {
279+
// eslint-disable-next-line aws-toolkits/no-console-log
280+
console.log('throw new TypeError')
277281
throw new TypeError('Response body should be Buffer type')
278282
}
279283
}

packages/core/src/eventSchemas/utils.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
import * as nls from 'vscode-nls'
77
const localize = nls.loadMessageBundle()
88

9-
import { Schemas } from 'aws-sdk'
9+
import { RegistrySummary, SchemaSummary, SearchSchemaSummary } from '@aws-sdk/client-schemas'
1010
import * as vscode from 'vscode'
1111
import { SchemaClient } from '../shared/clients/schemaClient'
1212

13-
export async function* listRegistryItems(client: SchemaClient): AsyncIterableIterator<Schemas.RegistrySummary> {
13+
export async function* listRegistryItems(client: SchemaClient): AsyncIterableIterator<RegistrySummary> {
1414
const status = vscode.window.setStatusBarMessage(
1515
localize('AWS.message.statusBar.loading.registries', 'Loading Registry Items...')
1616
)
@@ -25,7 +25,7 @@ export async function* listRegistryItems(client: SchemaClient): AsyncIterableIte
2525
export async function* listSchemaItems(
2626
client: SchemaClient,
2727
registryName: string
28-
): AsyncIterableIterator<Schemas.SchemaSummary> {
28+
): AsyncIterableIterator<SchemaSummary> {
2929
const status = vscode.window.setStatusBarMessage(
3030
localize('AWS.message.statusBar.loading.schemaItems', 'Loading Schema Items...')
3131
)
@@ -41,7 +41,7 @@ export async function* searchSchemas(
4141
client: SchemaClient,
4242
keyword: string,
4343
registryName: string
44-
): AsyncIterableIterator<Schemas.SearchSchemaSummary> {
44+
): AsyncIterableIterator<SearchSchemaSummary> {
4545
const status = vscode.window.setStatusBarMessage(
4646
localize('AWS.message.statusBar.searching.schemas', 'Searching Schemas...')
4747
)

0 commit comments

Comments
 (0)