diff --git a/examples/nodejs-minimal/src/index.ts b/examples/nodejs-minimal/src/index.ts index ee03876e8..f8100e933 100644 --- a/examples/nodejs-minimal/src/index.ts +++ b/examples/nodejs-minimal/src/index.ts @@ -1,8 +1,9 @@ // Correct imports for Scaleway SDK v2.27.0+ -import * as http from 'http' + import { loadProfileFromConfigurationFile } from '@scaleway/configuration-loader' import { Registry } from '@scaleway/sdk' import { createClient } from '@scaleway/sdk-client' +import * as http from 'http' const hostname = '127.0.0.1' const port = 3000 diff --git a/examples/serverless-function-minimal/src/index.ts b/examples/serverless-function-minimal/src/index.ts index 02e952535..896615b45 100644 --- a/examples/serverless-function-minimal/src/index.ts +++ b/examples/serverless-function-minimal/src/index.ts @@ -1,5 +1,5 @@ import { loadProfileFromEnvironmentValues } from '@scaleway/configuration-loader' -import { Errors, Registry, createClient } from '@scaleway/sdk' +import { createClient, Errors, Registry } from '@scaleway/sdk' // Profile will be loade from the variables in your `.env` file. const loadedProfile = loadProfileFromEnvironmentValues() diff --git a/packages/client/src/bridge.ts b/packages/client/src/bridge.ts index f43c30ba9..35e6026bc 100644 --- a/packages/client/src/bridge.ts +++ b/packages/client/src/bridge.ts @@ -1,36 +1,36 @@ /** List all helpers required by APIs */ export { isJSONObject } from './helpers/json' -export { waitForResource } from './internal/async/interval-retrier' +export { + resolveOneOf, + unmarshalArrayOfObject, + unmarshalDate, + unmarshalMapOfObject, + urlParams, + validatePathParam, +} from './helpers/marshalling' export type { WaitForOptions } from './internal/async/interval-retrier' +export { waitForResource } from './internal/async/interval-retrier' export { API } from './scw/api' export type { DefaultValues } from './scw/client-settings' -export type { - Money, - ServiceInfo, - ScwFile, - TimeSeries, -} from './scw/custom-types' -export { Decimal } from './scw/custom-types' export { - marshalScwFile, + marshalBlobToScwFile, + marshalDecimal, marshalMoney, + marshalScwFile, marshalTimeSeries, - marshalDecimal, - marshalBlobToScwFile, + unmarshalDecimal, unmarshalMoney, unmarshalScwFile, unmarshalServiceInfo, unmarshalTimeSeries, unmarshalTimeSeriesPoint, - unmarshalDecimal, } from './scw/custom-marshalling' +export type { + Money, + ScwFile, + ServiceInfo, + TimeSeries, +} from './scw/custom-types' +export { Decimal } from './scw/custom-types' export { enrichForPagination } from './scw/fetch/resource-paginator' export type { Region, Zone } from './scw/locality' -export { - resolveOneOf, - unmarshalDate, - unmarshalArrayOfObject, - unmarshalMapOfObject, - urlParams, - validatePathParam, -} from './helpers/marshalling' diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 75e02e2d4..2ff338579 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -5,16 +5,15 @@ export type { export type { NetworkInterceptors, RequestInterceptor, - ResponseInterceptor, ResponseErrorInterceptor, + ResponseInterceptor, } from './internal/interceptors/types' export { enableConsoleLogger, setLogger } from './internal/logger' export type { Logger } from './internal/logger/logger' -export { createClient, createAdvancedClient } from './scw/client' -export { AUTH_HEADER_KEY, SESSION_HEADER_KEY } from './scw/constants' +export * from './internals' export type { Client } from './scw/client' -export type { Profile } from './scw/client-ini-profile' -export type { Settings } from './scw/client-settings' +export { createAdvancedClient, createClient } from './scw/client' +export type { ClientConfig } from './scw/client-ini-factory' export { withAdditionalInterceptors, withDefaultPageSize, @@ -23,11 +22,11 @@ export { withUserAgent, withUserAgentSuffix, } from './scw/client-ini-factory' -export type { ClientConfig } from './scw/client-ini-factory' -export { Decimal } from './scw/custom-types' +export type { Profile } from './scw/client-ini-profile' +export type { Settings } from './scw/client-settings' +export { AUTH_HEADER_KEY, SESSION_HEADER_KEY } from './scw/constants' export type { Money, ScwFile, TimeSeries } from './scw/custom-types' +export { Decimal } from './scw/custom-types' export * as Errors from './scw/errors/standard' -export type { Region, Zone } from './scw/locality' -export * from './internals' +export type { ApiLocality, Region, Zone } from './scw/locality' export { toApiLocality } from './scw/locality' -export type { ApiLocality } from './scw/locality' diff --git a/packages/client/src/internal/logger/console-logger.ts b/packages/client/src/internal/logger/console-logger.ts index 9d4e173b7..c19045138 100644 --- a/packages/client/src/internal/logger/console-logger.ts +++ b/packages/client/src/internal/logger/console-logger.ts @@ -1,5 +1,5 @@ -import { LevelResolver, shouldLog } from './level-resolver' import type { LogLevel } from './level-resolver' +import { LevelResolver, shouldLog } from './level-resolver' import type { Logger } from './logger' /** diff --git a/packages/client/src/internals.ts b/packages/client/src/internals.ts index a8ce16265..b22fe5d18 100644 --- a/packages/client/src/internals.ts +++ b/packages/client/src/internals.ts @@ -1,4 +1,12 @@ export { isJSONObject } from './helpers/json' +export { + resolveOneOf, + unmarshalArrayOfObject, + unmarshalDate, + unmarshalMapOfObject, + urlParams, + validatePathParam, +} from './helpers/marshalling' export { createExponentialBackoffStrategy, tryAtIntervals, @@ -6,9 +14,7 @@ export { } from './internal/async/interval-retrier' export { addAsyncHeaderInterceptor } from './internal/interceptors/helpers' export { API } from './scw/api' - export { authenticateWithSessionToken } from './scw/auth' - export type { DefaultValues } from './scw/client-settings' export { marshalBlobToScwFile, @@ -25,12 +31,4 @@ export { unmarshalTimeSeriesPoint, } from './scw/custom-marshalling' export type { ServiceInfo } from './scw/custom-types' -export { - resolveOneOf, - unmarshalDate, - unmarshalArrayOfObject, - unmarshalMapOfObject, - urlParams, - validatePathParam, -} from './helpers/marshalling' export { enrichForPagination } from './scw/fetch/resource-paginator' diff --git a/packages/client/src/scw/__tests__/client.test.ts b/packages/client/src/scw/__tests__/client.test.ts index 0fd241ad4..e44e5fa53 100644 --- a/packages/client/src/scw/__tests__/client.test.ts +++ b/packages/client/src/scw/__tests__/client.test.ts @@ -1,7 +1,7 @@ import { describe, expect, it } from 'vitest' import { createAdvancedClient, createClient } from '../client' -import { withProfile } from '../client-ini-factory' import type { ClientConfig } from '../client-ini-factory' +import { withProfile } from '../client-ini-factory' import type { Settings } from '../client-settings' const withApiURL = diff --git a/packages/client/src/scw/auth.ts b/packages/client/src/scw/auth.ts index 75ff6b41f..e5255afb4 100644 --- a/packages/client/src/scw/auth.ts +++ b/packages/client/src/scw/auth.ts @@ -3,8 +3,8 @@ import { addHeaderInterceptor, } from '../internal/interceptors/helpers' import type { RequestInterceptor } from '../internal/interceptors/types' -import { assertValidAuthenticationSecrets } from './client-ini-profile' import type { AuthenticationSecrets } from './client-ini-profile' +import { assertValidAuthenticationSecrets } from './client-ini-profile' import { AUTH_HEADER_KEY, SESSION_HEADER_KEY } from './constants' interface TokenAccessor { diff --git a/packages/client/src/scw/client-ini-factory.ts b/packages/client/src/scw/client-ini-factory.ts index db1c5b2ca..5e68e6228 100644 --- a/packages/client/src/scw/client-ini-factory.ts +++ b/packages/client/src/scw/client-ini-factory.ts @@ -1,7 +1,7 @@ import type { NetworkInterceptors } from '../index' import { authenticateWithSecrets } from './auth' -import { hasAuthenticationSecrets } from './client-ini-profile' import type { Profile } from './client-ini-profile' +import { hasAuthenticationSecrets } from './client-ini-profile' import type { Settings } from './client-settings' /** diff --git a/packages/client/src/scw/client.ts b/packages/client/src/scw/client.ts index ef6e5b699..179ae1397 100644 --- a/packages/client/src/scw/client.ts +++ b/packages/client/src/scw/client.ts @@ -8,8 +8,8 @@ import { import type { Settings } from './client-settings' import { assertValidSettings } from './client-settings' import { userAgent, version } from './constants' -import { buildFetcher } from './fetch/build-fetcher' import type { Fetcher } from './fetch/build-fetcher' +import { buildFetcher } from './fetch/build-fetcher' /** Default {@link Settings} values. */ const DEFAULT_SETTINGS: Settings = { diff --git a/packages/client/src/scw/errors/standard/index.ts b/packages/client/src/scw/errors/standard/index.ts index c1f1c8105..172880409 100644 --- a/packages/client/src/scw/errors/standard/index.ts +++ b/packages/client/src/scw/errors/standard/index.ts @@ -1,20 +1,20 @@ export { ScalewayError } from '../scw-error' export { AlreadyExistsError } from './already-exists-error' export { DeniedAuthenticationError } from './denied-authentication-error' -export { InvalidArgumentsError } from './invalid-arguments-error' export type { InvalidArgumentsErrorDetails } from './invalid-arguments-error' +export { InvalidArgumentsError } from './invalid-arguments-error' export { OutOfStockError } from './out-of-stock-error' -export { PermissionsDeniedError } from './permissions-denied-error' export type { PermissionsDeniedErrorDetails } from './permissions-denied-error' +export { PermissionsDeniedError } from './permissions-denied-error' export { PreconditionFailedError } from './precondition-failed-error' -export { QuotasExceededError } from './quotas-exceeded-error' export type { QuotasExceededErrorDetails, QuotasExceededErrorScope, } from './quotas-exceeded-error' +export { QuotasExceededError } from './quotas-exceeded-error' export { ResourceExpiredError } from './resource-expired-error' export { ResourceLockedError } from './resource-locked-error' export { ResourceNotFoundError } from './resource-not-found-error' -export { TooManyRequestsError } from './too-many-requests-error' export type { TooManyRequestsQuotaPolicy } from './too-many-requests-error' +export { TooManyRequestsError } from './too-many-requests-error' export { TransientStateError } from './transient-state-error' diff --git a/packages/client/src/scw/fetch/__tests__/resource-paginator.test.ts b/packages/client/src/scw/fetch/__tests__/resource-paginator.test.ts index 567a67d7c..096fd1923 100644 --- a/packages/client/src/scw/fetch/__tests__/resource-paginator.test.ts +++ b/packages/client/src/scw/fetch/__tests__/resource-paginator.test.ts @@ -1,10 +1,10 @@ import { describe, expect, it, vi } from 'vitest' +import type { PaginatedContent, PaginatedFetcher } from '../resource-paginator' import { enrichForPagination, fetchAll, fetchPaginated, } from '../resource-paginator' -import type { PaginatedContent, PaginatedFetcher } from '../resource-paginator' const fetchPages = (input: T[][] = [], delay = 0) => { const totalCount = input.flat().length diff --git a/packages/client/src/scw/fetch/__tests__/response-parser.test.ts b/packages/client/src/scw/fetch/__tests__/response-parser.test.ts index 3b292a310..255e16342 100644 --- a/packages/client/src/scw/fetch/__tests__/response-parser.test.ts +++ b/packages/client/src/scw/fetch/__tests__/response-parser.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { isJSONObject } from '../../../helpers/json' import type { JSONObject } from '../../../helpers/json' +import { isJSONObject } from '../../../helpers/json' import { ScalewayError } from '../../errors/scw-error' import { fixLegacyTotalCount, responseParser } from '../response-parser' diff --git a/scripts/generatePackages.ts b/scripts/generatePackages.ts index be50f395b..9092203cb 100644 --- a/scripts/generatePackages.ts +++ b/scripts/generatePackages.ts @@ -1,17 +1,17 @@ import { - constants, access, appendFileSync, + constants, copyFileSync, - readFileSync, readdirSync, + readFileSync, statSync, writeFileSync, } from 'node:fs' import { join, resolve } from 'node:path' import { cwd, exit } from 'node:process' -import { parseArgs } from 'node:util' import type { ParseArgsConfig } from 'node:util' +import { parseArgs } from 'node:util' import { SDKS } from './constants' import { renderTemplatePackageJson, diff --git a/scripts/updateGlobalSdkPackage.ts b/scripts/updateGlobalSdkPackage.ts index 4306eda81..8ebb78607 100644 --- a/scripts/updateGlobalSdkPackage.ts +++ b/scripts/updateGlobalSdkPackage.ts @@ -1,4 +1,4 @@ -import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs' +import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs' import path, { join } from 'node:path' import { cwd, exit } from 'node:process' import { SDKS } from './constants' @@ -95,7 +95,10 @@ const updateSdkPackageJson = ({ const updateSdkIndex = ({ generatedPackages, sdkIndexPath, -}: { generatedPackages: PackageJSON[]; sdkIndexPath: string }) => { +}: { + generatedPackages: PackageJSON[] + sdkIndexPath: string +}) => { try { let indexContent = '// Auto-generated exports from all SDK packages\n\n'