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

fix: added missing push and reminders related types #942

Merged
merged 3 commits into from
Apr 5, 2022
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
5 changes: 5 additions & 0 deletions .github/workflows/type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ jobs:
- uses: ./.github/actions/setup-node
- name: Run API type definition tests
run: yarn test-types
env:
API_KEY: ${{ secrets.TS_TEST_API_KEY }}
API_SECRET: ${{ secrets.TS_TEST_API_SECRET }}
MULTITENANCY_API_KEY: ${{ secrets.TS_TEST_MULTITENANCY_API_KEY }}
MULTITENANCY_API_SECRET: ${{ secrets.TS_TEST_MULTITENANCY_API_SECRET }}
8 changes: 7 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ export type AppSettingsAPIResponse<StreamChatGenerics extends ExtendableGenerics
channel_configs: Record<
string,
{
reminders: boolean;
vishalnarkhede marked this conversation as resolved.
Show resolved Hide resolved
automod?: ChannelConfigAutomod;
automod_behavior?: ChannelConfigAutomodBehavior;
automod_thresholds?: ChannelConfigAutomodThresholds;
blocklist_behavior?: ChannelConfigAutomodBehavior;
commands?: CommandVariants<StreamChatGenerics>[];
connect_events?: boolean;
Expand All @@ -98,6 +100,7 @@ export type AppSettingsAPIResponse<StreamChatGenerics extends ExtendableGenerics
url_enrichment?: boolean;
}
>;
reminders_interval: number;
vishalnarkhede marked this conversation as resolved.
Show resolved Hide resolved
async_url_enrich_enabled?: boolean;
auto_translation_enabled?: boolean;
before_message_send_hook_url?: string;
Expand Down Expand Up @@ -1542,8 +1545,10 @@ export type ChannelConfigAutomodThresholds = null | {
};

export type ChannelConfigFields = {
reminders: boolean;
vishalnarkhede marked this conversation as resolved.
Show resolved Hide resolved
automod?: ChannelConfigAutomod;
automod_behavior?: ChannelConfigAutomodBehavior;
automod_thresholds?: ChannelConfigAutomodThresholds;
blocklist_behavior?: ChannelConfigAutomodBehavior;
connect_events?: boolean;
custom_events?: boolean;
Expand Down Expand Up @@ -1617,6 +1622,7 @@ export type CheckPushInput<StreamChatGenerics extends ExtendableGenerics = Defau
export type PushProvider = 'apn' | 'firebase' | 'huawei' | 'xiaomi';

export type PushProviderConfig = PushProviderCommon &
PushProviderID &
PushProviderAPN &
PushProviderFirebase &
PushProviderHuawei &
Expand Down Expand Up @@ -1956,7 +1962,7 @@ export type Policy = {
owner?: boolean;
priority?: number;
resources?: string[];
roles?: string[];
roles?: string[] | null;
Comment on lines -1959 to +1965
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't ? means it's nullable already?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

? means string[] | undefined which is a bit different from null. So the result type here is string[] undefined | null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but does it make sense here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah but does it make sense here?

That's a good question :) I don't think this should be necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not to me ... but backend sent null in one of our test case

Copy link
Contributor Author

@vishalnarkhede vishalnarkhede Apr 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove it if we can ensure its never null from backend response

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep null since this was sent from the backend

updated_at?: string;
};

Expand Down
12 changes: 7 additions & 5 deletions test/typescript/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const { StreamChat } = require('../../dist');
require('dotenv').config();
const apiKey = '892s22ypvt6m';
const apiSecret = '5cssrefv55rs3cnkk38kfjam2k7c2ykwn4h79dqh66ym89gm65cxy4h9jx4cypd6';

const multiTenancySecret = 'pf8krbh9z3vc8d35dn65tq4xsa4jqmcbdgp5spuej2fprm6rqc5mtxuxghgxw43u';
const multiTenancyKey = '2g3vcvcnmm5u';
require('dotenv').config({ path: `${process.cwd()}/test/typescript/.env` });

const apiKey = process.env.API_KEY;
const apiSecret = process.env.API_SECRET;

const multiTenancySecret = process.env.MULTITENANCY_API_SECRET;
const multiTenancyKey = process.env.MULTITENANCY_API_KEY;

module.exports = {
createMultiTenancyUsers: async function createMultiTenancyUsers(userIDs, teams = [], additionalInfo) {
Expand Down