Skip to content
Merged
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
3 changes: 2 additions & 1 deletion examples/nodejs-minimal/src/index.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/serverless-function-minimal/src/index.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
40 changes: 20 additions & 20 deletions packages/client/src/bridge.ts
Original file line number Diff line number Diff line change
@@ -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'
19 changes: 9 additions & 10 deletions packages/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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'
2 changes: 1 addition & 1 deletion packages/client/src/internal/logger/console-logger.ts
Original file line number Diff line number Diff line change
@@ -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'

/**
Expand Down
18 changes: 8 additions & 10 deletions packages/client/src/internals.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
export { isJSONObject } from './helpers/json'
export {
resolveOneOf,
unmarshalArrayOfObject,
unmarshalDate,
unmarshalMapOfObject,
urlParams,
validatePathParam,
} from './helpers/marshalling'
export {
createExponentialBackoffStrategy,
tryAtIntervals,
waitForResource,
} 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,
Expand All @@ -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'
2 changes: 1 addition & 1 deletion packages/client/src/scw/__tests__/client.test.ts
Original file line number Diff line number Diff line change
@@ -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 =
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/scw/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/scw/client-ini-factory.ts
Original file line number Diff line number Diff line change
@@ -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'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/scw/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/scw/errors/standard/index.ts
Original file line number Diff line number Diff line change
@@ -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'
Original file line number Diff line number Diff line change
@@ -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 = <T>(input: T[][] = [], delay = 0) => {
const totalCount = input.flat().length
Expand Down
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
6 changes: 3 additions & 3 deletions scripts/generatePackages.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 5 additions & 2 deletions scripts/updateGlobalSdkPackage.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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'

Expand Down
Loading