Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Version should be strictly string #25

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/chat-core.chatconfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export interface ChatConfig
| [endpoints?](./chat-core.chatconfig.endpoints.md) | | [Endpoints](./chat-core.endpoints.md) | _(Optional)_ Overrides for the URLs which are used when making requests to the Chat API. |
| [env?](./chat-core.chatconfig.env.md) | | [EnumOrLiteral](./chat-core.enumorliteral.md)<!-- -->&lt;[Environment](./chat-core.environment.md)<!-- -->&gt; | _(Optional)_ Defines the environment of the API domains. |
| [region?](./chat-core.chatconfig.region.md) | | [EnumOrLiteral](./chat-core.enumorliteral.md)<!-- -->&lt;[Region](./chat-core.region.md)<!-- -->&gt; | _(Optional)_ The region to send the requests to. |
| [version?](./chat-core.chatconfig.version.md) | | "STAGING" \| "PRODUCTION" \| number | _(Optional)_ The version of the chat bot configuration. |
| [version?](./chat-core.chatconfig.version.md) | | string | _(Optional)_ The version of the chat bot configuration. |

6 changes: 3 additions & 3 deletions docs/chat-core.chatconfig.version.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ The version of the chat bot configuration.
**Signature:**

```typescript
version?: "STAGING" | "PRODUCTION" | number;
version?: string;
```

## Remarks

May be a configuration label (string) or a configuration version (number). Default to 'STAGING' in Chat API
Default to 'STAGING' in Chat API

## Example

Examples: 'STAGING', 42
Examples: 'STAGING', 'PRODUCTION', '42'

2 changes: 1 addition & 1 deletion etc/chat-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export interface ChatConfig {
endpoints?: Endpoints;
env?: EnumOrLiteral<Environment>;
region?: EnumOrLiteral<Region>;
version?: "STAGING" | "PRODUCTION" | number;
version?: string;
}

// @public
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/chat-core",
"version": "0.7.1",
"version": "0.7.2",
"description": "Typescript Networking Library for the Yext Chat API",
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.mjs",
Expand Down
5 changes: 2 additions & 3 deletions src/models/ChatConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ export interface ChatConfig {
* The version of the chat bot configuration.
*
* @remarks
* May be a configuration label (string) or a configuration version (number).
* Default to 'STAGING' in Chat API
*
* @example
* Examples: 'STAGING', 42
* Examples: 'STAGING', 'PRODUCTION', '42'
*/
version?: "STAGING" | "PRODUCTION" | number;
version?: string;
/**
* Defines the environment of the API domains.
*
Expand Down
2 changes: 1 addition & 1 deletion src/models/endpoints/MessageRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export interface ApiMessageRequest {
/** {@inheritdoc MessageRequest.conversationId} */
conversationId?: string;
/** {@inheritDoc ChatConfig.version} */
version?: "STAGING" | "PRODUCTION" | number;
version?: string;
/** {@inheritDoc MessageRequest.messages} */
messages: Message[];
/** {@inheritDoc MessageNotes} */
Expand Down
2 changes: 1 addition & 1 deletion test-browser-esm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test-node-cjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/ChatCore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ describe("URL and http request construction", () => {

const configWithVersion: ChatConfig = {
...defaultConfig,
version: 42,
version: '42',
};

it("sets custom version when specified for Chat API", async () => {
Expand All @@ -167,7 +167,7 @@ describe("URL and http request construction", () => {
"https://liveapi.yext.com/v2/accounts/me/chat/my-bot/message",
{ v: defaultApiVersion },
{
version: 42,
version: '42',
conversationId: "my-id",
context: {
foo: "bar",
Expand All @@ -186,7 +186,7 @@ describe("URL and http request construction", () => {
"https://liveapi.yext.com/v2/accounts/me/chat/my-bot/message/streaming",
{ v: defaultApiVersion },
{
version: 42,
version: '42',
conversationId: "my-id",
context: {
foo: "bar",
Expand Down