From bb81ff0d2bf069e69588e3e8d7d0ef4fee0a00a6 Mon Sep 17 00:00:00 2001 From: Smita Nachan Date: Sat, 27 Jul 2024 10:02:31 +0000 Subject: [PATCH] Removed yammer command aliases. Closes #5764 --- docs/docs/cmd/cli/cli-consent.mdx | 2 +- docs/docs/v9-upgrade-guidance.mdx | 34 +++++++++++++++++++ docs/docusaurus.config.ts | 3 -- src/m365/cli/commands/cli-consent.spec.ts | 5 --- src/m365/cli/commands/cli-consent.ts | 10 ++---- .../commands/engage/engage-group-list.spec.ts | 18 ---------- .../viva/commands/engage/engage-group-list.ts | 7 ---- .../engage/engage-group-user-add.spec.ts | 18 ---------- .../commands/engage/engage-group-user-add.ts | 7 ---- .../engage/engage-group-user-remove.spec.ts | 18 ---------- .../engage/engage-group-user-remove.ts | 7 ---- .../engage/engage-message-add.spec.ts | 18 ---------- .../commands/engage/engage-message-add.ts | 7 ---- .../engage/engage-message-get.spec.ts | 18 ---------- .../commands/engage/engage-message-get.ts | 7 ---- .../engage/engage-message-like-set.spec.ts | 18 ---------- .../engage/engage-message-like-set.ts | 7 ---- .../engage/engage-message-list.spec.ts | 18 ---------- .../commands/engage/engage-message-list.ts | 7 ---- .../engage/engage-message-remove.spec.ts | 18 ---------- .../commands/engage/engage-message-remove.ts | 7 ---- .../engage/engage-network-list.spec.ts | 18 ---------- .../commands/engage/engage-network-list.ts | 7 ---- .../engage-report-activitycounts.spec.ts | 19 ----------- .../engage/engage-report-activitycounts.ts | 14 +------- .../engage-report-activityusercounts.spec.ts | 19 ----------- .../engage-report-activityusercounts.ts | 14 +------- .../engage-report-activityuserdetail.spec.ts | 19 ----------- .../engage-report-activityuserdetail.ts | 14 +------- ...-deviceusagedistributionusercounts.spec.ts | 19 ----------- ...eport-deviceusagedistributionusercounts.ts | 14 +------- ...ngage-report-deviceusageusercounts.spec.ts | 19 ----------- .../engage-report-deviceusageusercounts.ts | 14 +------- ...ngage-report-deviceusageuserdetail.spec.ts | 19 ----------- .../engage-report-deviceusageuserdetail.ts | 14 +------- ...engage-report-groupsactivitycounts.spec.ts | 19 ----------- .../engage-report-groupsactivitycounts.ts | 14 +------- ...engage-report-groupsactivitydetail.spec.ts | 19 ----------- .../engage-report-groupsactivitydetail.ts | 14 +------- ...e-report-groupsactivitygroupcounts.spec.ts | 21 +----------- ...engage-report-groupsactivitygroupcounts.ts | 14 +------- .../commands/engage/engage-search.spec.ts | 18 ---------- .../viva/commands/engage/engage-search.ts | 7 ---- .../commands/engage/engage-user-get.spec.ts | 18 ---------- .../viva/commands/engage/engage-user-get.ts | 7 ---- .../commands/engage/engage-user-list.spec.ts | 18 ---------- .../viva/commands/engage/engage-user-list.ts | 9 +---- .../viva/commands/engage/yammerCommands.ts | 25 -------------- 48 files changed, 49 insertions(+), 631 deletions(-) delete mode 100644 src/m365/viva/commands/engage/yammerCommands.ts diff --git a/docs/docs/cmd/cli/cli-consent.mdx b/docs/docs/cmd/cli/cli-consent.mdx index 398ba642ab4..09bc9d98394 100644 --- a/docs/docs/cmd/cli/cli-consent.mdx +++ b/docs/docs/cmd/cli/cli-consent.mdx @@ -16,7 +16,7 @@ m365 cli consent [options] ```md definition-list `-s, --service ` -: Service for which to consent permissions. Allowed values: `VivaEngage`, (deprecated)`yammer`. +: Service for which to consent permissions. Allowed values: `VivaEngage`. ``` diff --git a/docs/docs/v9-upgrade-guidance.mdx b/docs/docs/v9-upgrade-guidance.mdx index 2b5ec9a8e93..2dba88b1bcd 100644 --- a/docs/docs/v9-upgrade-guidance.mdx +++ b/docs/docs/v9-upgrade-guidance.mdx @@ -174,3 +174,37 @@ Overwriting the SPFx package should be the default behavior of the continuous de #### What action do I need to take? Please update your scripts not to use the `overwrite` option. + +## Yammer (Viva Engage) + +### Removal of deprecated Yammer aliases + +We have removed all deprecated `Yammer` command aliases. These aliases were introduced in the previous version to prevent the introduction of breaking changes. Since Yammer has been renamed to Viva Engage a while ago, the following aliases were removed: + +Alias | Command +--|-- +`yammer search` | [viva engage search](./cmd/viva/engage/engage-search.mdx) +`yammer group list` | [viva engage group list](./cmd/viva/engage/engage-group-list.mdx) +`yammer group user add` | [viva engage user add](./cmd/viva/engage/engage-group-user-add.mdx) +`yammer group user remove` | [viva engage user remove](./cmd/viva/engage/engage-group-user-remove.mdx) +`yammer message add` | [viva engage message add](./cmd/viva/engage/engage-message-add.mdx) +`yammer message get` | [viva engage message get](./cmd/viva/engage/engage-message-get.mdx) +`yammer message list` | [viva engage message list](./cmd/viva/engage/engage-message-list.mdx) +`yammer message remove` | [viva engage message remove](./cmd/viva/engage/engage-message-remove.mdx) +`yammer message like set` | [viva engage message like set](./cmd/viva/engage/engage-message-like-set.mdx) +`yammer network list` | [viva engage network list](./cmd/viva/engage/engage-network-list.mdx) +`yammer report activitycounts` | [viva engage report activitycounts](./cmd/viva/engage/engage-report-activitycounts.mdx) +`yammer report activityusercounts` | [viva engage report activityusercounts](./cmd/viva/engage/engage-report-activityusercounts.mdx) +`yammer report activityuserdetail` | [viva engage report activityuserdetail](./cmd/viva/engage/engage-report-activityuserdetail.mdx) +`yammer report deviceusagedistributionusercounts` | [viva engage report deviceusagedistributionusercounts](./cmd/viva/engage/engage-report-deviceusagedistributionusercounts.mdx) +`yammer report deviceusageusercounts` | [viva engage report deviceusageusercounts](./cmd/viva/engage/engage-report-deviceusageusercounts.mdx) +`yammer report deviceusageuserdetail` | [viva engage report deviceusageuserdetail](./cmd/viva/engage/engage-report-deviceusageuserdetail.mdx) +`yammer report groupsactivitycounts` | [viva engage report groupsactivitycounts](./cmd/viva/engage/engage-report-groupsactivitycounts.mdx) +`yammer report groupsactivitydetail` | [viva engage report groupsactivitydetail](./cmd/viva/engage/engage-report-groupsactivitydetail.mdx) +`yammer report groupsactivitygroupcounts` | [viva engage report groupsactivitygroupcounts](./cmd/viva/engage/engage-report-groupsactivitygroupcounts.mdx) +`yammer user get` | [viva engage user get](./cmd/viva/engage/engage-user-get.mdx) +`yammer user list` | [viva engage user list](./cmd/viva/engage/engage-user-list.mdx) + +#### What action do I need to take? + +Replace any of the aliases mentioned above with the corresponding command name. The functionality of the command hasn't changed. diff --git a/docs/docusaurus.config.ts b/docs/docusaurus.config.ts index ef1c39e6c2e..27e2b9e0dea 100644 --- a/docs/docusaurus.config.ts +++ b/docs/docusaurus.config.ts @@ -52,9 +52,6 @@ const config: Config = { if (routePath.includes('/entra')) { return [routePath.replace('/entra', '/aad')]; } - if (routePath.includes('/viva/engage')) { - return [routePath.replace('/viva/engage', '/yammer')]; - } return []; } diff --git a/src/m365/cli/commands/cli-consent.spec.ts b/src/m365/cli/commands/cli-consent.spec.ts index edbf11b5271..92bfac8546e 100644 --- a/src/m365/cli/commands/cli-consent.spec.ts +++ b/src/m365/cli/commands/cli-consent.spec.ts @@ -65,11 +65,6 @@ describe(commands.CONSENT, () => { assert(loggerLogSpy.calledWith(`To consent permissions for executing VivaEngage commands, navigate in your web browser to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&response_type=code&scope=https%3A%2F%2Fapi.yammer.com%2Fuser_impersonation`)); }); - it('shows consent URL for yammer permissions for the default multi-tenant app', async () => { - await command.action(logger, { options: { service: 'yammer' } }); - assert(loggerLogSpy.calledWith(`To consent permissions for executing yammer commands, navigate in your web browser to https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=31359c7f-bd7e-475c-86db-fdb8c937548e&response_type=code&scope=https%3A%2F%2Fapi.yammer.com%2Fuser_impersonation`)); - }); - it('shows consent URL for VivaEngage permissions for a custom single-tenant app', async () => { config.tenant = 'fb5cb38f-ecdb-4c6a-a93b-b8cfd56b4a89'; config.cliEntraAppId = '2587b55d-a41e-436d-bb1d-6223eb185dd4'; diff --git a/src/m365/cli/commands/cli-consent.ts b/src/m365/cli/commands/cli-consent.ts index b97f4d954e1..d9f87f6498d 100644 --- a/src/m365/cli/commands/cli-consent.ts +++ b/src/m365/cli/commands/cli-consent.ts @@ -49,7 +49,7 @@ class CliConsentCommand extends AnonymousCommand { #initValidators(): void { this.validators.push( async (args: CommandArgs) => { - if (args.options.service !== 'VivaEngage' && args.options.service !== 'yammer') { + if (args.options.service !== 'VivaEngage') { return `${args.options.service} is not a valid value for the service option. Allowed values: VivaEngage`; } @@ -60,12 +60,8 @@ class CliConsentCommand extends AnonymousCommand { public async commandAction(logger: Logger, args: CommandArgs): Promise { let scope = ''; - switch (args.options.service) { - case 'yammer': - await this.warn(logger, 'The yammer service is deprecated. Please use the VivaEngage service instead.'); - case 'VivaEngage': - scope = 'https://api.yammer.com/user_impersonation'; - break; + if (args.options.service === 'VivaEngage') { + scope = 'https://api.yammer.com/user_impersonation'; } await logger.log(`To consent permissions for executing ${args.options.service} commands, navigate in your web browser to https://login.microsoftonline.com/${config.tenant}/oauth2/v2.0/authorize?client_id=${config.cliEntraAppId}&response_type=code&scope=${encodeURIComponent(scope)}`); diff --git a/src/m365/viva/commands/engage/engage-group-list.spec.ts b/src/m365/viva/commands/engage/engage-group-list.spec.ts index b8fb7e1d155..34082a151f0 100644 --- a/src/m365/viva/commands/engage/engage-group-list.spec.ts +++ b/src/m365/viva/commands/engage/engage-group-list.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-group-list.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_GROUP_LIST, () => { @@ -235,23 +234,6 @@ describe(commands.ENGAGE_GROUP_LIST, () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'name', 'email', 'privacy', 'external', 'moderated']); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.GROUP_LIST]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_LIST); - sinon.stub(request, 'get').resolves([]); - - await command.action(logger, { options: {} }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_LIST}' is deprecated. Please use '${commands.ENGAGE_GROUP_LIST}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'get').rejects( { diff --git a/src/m365/viva/commands/engage/engage-group-list.ts b/src/m365/viva/commands/engage/engage-group-list.ts index 450cb657c02..72f5263942d 100644 --- a/src/m365/viva/commands/engage/engage-group-list.ts +++ b/src/m365/viva/commands/engage/engage-group-list.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -25,10 +24,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand { return 'Returns the list of groups in a Viva Engage network or the groups for a specific user'; } - public alias(): string[] | undefined { - return [yammerCommands.GROUP_LIST]; - } - constructor() { super(); this.items = []; @@ -114,8 +109,6 @@ class VivaEngageGroupListCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - this.items = []; // this will reset the items array in interactive mode try { diff --git a/src/m365/viva/commands/engage/engage-group-user-add.spec.ts b/src/m365/viva/commands/engage/engage-group-user-add.spec.ts index dd45fbd0b19..d6a5741c426 100644 --- a/src/m365/viva/commands/engage/engage-group-user-add.spec.ts +++ b/src/m365/viva/commands/engage/engage-group-user-add.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-group-user-add.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_GROUP_USER_ADD, () => { @@ -65,23 +64,6 @@ describe(commands.ENGAGE_GROUP_USER_ADD, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.GROUP_USER_ADD]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_USER_ADD); - sinon.stub(request, 'post').resolves(); - - await command.action(logger, { options: { groupId: 1231231, id: 989998789 } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_USER_ADD}' is deprecated. Please use '${commands.ENGAGE_GROUP_USER_ADD}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'post').callsFake(async () => { throw { diff --git a/src/m365/viva/commands/engage/engage-group-user-add.ts b/src/m365/viva/commands/engage/engage-group-user-add.ts index 223eeb160b8..5f9cab6b40c 100644 --- a/src/m365/viva/commands/engage/engage-group-user-add.ts +++ b/src/m365/viva/commands/engage/engage-group-user-add.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -24,10 +23,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand { return 'Adds a user to a Viva Engage Group'; } - public alias(): string[] | undefined { - return [yammerCommands.GROUP_USER_ADD]; - } - constructor() { super(); @@ -76,8 +71,6 @@ class VivaEngageGroupUserAddCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - const requestOptions: any = { url: `${this.resource}/v1/group_memberships.json`, headers: { diff --git a/src/m365/viva/commands/engage/engage-group-user-remove.spec.ts b/src/m365/viva/commands/engage/engage-group-user-remove.spec.ts index 84b076b2c68..43302d3630f 100644 --- a/src/m365/viva/commands/engage/engage-group-user-remove.spec.ts +++ b/src/m365/viva/commands/engage/engage-group-user-remove.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-group-user-remove.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_GROUP_USER_REMOVE, () => { @@ -67,23 +66,6 @@ describe(commands.ENGAGE_GROUP_USER_REMOVE, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.GROUP_USER_REMOVE]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.GROUP_USER_REMOVE); - sinon.stub(request, 'delete').resolves(); - - await command.action(logger, { options: { groupId: 1231231, id: 989998789, force: true } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.GROUP_USER_REMOVE}' is deprecated. Please use '${commands.ENGAGE_GROUP_USER_REMOVE}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'delete').callsFake(async () => { throw { diff --git a/src/m365/viva/commands/engage/engage-group-user-remove.ts b/src/m365/viva/commands/engage/engage-group-user-remove.ts index f2fc0501bd7..84ec7cbb259 100644 --- a/src/m365/viva/commands/engage/engage-group-user-remove.ts +++ b/src/m365/viva/commands/engage/engage-group-user-remove.ts @@ -4,7 +4,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from "../../../base/VivaEngageCommand.js"; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -25,10 +24,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand { return 'Removes a user from a Viva Engage group'; } - public alias(): string[] | undefined { - return [yammerCommands.GROUP_USER_REMOVE]; - } - constructor() { super(); @@ -77,8 +72,6 @@ class VivaEngageGroupUserRemoveCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - if (args.options.force) { await this.executeRemoveAction(args.options); } diff --git a/src/m365/viva/commands/engage/engage-message-add.spec.ts b/src/m365/viva/commands/engage/engage-message-add.spec.ts index 1a3b0f051a1..3b8967a3dab 100644 --- a/src/m365/viva/commands/engage/engage-message-add.spec.ts +++ b/src/m365/viva/commands/engage/engage-message-add.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-message-add.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_MESSAGE_ADD, () => { @@ -67,23 +66,6 @@ describe(commands.ENGAGE_MESSAGE_ADD, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_ADD]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_ADD); - sinon.stub(request, 'post').resolves(firstMessage); - - await command.action(logger, { options: { body: 'send a letter to me', groupId: 13114941440 } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_ADD}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_ADD}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('defines correct properties for the default output', () => { assert.deepStrictEqual(command.defaultProperties(), ['id']); }); diff --git a/src/m365/viva/commands/engage/engage-message-add.ts b/src/m365/viva/commands/engage/engage-message-add.ts index 09349f07bd0..2727810e73e 100644 --- a/src/m365/viva/commands/engage/engage-message-add.ts +++ b/src/m365/viva/commands/engage/engage-message-add.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -26,10 +25,6 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand { return 'Posts a Viva Engage network message on behalf of the current user'; } - public alias(): string[] | undefined { - return [yammerCommands.MESSAGE_ADD]; - } - public defaultProperties(): string[] | undefined { return ['id']; } @@ -100,8 +95,6 @@ class VivaEngageMessageAddCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - const requestOptions: any = { url: `${this.resource}/v1/messages.json`, headers: { diff --git a/src/m365/viva/commands/engage/engage-message-get.spec.ts b/src/m365/viva/commands/engage/engage-message-get.spec.ts index 50ce9b16026..25c0b8988ed 100644 --- a/src/m365/viva/commands/engage/engage-message-get.spec.ts +++ b/src/m365/viva/commands/engage/engage-message-get.spec.ts @@ -13,7 +13,6 @@ import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-message-get.js'; import { settingsNames } from '../../../../settingsNames.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_MESSAGE_GET, () => { @@ -71,23 +70,6 @@ describe(commands.ENGAGE_MESSAGE_GET, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_GET]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_GET); - sinon.stub(request, 'get').resolves(firstMessage); - - await command.action(logger, { options: { id: 10123190123123 } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_GET}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_GET}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('defines correct properties for the default output', () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'sender_id', 'replied_to_id', 'thread_id', 'group_id', 'created_at', 'direct_message', 'system_message', 'privacy', 'message_type', 'content_excerpt']); }); diff --git a/src/m365/viva/commands/engage/engage-message-get.ts b/src/m365/viva/commands/engage/engage-message-get.ts index afca6aa5fb0..89706c26a78 100644 --- a/src/m365/viva/commands/engage/engage-message-get.ts +++ b/src/m365/viva/commands/engage/engage-message-get.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -22,10 +21,6 @@ class VivaEngageMessageGetCommand extends VivaEngageCommand { return 'Returns a Viva Engage message'; } - public alias(): string[] | undefined { - return [yammerCommands.MESSAGE_GET]; - } - public defaultProperties(): string[] | undefined { return ['id', 'sender_id', 'replied_to_id', 'thread_id', 'group_id', 'created_at', 'direct_message', 'system_message', 'privacy', 'message_type', 'content_excerpt']; } @@ -58,8 +53,6 @@ class VivaEngageMessageGetCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - const requestOptions: any = { url: `${this.resource}/v1/messages/${args.options.id}.json`, headers: { diff --git a/src/m365/viva/commands/engage/engage-message-like-set.spec.ts b/src/m365/viva/commands/engage/engage-message-like-set.spec.ts index d85422c7fbb..9846ca35558 100644 --- a/src/m365/viva/commands/engage/engage-message-like-set.spec.ts +++ b/src/m365/viva/commands/engage/engage-message-like-set.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-message-like-set.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_MESSAGE_LIKE_SET, () => { @@ -75,23 +74,6 @@ describe(commands.ENGAGE_MESSAGE_LIKE_SET, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_LIKE_SET]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_LIKE_SET); - sinon.stub(request, 'post').resolves(); - - await command.action(logger, { options: { id: 10123190123123 } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_LIKE_SET}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_LIKE_SET}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'post').rejects({ "error": { diff --git a/src/m365/viva/commands/engage/engage-message-like-set.ts b/src/m365/viva/commands/engage/engage-message-like-set.ts index 04253a6ee12..8c1becffc0a 100644 --- a/src/m365/viva/commands/engage/engage-message-like-set.ts +++ b/src/m365/viva/commands/engage/engage-message-like-set.ts @@ -4,7 +4,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -25,10 +24,6 @@ class VivaEngageMessageLikeSetCommand extends VivaEngageCommand { return 'Likes or unlikes a Viva Engage message'; } - public alias(): string[] | undefined { - return [yammerCommands.MESSAGE_LIKE_SET]; - } - constructor() { super(); @@ -79,8 +74,6 @@ class VivaEngageMessageLikeSetCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - if (args.options.enable === false) { if (args.options.force) { await this.executeLikeAction(args.options); diff --git a/src/m365/viva/commands/engage/engage-message-list.spec.ts b/src/m365/viva/commands/engage/engage-message-list.spec.ts index 97548874fb0..502e1336004 100644 --- a/src/m365/viva/commands/engage/engage-message-list.spec.ts +++ b/src/m365/viva/commands/engage/engage-message-list.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-message-list.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_MESSAGE_LIST, () => { @@ -91,23 +90,6 @@ describe(commands.ENGAGE_MESSAGE_LIST, () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'replied_to_id', 'thread_id', 'group_id', 'shortBody']); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_LIST]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_LIST); - sinon.stub(request, 'get').resolves(secondMessageBatch); - - await command.action(logger, { options: { feedType: 'Top' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_LIST}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_LIST}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'get').rejects({ "error": { diff --git a/src/m365/viva/commands/engage/engage-message-list.ts b/src/m365/viva/commands/engage/engage-message-list.ts index a332aa263a9..11fe24e2785 100644 --- a/src/m365/viva/commands/engage/engage-message-list.ts +++ b/src/m365/viva/commands/engage/engage-message-list.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -30,10 +29,6 @@ class VivaEngageMessageListCommand extends VivaEngageCommand { return 'Returns all accessible messages from the user\'s Viva Engage network'; } - public alias(): string[] | undefined { - return [yammerCommands.MESSAGE_LIST]; - } - public defaultProperties(): string[] | undefined { return ['id', 'replied_to_id', 'thread_id', 'group_id', 'shortBody']; } @@ -197,8 +192,6 @@ class VivaEngageMessageListCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - this.items = []; // this will reset the items array in interactive mode try { diff --git a/src/m365/viva/commands/engage/engage-message-remove.spec.ts b/src/m365/viva/commands/engage/engage-message-remove.spec.ts index f66169905d3..62eac6665b9 100644 --- a/src/m365/viva/commands/engage/engage-message-remove.spec.ts +++ b/src/m365/viva/commands/engage/engage-message-remove.spec.ts @@ -13,7 +13,6 @@ import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-message-remove.js'; import { settingsNames } from '../../../../settingsNames.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_MESSAGE_REMOVE, () => { @@ -68,23 +67,6 @@ describe(commands.ENGAGE_MESSAGE_REMOVE, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.MESSAGE_REMOVE]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.MESSAGE_REMOVE); - sinon.stub(request, 'delete').resolves(); - - await command.action(logger, { options: { id: 10123190123123, force: true } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.MESSAGE_REMOVE}' is deprecated. Please use '${commands.ENGAGE_MESSAGE_REMOVE}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('id must be a number', async () => { const actual = await command.validate({ options: { id: 'nonumber' } }, commandInfo); assert.notStrictEqual(actual, true); diff --git a/src/m365/viva/commands/engage/engage-message-remove.ts b/src/m365/viva/commands/engage/engage-message-remove.ts index 461ac679ee7..e441cab2430 100644 --- a/src/m365/viva/commands/engage/engage-message-remove.ts +++ b/src/m365/viva/commands/engage/engage-message-remove.ts @@ -4,7 +4,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -24,10 +23,6 @@ class VivaEngageMessageRemoveCommand extends VivaEngageCommand { return 'Removes a Viva Engage message'; } - public alias(): string[] | undefined { - return [yammerCommands.MESSAGE_REMOVE]; - } - constructor() { super(); @@ -68,8 +63,6 @@ class VivaEngageMessageRemoveCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - if (args.options.force) { await this.removeMessage(args.options); } diff --git a/src/m365/viva/commands/engage/engage-network-list.spec.ts b/src/m365/viva/commands/engage/engage-network-list.spec.ts index bc11f8d5788..ef7d32ad890 100644 --- a/src/m365/viva/commands/engage/engage-network-list.spec.ts +++ b/src/m365/viva/commands/engage/engage-network-list.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-network-list.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_NETWORK_LIST, () => { @@ -67,23 +66,6 @@ describe(commands.ENGAGE_NETWORK_LIST, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.NETWORK_LIST]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.NETWORK_LIST); - sinon.stub(request, 'get').resolves(); - - await command.action(logger, { options: {} }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.NETWORK_LIST}' is deprecated. Please use '${commands.ENGAGE_NETWORK_LIST}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('defines correct properties for the default output', () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'name', 'email', 'community', 'permalink', 'web_url']); }); diff --git a/src/m365/viva/commands/engage/engage-network-list.ts b/src/m365/viva/commands/engage/engage-network-list.ts index 7738235c167..be0397fb524 100644 --- a/src/m365/viva/commands/engage/engage-network-list.ts +++ b/src/m365/viva/commands/engage/engage-network-list.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -22,10 +21,6 @@ class VivaEngageNetworkListCommand extends VivaEngageCommand { return 'Returns a list of networks to which the current user has access'; } - public alias(): string[] | undefined { - return [yammerCommands.NETWORK_LIST]; - } - public defaultProperties(): string[] | undefined { return ['id', 'name', 'email', 'community', 'permalink', 'web_url']; } @@ -54,8 +49,6 @@ class VivaEngageNetworkListCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - const requestOptions: CliRequestOptions = { url: `${this.resource}/v1/networks/current.json`, headers: { diff --git a/src/m365/viva/commands/engage/engage-report-activitycounts.spec.ts b/src/m365/viva/commands/engage/engage-report-activitycounts.spec.ts index 93bd6641b15..04501a7cb99 100644 --- a/src/m365/viva/commands/engage/engage-report-activitycounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-activitycounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-activitycounts.js'; -import { cli } from '../../../../cli/cli.js'; -import yammerCommands from './yammerCommands.js'; describe(commands.ENGAGE_REPORT_ACTIVITYCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_ACTIVITYCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_ACTIVITYCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_ACTIVITYCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,Liked,Posted,Read,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_ACTIVITYCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_ACTIVITYCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerActivityCounts(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-activitycounts.ts b/src/m365/viva/commands/engage/engage-report-activitycounts.ts index 6e1f92d1652..80653dc6ce0 100644 --- a/src/m365/viva/commands/engage/engage-report-activitycounts.ts +++ b/src/m365/viva/commands/engage/engage-report-activitycounts.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportActivityCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_ACTIVITYCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_ACTIVITYCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerActivityCounts'; } @@ -19,12 +13,6 @@ class VivaEngageReportActivityCountsCommand extends PeriodBasedReport { public get description(): string { return 'Gets the trends on the amount of VivaEngage activity in your organization by how many messages were posted, read, and liked'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportActivityCountsCommand(); diff --git a/src/m365/viva/commands/engage/engage-report-activityusercounts.spec.ts b/src/m365/viva/commands/engage/engage-report-activityusercounts.spec.ts index 3f79d7c0f08..54fd7b6dd3b 100644 --- a/src/m365/viva/commands/engage/engage-report-activityusercounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-activityusercounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-activityusercounts.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_ACTIVITYUSERCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_ACTIVITYUSERCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_ACTIVITYUSERCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_ACTIVITYUSERCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,Liked,Posted,Read,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_ACTIVITYUSERCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_ACTIVITYUSERCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerActivityUserCounts(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-activityusercounts.ts b/src/m365/viva/commands/engage/engage-report-activityusercounts.ts index ae382baf177..098911039c8 100644 --- a/src/m365/viva/commands/engage/engage-report-activityusercounts.ts +++ b/src/m365/viva/commands/engage/engage-report-activityusercounts.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportActivityUserCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_ACTIVITYUSERCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_ACTIVITYUSERCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerActivityUserCounts'; } @@ -19,12 +13,6 @@ class VivaEngageReportActivityUserCountsCommand extends PeriodBasedReport { public get description(): string { return 'Gets the trends on the number of unique users who posted, read, and liked Viva Engage messages'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportActivityUserCountsCommand(); diff --git a/src/m365/viva/commands/engage/engage-report-activityuserdetail.spec.ts b/src/m365/viva/commands/engage/engage-report-activityuserdetail.spec.ts index 6fc5cf7cbb4..a7805175db0 100644 --- a/src/m365/viva/commands/engage/engage-report-activityuserdetail.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-activityuserdetail.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-activityuserdetail.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_ACTIVITYUSERDETAIL, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_ACTIVITYUSERDETAIL, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_ACTIVITYUSERDETAIL]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_ACTIVITYUSERDETAIL); - sinon.stub(request, 'get').resolves('Report Refresh Date,Liked,Posted,Read,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_ACTIVITYUSERDETAIL}' is deprecated. Please use '${commands.ENGAGE_REPORT_ACTIVITYUSERDETAIL}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerActivityUserDetail(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-activityuserdetail.ts b/src/m365/viva/commands/engage/engage-report-activityuserdetail.ts index 5b55577fc31..935b512fb0f 100644 --- a/src/m365/viva/commands/engage/engage-report-activityuserdetail.ts +++ b/src/m365/viva/commands/engage/engage-report-activityuserdetail.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import DateAndPeriodBasedReport, { CommandArgs } from '../../../base/DateAndPeriodBasedReport.js'; +import DateAndPeriodBasedReport from '../../../base/DateAndPeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportActivityUserDetailCommand extends DateAndPeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_ACTIVITYUSERDETAIL; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_ACTIVITYUSERDETAIL]; - } - public get usageEndpoint(): string { return 'getYammerActivityUserDetail'; } @@ -19,12 +13,6 @@ class VivaEngageReportActivityUserDetailCommand extends DateAndPeriodBasedReport public get description(): string { return 'Gets details about Viva Engage activity by user'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportActivityUserDetailCommand(); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.spec.ts b/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.spec.ts index ba4dd673817..6ee69c7e958 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-deviceusagedistributionusercounts.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,Liked,Posted,Read,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerDeviceUsageDistributionUserCounts(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.ts b/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.ts index 34b36b1b26b..b365d8f29c2 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusagedistributionusercounts.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportDeviceUsageDistributionUserCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerDeviceUsageDistributionUserCounts'; } @@ -19,12 +13,6 @@ class VivaEngageReportDeviceUsageDistributionUserCountsCommand extends PeriodBas public get description(): string { return 'Gets the number of users by device type'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportDeviceUsageDistributionUserCountsCommand(); diff --git a/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.spec.ts b/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.spec.ts index 944111780f4..0f764b3f055 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-deviceusageusercounts.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_DEVICEUSAGEUSERCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_DEVICEUSAGEUSERCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_DEVICEUSAGEUSERCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_DEVICEUSAGEUSERCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,Web,Windows Phone,Android Phone,iPhone,iPad,Other,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_DEVICEUSAGEUSERCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_DEVICEUSAGEUSERCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerDeviceUsageUserCounts(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.ts b/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.ts index ab808f82277..95519da345c 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusageusercounts.ts @@ -1,18 +1,12 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportDeviceUsageUserCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_DEVICEUSAGEUSERCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_DEVICEUSAGEUSERCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerDeviceUsageUserCounts'; } @@ -20,12 +14,6 @@ class VivaEngageReportDeviceUsageUserCountsCommand extends PeriodBasedReport { public get description(): string { return 'Gets the number of daily users by device type'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportDeviceUsageUserCountsCommand(); diff --git a/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.spec.ts b/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.spec.ts index 0f757511380..2eb97c512ac 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-deviceusageuserdetail.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_DEVICEUSAGEUSERDETAIL, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_DEVICEUSAGEUSERDETAIL, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_DEVICEUSAGEUSERDETAIL]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_DEVICEUSAGEUSERDETAIL); - sinon.stub(request, 'get').resolves('Report Refresh Date,User Principal Name,Display Name,User State,State Change Date,Last Activity Date,Used Web,Used Windows Phone,Used Android Phone,Used iPhone,Used iPad,Used Others,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_DEVICEUSAGEUSERDETAIL}' is deprecated. Please use '${commands.ENGAGE_REPORT_DEVICEUSAGEUSERDETAIL}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerDeviceUsageUserDetail(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.ts b/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.ts index 7db85d2cd04..70fe283b809 100644 --- a/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.ts +++ b/src/m365/viva/commands/engage/engage-report-deviceusageuserdetail.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import DateAndPeriodBasedReport, { CommandArgs } from '../../../base/DateAndPeriodBasedReport.js'; +import DateAndPeriodBasedReport from '../../../base/DateAndPeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportDeviceUsageUserDetailCommand extends DateAndPeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_DEVICEUSAGEUSERDETAIL; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_DEVICEUSAGEUSERDETAIL]; - } - public get usageEndpoint(): string { return 'getYammerDeviceUsageUserDetail'; } @@ -19,12 +13,6 @@ class VivaEngageReportDeviceUsageUserDetailCommand extends DateAndPeriodBasedRep public get description(): string { return 'Gets details about Viva Engage device usage by user'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportDeviceUsageUserDetailCommand(); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.spec.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.spec.ts index b6e6e72cbc7..5c552313bac 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-groupsactivitycounts.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_GROUPSACTIVITYCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_GROUPSACTIVITYCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_GROUPSACTIVITYCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_GROUPSACTIVITYCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,User Principal Name,Display Name,User State,State Change Date,Last Activity Date,Used Web,Used Windows Phone,Used Android Phone,Used iPhone,Used iPad,Used Others,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_GROUPSACTIVITYCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_GROUPSACTIVITYCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerGroupsActivityCounts(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.ts index 94a7ae463f9..ac5c5933b28 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitycounts.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportGroupsActivityCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_GROUPSACTIVITYCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_GROUPSACTIVITYCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerGroupsActivityCounts'; } @@ -19,12 +13,6 @@ class VivaEngageReportGroupsActivityCountsCommand extends PeriodBasedReport { public get description(): string { return 'Gets the number of Viva Engage messages posted, read, and liked in groups'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportGroupsActivityCountsCommand(); diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.spec.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.spec.ts index 71841b27c48..d1e8e48c4ca 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-groupsactivitydetail.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_GROUPSACTIVITYDETAIL, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_GROUPSACTIVITYDETAIL, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_GROUPSACTIVITYDETAIL]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_GROUPSACTIVITYDETAIL); - sinon.stub(request, 'get').resolves('Report Refresh Date,Group Display Name,Is Deleted,Owner Principal Name,Last Activity Date,Group Type,Microsoft 365 Connected,Member Count,Posted Count,Read Count,Liked Count,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_GROUPSACTIVITYDETAIL}' is deprecated. Please use '${commands.ENGAGE_REPORT_GROUPSACTIVITYDETAIL}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerGroupsActivityDetail(period='D7')`) { diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.ts index 168b532befa..de90927ae3c 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitydetail.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import DateAndPeriodBasedReport, { CommandArgs } from '../../../base/DateAndPeriodBasedReport.js'; +import DateAndPeriodBasedReport from '../../../base/DateAndPeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportGroupsActivityDetailCommand extends DateAndPeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_GROUPSACTIVITYDETAIL; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_GROUPSACTIVITYDETAIL]; - } - public get usageEndpoint(): string { return 'getYammerGroupsActivityDetail'; } @@ -19,12 +13,6 @@ class VivaEngageReportGroupsActivityDetailCommand extends DateAndPeriodBasedRepo public get description(): string { return 'Gets details about Viva Engage groups activity by group'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportGroupsActivityDetailCommand(); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.spec.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.spec.ts index daba79e07c7..252c92285eb 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.spec.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.spec.ts @@ -9,8 +9,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-report-groupsactivitygroupcounts.js'; -import yammerCommands from './yammerCommands.js'; -import { cli } from '../../../../cli/cli.js'; describe(commands.ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS, () => { let log: string[]; @@ -59,23 +57,6 @@ describe(commands.ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.REPORT_GROUPSACTIVITYGROUPCOUNTS]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.REPORT_GROUPSACTIVITYGROUPCOUNTS); - sinon.stub(request, 'get').resolves('Report Refresh Date,Total,Active,Report Date,Report Period'); - - await command.action(logger, { options: { period: 'D7' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.REPORT_GROUPSACTIVITYGROUPCOUNTS}' is deprecated. Please use '${commands.ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('gets the report for the last week', async () => { const requestStub: sinon.SinonStub = sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === `https://graph.microsoft.com/v1.0/reports/getYammerGroupsActivityGroupCounts(period='D7')`) { @@ -89,4 +70,4 @@ describe(commands.ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS, () => { assert.strictEqual(requestStub.lastCall.args[0].url, "https://graph.microsoft.com/v1.0/reports/getYammerGroupsActivityGroupCounts(period='D7')"); assert.strictEqual(requestStub.lastCall.args[0].headers["accept"], 'application/json;odata.metadata=none'); }); -}); +}); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.ts b/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.ts index 4a107661d5a..aee4c8ca7df 100644 --- a/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.ts +++ b/src/m365/viva/commands/engage/engage-report-groupsactivitygroupcounts.ts @@ -1,17 +1,11 @@ -import { Logger } from '../../../../cli/Logger.js'; -import PeriodBasedReport, { CommandArgs } from '../../../base/PeriodBasedReport.js'; +import PeriodBasedReport from '../../../base/PeriodBasedReport.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; class VivaEngageReportGroupsActivityGroupCountsCommand extends PeriodBasedReport { public get name(): string { return commands.ENGAGE_REPORT_GROUPSACTIVITYGROUPCOUNTS; } - public alias(): string[] | undefined { - return [yammerCommands.REPORT_GROUPSACTIVITYGROUPCOUNTS]; - } - public get usageEndpoint(): string { return 'getYammerGroupsActivityGroupCounts'; } @@ -19,12 +13,6 @@ class VivaEngageReportGroupsActivityGroupCountsCommand extends PeriodBasedReport public get description(): string { return 'Gets the total number of groups that existed and how many included group conversation activity'; } - - public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - - await super.commandAction(logger, args); - } } export default new VivaEngageReportGroupsActivityGroupCountsCommand(); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/engage-search.spec.ts b/src/m365/viva/commands/engage/engage-search.spec.ts index 5823e1f053c..b9622ca6190 100644 --- a/src/m365/viva/commands/engage/engage-search.spec.ts +++ b/src/m365/viva/commands/engage/engage-search.spec.ts @@ -13,7 +13,6 @@ import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import { settingsNames } from '../../../../settingsNames.js'; import command from './engage-search.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_SEARCH, () => { @@ -250,23 +249,6 @@ describe(commands.ENGAGE_SEARCH, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.SEARCH]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.SEARCH); - sinon.stub(request, 'get').resolves(searchResults); - - await command.action(logger, { options: { queryText: 'contents' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.SEARCH}' is deprecated. Please use '${commands.ENGAGE_SEARCH}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('correctly handles error', async () => { sinon.stub(request, 'get').rejects({ "error": { diff --git a/src/m365/viva/commands/engage/engage-search.ts b/src/m365/viva/commands/engage/engage-search.ts index 65b4c67ab1c..8dd18996200 100644 --- a/src/m365/viva/commands/engage/engage-search.ts +++ b/src/m365/viva/commands/engage/engage-search.ts @@ -5,7 +5,6 @@ import request, { CliRequestOptions } from '../../../../request.js'; import { formatting } from '../../../../utils/formatting.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -100,10 +99,6 @@ class VivaEngageSearchCommand extends VivaEngageCommand { return 'Returns a list of messages, users, topics and groups that match the specified query.'; } - public alias(): string[] | undefined { - return [yammerCommands.SEARCH]; - } - constructor() { super(); this.summary = { @@ -245,8 +240,6 @@ class VivaEngageSearchCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - this.summary = { messages: 0, groups: 0, diff --git a/src/m365/viva/commands/engage/engage-user-get.spec.ts b/src/m365/viva/commands/engage/engage-user-get.spec.ts index 82a89e042ec..c1344552c4a 100644 --- a/src/m365/viva/commands/engage/engage-user-get.spec.ts +++ b/src/m365/viva/commands/engage/engage-user-get.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-user-get.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_USER_GET, () => { @@ -71,23 +70,6 @@ describe(commands.ENGAGE_USER_GET, () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'full_name', 'email', 'job_title', 'state', 'url']); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.USER_GET]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.USER_GET); - sinon.stub(request, 'get').resolves({ 'type': 'user', 'id': 1496550646, 'network_id': 801445, 'state': 'active', 'full_name': 'John Doe' }); - - await command.action(logger, { options: { email: 'pl@nubo.eu' } }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.USER_GET}' is deprecated. Please use '${commands.ENGAGE_USER_GET}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('calls user by e-mail', async () => { sinon.stub(request, 'get').callsFake(async (opts) => { if (opts.url === 'https://www.yammer.com/api/v1/users/by_email.json?email=pl%40nubo.eu') { diff --git a/src/m365/viva/commands/engage/engage-user-get.ts b/src/m365/viva/commands/engage/engage-user-get.ts index 899e3cc8ae4..355af5fdbdb 100644 --- a/src/m365/viva/commands/engage/engage-user-get.ts +++ b/src/m365/viva/commands/engage/engage-user-get.ts @@ -4,7 +4,6 @@ import request, { CliRequestOptions } from '../../../../request.js'; import { formatting } from '../../../../utils/formatting.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -24,10 +23,6 @@ class VivaEngageUserGetCommand extends VivaEngageCommand { return 'Retrieves the current user or searches for a user by ID or e-mail'; } - public alias(): string[] | undefined { - return [yammerCommands.USER_GET]; - } - public defaultProperties(): string[] | undefined { return ['id', 'full_name', 'email', 'job_title', 'state', 'url']; } @@ -73,8 +68,6 @@ class VivaEngageUserGetCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - let endPoint = `${this.resource}/v1/users/current.json`; if (args.options.id) { diff --git a/src/m365/viva/commands/engage/engage-user-list.spec.ts b/src/m365/viva/commands/engage/engage-user-list.spec.ts index fca9116ebe7..cfb6ac8eeee 100644 --- a/src/m365/viva/commands/engage/engage-user-list.spec.ts +++ b/src/m365/viva/commands/engage/engage-user-list.spec.ts @@ -12,7 +12,6 @@ import { session } from '../../../../utils/session.js'; import { sinonUtil } from '../../../../utils/sinonUtil.js'; import commands from '../../commands.js'; import command from './engage-user-list.js'; -import yammerCommands from './yammerCommands.js'; import { accessToken } from '../../../../utils/accessToken.js'; describe(commands.ENGAGE_USER_LIST, () => { @@ -67,23 +66,6 @@ describe(commands.ENGAGE_USER_LIST, () => { assert.notStrictEqual(command.description, null); }); - it('defines correct alias', () => { - const alias = command.alias(); - assert.deepStrictEqual(alias, [yammerCommands.USER_LIST]); - }); - - it('correctly logs deprecation warning for yammer command', async () => { - const chalk = (await import('chalk')).default; - const loggerErrSpy = sinon.spy(logger, 'logToStderr'); - const commandNameStub = sinon.stub(cli, 'currentCommandName').value(yammerCommands.USER_LIST); - sinon.stub(request, 'get').resolves([{ 'type': 'user', 'id': 1496550647, 'network_id': 801445, 'state': 'active', 'full_name': 'Adam Doe' }]); - - await command.action(logger, { options: {} }); - assert.deepStrictEqual(loggerErrSpy.firstCall.firstArg, chalk.yellow(`Command '${yammerCommands.USER_LIST}' is deprecated. Please use '${commands.ENGAGE_USER_LIST}' instead.`)); - - sinonUtil.restore([loggerErrSpy, commandNameStub]); - }); - it('defines correct properties for the default output', () => { assert.deepStrictEqual(command.defaultProperties(), ['id', 'full_name', 'email']); }); diff --git a/src/m365/viva/commands/engage/engage-user-list.ts b/src/m365/viva/commands/engage/engage-user-list.ts index cd486fe12c7..5bd3987e9af 100644 --- a/src/m365/viva/commands/engage/engage-user-list.ts +++ b/src/m365/viva/commands/engage/engage-user-list.ts @@ -3,7 +3,6 @@ import GlobalOptions from '../../../../GlobalOptions.js'; import request, { CliRequestOptions } from '../../../../request.js'; import VivaEngageCommand from '../../../base/VivaEngageCommand.js'; import commands from '../../commands.js'; -import yammerCommands from './yammerCommands.js'; interface CommandArgs { options: Options; @@ -28,10 +27,6 @@ class VivaEngageUserListCommand extends VivaEngageCommand { return 'Returns users from the current network'; } - public alias(): string[] | undefined { - return [yammerCommands.USER_LIST]; - } - public defaultProperties(): string[] | undefined { return ['id', 'full_name', 'email']; } @@ -177,8 +172,6 @@ class VivaEngageUserListCommand extends VivaEngageCommand { } public async commandAction(logger: Logger, args: CommandArgs): Promise { - await this.showDeprecationWarning(logger, this.alias()![0], this.name); - this.items = []; // this will reset the items array in interactive mode try { @@ -191,4 +184,4 @@ class VivaEngageUserListCommand extends VivaEngageCommand { } } -export default new VivaEngageUserListCommand(); +export default new VivaEngageUserListCommand(); \ No newline at end of file diff --git a/src/m365/viva/commands/engage/yammerCommands.ts b/src/m365/viva/commands/engage/yammerCommands.ts deleted file mode 100644 index e86874a5503..00000000000 --- a/src/m365/viva/commands/engage/yammerCommands.ts +++ /dev/null @@ -1,25 +0,0 @@ -const prefix: string = 'yammer'; - -export default { - GROUP_LIST: `${prefix} group list`, - GROUP_USER_ADD: `${prefix} group user add`, - GROUP_USER_REMOVE: `${prefix} group user remove`, - MESSAGE_ADD: `${prefix} message add`, - MESSAGE_GET: `${prefix} message get`, - MESSAGE_LIKE_SET: `${prefix} message like set`, - MESSAGE_LIST: `${prefix} message list`, - MESSAGE_REMOVE: `${prefix} message remove`, - NETWORK_LIST: `${prefix} network list`, - REPORT_ACTIVITYCOUNTS: `${prefix} report activitycounts`, - REPORT_ACTIVITYUSERCOUNTS: `${prefix} report activityusercounts`, - REPORT_ACTIVITYUSERDETAIL: `${prefix} report activityuserdetail`, - REPORT_DEVICEUSAGEDISTRIBUTIONUSERCOUNTS: `${prefix} report deviceusagedistributionusercounts`, - REPORT_DEVICEUSAGEUSERCOUNTS: `${prefix} report deviceusageusercounts`, - REPORT_DEVICEUSAGEUSERDETAIL: `${prefix} report deviceusageuserdetail`, - REPORT_GROUPSACTIVITYCOUNTS: `${prefix} report groupsactivitycounts`, - REPORT_GROUPSACTIVITYDETAIL: `${prefix} report groupsactivitydetail`, - REPORT_GROUPSACTIVITYGROUPCOUNTS: `${prefix} report groupsactivitygroupcounts`, - SEARCH: `${prefix} search`, - USER_GET: `${prefix} user get`, - USER_LIST: `${prefix} user list` -}; \ No newline at end of file