Skip to content

Commit

Permalink
import sdk from path, added API clients to sdk exports
Browse files Browse the repository at this point in the history
  • Loading branch information
Ptroger committed Oct 11, 2024
1 parent e226098 commit 3f83e87
Show file tree
Hide file tree
Showing 18 changed files with 91 additions and 62 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ include ./packages/policy-engine-shared/Makefile
include ./packages/transaction-request-intent/Makefile
include ./packages/signature/Makefile
include ./packages/armory-sdk/Makefile
include ./packages/user-journey/Makefile

# For more terminal color codes, head over to
# https://opensource.com/article/19/9/linux-terminal-colors
Expand Down
3 changes: 3 additions & 0 deletions packages/armory-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ export * from './lib/shared/promise'
export * from './lib/types'
export * from './lib/vault'

export { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from './lib/http/client/auth'
export { ClientDto, WalletDto } from './lib/http/client/vault'
export { Signer } from './lib/shared/type'
export { resourceId } from './lib/utils'

export type { Jwk, PrivateKey, PublicKey, RsaPublicKey } from '@narval/signature'
Expand Down
7 changes: 7 additions & 0 deletions packages/user-journey/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"@nx/dependency-checks": "error"
}
}
]
}
10 changes: 0 additions & 10 deletions packages/user-journey/package.json

This file was deleted.

8 changes: 6 additions & 2 deletions packages/user-journey/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"tags": [],
"targets": {
"lint": {
"executor": "@nx/eslint:lint"
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/user-journey/**/*.ts"]
}
},
"test:e2e": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
"options": {
"jestConfig": "packages/armory-sdk/jest.e2e.ts",
"jestConfig": "packages/user-journey/jest.e2e.ts",
"verbose": true,
"runInBand": true
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Action, Decision, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defaultEntities from '../../resource/entity/test.default.json'
import twoAdminApproval from '../../resource/policy/checkApprovals/2-admin-approval-required.json'
import adminApproval from '../../resource/policy/checkApprovals/admin-approval-required.json'
import adminPermitAll from '../../resource/policy/checkPrincipalRole/admin-permit-all.json'
import defaultEntities from '../../../resource/entity/test.default.json'
import twoAdminApproval from '../../../resource/policy/checkApprovals/2-admin-approval-required.json'
import adminApproval from '../../../resource/policy/checkApprovals/admin-approval-required.json'
import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json'
import {
buildAuthClient,
buildPolicy,
Expand All @@ -12,7 +12,7 @@ import {
getAuthAdminApiKey,
getAuthHost,
saveDataStore
} from '../../util/setup'
} from '../../../util/setup'

const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root
const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { Action, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defaultEntities from '../../../resource/entity/test.default.json'
import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json'
import memberTwoTransferPerDay from '../../../resource/policy/checkRateLimit/members-2-transfer-per-day.json'
import {
buildAuthClient,
buildPolicy,
Expand All @@ -8,10 +11,7 @@ import {
getAuthAdminApiKey,
getAuthHost,
saveDataStore
} from '../../util/setup'
import defaultEntities from '../resource/entity/test.default.json'
import adminPermitAll from '../resource/policy/checkPrincipalRole/admin-permit-all.json'
import memberTwoTransferPerDay from '../resource/policy/checkRateLimit/members-2-transfer-per-day.json'
} from '../../../util/setup'

const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root
const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Action, entitiesSchema, FIXTURE, Request } from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defaultEntities from '../../resource/entity/test.default.json'
import adminPermitAll from '../../resource/policy/checkPrincipalRole/admin-permit-all.json'
import treasuryMemberCanTransferOneEthFixed from '../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json'
import treasuryMemberCanTransferOneEthRolling from '../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json'
import defaultEntities from '../../../resource/entity/test.default.json'
import adminPermitAll from '../../../resource/policy/checkPrincipalRole/admin-permit-all.json'
import treasuryMemberCanTransferOneEthFixed from '../../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-fixed.json'
import treasuryMemberCanTransferOneEthRolling from '../../../resource/policy/checkSpendingLimit/treasury-groupMember-can-transfer-1-eth-rolling.json'
import {
buildAuthClient,
buildPolicy,
Expand All @@ -12,7 +12,7 @@ import {
getAuthAdminApiKey,
getAuthHost,
saveDataStore
} from '../../util/setup'
} from '../../../util/setup'

const systemManagerHexPk = FIXTURE.UNSAFE_PRIVATE_KEY.Root
const ericPrivateKey = FIXTURE.UNSAFE_PRIVATE_KEY.Eric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import { AddressBookAddresses } from 'packages/policy-engine-shared/src/lib/dev.
import { v4 } from 'uuid'
import { Hex } from 'viem'
import { generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
import defaultEntities from '../../../resource/entity/test.default.json'
import addressBookAndRoles from '../../../resource/policy/set/address-book-and-roles.json'
import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup'
import defaultEntities from '../resource/entity/test.default.json'
import addressBookAndRoles from '../resource/policy/set/address-book-and-roles.json'

const TEST_TIMEOUT_MS = 30_000

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable jest/consistent-test-it */
import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval-xyz/armory-sdk'
import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request } from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defaultEntities from '../../resource/entity/test.default.json'
import approvalsAndSpendingLimit from '../../resource/policy/set/approvals-and-spending-limit.json'
import { buildAuthClient, createClient, saveDataStore } from '../../util/setup'
import defaultEntities from '../../../resource/entity/test.default.json'
import approvalsAndSpendingLimit from '../../../resource/policy/set/approvals-and-spending-limit.json'
import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup'

const TEST_TIMEOUT_MS = 30_000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
FIXTURE,
policySchema,
Request
} from '@narval-xyz/armory-sdk'
} from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defiEntities from '../../../resource/entity/defi-interaction.json'
import defiInteractionPolicy from '../../../resource/policy/set/defi-interaction.json'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable jest/consistent-test-it */
import { Action, Decision, entitiesSchema, FIXTURE, policySchema, Request, toHex } from '@narval/policy-engine-shared'
import { v4 } from 'uuid'
import defaultEntities from '../../resource/entity/test.default.json'
import tieredEthTransfer from '../../resource/policy/set/tiered-eth-transfer.json'
import { buildAuthClient, createClient, saveDataStore } from '../../util/setup'
import defaultEntities from '../../../resource/entity/test.default.json'
import tieredEthTransfer from '../../../resource/policy/set/tiered-eth-transfer.json'
import { buildAuthClient, createClient, saveDataStore } from '../../../util/setup'

const TEST_TIMEOUT_MS = 30_000

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
/* eslint-disable jest/consistent-test-it */
import {
AuthAdminClient,
AuthClient,
AuthorizationResponseDtoStatusEnum,
ClientDto,
CreateClientResponseDto,
DataStoreConfig,
EntityStoreClient,
Permission,
PolicyStoreClient,
SignOptions,
Signer,
VaultAdminClient,
VaultClient,
WalletDto,
createHttpDataStore,
credential,
resourceId
} from '@narval/armory-sdk'
import {
AccessToken,
AccountEntity,
Expand Down Expand Up @@ -26,16 +45,6 @@ import {
import { format } from 'date-fns'
import { v4 as uuid } from 'uuid'
import { english, generateMnemonic, generatePrivateKey, privateKeyToAccount } from 'viem/accounts'
import { AuthAdminClient, AuthClient } from '../../../auth/client'
import { EntityStoreClient, PolicyStoreClient } from '../../../data-store/client'
import { DataStoreConfig } from '../../../data-store/type'
import { createHttpDataStore, credential } from '../../../data-store/util'
import { Permission } from '../../../domain'
import { AuthorizationResponseDtoStatusEnum, CreateClientResponseDto } from '../../../http/client/auth'
import { ClientDto, WalletDto } from '../../../http/client/vault'
import { SignOptions, Signer } from '../../../shared/type'
import { resourceId } from '../../../utils'
import { VaultAdminClient, VaultClient } from '../../../vault/client'

const TEST_TIMEOUT_MS = 30_000

Expand Down
14 changes: 11 additions & 3 deletions packages/user-journey/src/util/setup.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import {
AuthAdminClient,
AuthClient,
AuthConfig,
createHttpDataStore,
DataStoreConfig,
EntityStoreClient,
PolicyStoreClient,
VaultAdminClient,
VaultConfig
} from '@narval/armory-sdk'
import { Entities, Hex, Policy, policySchema, Request } from '@narval/policy-engine-shared'
import { buildSignerForAlg, getPublicKey, privateKeyToJwk } from '@narval/signature'
import { format } from 'date-fns'
import { v4 } from 'uuid'
import { AuthAdminClient, AuthClient, AuthConfig } from '../../auth'
import { createHttpDataStore, DataStoreConfig, EntityStoreClient, PolicyStoreClient } from '../../data-store'
import { VaultAdminClient, VaultConfig } from '../../vault'

export const getAuthHost = () => 'http://localhost:3005'
export const getAuthAdminApiKey = () => 'armory-admin-api-key'
Expand Down
19 changes: 9 additions & 10 deletions packages/user-journey/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "commonjs",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"files": [],
"include": [],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
]
],
"compilerOptions": {
"module": "commonjs",
"strict": true,
"resolveJsonModule": true
}
}
2 changes: 1 addition & 1 deletion packages/user-journey/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"types": ["node"]
},
"include": ["src/**/*.ts"],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
"exclude": ["jest.config.ts", "src/**/*.spec.ts"]
}
9 changes: 9 additions & 0 deletions packages/user-journey/tsconfig.spec.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "../../dist/out-tsc",
"module": "commonjs",
"types": ["jest", "node"]
},
"include": ["jest.config.ts", "src/**/*.test.ts", "src/**/*.spec.ts", "src/**/*.d.ts"]
}
3 changes: 1 addition & 2 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
"@narval/nestjs-shared": ["packages/nestjs-shared/src/index.ts"],
"@narval/policy-engine-shared": ["packages/policy-engine-shared/src/index.ts"],
"@narval/signature": ["packages/signature/src/index.ts"],
"@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"],
"@narval/user-journey": ["packages/user-journey/src/index.ts"]
"@narval/transaction-request-intent": ["packages/transaction-request-intent/src/index.ts"]
},
"removeComments": true,
"rootDir": ".",
Expand Down

0 comments on commit 3f83e87

Please sign in to comment.