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

Removes defaultProperties method from various commands. Closes #6432 #6441

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
6 changes: 1 addition & 5 deletions src/m365/entra/commands/user/user-guest-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ describe(commands.USER_GUEST_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'inviteRedeemUrl', 'invitedUserDisplayName', 'invitedUserEmailAddress', 'invitedUserType', 'resetRedemption', 'sendInvitationMessage', 'status']);
});

it('correctly logs the API response', async () => {
sinon.stub(request, 'post').callsFake(async (opts) => {
if (opts.url === 'https://graph.microsoft.com/v1.0/invitations') {
Expand Down Expand Up @@ -197,4 +193,4 @@ describe(commands.USER_GUEST_ADD, () => {
}
}), new CommandError(errorMessage));
});
});
});
4 changes: 0 additions & 4 deletions src/m365/entra/commands/user/user-guest-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ class EntraUserGuestAddCommand extends GraphCommand {
);
}

public defaultProperties(): string[] | undefined {
return ['id', 'inviteRedeemUrl', 'invitedUserDisplayName', 'invitedUserEmailAddress', 'invitedUserType', 'resetRedemption', 'sendInvitationMessage', 'status'];
}

public async commandAction(logger: Logger, args: CommandArgs): Promise<void> {
try {
const requestOptions: CliRequestOptions = {
Expand Down
6 changes: 1 addition & 5 deletions src/m365/flow/commands/environment/environment-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ describe(commands.ENVIRONMENT_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault']);
});

it('retrieves information about the specified environment (debug)', async () => {
sinon.stub(request, 'get').callsFake(async opts => {
if ((opts.url === `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5?api-version=2016-11-01`)) {
Expand Down Expand Up @@ -203,4 +199,4 @@ describe(commands.ENVIRONMENT_GET, () => {
await assert.rejects(command.action(logger, { options: { name: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5' } } as any),
new CommandError('An error has occurred'));
});
});
});
4 changes: 0 additions & 4 deletions src/m365/flow/commands/environment/environment-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class FlowEnvironmentGetCommand extends PowerAutomateCommand {
return 'Gets information about the specified Microsoft Flow environment';
}

public defaultProperties(): string[] | undefined {
return ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault'];
}

constructor() {
super();

Expand Down
6 changes: 1 addition & 5 deletions src/m365/flow/commands/flow-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ describe(commands.GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'displayName', 'description', 'triggers', 'actions']);
});

it('retrieves information about the specified flow (debug)', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `https://api.flow.microsoft.com/providers/Microsoft.ProcessSimple/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5/flows/3989cb59-ce1a-4a5c-bb78-257c5c39381d?api-version=2016-11-01${expandUrl}`) {
Expand Down Expand Up @@ -229,4 +225,4 @@ describe(commands.GET, () => {
await assert.rejects(command.action(logger, { options: { environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5', name: '3989cb59-ce1a-4a5c-bb78-257c5c39381d' } } as any),
new CommandError('An error has occurred'));
});
});
});
4 changes: 0 additions & 4 deletions src/m365/flow/commands/flow-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ class FlowGetCommand extends PowerAutomateCommand {
return 'Gets information about the specified Microsoft Flow';
}

public defaultProperties(): string[] | undefined {
return ['name', 'displayName', 'description', 'triggers', 'actions'];
}

constructor() {
super();

Expand Down
6 changes: 1 addition & 5 deletions src/m365/flow/commands/run/run-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,4 @@ describe(commands.RUN_GET, () => {
const actual = await command.validate({ options: { environmentName: environmentName, flowName: flowName, name: runName } }, commandInfo);
assert.strictEqual(actual, true);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'startTime', 'endTime', 'status', 'triggerName']);
});
});
});
4 changes: 0 additions & 4 deletions src/m365/flow/commands/run/run-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ class FlowRunGetCommand extends PowerAutomateCommand {
return 'Gets information about a specific run of the specified Microsoft Flow';
}

public defaultProperties(): string[] | undefined {
return ['name', 'startTime', 'endTime', 'status', 'triggerName'];
}

constructor() {
super();

Expand Down
6 changes: 1 addition & 5 deletions src/m365/pa/commands/app/app-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,6 @@ describe(commands.APP_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'displayName', 'description', 'appVersion', 'owner']);
});

it('fails validation if name or displayName not specified', async () => {
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
if (settingName === settingsNames.prompt) {
Expand Down Expand Up @@ -768,4 +764,4 @@ describe(commands.APP_GET, () => {
const actual = await command.validate({ options: { name: "5369f386-e380-46cb-82a4-4e18f9e4f3a7", asAdmin: true, environmentName: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c6' } }, commandInfo);
assert.strictEqual(actual, true);
});
});
});
4 changes: 0 additions & 4 deletions src/m365/pa/commands/app/app-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class PaAppGetCommand extends PowerAppsCommand {
return 'Gets information about the specified Microsoft Power App';
}

public defaultProperties(): string[] | undefined {
return ['name', 'displayName', 'description', 'appVersion', 'owner'];
}

constructor() {
super();

Expand Down
6 changes: 1 addition & 5 deletions src/m365/pa/commands/environment/environment-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,6 @@ describe(commands.ENVIRONMENT_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault']);
});

it('retrieves information about the default environment', async () => {
const env: any = { "name": "Default-d87a7535-dd31-4437-bfe1-95340acd55c5", "location": "europe", "type": "Microsoft.PowerApps/environments", "id": "/providers/Microsoft.PowerApps/environments/Default-d87a7535-dd31-4437-bfe1-95340acd55c5", "properties": { "displayName": "Contoso (default)", "createdTime": "2018-03-22T20:20:46.08653Z", "createdBy": { "id": "SYSTEM", "displayName": "SYSTEM", "type": "NotSpecified" }, "provisioningState": "Succeeded", "creationType": "DefaultTenant", "environmentSku": "Default", "environmentType": "Production", "isDefault": true, "azureRegionHint": "westeurope", "runtimeEndpoints": { "microsoft.BusinessAppPlatform": "https://europe.api.bap.microsoft.com", "microsoft.CommonDataModel": "https://europe.api.cds.microsoft.com", "microsoft.PowerApps": "https://europe.api.powerapps.com", "microsoft.Flow": "https://europe.api.flow.microsoft.com" } } };

Expand Down Expand Up @@ -130,4 +126,4 @@ describe(commands.ENVIRONMENT_GET, () => {
await assert.rejects(command.action(logger, { options: { name: 'Default-d87a7535-dd31-4437-bfe1-95340acd55c5' } } as any),
new CommandError('An error has occurred'));
});
});
});
4 changes: 0 additions & 4 deletions src/m365/pa/commands/environment/environment-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ class PaEnvironmentGetCommand extends PowerAppsCommand {
return 'Gets information about the specified Microsoft Power Apps environment';
}

public defaultProperties(): string[] | undefined {
return ['name', 'id', 'location', 'displayName', 'provisioningState', 'environmentSku', 'azureRegionHint', 'isDefault'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/bucket/bucket-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,6 @@ describe(commands.BUCKET_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'name', 'planId', 'orderHint']);
});

it('passes validation when valid name and planId specified', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/bucket/bucket-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ class PlannerBucketAddCommand extends GraphCommand {
return 'Adds a new Microsoft Planner bucket';
}

public defaultProperties(): string[] | undefined {
return ['id', 'name', 'planId', 'orderHint'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@ describe(commands.PLAN_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'title', 'createdDateTime', 'owner']);
});

it('fails validation if the ownerGroupId is not a valid guid.', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ class PlannerPlanAddCommand extends GraphCommand {
return 'Adds a new Microsoft Planner plan';
}

public defaultProperties(): string[] | undefined {
return ['id', 'title', 'createdDateTime', 'owner'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ describe(commands.PLAN_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'title', 'createdDateTime', 'owner', '@odata.etag']);
});

it('fails validation if the ownerGroupId is not a valid guid.', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class PlannerPlanGetCommand extends GraphCommand {
return 'Get a Microsoft Planner plan';
}

public defaultProperties(): string[] | undefined {
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-set.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ describe(commands.PLAN_SET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'title', 'createdDateTime', 'owner']);
});

it('fails validation if the ownerGroupId is not a valid guid.', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/plan/plan-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ class PlannerPlanSetCommand extends GraphCommand {
return 'Updates a Microsoft Planner plan';
}

public defaultProperties(): string[] | undefined {
return ['id', 'title', 'createdDateTime', 'owner'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/task/task-checklistitem-add.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,6 @@ describe(commands.TASK_CHECKLISTITEM_ADD, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['id', 'title', 'isChecked']);
});

it('correctly adds checklist item', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `https://graph.microsoft.com/v1.0/planner/tasks/${formatting.encodeQueryParameter(validTaskId)}/details`) {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/planner/commands/task/task-checklistitem-add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ class PlannerTaskChecklistItemAddCommand extends GraphCommand {
return 'Adds a new checklist item to a Planner task.';
}

public defaultProperties(): string[] | undefined {
return ['id', 'title', 'isChecked'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/aibuildermodel/aibuildermodel-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ class PpAiBuilderModelGetCommand extends PowerPlatformCommand {
return 'Get an AI builder model in the specified Power Platform environment.';
}

public defaultProperties(): string[] | undefined {
return ['msdyn_name', 'msdyn_aimodelid', 'createdon', 'modifiedon'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/card/card-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@ describe(commands.CARD_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon']);
});

it('fails validation if id is not a valid guid.', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/card/card-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class PpCardGetCommand extends PowerPlatformCommand {
return 'Get specific Microsoft Power Platform card in the specified Power Platform environment.';
}

public defaultProperties(): string[] | undefined {
return ['name', 'cardid', 'publishdate', 'createdon', 'modifiedon'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/chatbot/chatbot-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ describe(commands.CHATBOT_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'botid', 'publishedon', 'createdon', 'modifiedon']);
});

it('fails validation if id is not a valid guid.', async () => {
const actual = await command.validate({
options: {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/chatbot/chatbot-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ class PpChatbotGetCommand extends PowerPlatformCommand {
return 'Get information about the specified chatbot';
}

public defaultProperties(): string[] | undefined {
return ['name', 'botid', 'publishedon', 'createdon', 'modifiedon'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/dataverse/dataverse-table-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ describe(commands.DATAVERSE_TABLE_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['SchemaName', 'EntitySetName', 'LogicalName', 'IsManaged']);
});

it('retrieves data for a specific dataverse table', async () => {
sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl);

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/dataverse/dataverse-table-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class PpDataverseTableGetCommand extends PowerPlatformCommand {
return 'Gets a dataverse table in a given environment';
}

public defaultProperties(): string[] | undefined {
return ['SchemaName', 'EntitySetName', 'LogicalName', 'IsManaged'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/environment/environment-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,6 @@ describe(commands.ENVIRONMENT_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['name', 'id']);
});

it('correctly handles API OData error', async () => {
const errorMessage = `Resource '' does not exist or one of its queried reference-property objects are not present`;
sinon.stub(request, 'get').callsFake(async () => {
Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/environment/environment-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ class PpEnvironmentGetCommand extends PowerPlatformCommand {
return 'Gets information about the specified Power Platform environment';
}

public defaultProperties(): string[] | undefined {
return ['name', 'id'];
}

constructor() {
super();

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/solution/solution-get.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ describe(commands.SOLUTION_GET, () => {
assert.notStrictEqual(command.description, null);
});

it('defines correct properties for the default output', () => {
assert.deepStrictEqual(command.defaultProperties(), ['uniquename', 'version', 'publisher']);
});

it('fails validation when no solution found', async () => {
sinon.stub(powerPlatform, 'getDynamicsInstanceApiUrl').callsFake(async () => envUrl);

Expand Down
4 changes: 0 additions & 4 deletions src/m365/pp/commands/solution/solution-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ class PpSolutionGetCommand extends PowerPlatformCommand {
return 'Gets a specific solution in a given environment.';
}

public defaultProperties(): string[] | undefined {
return ['uniquename', 'version', 'publisher'];
}

constructor() {
super();

Expand Down
Loading