From e52c9ecc7335cc85fe355716f8b240517d6c97dc Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 09:31:47 +0100 Subject: [PATCH 1/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20Prepare=20dependenc?= =?UTF-8?q?y=20for=20SDK=203.2.0=20(release-candidate)=20=20(#23)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Why? Prepare dependency for SDK 3.2.0 (release-candidate) ## How? - Start with "workspace" protocol - When ready, will point to latest public build of SDK ## Tickets? - [Ticket 1](the-ticket-url-here) - [Ticket 2](the-ticket-url-here) - [Ticket 3](the-ticket-url-here) ## Contribution checklist? - [ ] The commit messages are detailed - [ ] The `build` command runs locally - [ ] Assets or static content are linked and stored in the project - [ ] You have manually tested - [ ] You have provided tests ## Security checklist? - [ ] Sensitive data has been identified and is being protected properly - [ ] Injection has been prevented (parameterized queries, no eval or system calls) ## Preview? Optionally, provide the preview url here --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 77035b2..e3cc750 100644 --- a/package.json +++ b/package.json @@ -66,8 +66,8 @@ "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", From aa73bbb63b2761cee70aa3afcdf699624d7fd7d0 Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:57:12 +0100 Subject: [PATCH 2/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20import=20sdk/node?= =?UTF-8?q?=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applications/prompts/enterApplicationNameOrPrompt.ts | 2 +- src/commands/applications/prompts/getApplicationOrPrompt.ts | 2 +- src/commands/applications/utils/parser.ts | 2 +- src/commands/auth/login.test.ts | 4 ++-- src/commands/auth/login.ts | 2 +- src/commands/domains/create.test.ts | 4 ++-- src/commands/domains/delete.test.ts | 4 ++-- src/commands/domains/detail.test.ts | 2 +- src/commands/domains/detail.ts | 2 +- src/commands/domains/list.test.ts | 4 ++-- src/commands/domains/prompts/getDomainOrPrompt.test.ts | 4 ++-- src/commands/domains/prompts/getDomainOrPrompt.ts | 2 +- src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts | 4 ++-- src/commands/domains/prompts/getSiteOrPrivateGateway.ts | 2 +- src/commands/domains/utils/getSiteDomains.ts | 2 +- src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts | 2 +- src/commands/domains/verify.test.ts | 4 ++-- src/commands/domains/verify.ts | 2 +- src/commands/domains/wait/waitForDomainCreationResult.ts | 2 +- src/commands/domains/wait/waitForDomainVerificationResult.ts | 2 +- src/commands/domains/wait/waitForZoneCreationResult.ts | 2 +- src/commands/domains/wait/waitUntilDomainDeleted.ts | 2 +- src/commands/domains/wait/waitUntilZoneDeleted.ts | 2 +- src/commands/ens/create.test.ts | 4 ++-- src/commands/ens/delete.test.ts | 4 ++-- src/commands/ens/detail.test.ts | 2 +- src/commands/ens/list.test.ts | 4 ++-- src/commands/ens/prompts/getEnsRecordOrPrompt.ts | 2 +- src/commands/ens/prompts/getIpnsRecordOrPrompt.ts | 2 +- src/commands/ens/utils/getSiteEnsRecords.ts | 2 +- src/commands/ens/verify.test.ts | 4 ++-- src/commands/ens/verify.ts | 2 +- src/commands/ens/wait/waitForEnsRecordCreationResult.ts | 2 +- src/commands/ens/wait/waitForEnsRecordVerificationResult.ts | 2 +- src/commands/ens/wait/waitUntilEnsRecordDeleted.ts | 2 +- src/commands/functions/deploy.ts | 3 +-- src/commands/functions/prompts/getFunctionOrPrompt.test.ts | 4 ++-- src/commands/functions/prompts/getFunctionOrPrompt.ts | 2 +- src/commands/functions/prompts/getFunctionStatusOrPrompt.ts | 2 +- src/commands/gateways/create.test.ts | 4 ++-- src/commands/gateways/delete.test.ts | 4 ++-- src/commands/gateways/detail.test.ts | 4 ++-- src/commands/gateways/list.test.ts | 4 ++-- .../gateways/prompts/getPrivateGatewayOrPrompt.test.ts | 4 ++-- src/commands/gateways/prompts/getPrivateGatewayOrPrompt.ts | 2 +- .../gateways/utils/getAllPrivateGatewayDomains.test.ts | 4 ++-- src/commands/gateways/utils/getAllPrivateGatewayDomains.ts | 2 +- src/commands/ipfs/utils/uploadPathOnIpfs.ts | 2 +- src/commands/ipns/prompts/getRecordOrPrompt.test.ts | 4 ++-- src/commands/ipns/prompts/getRecordOrPrompt.ts | 2 +- src/commands/ipns/prompts/getSiteToAssignRecordOrPrompt.ts | 2 +- src/commands/pat/create.ts | 2 +- src/commands/pat/utils/deletePersonalAccessToken.ts | 2 +- src/commands/projects/create.test.ts | 4 ++-- src/commands/projects/list.test.ts | 4 ++-- src/commands/projects/prompts/getProjectOrPrompt.test.ts | 4 ++-- src/commands/projects/prompts/getProjectOrPrompt.ts | 2 +- src/commands/projects/switch.test.ts | 4 ++-- src/commands/sites/prompts/getSiteOrPrompt.test.ts | 4 ++-- src/commands/sites/prompts/getSiteOrPrompt.ts | 2 +- src/commands/sites/utils/chooseOrCreateSite.ts | 2 +- src/commands/sites/utils/createSite.ts | 2 +- src/commands/sites/utils/initConfiguration.ts | 2 +- src/commands/sites/utils/initCongifuration.ts | 2 +- src/commands/sites/utils/printDeploymentsTable.ts | 2 +- src/commands/sites/utils/returnDeploymentWhenFinished.ts | 2 +- .../sites/utils/waitUntilDeploymentFinishedAndInformUser.ts | 2 +- src/commands/storage/delete.test.ts | 4 ++-- src/commands/storage/get.test.ts | 4 ++-- src/commands/storage/get.ts | 2 +- src/commands/storage/list.test.ts | 4 ++-- src/commands/storage/utils/CreateOutputTable.ts | 2 +- 72 files changed, 99 insertions(+), 100 deletions(-) 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..dd10a23 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..7cb7ee0 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..ba2d1b9 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..2252c5e 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..836d3d0 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..f4b535f 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..86acfda 100644 --- a/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts +++ b/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts @@ -1,4 +1,4 @@ -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..f847d41 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..647f600 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..cd68ccd 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..b639f85 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..c49e084 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..7921bcf 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'; @@ -14,7 +13,7 @@ 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'; diff --git a/src/commands/functions/prompts/getFunctionOrPrompt.test.ts b/src/commands/functions/prompts/getFunctionOrPrompt.test.ts index af536ba..94d7cfd 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/gateways/create.test.ts b/src/commands/gateways/create.test.ts index 2cf120a..a2c53d7 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..7a1b047 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..3df17f6 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..12817b9 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..e7f9087 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..9b9e2fa 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..e01bfe0 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..bb9c208 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..d869a42 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..7fb9186 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..f04342f 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..baf3229 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..2533478 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..f8d1212 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..8722734 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, From c5f7ec30ffd1e83152250904da5ed6b85fd8a3b3 Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:57:29 +0100 Subject: [PATCH 3/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20cjs=20pkgs=20?= =?UTF-8?q?to=20globals?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global.d.ts | 2 ++ 1 file changed, 2 insertions(+) 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'; From 9279fb1be631bbcd3c9dd22b38fbd5e674bcafb6 Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:58:06 +0100 Subject: [PATCH 4/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20use=20tsconfig=20mo?= =?UTF-8?q?dule=20resolve=20as=20nodenext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 85e50c0..7b8ab41 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, From 76a1f692102ce3efe870ccd83a6d675eb317f09f Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:58:20 +0100 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20graphql=20syntax?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rPersonalAccessTokenFromVerificationSession.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts b/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts index c54896e..45cec9a 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,9 +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); From 03e8cea2c10a276c48eafc1ea0b0ea5b03fb9072 Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:58:38 +0100 Subject: [PATCH 6/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20import=20sdk/node?= =?UTF-8?q?=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/guards/sdkGuard.ts | 2 +- src/guards/types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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; From a11ecfcb90ab6d079abd7e3b1476e60ef7a5bea7 Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 10:59:00 +0100 Subject: [PATCH 7/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20remove=20node-fetch?= =?UTF-8?q?=20already=20in=20node=20v18?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index e3cc750..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", @@ -73,7 +72,7 @@ "@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 +} From c49bbe56456b019d3ba597e4ee2a677817e2512a Mon Sep 17 00:00:00 2001 From: Helder Oliveira Date: Fri, 6 Sep 2024 13:17:27 +0100 Subject: [PATCH 8/8] =?UTF-8?q?chore:=20=F0=9F=A4=96=20code=20format?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/en.json | 2 +- src/commands/auth/login.test.ts | 2 +- src/commands/domains/create.test.ts | 2 +- src/commands/domains/delete.test.ts | 2 +- src/commands/domains/list.test.ts | 2 +- .../domains/prompts/getDomainOrPrompt.test.ts | 2 +- .../prompts/getSiteOrPrivateGateway.test.ts | 2 +- .../utils/getZoneForSiteOrPrivateGateway.ts | 7 +- src/commands/domains/verify.test.ts | 2 +- src/commands/ens/create.test.ts | 2 +- src/commands/ens/delete.test.ts | 2 +- src/commands/ens/list.test.ts | 2 +- src/commands/ens/verify.test.ts | 2 +- src/commands/functions/deploy.ts | 39 +++--- .../prompts/getFunctionOrPrompt.test.ts | 2 +- .../functions/utils/getJsCodeFromPath.ts | 6 +- .../functions/utils/getWasmCodeFromPath.ts | 129 +++++++++--------- src/commands/gateways/create.test.ts | 2 +- src/commands/gateways/delete.test.ts | 2 +- src/commands/gateways/detail.test.ts | 2 +- src/commands/gateways/list.test.ts | 2 +- .../prompts/getPrivateGatewayOrPrompt.test.ts | 2 +- .../utils/getAllPrivateGatewayDomains.test.ts | 2 +- .../ipns/prompts/getRecordOrPrompt.test.ts | 2 +- src/commands/projects/create.test.ts | 2 +- src/commands/projects/list.test.ts | 2 +- .../prompts/getProjectOrPrompt.test.ts | 2 +- src/commands/projects/switch.test.ts | 2 +- .../sites/prompts/getSiteOrPrompt.test.ts | 2 +- src/commands/storage/delete.test.ts | 2 +- src/commands/storage/get.test.ts | 2 +- src/commands/storage/list.test.ts | 2 +- ...sonalAccessTokenFromVerificationSession.ts | 3 +- tsconfig.json | 2 +- 34 files changed, 126 insertions(+), 116 deletions(-) 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/src/commands/auth/login.test.ts b/src/commands/auth/login.test.ts index dd10a23..a74cd05 100644 --- a/src/commands/auth/login.test.ts +++ b/src/commands/auth/login.test.ts @@ -39,7 +39,7 @@ vi.mock('../../config', () => ({ })); // Assumes user goes ahead with the flow and logs in -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const MockClient = vi.fn(); MockClient.prototype.mutation = vi.fn().mockResolvedValue({ createPersonalAccessTokenFromVerificationSession: 'mockPat', diff --git a/src/commands/domains/create.test.ts b/src/commands/domains/create.test.ts index 7cb7ee0..ceab498 100644 --- a/src/commands/domains/create.test.ts +++ b/src/commands/domains/create.test.ts @@ -58,7 +58,7 @@ vi.mock('../../utils/pressAnyKey', () => { }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 ba2d1b9..f753c3f 100644 --- a/src/commands/domains/delete.test.ts +++ b/src/commands/domains/delete.test.ts @@ -37,7 +37,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/list.test.ts b/src/commands/domains/list.test.ts index 2252c5e..0de6eff 100644 --- a/src/commands/domains/list.test.ts +++ b/src/commands/domains/list.test.ts @@ -16,7 +16,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 836d3d0..a6ccc19 100644 --- a/src/commands/domains/prompts/getDomainOrPrompt.test.ts +++ b/src/commands/domains/prompts/getDomainOrPrompt.test.ts @@ -13,7 +13,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondDomainId'), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts b/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts index f4b535f..858cae9 100644 --- a/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts +++ b/src/commands/domains/prompts/getSiteOrPrivateGateway.test.ts @@ -50,7 +50,7 @@ vi.mock('../../sites/prompts/getSiteOrPrompt', () => ({ }), })); -vi.mock('@fleek-platform/sdk/node, () => ({ +vi.mock('@fleek-platform/sdk/node', () => ({ FleekSdk: vi.fn(), PersonalAccessTokenService: vi.fn(), })); diff --git a/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts b/src/commands/domains/utils/getZoneForSiteOrPrivateGateway.ts index 86acfda..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/node'; +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 f847d41..ba796a8 100644 --- a/src/commands/domains/verify.test.ts +++ b/src/commands/domains/verify.test.ts @@ -42,7 +42,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const domains = { diff --git a/src/commands/ens/create.test.ts b/src/commands/ens/create.test.ts index 647f600..7777087 100644 --- a/src/commands/ens/create.test.ts +++ b/src/commands/ens/create.test.ts @@ -60,7 +60,7 @@ vi.mock('../../utils/pressAnyKey', () => { }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 cd68ccd..1fac881 100644 --- a/src/commands/ens/delete.test.ts +++ b/src/commands/ens/delete.test.ts @@ -38,7 +38,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/ens/list.test.ts b/src/commands/ens/list.test.ts index b639f85..1a1dc8b 100644 --- a/src/commands/ens/list.test.ts +++ b/src/commands/ens/list.test.ts @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/ens/verify.test.ts b/src/commands/ens/verify.test.ts index c49e084..ab50570 100644 --- a/src/commands/ens/verify.test.ts +++ b/src/commands/ens/verify.test.ts @@ -43,7 +43,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ens = { diff --git a/src/commands/functions/deploy.ts b/src/commands/functions/deploy.ts index 7921bcf..5a1108c 100644 --- a/src/commands/functions/deploy.ts +++ b/src/commands/functions/deploy.ts @@ -9,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/node'; import { getWasmCodeFromPath } from './utils/getWasmCodeFromPath'; - type DeployActionArgs = { filePath?: string; name?: string; @@ -47,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(); @@ -77,7 +80,6 @@ const deployAction: SdkGuardedFunction = async ({ options: { functionName: functionToDeploy.name }, onUploadProgress: uploadOnProgress(progressBar), }); - } let b3Hash; @@ -150,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 94d7cfd..6ccde3d 100644 --- a/src/commands/functions/prompts/getFunctionOrPrompt.test.ts +++ b/src/commands/functions/prompts/getFunctionOrPrompt.test.ts @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondFunctionId'), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const functions = { 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 a2c53d7..086b854 100644 --- a/src/commands/gateways/create.test.ts +++ b/src/commands/gateways/create.test.ts @@ -34,7 +34,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 7a1b047..c677817 100644 --- a/src/commands/gateways/delete.test.ts +++ b/src/commands/gateways/delete.test.ts @@ -38,7 +38,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 3df17f6..d4be674 100644 --- a/src/commands/gateways/detail.test.ts +++ b/src/commands/gateways/detail.test.ts @@ -26,7 +26,7 @@ vi.mock('./prompts/getPrivateGatewayOrPrompt', () => ({ }), })); -vi.mock('@fleek-platform/sdk/node, () => { +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 12817b9..ef8dfe6 100644 --- a/src/commands/gateways/list.test.ts +++ b/src/commands/gateways/list.test.ts @@ -13,7 +13,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 e7f9087..3be05c9 100644 --- a/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts +++ b/src/commands/gateways/prompts/getPrivateGatewayOrPrompt.test.ts @@ -10,7 +10,7 @@ vi.mock('prompts', () => ({ default: vi.fn().mockResolvedValue({ value: 'secondPrivateGatewayId' }), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts b/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts index 9b9e2fa..754cce1 100644 --- a/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts +++ b/src/commands/gateways/utils/getAllPrivateGatewayDomains.test.ts @@ -6,7 +6,7 @@ import { getAllPrivateGatewayDomains, } from './getAllPrivateGatewayDomains'; -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const privateGateways = { diff --git a/src/commands/ipns/prompts/getRecordOrPrompt.test.ts b/src/commands/ipns/prompts/getRecordOrPrompt.test.ts index e01bfe0..a3866de 100644 --- a/src/commands/ipns/prompts/getRecordOrPrompt.test.ts +++ b/src/commands/ipns/prompts/getRecordOrPrompt.test.ts @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondRecordId'), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const ipns = { diff --git a/src/commands/projects/create.test.ts b/src/commands/projects/create.test.ts index bb9c208..1cdeea1 100644 --- a/src/commands/projects/create.test.ts +++ b/src/commands/projects/create.test.ts @@ -28,7 +28,7 @@ vi.mock('../../config', () => { return { config }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 d869a42..8d49aea 100644 --- a/src/commands/projects/list.test.ts +++ b/src/commands/projects/list.test.ts @@ -22,7 +22,7 @@ vi.mock('../../config', () => { return { config }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 7fb9186..e4b5cd8 100644 --- a/src/commands/projects/prompts/getProjectOrPrompt.test.ts +++ b/src/commands/projects/prompts/getProjectOrPrompt.test.ts @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondProjectId'), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const projects = { diff --git a/src/commands/projects/switch.test.ts b/src/commands/projects/switch.test.ts index f04342f..b494aa0 100644 --- a/src/commands/projects/switch.test.ts +++ b/src/commands/projects/switch.test.ts @@ -34,7 +34,7 @@ vi.mock('./create', () => ({ createProjectActionHandler: vi.fn().mockResolvedValue(undefined), })); -vi.mock('@fleek-platform/sdk/node, () => ({})); +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 baf3229..98357b8 100644 --- a/src/commands/sites/prompts/getSiteOrPrompt.test.ts +++ b/src/commands/sites/prompts/getSiteOrPrompt.test.ts @@ -9,7 +9,7 @@ vi.mock('../../../prompts/selectPrompt', () => ({ selectPrompt: vi.fn().mockResolvedValue('secondSiteId'), })); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const sites = { diff --git a/src/commands/storage/delete.test.ts b/src/commands/storage/delete.test.ts index 2533478..f9dafec 100644 --- a/src/commands/storage/delete.test.ts +++ b/src/commands/storage/delete.test.ts @@ -14,7 +14,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +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 f8d1212..2447976 100644 --- a/src/commands/storage/get.test.ts +++ b/src/commands/storage/get.test.ts @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const storage = { diff --git a/src/commands/storage/list.test.ts b/src/commands/storage/list.test.ts index 8722734..482099d 100644 --- a/src/commands/storage/list.test.ts +++ b/src/commands/storage/list.test.ts @@ -15,7 +15,7 @@ vi.mock('../../cli', () => { return { output }; }); -vi.mock('@fleek-platform/sdk/node, () => { +vi.mock('@fleek-platform/sdk/node', () => { const FleekSdkMock = vi.fn(); const storage = { diff --git a/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts b/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts index 45cec9a..192d2d5 100644 --- a/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts +++ b/src/utils/token/waitForPersonalAccessTokenFromVerificationSession.ts @@ -28,8 +28,7 @@ export const waitForPersonalAccessTokenFromVerificationSession = async ({ name, }, }, - } - + }, }) .catch(() => null); diff --git a/tsconfig.json b/tsconfig.json index 7b8ab41..825b2b5 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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" }