Skip to content

Commit

Permalink
feat: adjust the code format of policy APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoYP-2001 committed Jul 19, 2024
1 parent e31da98 commit 5de8697
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 20 deletions.
12 changes: 2 additions & 10 deletions src/policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@ export class PolicySDK {
})) as unknown as Promise<AxiosResponse<{ data: Policy[] }>>
}

public async modifyPolicy(
method: string,
enforcer: Enforcer,
policies: Policy[],
) {
public async modifyPolicy(method: string, enforcer: Enforcer, policies: Policy[]) {

Check failure on line 54 in src/policy.ts

View workflow job for this annotation

GitHub Actions / test (^18)

Replace `method:·string,·enforcer:·Enforcer,·policies:·Policy[]` with `⏎····method:·string,⏎····enforcer:·Enforcer,⏎····policies:·Policy[],⏎··`

Check failure on line 54 in src/policy.ts

View workflow job for this annotation

GitHub Actions / test (^20)

Replace `method:·string,·enforcer:·Enforcer,·policies:·Policy[]` with `⏎····method:·string,⏎····enforcer:·Enforcer,⏎····policies:·Policy[],⏎··`
if (!this.request) {
throw new Error('request init failed')
}
Expand All @@ -79,11 +75,7 @@ export class PolicySDK {
return this.modifyPolicy('add-policy', enforcer, [policy])
}

public async updatePolicy(
enforcer: Enforcer,
oldPolicy: Policy,
newPolicy: Policy,
) {
public async updatePolicy(enforcer: Enforcer, oldPolicy: Policy, newPolicy: Policy) {

Check failure on line 78 in src/policy.ts

View workflow job for this annotation

GitHub Actions / test (^18)

Replace `enforcer:·Enforcer,·oldPolicy:·Policy,·newPolicy:·Policy` with `⏎····enforcer:·Enforcer,⏎····oldPolicy:·Policy,⏎····newPolicy:·Policy,⏎··`

Check failure on line 78 in src/policy.ts

View workflow job for this annotation

GitHub Actions / test (^20)

Replace `enforcer:·Enforcer,·oldPolicy:·Policy,·newPolicy:·Policy` with `⏎····enforcer:·Enforcer,⏎····oldPolicy:·Policy,⏎····newPolicy:·Policy,⏎··`
return this.modifyPolicy('update-policy', enforcer, [oldPolicy, newPolicy])
}

Expand Down
6 changes: 1 addition & 5 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,11 +401,7 @@ export class SDK {
return await this.policySDK.addPolicy(enforcer, policy)
}

public async updatePolicy(
enforcer: Enforcer,
oldPolicy: Policy,
newPolicy: Policy,
) {
public async updatePolicy(enforcer: Enforcer, oldPolicy: Policy, newPolicy: Policy) {

Check failure on line 404 in src/sdk.ts

View workflow job for this annotation

GitHub Actions / test (^18)

Replace `enforcer:·Enforcer,·oldPolicy:·Policy,·newPolicy:·Policy` with `⏎····enforcer:·Enforcer,⏎····oldPolicy:·Policy,⏎····newPolicy:·Policy,⏎··`

Check failure on line 404 in src/sdk.ts

View workflow job for this annotation

GitHub Actions / test (^20)

Replace `enforcer:·Enforcer,·oldPolicy:·Policy,·newPolicy:·Policy` with `⏎····enforcer:·Enforcer,⏎····oldPolicy:·Policy,⏎····newPolicy:·Policy,⏎··`
return await this.policySDK.updatePolicy(enforcer, oldPolicy, newPolicy)
}

Expand Down
6 changes: 1 addition & 5 deletions test/policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ test('TestPolicy', async () => {
}

// Update the object
const { data: updateResponse } = await sdk.updatePolicy(
enforcer,
policy,
newPolicy,
)
const { data: updateResponse } = await sdk.updatePolicy(enforcer, policy, newPolicy)

Check failure on line 81 in test/policy.test.ts

View workflow job for this annotation

GitHub Actions / test (^18)

Replace `enforcer,·policy,·newPolicy` with `⏎····enforcer,⏎····policy,⏎····newPolicy,⏎··`

Check failure on line 81 in test/policy.test.ts

View workflow job for this annotation

GitHub Actions / test (^20)

Replace `enforcer,·policy,·newPolicy` with `⏎····enforcer,⏎····policy,⏎····newPolicy,⏎··`
if (updateResponse.data !== 'Affected') {
throw new Error('Failed to update object')
}
Expand Down

0 comments on commit 5de8697

Please sign in to comment.