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

Improvement/arsn 423 bump dependencies #2266

Open
wants to merge 9 commits into
base: development/8.2
Choose a base branch
from
Open
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: 0 additions & 6 deletions .eslintrc

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ jobs:
uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: 'yarn'
- name: install dependencies
run: yarn install --frozen-lockfile --prefer-offline --network-concurrency 1
continue-on-error: true # TODO ARSN-97 Remove it when no errors in TS
- name: lint yaml
run: yarn --silent lint_yml
- name: lint javascript
Expand All @@ -44,6 +43,8 @@ jobs:
sudo sh -c "echo '127.0.0.1 testrequestbucket.localhost' >> /etc/hosts"
- name: test and coverage
run: yarn --silent coverage
env:
NODE_OPTIONS: "--tls-max-v1.2"
- name: run functional tests
run: yarn ft_test
- uses: codecov/codecov-action@v4
Expand All @@ -63,14 +64,12 @@ jobs:
- name: Install NodeJS
uses: actions/setup-node@v4
with:
node-version: '16'
node-version: '22'
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile --prefer-offline
continue-on-error: true # TODO ARSN-97 Remove it when no errors in TS
- name: Compile
run: yarn build
continue-on-error: true # TODO ARSN-97 Remove it when no errors in TS
- name: Upload artifacts
uses: scality/action-artifacts@v4
with:
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ console.log(errors.AccessDenied);

```

## Build Status

![Public Build Status][badgepub]
![Private Build Status][badgepriv]

## Clustering

The clustering class can be used to set up a cluster of workers. The class will
Expand Down
2 changes: 1 addition & 1 deletion documentation/BucketInfoModelVersion.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,4 @@ this._quotaMax = quotaMax || 0;

### Usage

Used to store bucket quota
Used to store bucket quota
33 changes: 33 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
import tseslint from 'typescript-eslint';
import { includeIgnoreFile } from '@eslint/compat';


const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, '.gitignore');
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default tseslint.config(
...compat.extends('scality'),
...tseslint.configs.recommended,
includeIgnoreFile(gitignorePath),
{
rules: {
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/no-require-imports': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'camelcase': 'off',
'no-param-reassign': 'off',
'new-cap': 'off',
}
}
);
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import RequestContext, {
actionWithDataDeletion } from './lib/policyEvaluator/RequestContext';
import * as requestUtils from './lib/policyEvaluator/requestUtils';
import * as actionMaps from './lib/policyEvaluator/utils/actionMaps';
import { validateUserPolicy } from './lib/policy/policyValidator'
import { validateUserPolicy } from './lib/policy/policyValidator';
import * as locationConstraints from './lib/patches/locationConstraints';
import * as userMetadata from './lib/s3middleware/userMetadata';
import convertToXml from './lib/s3middleware/convertToXml';
Expand Down
6 changes: 3 additions & 3 deletions lib/Clustering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,15 @@
this._workersTimeout[i] = setTimeout(() => {
// Kill the worker if the sigterm was ignored or take too long
if (worker.process.pid) {
process.kill(worker.process.pid, 'SIGKILL');
process.kill(worker.process.pid, 'SIGKILL');
}
}, this._shutdownTimeout);
// Send sigterm to the process, allowing to release ressources
// and save some states
if (worker.process.pid) {
return process.kill(worker.process.pid, 'SIGTERM');
return process.kill(worker.process.pid, 'SIGTERM');
} else {
return true;
return true;

Check warning on line 276 in lib/Clustering.ts

View check run for this annotation

Codecov / codecov/patch

lib/Clustering.ts#L276

Added line #L276 was not covered by tests
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/algos/cache/GapCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
maxGapWeight: number
): GapCache {
const gapCache = new GapCache(exposureDelayMs, maxGaps, maxGapWeight);
gapCache._exposedGaps = GapSet.createFromArray(gaps, maxGapWeight)
gapCache._exposedGaps = GapSet.createFromArray(gaps, maxGapWeight);

Check warning on line 119 in lib/algos/cache/GapCache.ts

View check run for this annotation

Codecov / codecov/patch

lib/algos/cache/GapCache.ts#L119

Added line #L119 was not covered by tests
return gapCache;
}

Expand Down
6 changes: 2 additions & 4 deletions lib/algos/cache/GapSet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import assert from 'assert';
import { OrderedSet } from '@js-sdsl/ordered-set';

import errors from '../../errors';

export type GapSetEntry = {
firstKey: string,
lastKey: string,
Expand Down Expand Up @@ -40,7 +38,7 @@ export default class GapSet implements GapSetInterface, Iterable<GapSetEntry> {
[],
(left: GapSetEntry, right: GapSetEntry) => (
left.firstKey < right.firstKey ? -1 :
left.firstKey > right.firstKey ? 1 : 0
left.firstKey > right.firstKey ? 1 : 0
)
);
this._maxWeight = maxWeight;
Expand Down Expand Up @@ -90,7 +88,7 @@ export default class GapSet implements GapSetInterface, Iterable<GapSetEntry> {
|| curGap.lastKey < firstKey // previous gap not overlapping
|| (curGap.lastKey === firstKey // previous gap overlapping by one key...
&& curGap.weight + weight > this._maxWeight) // ...but we can't extend it
) {
) {
// create a new gap indexed by 'firstKey'
curGap = { firstKey, lastKey: firstKey, weight: 0 };
this._gaps.insert(curGap);
Expand Down
9 changes: 5 additions & 4 deletions lib/algos/list/delimiter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const Extension = require('./Extension').default;
const { inc, listingParamsMasterKeysV0ToV1,
Expand Down Expand Up @@ -213,7 +213,7 @@ export class Delimiter extends Extension {
* @param {String} key - full key starting with commonPrefix
* @return {Boolean} - indicates if iteration should continue
*/
addCommonPrefix(commonPrefix: string, key: string): void {
addCommonPrefix(commonPrefix: string): void {
// add the new prefix to the list
this.CommonPrefixes.push(commonPrefix);
++this.keys;
Expand All @@ -224,7 +224,7 @@ export class Delimiter extends Extension {
// add the subprefix to the common prefixes if the key has the delimiter
const commonPrefix = this.getCommonPrefix(key);
if (commonPrefix) {
this.addCommonPrefix(commonPrefix, key);
this.addCommonPrefix(commonPrefix);
return commonPrefix;
}
this.addContents(key, value);
Expand Down Expand Up @@ -306,9 +306,10 @@ export class Delimiter extends Extension {

skippingBase(): string | undefined {
switch (this.state.id) {
case DelimiterFilterStateId.SkippingPrefix:
case DelimiterFilterStateId.SkippingPrefix: {
const { prefix } = <DelimiterFilterState_SkippingPrefix> this.state;
return inc(prefix);
}

default:
return SKIP_NONE;
Expand Down
3 changes: 1 addition & 2 deletions lib/algos/list/delimiterCurrent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { DelimiterMaster } = require('./delimiterMaster');
const { FILTER_ACCEPT, FILTER_END } = require('./tools');

type ResultObject = {
Contents: {
Expand Down Expand Up @@ -46,7 +45,7 @@ class DelimiterCurrent extends DelimiterMaster {
if (this.excludedDataStoreName) {
params.dataStoreName = {
ne: this.excludedDataStoreName,
}
};
}

return params;
Expand Down
11 changes: 7 additions & 4 deletions lib/algos/list/delimiterMaster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
const Version = require('../../versioning/Version').Version;
const VSConst = require('../../versioning/constants').VersioningConstants;
const { BucketVersioningKeyFormat } = VSConst;
const { FILTER_ACCEPT, FILTER_SKIP, FILTER_END, SKIP_NONE, inc } = require('./tools');
const { FILTER_ACCEPT, FILTER_SKIP, FILTER_END, inc } = require('./tools');

import { GapSetEntry } from '../cache/GapSet';
import { GapCacheInterface } from '../cache/GapCache';
Expand Down Expand Up @@ -492,13 +492,15 @@ export class DelimiterMaster extends Delimiter {

skippingBase(): string | undefined {
switch (this.state.id) {
case DelimiterMasterFilterStateId.SkippingVersionsV0:
case DelimiterMasterFilterStateId.SkippingVersionsV0: {
const { masterKey } = <DelimiterMasterFilterState_SkippingVersionsV0> this.state;
return masterKey + inc(VID_SEP);
}

case DelimiterMasterFilterStateId.SkippingGapV0:
case DelimiterMasterFilterStateId.SkippingGapV0: {
const { gapCached } = <GapCachingInfo_GapCached> this._gapCaching;
return gapCached.lastKey;
}

default:
return super.skippingBase();
Expand Down Expand Up @@ -598,7 +600,8 @@ export class DelimiterMaster extends Delimiter {
_cutBuildingGap(): void {
if (this._gapBuilding.state === GapBuildingState.Building) {
let gapBuilding = <GapBuildingInfo_Building> this._gapBuilding;
let { gapCache, params, gap, gapWeight } = gapBuilding;
const { gapCache, gap, gapWeight } = gapBuilding;
let params = gapBuilding.params;
// only set gaps that are significant enough in weight and
// with a non-empty extension
if (gapWeight >= params.minGapWeight && gap.weight > 0) {
Expand Down
10 changes: 6 additions & 4 deletions lib/algos/list/delimiterVersions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'; // eslint-disable-line strict
'use strict';

const Extension = require('./Extension').default;

Expand Down Expand Up @@ -239,7 +239,7 @@ export class DelimiterVersions extends Extension {
return { key: fullKey };
}
const nonversionedKey: string = fullKey.slice(0, versionIdIndex);
let versionId: string = fullKey.slice(versionIdIndex + 1);
const versionId: string = fullKey.slice(versionIdIndex + 1);
return { key: nonversionedKey, versionId };
}

Expand Down Expand Up @@ -455,16 +455,18 @@ export class DelimiterVersions extends Extension {

skippingBase(): string | undefined {
switch (this.state.id) {
case DelimiterVersionsFilterStateId.SkippingPrefix:
case DelimiterVersionsFilterStateId.SkippingPrefix: {
const { prefix } = <DelimiterVersionsFilterState_SkippingPrefix> this.state;
return inc(prefix);
}

case DelimiterVersionsFilterStateId.SkippingVersions:
case DelimiterVersionsFilterStateId.SkippingVersions: {
const { gt } = <DelimiterVersionsFilterState_SkippingVersions> this.state;
// the contract of skipping() is to return the first key
// that can be skipped to, so adding a null byte to skip
// over the existing versioned key set in 'gt'
return `${gt}\0`;
}

default:
return SKIP_NONE;
Expand Down
4 changes: 2 additions & 2 deletions lib/auth/Vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function vaultSignatureCb(
return callback(err);
}

const { email, ...userInfoWithoutEmail } = authInfo.message.body.userInfo;
const { ...userInfoWithoutEmail } = authInfo.message.body.userInfo;

log.debug('received info from Vault', {
...authInfo,
Expand Down Expand Up @@ -265,7 +265,7 @@ export default class Vault {
foundIds.push({
email: key,
canonicalID: infoFromVault[key],
})
});
}
return callback(null, foundIds);
});
Expand Down
16 changes: 8 additions & 8 deletions lib/auth/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@
return cb(null, res.params);
}
if (requestContexts) {
requestContexts.forEach((requestContext) => {
const { params } = res
requestContexts.forEach(requestContext => {
const { params } = res;

Check warning on line 134 in lib/auth/auth.ts

View check run for this annotation

Codecov / codecov/patch

lib/auth/auth.ts#L133-L134

Added lines #L133 - L134 were not covered by tests
if ('data' in params) {
const { data } = params
const { data } = params;

Check warning on line 136 in lib/auth/auth.ts

View check run for this annotation

Codecov / codecov/patch

lib/auth/auth.ts#L136

Added line #L136 was not covered by tests
requestContext.setAuthType(data.authType);
requestContext.setSignatureVersion(data.signatureVersion);
requestContext.setSecurityToken(data.securityToken);
Expand Down Expand Up @@ -254,12 +254,12 @@
Object.assign(request, { headers: {} });
}

export const server = { extractParams, doAuth }
export const client = { generateV4Headers, constructStringToSignV2 }
export const inMemory = { backend: inMemoryBackend, validateAuthConfig, AuthLoader }
export const backends = { baseBackend, chainBackend }
export const server = { extractParams, doAuth };
export const client = { generateV4Headers, constructStringToSignV2 };
export const inMemory = { backend: inMemoryBackend, validateAuthConfig, AuthLoader };
export const backends = { baseBackend, chainBackend };
export {
setAuthHandler as setHandler,
AuthInfo,
Vault
}
};
Loading
Loading