Skip to content

Commit

Permalink
feat: replaced jest with vitest and refactored init functions
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinbrewer committed Dec 25, 2024
1 parent 115bf6a commit e484718
Show file tree
Hide file tree
Showing 13 changed files with 2,465 additions and 4,027 deletions.
5 changes: 5 additions & 0 deletions .changeset/real-trains-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cipherstash/jseql": minor
---

Refactored init function to not require envrionment variables as arguments.
5 changes: 5 additions & 0 deletions .changeset/witty-ligers-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@cipherstash/jseql": minor
---

Replaces jset with vitest for better typescript support.
10 changes: 1 addition & 9 deletions apps/basic/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ import 'dotenv/config'
import { eql } from '../../packages/jseql/dist/index.cjs'

async function main() {
if (!process.env.CS_CLIENT_ID || !process.env.CS_CLIENT_KEY) {
throw new Error('CS_CLIENT_ID and CS_CLIENT_KEY must be set')
}

const eqlClient = await eql({
workspaceId: process.env.CS_WORKSPACE_ID,
clientId: process.env.CS_CLIENT_ID,
clientKey: process.env.CS_CLIENT_KEY,
})
const eqlClient = await eql()

const ciphertext = await eqlClient.encrypt('plaintext', {
column: 'column_name',
Expand Down
12 changes: 6 additions & 6 deletions apps/basic/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */

/* Language and Environment */
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
// "jsx": "preserve", /* Specify what JSX code is generated. */
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
Expand All @@ -25,7 +25,7 @@
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "commonjs" /* Specify what module code is generated. */,
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
Expand Down Expand Up @@ -77,12 +77,12 @@
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,

/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
Expand All @@ -105,6 +105,6 @@

/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
}
}
13 changes: 4 additions & 9 deletions apps/drizzle/src/eql.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import 'dotenv/config'

// NPM isn't working with Turborepo so hardcoded to cjs build for now
// import { eql } from '@cipherstash/jseql'
import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const { eql } = require('@cipherstash/jseql')
import { eql } from '../../../packages/jseql/dist/index.cjs'

export const eqlClient = await eql({
workspaceId: process.env.CS_WORKSPACE_ID,
clientId: process.env.CS_CLIENT_ID,
clientKey: process.env.CS_CLIENT_KEY,
accessToken: process.env.CS_CLIENT_ACCESS_KEY,
})
export const eqlClient = await eql()
Loading

0 comments on commit e484718

Please sign in to comment.