Skip to content

Commit 6e7ae4e

Browse files
committed
feat(stack): export operation classes returned by public methods
Export the operation classes returned by the encryption and DynamoDB clients (plus EncryptedQuery and EncryptedFromSchema) so they are part of the public API and appear in the generated TypeDoc reference. This makes the TSDoc {@link} cross-references and method return types resolve to real pages instead of failing to resolve or pointing at undocumented symbols. - encryption: Encrypt/EncryptQuery/Decrypt/Bulk*/*Model* operation classes - dynamodb: model operation classes - types: EncryptedQuery, EncryptedFromSchema - EncryptQueryOperation / BatchEncryptQueryOperation are no longer @internal, for consistency with the other operations (they are returned from encryptQuery) - add type-only imports for {@link} resolution; fix the init reference and a buildEncryptConfig @param name
1 parent b9c4fe5 commit 6e7ae4e

8 files changed

Lines changed: 54 additions & 14 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
"@cipherstash/stack": minor
3+
---
4+
5+
Export the operation classes returned by the encryption and DynamoDB clients as public API.
6+
7+
The classes returned from public methods are now exported and documented in the API reference, so their types can be named and their TSDoc links resolve.
8+
9+
- From `@cipherstash/stack/encryption`: `EncryptOperation`, `EncryptQueryOperation`, `BatchEncryptQueryOperation`, `DecryptOperation`, `EncryptModelOperation`, `DecryptModelOperation`, `BulkEncryptOperation`, `BulkDecryptOperation`, `BulkEncryptModelsOperation`, `BulkDecryptModelsOperation`. `EncryptQueryOperation` and `BatchEncryptQueryOperation` were previously marked `@internal`; since they are returned from `EncryptionClient.encryptQuery`, they are now public for consistency with the other operations.
10+
- From `@cipherstash/stack/dynamodb`: `EncryptModelOperation`, `DecryptModelOperation`, `BulkEncryptModelsOperation`, `BulkDecryptModelsOperation`.
11+
- From `@cipherstash/stack/types`: `EncryptedQuery` and `EncryptedFromSchema`.
12+
13+
The `*WithLockContext` variants returned by `.withLockContext()` remain internal — they share the same awaitable shape and are not intended to be named directly.
14+
15+
No runtime behaviour changes; this only widens the exported surface and corrects TSDoc cross-references that previously failed to resolve.

packages/stack/src/dynamodb/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,12 @@ export type {
9797
EncryptedDynamoDBError,
9898
EncryptedDynamoDBInstance,
9999
} from './types'
100+
101+
// Re-export the operation classes returned by the DynamoDB instance methods so
102+
// they are part of the public API and appear in the generated reference.
103+
export {
104+
EncryptModelOperation,
105+
DecryptModelOperation,
106+
BulkEncryptModelsOperation,
107+
BulkDecryptModelsOperation,
108+
}

packages/stack/src/encryption/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { type EncryptionError, EncryptionErrorTypes } from '@/errors'
2+
// `LockContext` is imported type-only so the TSDoc {@link} references in the
3+
// comments below resolve; it is erased at compile time.
4+
import type { LockContext } from '@/identity'
25
import {
36
type EncryptConfig,
47
type EncryptedTable,
58
type EncryptedTableColumn,
69
buildEncryptConfig,
710
encryptConfigSchema,
11+
// Imported type-only for the TSDoc {@link} references in the comments below.
12+
type encryptedColumn,
13+
type encryptedField,
14+
type encryptedTable,
815
} from '@/schema'
916
import type {
1017
BulkDecryptPayload,
@@ -35,6 +42,22 @@ import { EncryptOperation } from './operations/encrypt'
3542
import { EncryptModelOperation } from './operations/encrypt-model'
3643
import { EncryptQueryOperation } from './operations/encrypt-query'
3744

45+
// Re-export the operation classes returned by EncryptionClient methods so they
46+
// are part of the public API and appear in the generated reference, allowing
47+
// TSDoc {@link} references and method return types to resolve to real pages.
48+
export {
49+
EncryptOperation,
50+
EncryptQueryOperation,
51+
BatchEncryptQueryOperation,
52+
DecryptOperation,
53+
EncryptModelOperation,
54+
DecryptModelOperation,
55+
BulkEncryptOperation,
56+
BulkDecryptOperation,
57+
BulkEncryptModelsOperation,
58+
BulkDecryptModelsOperation,
59+
}
60+
3861
export const noClientError = () =>
3962
new Error(
4063
'The Encryption client has not been initialized. Please call init() before using the client.',
@@ -610,7 +633,7 @@ export class EncryptionClient {
610633
* {@link EncryptionClient.encrypt}, {@link EncryptionClient.decrypt}, and related operations.
611634
*
612635
* @throws Throws if `schemas` is empty, or if a keyset `id` is supplied but is not a valid UUID.
613-
* Also throws if {@link EncryptionClient.init} fails (e.g. invalid credentials or config).
636+
* Also throws if the client fails to initialize (e.g. invalid credentials or config).
614637
*
615638
* @example
616639
* ```typescript

packages/stack/src/encryption/operations/batch-encrypt-query.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,6 @@ function assembleResults(
9191
return results
9292
}
9393

94-
/**
95-
* @internal Use {@link EncryptionClient.encryptQuery} with array input instead.
96-
*/
9794
export class BatchEncryptQueryOperation extends EncryptionOperation<
9895
EncryptedQueryResult[]
9996
> {
@@ -168,9 +165,6 @@ export class BatchEncryptQueryOperation extends EncryptionOperation<
168165
}
169166
}
170167

171-
/**
172-
* @internal Use {@link EncryptionClient.encryptQuery} with array input and `.withLockContext()` instead.
173-
*/
174168
export class BatchEncryptQueryOperationWithLockContext extends EncryptionOperation<
175169
EncryptedQueryResult[]
176170
> {

packages/stack/src/encryption/operations/encrypt-query.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ import {
1717
import { noClientError } from '../index'
1818
import { EncryptionOperation } from './base-operation'
1919

20-
/**
21-
* @internal Use {@link EncryptionClient.encryptQuery} instead.
22-
*/
2320
export class EncryptQueryOperation extends EncryptionOperation<EncryptedQueryResult> {
2421
constructor(
2522
private client: Client,
@@ -114,9 +111,6 @@ export class EncryptQueryOperation extends EncryptionOperation<EncryptedQueryRes
114111
}
115112
}
116113

117-
/**
118-
* @internal Use {@link EncryptionClient.encryptQuery} with `.withLockContext()` instead.
119-
*/
120114
export class EncryptQueryOperationWithLockContext extends EncryptionOperation<EncryptedQueryResult> {
121115
constructor(
122116
private client: Client,

packages/stack/src/schema/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ export function encryptedField(valueName: string) {
658658
/**
659659
* Build an encrypt config from a list of encrypted tables.
660660
*
661-
* @param ...tables - The list of encrypted tables to build the config from.
661+
* @param protectTables - The list of encrypted tables to build the config from.
662662
* @returns An encrypt config object.
663663
*
664664
* @example

packages/stack/src/types-public.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type {
1111
Client,
1212
EncryptedValue,
1313
Encrypted,
14+
EncryptedQuery,
1415
} from '@/types'
1516

1617
// Client configuration
@@ -35,6 +36,7 @@ export type {
3536
OtherFields,
3637
DecryptedFields,
3738
Decrypted,
39+
EncryptedFromSchema,
3840
} from '@/types'
3941

4042
// Bulk operations

packages/stack/src/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import type {
33
EncryptedField,
44
EncryptedTable,
55
EncryptedTableColumn,
6+
// Imported type-only for the TSDoc {@link} references in the comments below.
7+
encryptedColumn,
8+
encryptedField,
69
} from '@/schema'
710
import type {
811
Encrypted as CipherStashEncrypted,

0 commit comments

Comments
 (0)