Skip to content

Commit 936b923

Browse files
authored
Merge pull request #166 from cipherstash/schema-package
feat(schema): decouple schema from protect into a seperate package
2 parents cab69b2 + d0b02ea commit 936b923

23 files changed

+426
-32
lines changed

.changeset/mean-views-rest.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cipherstash/schema": minor
3+
---
4+
5+
Released initial package for CipherStash Encrypt schemas.

packages/protect/__tests__/bulk-protect.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import 'dotenv/config'
22
import { describe, expect, it, beforeAll } from 'vitest'
3-
4-
import {
5-
LockContext,
6-
protect,
7-
csTable,
8-
csColumn,
9-
type EncryptedPayload,
10-
} from '../src'
3+
import { csTable, csColumn } from '@cipherstash/schema'
4+
import { LockContext, protect, type EncryptedPayload } from '../src'
115

126
const users = csTable('users', {
137
email: csColumn('email').freeTextSearch().equality().orderAndRange(),

packages/protect/__tests__/helpers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
import { describe, expect, it } from 'vitest'
12
import {
23
encryptedToPgComposite,
34
modelToEncryptedPgComposites,
45
bulkModelsToEncryptedPgComposites,
56
isEncryptedPayload,
67
} from '../src/helpers'
7-
import { describe, expect, it } from 'vitest'
88

99
describe('helpers', () => {
1010
describe('encryptedToPgComposite', () => {

packages/protect/__tests__/nested-models.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config'
22
import { describe, expect, it, vi } from 'vitest'
3-
4-
import { LockContext, protect, csTable, csColumn, csValue } from '../src'
3+
import { csTable, csColumn, csValue } from '@cipherstash/schema'
4+
import { LockContext, protect } from '../src'
55

66
const users = csTable('users', {
77
email: csColumn('email').freeTextSearch().equality().orderAndRange(),

packages/protect/__tests__/protect.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config'
22
import { describe, expect, it, beforeAll } from 'vitest'
3-
4-
import { LockContext, protect, csTable, csColumn } from '../src'
3+
import { csTable, csColumn } from '@cipherstash/schema'
4+
import { LockContext, protect } from '../src'
55

66
const users = csTable('users', {
77
email: csColumn('email').freeTextSearch().equality().orderAndRange(),

packages/protect/__tests__/search-terms.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'dotenv/config'
22
import { describe, expect, it } from 'vitest'
3-
4-
import { protect, csTable, csColumn, type SearchTerm } from '../src'
3+
import { csTable, csColumn } from '@cipherstash/schema'
4+
import { protect, type SearchTerm } from '../src'
55

66
const users = csTable('users', {
77
email: csColumn('email').freeTextSearch().equality().orderAndRange(),

packages/protect/__tests__/supabase.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import 'dotenv/config'
22
import { describe, expect, it } from 'vitest'
3-
3+
import { csTable, csColumn } from '@cipherstash/schema'
44
import {
55
protect,
6-
csTable,
7-
csColumn,
86
type EncryptedPayload,
97
encryptedToPgComposite,
108
modelToEncryptedPgComposites,

packages/protect/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
"dependencies": {
5555
"@byteslice/result": "^0.2.0",
5656
"@cipherstash/protect-ffi": "0.16.0-0",
57+
"@cipherstash/schema": "workspace:*",
5758
"zod": "^3.24.2"
5859
},
5960
"optionalDependencies": {

packages/protect/src/ffi/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import {
2727
encryptConfigSchema,
2828
type ProtectTable,
2929
type ProtectTableColumn,
30-
} from '../schema'
30+
} from '@cipherstash/schema'
3131

3232
export const noClientError = () =>
3333
new Error(

packages/protect/src/ffi/model-helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
type Encrypted,
55
} from '@cipherstash/protect-ffi'
66
import type { EncryptedPayload, Decrypted, Client } from '../types'
7-
import type { ProtectTable, ProtectTableColumn } from '../schema'
7+
import type { ProtectTable, ProtectTableColumn } from '@cipherstash/schema'
88
import type { GetLockContextResponse } from '../identify'
99
import { isEncryptedPayload } from '../helpers'
1010

0 commit comments

Comments
 (0)