diff --git a/locales/en.json b/locales/en.json index 93bce13..f8f24a0 100644 --- a/locales/en.json +++ b/locales/en.json @@ -346,4 +346,4 @@ "invalidWasmCode": "The {path} is a not valid wasm file", "expectedNotFoundGeneric": "We had trouble locating the {name}. Please try again, and contact us if the issue persists.", "unexpectedFileFormat": "We weren't expecting the format {format}. Please report the issue to our team and provide details for a quick fix." -} \ No newline at end of file +} diff --git a/package.json b/package.json index 77035b2..90ad14a 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,6 @@ "lodash-es": "^4.17.21", "multiformats": "^9.9.0", "nanoid": "^3.3.4", - "node-fetch": "2", "ora": "^3.4.0", "press-any-key": "^0.1.1", "prompts": "^2.4.2", @@ -66,14 +65,14 @@ "devDependencies": { "@biomejs/biome": "^1.8.3", "@changesets/cli": "^2.27.6", - "@fleek-platform/errors": "^2.2.4-stg.14", - "@fleek-platform/sdk": "^2.3.0-stg.10", + "@fleek-platform/errors": "workspace:*", + "@fleek-platform/sdk": "workspace:*", "@fleek-platform/tester": "^2.3.0", "@fleek-platform/utils-gateways": "^0.1.2", "@fleek-platform/utils-github": "^0.0.2", "@fleek-platform/utils-ipfs": "^0.4.2", "@fleek-platform/utils-ipns": "^0.1.2", - "@fleek-platform/utils-validation": "^2.2.1-stg.13", + "@fleek-platform/utils-validation": "workspace:*", "@tsconfig/node16": "^16.1.3", "@types/ansi-escapes": "3.0.1", "@types/cli-progress": "^3.11.5", @@ -83,7 +82,6 @@ "@types/glob": "^8.0.1", "@types/lodash": "^4.14.191", "@types/lodash-es": "^4.17.12", - "@types/node-fetch": "^2.6.11", "@types/prompts": "^2.4.2", "@types/semver": "^7.3.13", "@types/update-notifier": "^6.0.8", @@ -97,4 +95,4 @@ "engines": { "node": ">=18.18.2" } -} \ No newline at end of file +} diff --git a/src/commands/applications/prompts/enterApplicationNameOrPrompt.ts b/src/commands/applications/prompts/enterApplicationNameOrPrompt.ts index 2145fcc..da02e0d 100644 --- a/src/commands/applications/prompts/enterApplicationNameOrPrompt.ts +++ b/src/commands/applications/prompts/enterApplicationNameOrPrompt.ts @@ -1,5 +1,5 @@ import { ApplicationNameInvalidError } from '@fleek-platform/errors'; -import type { Application } from '@fleek-platform/sdk'; +import type { Application } from '@fleek-platform/sdk/node'; import { textPrompt } from '../../../prompts/textPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/applications/prompts/getApplicationOrPrompt.ts b/src/commands/applications/prompts/getApplicationOrPrompt.ts index d6343b0..b036900 100644 --- a/src/commands/applications/prompts/getApplicationOrPrompt.ts +++ b/src/commands/applications/prompts/getApplicationOrPrompt.ts @@ -1,5 +1,5 @@ import { ApplicationsNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/applications/utils/parser.ts b/src/commands/applications/utils/parser.ts index 8e1d57b..c42a1a1 100644 --- a/src/commands/applications/utils/parser.ts +++ b/src/commands/applications/utils/parser.ts @@ -1,7 +1,7 @@ import type { ApplicationWhiteLabelDomain, ApplicationWhitelistDomain, -} from '@fleek-platform/sdk'; +} from '@fleek-platform/sdk/node'; type WhitelistDomain = Omit< ApplicationWhitelistDomain, diff --git a/src/commands/auth/login.test.ts b/src/commands/auth/login.test.ts index 4a227fb..a74cd05 100644 --- a/src/commands/auth/login.test.ts +++ b/src/commands/auth/login.test.ts @@ -1,4 +1,4 @@ -import { createClient } from '@fleek-platform/sdk'; +import { createClient } from '@fleek-platform/sdk/node'; import { describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -39,7 +39,7 @@ vi.mock('../../config', () => ({ })); // Assumes user goes ahead with the flow and logs in -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const MockClient = vi.fn(); MockClient.prototype.mutation = vi.fn().mockResolvedValue({ createPersonalAccessTokenFromVerificationSession: 'mockPat', diff --git a/src/commands/auth/login.ts b/src/commands/auth/login.ts index ad18e3a..093db54 100644 --- a/src/commands/auth/login.ts +++ b/src/commands/auth/login.ts @@ -1,4 +1,4 @@ -import { createClient } from '@fleek-platform/sdk'; +import { createClient } from '@fleek-platform/sdk/node'; import { output } from '../../cli'; import { config } from '../../config'; diff --git a/src/commands/domains/create.test.ts b/src/commands/domains/create.test.ts index 63c82fa..ceab498 100644 --- a/src/commands/domains/create.test.ts +++ b/src/commands/domains/create.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -58,7 +58,7 @@ vi.mock('../../utils/pressAnyKey', () => { }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/delete.test.ts b/src/commands/domains/delete.test.ts index ee2820c..f753c3f 100644 --- a/src/commands/domains/delete.test.ts +++ b/src/commands/domains/delete.test.ts @@ -1,5 +1,5 @@ import { DomainNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -37,7 +37,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/detail.test.ts b/src/commands/domains/detail.test.ts index 9b4fc31..d79d821 100644 --- a/src/commands/domains/detail.test.ts +++ b/src/commands/domains/detail.test.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; diff --git a/src/commands/domains/detail.ts b/src/commands/domains/detail.ts index 15a9c56..83faf35 100644 --- a/src/commands/domains/detail.ts +++ b/src/commands/domains/detail.ts @@ -1,4 +1,4 @@ -import type { DomainStatus } from '@fleek-platform/sdk'; +import type { DomainStatus } from '@fleek-platform/sdk/node'; import { output } from '../../cli'; import type { SdkGuardedFunction } from '../../guards/types'; diff --git a/src/commands/domains/list.test.ts b/src/commands/domains/list.test.ts index 0e74900..0de6eff 100644 --- a/src/commands/domains/list.test.ts +++ b/src/commands/domains/list.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -16,7 +16,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/prompts/getDomainOrPrompt.test.ts b/src/commands/domains/prompts/getDomainOrPrompt.test.ts index 3987a7d..a6ccc19 100644 --- a/src/commands/domains/prompts/getDomainOrPrompt.test.ts +++ b/src/commands/domains/prompts/getDomainOrPrompt.test.ts @@ -3,7 +3,7 @@ import { type Domain, FleekSdk, PersonalAccessTokenService, -} from '@fleek-platform/sdk'; +} from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -13,7 +13,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondDomainId'), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/prompts/getDomainOrPrompt.ts b/src/commands/domains/prompts/getDomainOrPrompt.ts index 8d5e3ca..a2e43bc 100644 --- a/src/commands/domains/prompts/getDomainOrPrompt.ts +++ b/src/commands/domains/prompts/getDomainOrPrompt.ts @@ -1,5 +1,5 @@ import { DomainsNotFoundError } from '@fleek-platform/errors'; -import type { Domain, FleekSdk } from '@fleek-platform/sdk'; +import type { Domain, FleekSdk } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts b/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts index 49c236d..858cae9 100644 --- a/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts +++ b/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -50,7 +50,7 @@ vi.mock('../../sites/prompts/getSiteOrPrompt', () => ({ }), })); -vi.mock('@fleek-platform/sdk', () => ({ +vi.mock('@fleek-platform/sdk/node', () => ({ FleekSdk: vi.fn(), PersonalAccessTokenService: vi.fn(), })); diff --git a/src/commands/domains/prompts/getSiteOrPrivateGateway.ts b/src/commands/domains/prompts/getSiteOrPrivateGateway.ts index e7d23fc..0fc8d15 100644 --- a/src/commands/domains/prompts/getSiteOrPrivateGateway.ts +++ b/src/commands/domains/prompts/getSiteOrPrivateGateway.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, PrivateGateway, Site } from '@fleek-platform/sdk'; +import type { FleekSdk, PrivateGateway, Site } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/domains/utils/getSiteDomains.ts b/src/commands/domains/utils/getSiteDomains.ts index 97a797f..7bc05c1 100644 --- a/src/commands/domains/utils/getSiteDomains.ts +++ b/src/commands/domains/utils/getSiteDomains.ts @@ -1,4 +1,4 @@ -import type { Domain, FleekSdk } from '@fleek-platform/sdk'; +import type { Domain, FleekSdk } from '@fleek-platform/sdk/node'; type GetSiteDomainsArgs = { sdk: FleekSdk; diff --git a/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts b/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts index a344b6e..82e95ef 100644 --- a/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts +++ b/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts @@ -1,4 +1,9 @@ -import type { FleekSdk, PrivateGateway, Site, Zone } from '@fleek-platform/sdk'; +import type { + FleekSdk, + PrivateGateway, + Site, + Zone, +} from '@fleek-platform/sdk/node'; import { waitForZoneCreationResult } from '../wait/waitForZoneCreationResult'; diff --git a/src/commands/domains/verify.test.ts b/src/commands/domains/verify.test.ts index d6521ca..ba796a8 100644 --- a/src/commands/domains/verify.test.ts +++ b/src/commands/domains/verify.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -42,7 +42,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/verify.ts b/src/commands/domains/verify.ts index e80e84b..46034a6 100644 --- a/src/commands/domains/verify.ts +++ b/src/commands/domains/verify.ts @@ -1,4 +1,4 @@ -import type { Domain } from '@fleek-platform/sdk'; +import type { Domain } from '@fleek-platform/sdk/node'; import { output } from '../../cli'; import type { SdkGuardedFunction } from '../../guards/types'; diff --git a/src/commands/domains/wait/waitForDomainCreationResult.ts b/src/commands/domains/wait/waitForDomainCreationResult.ts index 610bd52..e76445b 100644 --- a/src/commands/domains/wait/waitForDomainCreationResult.ts +++ b/src/commands/domains/wait/waitForDomainCreationResult.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/domains/wait/waitForDomainVerificationResult.ts b/src/commands/domains/wait/waitForDomainVerificationResult.ts index 24bfdb0..2d365cf 100644 --- a/src/commands/domains/wait/waitForDomainVerificationResult.ts +++ b/src/commands/domains/wait/waitForDomainVerificationResult.ts @@ -1,4 +1,4 @@ -import type { Domain, FleekSdk } from '@fleek-platform/sdk'; +import type { Domain, FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/domains/wait/waitForZoneCreationResult.ts b/src/commands/domains/wait/waitForZoneCreationResult.ts index 7930086..9042368 100644 --- a/src/commands/domains/wait/waitForZoneCreationResult.ts +++ b/src/commands/domains/wait/waitForZoneCreationResult.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, Zone } from '@fleek-platform/sdk'; +import type { FleekSdk, Zone } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/domains/wait/waitUntilDomainDeleted.ts b/src/commands/domains/wait/waitUntilDomainDeleted.ts index f5efca1..7975b26 100644 --- a/src/commands/domains/wait/waitUntilDomainDeleted.ts +++ b/src/commands/domains/wait/waitUntilDomainDeleted.ts @@ -1,4 +1,4 @@ -import type { Domain, FleekSdk } from '@fleek-platform/sdk'; +import type { Domain, FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/domains/wait/waitUntilZoneDeleted.ts b/src/commands/domains/wait/waitUntilZoneDeleted.ts index f4fdff7..ac99e8c 100644 --- a/src/commands/domains/wait/waitUntilZoneDeleted.ts +++ b/src/commands/domains/wait/waitUntilZoneDeleted.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, Zone } from '@fleek-platform/sdk'; +import type { FleekSdk, Zone } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/ens/create.test.ts b/src/commands/ens/create.test.ts index 49552fe..7777087 100644 --- a/src/commands/ens/create.test.ts +++ b/src/commands/ens/create.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -60,7 +60,7 @@ vi.mock('../../utils/pressAnyKey', () => { }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ipns = { diff --git a/src/commands/ens/delete.test.ts b/src/commands/ens/delete.test.ts index 85259d8..1fac881 100644 --- a/src/commands/ens/delete.test.ts +++ b/src/commands/ens/delete.test.ts @@ -1,5 +1,5 @@ import { EnsRecordNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -38,7 +38,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/ens/detail.test.ts b/src/commands/ens/detail.test.ts index 9250be0..bc0d46b 100644 --- a/src/commands/ens/detail.test.ts +++ b/src/commands/ens/detail.test.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; diff --git a/src/commands/ens/list.test.ts b/src/commands/ens/list.test.ts index 3613a7d..1a1dc8b 100644 --- a/src/commands/ens/list.test.ts +++ b/src/commands/ens/list.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output as fakeOutput } from '../../cli'; @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/ens/prompts/getEnsRecordOrPrompt.ts b/src/commands/ens/prompts/getEnsRecordOrPrompt.ts index 484f73e..50d31a0 100644 --- a/src/commands/ens/prompts/getEnsRecordOrPrompt.ts +++ b/src/commands/ens/prompts/getEnsRecordOrPrompt.ts @@ -1,5 +1,5 @@ import { EnsRecordNotFoundError } from '@fleek-platform/errors'; -import type { EnsRecord, FleekSdk } from '@fleek-platform/sdk'; +import type { EnsRecord, FleekSdk } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/ens/prompts/getIpnsRecordOrPrompt.ts b/src/commands/ens/prompts/getIpnsRecordOrPrompt.ts index 6a8448c..a7c5c9c 100644 --- a/src/commands/ens/prompts/getIpnsRecordOrPrompt.ts +++ b/src/commands/ens/prompts/getIpnsRecordOrPrompt.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, IpnsRecord } from '@fleek-platform/sdk'; +import type { FleekSdk, IpnsRecord } from '@fleek-platform/sdk/node'; import { output } from '../../../cli'; import { selectPrompt } from '../../../prompts/selectPrompt'; diff --git a/src/commands/ens/utils/getSiteEnsRecords.ts b/src/commands/ens/utils/getSiteEnsRecords.ts index 4868328..87b479e 100644 --- a/src/commands/ens/utils/getSiteEnsRecords.ts +++ b/src/commands/ens/utils/getSiteEnsRecords.ts @@ -1,4 +1,4 @@ -import type { EnsRecord, FleekSdk, Site } from '@fleek-platform/sdk'; +import type { EnsRecord, FleekSdk, Site } from '@fleek-platform/sdk/node'; type GetSiteEnsRecordsArgs = { sdk: FleekSdk; diff --git a/src/commands/ens/verify.test.ts b/src/commands/ens/verify.test.ts index c1b1677..ab50570 100644 --- a/src/commands/ens/verify.test.ts +++ b/src/commands/ens/verify.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -43,7 +43,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/ens/verify.ts b/src/commands/ens/verify.ts index b18d6ff..c0ccd46 100644 --- a/src/commands/ens/verify.ts +++ b/src/commands/ens/verify.ts @@ -1,4 +1,4 @@ -import type { EnsRecord } from '@fleek-platform/sdk'; +import type { EnsRecord } from '@fleek-platform/sdk/node'; import { output } from '../../cli'; import type { SdkGuardedFunction } from '../../guards/types'; diff --git a/src/commands/ens/wait/waitForEnsRecordCreationResult.ts b/src/commands/ens/wait/waitForEnsRecordCreationResult.ts index 5273b6d..ad4c257 100644 --- a/src/commands/ens/wait/waitForEnsRecordCreationResult.ts +++ b/src/commands/ens/wait/waitForEnsRecordCreationResult.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/ens/wait/waitForEnsRecordVerificationResult.ts b/src/commands/ens/wait/waitForEnsRecordVerificationResult.ts index 9221cd6..6044517 100644 --- a/src/commands/ens/wait/waitForEnsRecordVerificationResult.ts +++ b/src/commands/ens/wait/waitForEnsRecordVerificationResult.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/ens/wait/waitUntilEnsRecordDeleted.ts b/src/commands/ens/wait/waitUntilEnsRecordDeleted.ts index bea526e..98c6da0 100644 --- a/src/commands/ens/wait/waitUntilEnsRecordDeleted.ts +++ b/src/commands/ens/wait/waitUntilEnsRecordDeleted.ts @@ -1,4 +1,4 @@ -import type { EnsRecord, FleekSdk } from '@fleek-platform/sdk'; +import type { EnsRecord, FleekSdk } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../../../utils/checkPeriodicallyUntil'; diff --git a/src/commands/functions/deploy.ts b/src/commands/functions/deploy.ts index 848ab48..5a1108c 100644 --- a/src/commands/functions/deploy.ts +++ b/src/commands/functions/deploy.ts @@ -1,5 +1,4 @@ import fs from 'node:fs'; -import fetch from 'node-fetch'; import cliProgress from 'cli-progress'; import { blake3 } from 'hash-wasm'; @@ -10,14 +9,16 @@ import { uploadOnProgress } from '../../output/utils/uploadOnProgress'; import { t } from '../../utils/translation'; import { getFunctionOrPrompt } from './prompts/getFunctionOrPrompt'; import { getFunctionPathOrPrompt } from './prompts/getFunctionPathOrPrompt'; -import { getJsCodeFromPath, getFileLikeObject } from './utils/getJsCodeFromPath'; +import { + getJsCodeFromPath, + getFileLikeObject, +} from './utils/getJsCodeFromPath'; import { getEnvironmentVariables } from './utils/parseEnvironmentVariables'; import { waitUntilFileAvailable } from './wait/waitUntilFileAvailable'; -import type { UploadPinResponse } from '@fleek-platform/sdk'; +import type { UploadPinResponse } from '@fleek-platform/sdk/node'; import { getWasmCodeFromPath } from './utils/getWasmCodeFromPath'; - type DeployActionArgs = { filePath?: string; name?: string; @@ -48,12 +49,13 @@ const deployAction: SdkGuardedFunction = async ({ return; } - const filePathToUpload = sgx ? await getWasmCodeFromPath({ filePath }) + const filePathToUpload = sgx + ? await getWasmCodeFromPath({ filePath }) : await getJsCodeFromPath({ - filePath, - bundle, - env, - }); + filePath, + bundle, + env, + }); output.printNewLine(); @@ -78,7 +80,6 @@ const deployAction: SdkGuardedFunction = async ({ options: { functionName: functionToDeploy.name }, onUploadProgress: uploadOnProgress(progressBar), }); - } let b3Hash; @@ -151,22 +152,27 @@ const deployAction: SdkGuardedFunction = async ({ // this is a temporarily hack until dalton comes up with a fix on network output.spinner(t('runningAvailabilityCheck')); try { - await fetch(`https://fleek-test.network/services/0/ipfs/${uploadResult.pin.cid}`) + await fetch( + `https://fleek-test.network/services/0/ipfs/${uploadResult.pin.cid}`, + ); } catch { - output.error(t('networkFetchFailed')) - return + output.error(t('networkFetchFailed')); + return; } - output.link("https://fleek-test.network/services/3"); + output.link('https://fleek-test.network/services/3'); output.printNewLine(); - output.link(`Blake3 Hash: ${b3Hash} `) - output.link(`Invoke by sending request to https://fleek-test.network/services/3 with payload of {hash: , decrypt: true, inputs: "foo"}`) - output.link(`Example: curl fleek-test.network/services/3 --data '{"hash": "${b3Hash}", "decrypt": true, "input": "foo"}'`) + output.link(`Blake3 Hash: ${b3Hash} `); + output.link( + `Invoke by sending request to https://fleek-test.network/services/3 with payload of {hash: , decrypt: true, inputs: "foo"}`, + ); + output.link( + `Example: curl fleek-test.network/services/3 --data '{"hash": "${b3Hash}", "decrypt": true, "input": "foo"}'`, + ); } else { output.link( `https://fleek-test.network/services/1/ipfs/${uploadResult.pin.cid}`, ); - } } }; diff --git a/src/commands/functions/prompts/getFunctionOrPrompt.test.ts b/src/commands/functions/prompts/getFunctionOrPrompt.test.ts index af536ba..6ccde3d 100644 --- a/src/commands/functions/prompts/getFunctionOrPrompt.test.ts +++ b/src/commands/functions/prompts/getFunctionOrPrompt.test.ts @@ -1,5 +1,5 @@ import { FleekFunctionsNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondFunctionId'), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const functions = { diff --git a/src/commands/functions/prompts/getFunctionOrPrompt.ts b/src/commands/functions/prompts/getFunctionOrPrompt.ts index 6477a13..c91767d 100644 --- a/src/commands/functions/prompts/getFunctionOrPrompt.ts +++ b/src/commands/functions/prompts/getFunctionOrPrompt.ts @@ -1,5 +1,5 @@ import { FleekFunctionsNotFoundError } from '@fleek-platform/errors'; -import type { FleekFunction, FleekSdk } from '@fleek-platform/sdk'; +import type { FleekFunction, FleekSdk } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/functions/prompts/getFunctionStatusOrPrompt.ts b/src/commands/functions/prompts/getFunctionStatusOrPrompt.ts index 0746d29..778ec0f 100644 --- a/src/commands/functions/prompts/getFunctionStatusOrPrompt.ts +++ b/src/commands/functions/prompts/getFunctionStatusOrPrompt.ts @@ -1,5 +1,5 @@ import { FleekFunctionStatusNotValidError } from '@fleek-platform/errors'; -import type { FleekFunctionStatus } from '@fleek-platform/sdk'; +import type { FleekFunctionStatus } from '@fleek-platform/sdk/node'; import { isFunctionStatusValid } from '@fleek-platform/utils-validation'; type GetFunctionStatusOrPromptArgs = { diff --git a/src/commands/functions/utils/getJsCodeFromPath.ts b/src/commands/functions/utils/getJsCodeFromPath.ts index 5d871da..60b720a 100644 --- a/src/commands/functions/utils/getJsCodeFromPath.ts +++ b/src/commands/functions/utils/getJsCodeFromPath.ts @@ -139,9 +139,9 @@ globalThis.fleek={env:{${buildEnvVars({ env })}}};`, const errorMessage = e && - typeof e === 'object' && - 'message' in e && - typeof e.message === 'string' + typeof e === 'object' && + 'message' in e && + typeof e.message === 'string' ? e.message : t('unknownTransformError'); diff --git a/src/commands/functions/utils/getWasmCodeFromPath.ts b/src/commands/functions/utils/getWasmCodeFromPath.ts index 8cef129..a108fbf 100644 --- a/src/commands/functions/utils/getWasmCodeFromPath.ts +++ b/src/commands/functions/utils/getWasmCodeFromPath.ts @@ -6,87 +6,86 @@ import { t } from '../../../utils/translation'; import cliProgress from 'cli-progress'; import { encrypt } from 'eciesjs'; import { - FleekFunctionPathNotValidError, - FleekFunctionWasmEncryptionFailedError, - FleekFunctionInvalidWasmCodeError, + FleekFunctionPathNotValidError, + FleekFunctionWasmEncryptionFailedError, + FleekFunctionInvalidWasmCodeError, } from '@fleek-platform/errors'; - -const PUBLIC_KEY = '03a3fe41244add26af1f820d2acb4ad22b158ff7b69ce41401bf932d7734eb5d49'; +const PUBLIC_KEY = + '03a3fe41244add26af1f820d2acb4ad22b158ff7b69ce41401bf932d7734eb5d49'; const getWasm = async (filePath: string) => { - const buffer = await fs.promises.readFile(filePath); - if (buffer.length < 8) { - return null; - } - - // WebAssembly namespace is only supported in dom in typescript - // https://webassembly.github.io/spec/core/binary/modules.html#binary-module - const wasmMagicNumber = [0x00, 0x61, 0x73, 0x6d]; - for (let i = 0; i < 4; i++) { - if (buffer[i] !== wasmMagicNumber[i]) { - return null; - } + const buffer = await fs.promises.readFile(filePath); + if (buffer.length < 8) { + return null; + } + + // WebAssembly namespace is only supported in dom in typescript + // https://webassembly.github.io/spec/core/binary/modules.html#binary-module + const wasmMagicNumber = [0x00, 0x61, 0x73, 0x6d]; + for (let i = 0; i < 4; i++) { + if (buffer[i] !== wasmMagicNumber[i]) { + return null; } - return buffer + } + return buffer; }; const enryptCode = async (args: { filePath: string }) => { - const { filePath } = args; - - const buffer = await getWasm(filePath); - if (!buffer) { - output.error(t('invalidWasmCode', { path: filePath })); - throw new FleekFunctionInvalidWasmCodeError({}) - } - - const progressBar = new cliProgress.SingleBar( - { - format: t('uploadProgress', { - action: t('encryptingCode'), - }), - }, - cliProgress.Presets.shades_grey, - ); - - let tempDir: string; - - if (!output.debugEnabled) { - tempDir = os.tmpdir(); - } else { - tempDir = '.fleek'; - - if (!fs.existsSync(tempDir)) { - fs.mkdirSync(tempDir); - } + const { filePath } = args; + + const buffer = await getWasm(filePath); + if (!buffer) { + output.error(t('invalidWasmCode', { path: filePath })); + throw new FleekFunctionInvalidWasmCodeError({}); + } + + const progressBar = new cliProgress.SingleBar( + { + format: t('uploadProgress', { + action: t('encryptingCode'), + }), + }, + cliProgress.Presets.shades_grey, + ); + + let tempDir: string; + + if (!output.debugEnabled) { + tempDir = os.tmpdir(); + } else { + tempDir = '.fleek'; + + if (!fs.existsSync(tempDir)) { + fs.mkdirSync(tempDir); } - const outFile = `${tempDir}/function.wasm`; - - progressBar.start(100, 10); - try { - const encryptedData = encrypt(PUBLIC_KEY, buffer); - progressBar.update(50); + } + const outFile = `${tempDir}/function.wasm`; - await fs.promises.writeFile(outFile, encryptedData); - } catch (error) { - progressBar.stop(); - throw new FleekFunctionWasmEncryptionFailedError({}) + progressBar.start(100, 10); + try { + const encryptedData = encrypt(PUBLIC_KEY, buffer); + progressBar.update(50); - } - progressBar.update(100); + await fs.promises.writeFile(outFile, encryptedData); + } catch (error) { progressBar.stop(); + throw new FleekFunctionWasmEncryptionFailedError({}); + } + progressBar.update(100); + progressBar.stop(); - return outFile; + return outFile; }; export const getWasmCodeFromPath = async (args: { - filePath: string; + filePath: string; }) => { - const { filePath } = args; + const { filePath } = args; - if (!fs.existsSync(filePath)) { - throw new FleekFunctionPathNotValidError({ path: filePath }); - } + if (!fs.existsSync(filePath)) { + throw new FleekFunctionPathNotValidError({ path: filePath }); + } - return enryptCode({ filePath }); -}; \ No newline at end of file + return enryptCode({ filePath }); +}; diff --git a/src/commands/gateways/create.test.ts b/src/commands/gateways/create.test.ts index 2cf120a..086b854 100644 --- a/src/commands/gateways/create.test.ts +++ b/src/commands/gateways/create.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -34,7 +34,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/gateways/delete.test.ts b/src/commands/gateways/delete.test.ts index 13aa35f..c677817 100644 --- a/src/commands/gateways/delete.test.ts +++ b/src/commands/gateways/delete.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -38,7 +38,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/gateways/detail.test.ts b/src/commands/gateways/detail.test.ts index a5204f9..d4be674 100644 --- a/src/commands/gateways/detail.test.ts +++ b/src/commands/gateways/detail.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -26,7 +26,7 @@ vi.mock('./prompts/getPrivateGatewayOrPrompt', () => ({ }), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/gateways/list.test.ts b/src/commands/gateways/list.test.ts index 7805c1d..ef8dfe6 100644 --- a/src/commands/gateways/list.test.ts +++ b/src/commands/gateways/list.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -13,7 +13,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts b/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts index ddba598..3be05c9 100644 --- a/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts +++ b/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts @@ -1,5 +1,5 @@ import { PrivateGatewaysNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; // eslint-disable-next-line no-restricted-imports import prompts from 'prompts'; import { type Mock, beforeEach, describe, expect, it, vi } from 'vitest'; @@ -10,7 +10,7 @@ vi.mock('prompts', () => ({ default: vi.fn().mockResolvedValue({ value: 'secondPrivateGatewayId' }), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.ts b/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.ts index 73f0218..fba091e 100644 --- a/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.ts +++ b/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.ts @@ -1,5 +1,5 @@ import { PrivateGatewaysNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts b/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts index 136b522..754cce1 100644 --- a/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts +++ b/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { @@ -6,7 +6,7 @@ import { getAllPrivateGatewayDomains, } from './getAllPrivateGatewayDomains'; -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/gateways/utils/getAllPrivateGatewayDomains.ts b/src/commands/gateways/utils/getAllPrivateGatewayDomains.ts index 9e6c847..67548c7 100644 --- a/src/commands/gateways/utils/getAllPrivateGatewayDomains.ts +++ b/src/commands/gateways/utils/getAllPrivateGatewayDomains.ts @@ -1,4 +1,4 @@ -import type { Domain, DomainStatus, FleekSdk } from '@fleek-platform/sdk'; +import type { Domain, DomainStatus, FleekSdk } from '@fleek-platform/sdk/node'; type DomainFilter = { status?: DomainStatus; diff --git a/src/commands/ipfs/utils/uploadPathOnIpfs.ts b/src/commands/ipfs/utils/uploadPathOnIpfs.ts index e0c24b7..7da7730 100644 --- a/src/commands/ipfs/utils/uploadPathOnIpfs.ts +++ b/src/commands/ipfs/utils/uploadPathOnIpfs.ts @@ -1,6 +1,6 @@ import { promises as fs } from 'node:fs'; import { basename } from 'node:path'; -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; type UploadPathOnIpfsArgs = { sdk: FleekSdk; diff --git a/src/commands/ipns/prompts/getRecordOrPrompt.test.ts b/src/commands/ipns/prompts/getRecordOrPrompt.test.ts index 3fed966..a3866de 100644 --- a/src/commands/ipns/prompts/getRecordOrPrompt.test.ts +++ b/src/commands/ipns/prompts/getRecordOrPrompt.test.ts @@ -1,5 +1,5 @@ import { IpnsRecordsNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondRecordId'), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ipns = { diff --git a/src/commands/ipns/prompts/getRecordOrPrompt.ts b/src/commands/ipns/prompts/getRecordOrPrompt.ts index 2018d0a..a0f6d15 100644 --- a/src/commands/ipns/prompts/getRecordOrPrompt.ts +++ b/src/commands/ipns/prompts/getRecordOrPrompt.ts @@ -1,5 +1,5 @@ import { IpnsRecordsNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk, IpnsRecord } from '@fleek-platform/sdk'; +import type { FleekSdk, IpnsRecord } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/ipns/prompts/getSiteToAssignRecordOrPrompt.ts b/src/commands/ipns/prompts/getSiteToAssignRecordOrPrompt.ts index 53e4af8..318b1a6 100644 --- a/src/commands/ipns/prompts/getSiteToAssignRecordOrPrompt.ts +++ b/src/commands/ipns/prompts/getSiteToAssignRecordOrPrompt.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, Site } from '@fleek-platform/sdk'; +import type { FleekSdk, Site } from '@fleek-platform/sdk/node'; import { confirmPrompt } from '../../../prompts/confirmPrompt'; import { getSiteOrPrompt } from '../../sites/prompts/getSiteOrPrompt'; diff --git a/src/commands/pat/create.ts b/src/commands/pat/create.ts index beaa139..1f09f56 100644 --- a/src/commands/pat/create.ts +++ b/src/commands/pat/create.ts @@ -1,4 +1,4 @@ -import { createClient } from '@fleek-platform/sdk'; +import { createClient } from '@fleek-platform/sdk/node'; import { output } from '../../cli'; import { getPersonalAccessTokenNameOrPrompt } from '../../utils/prompts/getPersonalAccessTokenNameOrPrompt'; diff --git a/src/commands/pat/utils/deletePersonalAccessToken.ts b/src/commands/pat/utils/deletePersonalAccessToken.ts index 887e9ac..82c3b31 100644 --- a/src/commands/pat/utils/deletePersonalAccessToken.ts +++ b/src/commands/pat/utils/deletePersonalAccessToken.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import type { Output } from '../../../output/Output'; import { t } from '../../../utils/translation'; diff --git a/src/commands/projects/create.test.ts b/src/commands/projects/create.test.ts index 4693fdd..1cdeea1 100644 --- a/src/commands/projects/create.test.ts +++ b/src/commands/projects/create.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -28,7 +28,7 @@ vi.mock('../../config', () => { return { config }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const projects = { diff --git a/src/commands/projects/list.test.ts b/src/commands/projects/list.test.ts index c7d834c..8d49aea 100644 --- a/src/commands/projects/list.test.ts +++ b/src/commands/projects/list.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -22,7 +22,7 @@ vi.mock('../../config', () => { return { config }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const projects = { diff --git a/src/commands/projects/prompts/getProjectOrPrompt.test.ts b/src/commands/projects/prompts/getProjectOrPrompt.test.ts index bb0d58b..e4b5cd8 100644 --- a/src/commands/projects/prompts/getProjectOrPrompt.test.ts +++ b/src/commands/projects/prompts/getProjectOrPrompt.test.ts @@ -1,5 +1,5 @@ import { ProjectsNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondProjectId'), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const projects = { diff --git a/src/commands/projects/prompts/getProjectOrPrompt.ts b/src/commands/projects/prompts/getProjectOrPrompt.ts index 4d68bcb..19c35cb 100644 --- a/src/commands/projects/prompts/getProjectOrPrompt.ts +++ b/src/commands/projects/prompts/getProjectOrPrompt.ts @@ -1,5 +1,5 @@ import { ProjectsNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk, Project } from '@fleek-platform/sdk'; +import type { FleekSdk, Project } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/projects/switch.test.ts b/src/commands/projects/switch.test.ts index dd34e04..b494aa0 100644 --- a/src/commands/projects/switch.test.ts +++ b/src/commands/projects/switch.test.ts @@ -1,5 +1,5 @@ import { ProjectsNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -34,7 +34,7 @@ vi.mock('./create', () => ({ createProjectActionHandler: vi.fn().mockResolvedValue(undefined), })); -vi.mock('@fleek-platform/sdk', () => ({})); +vi.mock('@fleek-platform/sdk/node', () => ({})); describe('Switch between projects', () => { it('should switch to project by given id', async () => { diff --git a/src/commands/sites/prompts/getSiteOrPrompt.test.ts b/src/commands/sites/prompts/getSiteOrPrompt.test.ts index 79cc30c..98357b8 100644 --- a/src/commands/sites/prompts/getSiteOrPrompt.test.ts +++ b/src/commands/sites/prompts/getSiteOrPrompt.test.ts @@ -1,5 +1,5 @@ import { SitesNotFoundError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { selectPrompt } from '../../../prompts/selectPrompt'; @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondSiteId'), })); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const sites = { diff --git a/src/commands/sites/prompts/getSiteOrPrompt.ts b/src/commands/sites/prompts/getSiteOrPrompt.ts index 50971b6..ad31dae 100644 --- a/src/commands/sites/prompts/getSiteOrPrompt.ts +++ b/src/commands/sites/prompts/getSiteOrPrompt.ts @@ -1,5 +1,5 @@ import { SitesNotFoundError } from '@fleek-platform/errors'; -import type { FleekSdk, Site } from '@fleek-platform/sdk'; +import type { FleekSdk, Site } from '@fleek-platform/sdk/node'; import { selectPrompt } from '../../../prompts/selectPrompt'; import { t } from '../../../utils/translation'; diff --git a/src/commands/sites/utils/chooseOrCreateSite.ts b/src/commands/sites/utils/chooseOrCreateSite.ts index d807c63..3537f61 100644 --- a/src/commands/sites/utils/chooseOrCreateSite.ts +++ b/src/commands/sites/utils/chooseOrCreateSite.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, Site } from '@fleek-platform/sdk'; +import type { FleekSdk, Site } from '@fleek-platform/sdk/node'; import { output } from '../../../cli'; import { t } from '../../../utils/translation'; diff --git a/src/commands/sites/utils/createSite.ts b/src/commands/sites/utils/createSite.ts index 20903ed..d9ee7d9 100644 --- a/src/commands/sites/utils/createSite.ts +++ b/src/commands/sites/utils/createSite.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { output } from '../../../cli'; import { t } from '../../../utils/translation'; diff --git a/src/commands/sites/utils/initConfiguration.ts b/src/commands/sites/utils/initConfiguration.ts index 5c956f5..8115c96 100644 --- a/src/commands/sites/utils/initConfiguration.ts +++ b/src/commands/sites/utils/initConfiguration.ts @@ -1,4 +1,4 @@ -import type { Site } from '@fleek-platform/sdk'; +import type { Site } from '@fleek-platform/sdk/node'; import { saveConfiguration } from '../../../utils/configuration/saveConfiguration'; import type { FleekRootConfig } from '../../../utils/configuration/types'; diff --git a/src/commands/sites/utils/initCongifuration.ts b/src/commands/sites/utils/initCongifuration.ts index b74a7c2..38191af 100644 --- a/src/commands/sites/utils/initCongifuration.ts +++ b/src/commands/sites/utils/initCongifuration.ts @@ -1,5 +1,5 @@ // TODO: rename this filename, fix typoe congifuration -> configuration -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { saveConfiguration } from '../../../utils/configuration/saveConfiguration'; import type { FleekRootConfig } from '../../../utils/configuration/types'; diff --git a/src/commands/sites/utils/printDeploymentsTable.ts b/src/commands/sites/utils/printDeploymentsTable.ts index aab5fca..81ee4de 100644 --- a/src/commands/sites/utils/printDeploymentsTable.ts +++ b/src/commands/sites/utils/printDeploymentsTable.ts @@ -1,4 +1,4 @@ -import type { Deployment } from '@fleek-platform/sdk'; +import type { Deployment } from '@fleek-platform/sdk/node'; import type { Output } from '../../../output/Output'; import { t } from '../../../utils/translation'; diff --git a/src/commands/sites/utils/returnDeploymentWhenFinished.ts b/src/commands/sites/utils/returnDeploymentWhenFinished.ts index c39d1eb..a97cb48 100644 --- a/src/commands/sites/utils/returnDeploymentWhenFinished.ts +++ b/src/commands/sites/utils/returnDeploymentWhenFinished.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; type ReturnDeploymentWhenFinishedArgs = { sdk: FleekSdk; diff --git a/src/commands/sites/utils/waitUntilDeploymentFinishedAndInformUser.ts b/src/commands/sites/utils/waitUntilDeploymentFinishedAndInformUser.ts index 719257a..9143512 100644 --- a/src/commands/sites/utils/waitUntilDeploymentFinishedAndInformUser.ts +++ b/src/commands/sites/utils/waitUntilDeploymentFinishedAndInformUser.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; import { getFleekDefaultGatewayBySlug } from '@fleek-platform/utils-gateways'; import type { Output } from '../../../output/Output'; diff --git a/src/commands/storage/delete.test.ts b/src/commands/storage/delete.test.ts index 7c2e26a..f9dafec 100644 --- a/src/commands/storage/delete.test.ts +++ b/src/commands/storage/delete.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -14,7 +14,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const storage = { diff --git a/src/commands/storage/get.test.ts b/src/commands/storage/get.test.ts index 4a283d6..2447976 100644 --- a/src/commands/storage/get.test.ts +++ b/src/commands/storage/get.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const storage = { diff --git a/src/commands/storage/get.ts b/src/commands/storage/get.ts index 893e239..ac4debb 100644 --- a/src/commands/storage/get.ts +++ b/src/commands/storage/get.ts @@ -7,7 +7,7 @@ import { withGuards } from '../../guards/withGuards'; import { t } from '../../utils/translation'; import { createOutputTable } from './utils/CreateOutputTable'; -import type { StoragePin } from '@fleek-platform/sdk'; +import type { StoragePin } from '@fleek-platform/sdk/node'; type GetActionArgs = { cid?: string; diff --git a/src/commands/storage/list.test.ts b/src/commands/storage/list.test.ts index 2ad5eec..482099d 100644 --- a/src/commands/storage/list.test.ts +++ b/src/commands/storage/list.test.ts @@ -1,4 +1,4 @@ -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { type Mock, describe, expect, it, vi } from 'vitest'; import { output } from '../../cli'; @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk', () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const storage = { diff --git a/src/commands/storage/utils/CreateOutputTable.ts b/src/commands/storage/utils/CreateOutputTable.ts index 00302d8..ebae91b 100644 --- a/src/commands/storage/utils/CreateOutputTable.ts +++ b/src/commands/storage/utils/CreateOutputTable.ts @@ -1,4 +1,4 @@ -import type { FleekSdk, StoragePin } from '@fleek-platform/sdk'; +import type { FleekSdk, StoragePin } from '@fleek-platform/sdk/node'; import { getCfIpfsGatewayUrl, getPrivateIpfsGatewayUrl, diff --git a/src/global.d.ts b/src/global.d.ts index 2704cdf..a149d3d 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -1 +1,3 @@ declare module 'update-notifier-cjs'; +declare module 'files-from-path'; +declare module 'multiformats'; diff --git a/src/guards/sdkGuard.ts b/src/guards/sdkGuard.ts index ada1291..d1a4046 100644 --- a/src/guards/sdkGuard.ts +++ b/src/guards/sdkGuard.ts @@ -1,5 +1,5 @@ import { UnauthenticatedError } from '@fleek-platform/errors'; -import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk'; +import { FleekSdk, PersonalAccessTokenService } from '@fleek-platform/sdk/node'; import { getDefined } from '../defined'; import { output } from '../cli'; diff --git a/src/guards/types.ts b/src/guards/types.ts index eebdc5d..37139a6 100644 --- a/src/guards/types.ts +++ b/src/guards/types.ts @@ -1,4 +1,4 @@ -import type { FleekSdk } from '@fleek-platform/sdk'; +import type { FleekSdk } from '@fleek-platform/sdk/node'; type NoArgumentsType = never; diff --git a/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts b/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts index c54896e..192d2d5 100644 --- a/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts +++ b/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts @@ -1,4 +1,4 @@ -import type { Client } from '@fleek-platform/sdk'; +import type { Client } from '@fleek-platform/sdk/node'; import { checkPeriodicallyUntil } from '../checkPeriodicallyUntil'; @@ -19,10 +19,16 @@ export const waitForPersonalAccessTokenFromVerificationSession = async ({ conditionFn: async () => { const response = await client .mutation({ - createPersonalAccessTokenFromVerificationSession: [ - { where: { id: verificationSessionId }, data: { name } }, - ], - + createPersonalAccessTokenFromVerificationSession: { + __args: { + where: { + id: verificationSessionId, + }, + data: { + name, + }, + }, + }, }) .catch(() => null); diff --git a/tsconfig.json b/tsconfig.json index 85e50c0..825b2b5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "resolveJsonModule": true, "allowSyntheticDefaultImports": true, "noImplicitAny": true, - "moduleResolution": "node", + "moduleResolution": "nodenext", "sourceMap": true, "outDir": "dist", "useUnknownInCatchVariables": true, @@ -14,5 +14,5 @@ }, "include": ["src/**/*", "global.d.ts", "locales/*.d.ts"], "exclude": ["dist", "**/node_modules", "**/*.test.ts"], - "extends": "@tsconfig/node16/tsconfig.json", + "extends": "@tsconfig/node16/tsconfig.json" }