Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #184 from Stedi-Demos/rob/update-partners-sdk
Browse files Browse the repository at this point in the history
chore: update partners sdk
  • Loading branch information
rsioss committed Jan 9, 2024
2 parents 506415d + 664bbfc commit e3eaa87
Show file tree
Hide file tree
Showing 11 changed files with 765 additions and 55 deletions.
791 changes: 742 additions & 49 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
"@ava/typescript": "^4.0.0",
"@aws-sdk/middleware-retry": "3.329.0",
"@aws-sdk/types": "3.272.0",
"@smithy/types": "1.2.0",
"@smithy/util-stream-node": "2.0.19",
"@stedi/sdk-client-as2": "^0.1.51",
"@stedi/sdk-client-buckets": "^0.1.51",
"@stedi/sdk-client-cores": "^0.1.51",
Expand All @@ -36,7 +38,7 @@
"@stedi/sdk-client-functions": "^0.1.51",
"@stedi/sdk-client-guides": "^0.1.51",
"@stedi/sdk-client-mappings": "^0.1.51",
"@stedi/sdk-client-partners": "^0.2.19",
"@stedi/sdk-client-partners": "^0.4.60",
"@stedi/sdk-client-queues": "^0.1.51",
"@stedi/sdk-client-sftp": "^0.1.51",
"@stedi/sdk-client-stash": "^0.1.51",
Expand Down Expand Up @@ -76,7 +78,7 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.3",
"umzug": "^3.2.1",
"zod": "^3.21.4"
"zod": "^3.22.4"
},
"prettier": {
"useTabs": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ test.serial(
updatedAt: new Date(),
timezone: Timezone.AMERICA_NEW_YORK,
interchangeUsageIndicator: "T",
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
2 changes: 2 additions & 0 deletions src/functions/edi/outbound/__tests__/handler.direction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ test.serial("skips delivery when direction is inbound", async (t) => {
updatedAt: new Date(),
interchangeUsageIndicator: "T",
timezone: Timezone.AMERICA_NEW_YORK,
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down Expand Up @@ -224,6 +225,7 @@ test.serial("runs delivery when direction is outbound", async (t) => {
updatedAt: new Date(),
interchangeUsageIndicator: "T",
timezone: Timezone.AMERICA_NEW_YORK,
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ test("translate 997 guide json without a guide and delivers to destination", asy
updatedAt: new Date(),
timezone: Timezone.AMERICA_NEW_YORK,
interchangeUsageIndicator: "T",
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
1 change: 1 addition & 0 deletions src/functions/edi/outbound/__tests__/handler.legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ test("using legacy function input, it translates guide json to X12 and delivers
updatedAt: new Date(),
timezone: Timezone.AMERICA_NEW_YORK,
interchangeUsageIndicator: "T",
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ test("translate guide json to X12 and delivers to destination", async (t) => {
updatedAt: new Date(),
timezone: Timezone.AMERICA_NEW_YORK,
interchangeUsageIndicator: "T",
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ test.serial(
updatedAt: new Date(),
interchangeUsageIndicator: "T",
timezone: Timezone.AMERICA_NEW_YORK,
timeFormat: undefined,
} satisfies GetX12PartnershipOutput as any)
// increment interchange control number
.on(IncrementX12ControlNumberCommand as any, {
Expand Down
14 changes: 10 additions & 4 deletions src/lib/clients/partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ import {
PartnersClient,
PartnersClientConfig,
} from "@stedi/sdk-client-partners";
import { DEFAULT_SDK_CLIENT_PROPS } from "../constants.js";
import { requiredEnvVar } from "../environment.js";
import { NodeHttpHandler } from "@smithy/node-http-handler";

let _partnersClient: PartnersClient | undefined;

export const partnersClient = () => {
if (_partnersClient === undefined) {
const config: PartnersClientConfig = {
...DEFAULT_SDK_CLIENT_PROPS,
apiKey: requiredEnvVar("STEDI_API_KEY"),
region: "us",
maxAttempts: 5,
requestHandler: new NodeHttpHandler({
connectionTimeout: 5_000,
}),
endpoint: "https://core.us.stedi.com/2023-08-01",
};

if (process.env.USE_PREVIEW !== undefined)
config.endpoint =
"https://partners.us.preproduction.stedi.com/2022-01-01";
config.endpoint = "https://core.us.preproduction.stedi.com/2023-08-01";

_partnersClient = new PartnersClient(config);
}
Expand Down
1 change: 1 addition & 0 deletions src/migrations/002-engine-preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const up = async () => {
partnerProfileId: partnerProfile.profileId,
timezone: Timezone.AMERICA_NEW_YORK,
interchangeUsageIndicator: "T",
timeFormat: undefined,
})
);

Expand Down
1 change: 1 addition & 0 deletions src/setup/bootstrap/createProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export const createProfiles = async ({
partnerProfileId: remoteProfile.profileId,
interchangeUsageIndicator: "T",
timezone: Timezone.AMERICA_NEW_YORK,
timeFormat: undefined,
})
);
} catch (error) {
Expand Down

0 comments on commit e3eaa87

Please sign in to comment.