Repository: jeremydaly/dynamodb-toolbox
Pull request #206 (2021-09-24 18:13:55)

support hidden option in inferred entity method types


Patch:
diff --git a/src/classes/Entity.ts b/src/classes/Entity.ts
index 807d2565..f151eb03 100644
--- a/src/classes/Entity.ts
+++ b/src/classes/Entity.ts
@@ -152,6 +152,7 @@ interface ParsedAttributes<Attributes extends A.Key = A.Key> {
   always: { all: Attributes; default: Attributes; input: Attributes }
   required: { all: Attributes; default: Attributes; input: Attributes }
   optional: Attributes
+  shown: Attributes
 }
 
 type ParseAttributes<
@@ -183,7 +184,8 @@ type ParseAttributes<
     KeyAttributes
   >,
   // 🔨 TOIMPROVE: Use EntityTable to infer extra attributes
-  Attribute extends A.Key = keyof Definitions | Aliases
+  Attribute extends A.Key = keyof Definitions | Aliases,
+  Hidden extends A.Key = O.SelectKeys<Definitions, { hidden: true } | [any, any, { hidden: true }]>
 > = {
   aliases: Aliases
   all: Attribute
@@ -212,6 +214,7 @@ type ParseAttributes<
     input: Exclude<RequiredAttributes, Default>
   }
   optional: Exclude<Attribute, KeyAttributes | AlwaysAttributes | RequiredAttributes>
+  shown: Exclude<Attribute, Hidden>
 }
 
 type FromDynamoData<T extends DynamoDBTypes> = {
@@ -721,12 +724,12 @@ class Entity<
   async get<
     MethodItemOverlay extends Overlay = undefined,
     MethodCompositeKeyOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
   >(
@@ -744,7 +747,7 @@ class Entity<
           O.Update<
             DocumentClient.GetItemOutput,
             'Item',
-            FirstDefined<[MethodItemOverlay, O.Pick<Item, ResponseAttributes>]>
+            FirstDefined<[MethodItemOverlay, A.Compute<O.Pick<Item, ResponseAttributes>>]>
           >
         >
       >
@@ -753,7 +756,7 @@ class Entity<
     const getParams = this.getParams<
       MethodItemOverlay,
       MethodCompositeKeyOverlay,
-      ItemAttributes,
+      ShownItemAttributes,
       ResponseAttributes,
       Execute,
       Parse
@@ -803,12 +806,12 @@ class Entity<
   getTransaction<
     MethodItemOverlay extends Overlay = undefined,
     MethodCompositeKeyOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes
   >(
     item: FirstDefined<[MethodCompositeKeyOverlay, EntityCompositeKeyOverlay, CompositePrimaryKey]>,
     // 💥 TODO: Support Projection Attributes
@@ -846,7 +849,7 @@ class Entity<
     let payload = this.getParams<
       MethodItemOverlay,
       MethodCompositeKeyOverlay,
-      ItemAttributes,
+      ShownItemAttributes,
       ResponseAttributes
     >(item, options)
 
@@ -866,12 +869,12 @@ class Entity<
   getParams<
     MethodItemOverlay extends Overlay = undefined,
     MethodCompositeKeyOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
   >(
@@ -958,12 +961,12 @@ class Entity<
   async delete<
     MethodItemOverlay extends Overlay = undefined,
     MethodCompositeKeyOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends DeleteOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -985,7 +988,9 @@ class Entity<
           O.Update<
             DocumentClient.DeleteItemOutput,
             'Attributes',
-            FirstDefined<[MethodItemOverlay, EntityItemOverlay, Item]>
+            FirstDefined<
+              [MethodItemOverlay, EntityItemOverlay, A.Compute<O.Pick<Item, ResponseAttributes>>]
+            >
           >
         >
       >
@@ -994,7 +999,7 @@ class Entity<
     const deleteParams = this.deleteParams<
       MethodItemOverlay,
       MethodCompositeKeyOverlay,
-      ItemAttributes,
+      ShownItemAttributes,
       ResponseAttributes,
       ReturnValues,
       Execute,
@@ -1094,12 +1099,12 @@ class Entity<
   deleteParams<
     MethodItemOverlay extends Overlay = undefined,
     MethodCompositeKeyOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends DeleteOptionsReturnValues | TransactionOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -1203,12 +1208,12 @@ class Entity<
    */
   async update<
     MethodItemOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends UpdateOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -1241,7 +1246,7 @@ class Entity<
     // Generate the payload
     const updateParams = this.updateParams<
       MethodItemOverlay,
-      ItemAttributes,
+      ShownItemAttributes,
       ResponseAttributes,
       ReturnValues,
       Execute,
@@ -1320,12 +1325,12 @@ class Entity<
   // Generate UPDATE Parameters
   updateParams<
     MethodItemOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends UpdateOptionsReturnValues | TransactionOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -1656,12 +1661,12 @@ class Entity<
   // PUT - put item
   async put<
     MethodItemOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends PutOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -1683,7 +1688,9 @@ class Entity<
           O.Update<
             DocumentClient.PutItemOutput,
             'Attributes',
-            FirstDefined<[MethodItemOverlay, EntityItemOverlay, Item]>
+            FirstDefined<
+              [MethodItemOverlay, EntityItemOverlay, A.Compute<O.Pick<Item, ResponseAttributes>>]
+            >
           >
         >
       >
@@ -1691,7 +1698,7 @@ class Entity<
   > {
     const putParams = this.putParams<
       MethodItemOverlay,
-      ItemAttributes,
+      ShownItemAttributes,
       ResponseAttributes,
       ReturnValues,
       Execute,
@@ -1783,12 +1790,12 @@ class Entity<
   // Generate PUT Parameters
   putParams<
     MethodItemOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ShownItemAttributes extends A.Key = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
+      Attributes['shown'],
       keyof MethodItemOverlay
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
+    ResponseAttributes extends ShownItemAttributes = ShownItemAttributes,
     ReturnValues extends PutOptionsReturnValues = 'NONE',
     Execute extends boolean | undefined = undefined,
     Parse extends boolean | undefined = undefined
@@ -1977,13 +1984,13 @@ class Entity<
   // Query pass-through (default entity)
   query<
     MethodItemOverlay extends Overlay = undefined,
-    ItemAttributes extends A.Key = If<
+    ItemAttributes extends { all: A.Key; shown: A.Key } = If<
       A.Equals<MethodItemOverlay, undefined>,
-      Attributes['all'],
-      keyof MethodItemOverlay
+      { all: Attributes['all']; shown: Attributes['shown'] },
+      { all: keyof MethodItemOverlay; shown: keyof MethodItemOverlay }
     >,
-    ResponseAttributes extends ItemAttributes = ItemAttributes,
-    FiltersAttributes extends ItemAttributes = ResponseAttributes
+    ResponseAttributes extends ItemAttributes['shown'] = ItemAttributes['shown'],
+    FiltersAttributes extends ItemAttributes['all'] = ItemAttributes['all']
   >(
     pk: any,
     options: AttributesQueryOptions<ResponseAttributes, FiltersAttributes> = {},
@@ -2028,36 +2035,41 @@ type ExtractAttributes<E extends EntityDef> = E['_typesOnly']['_entityItemOverla
   A.Key,
   any
 >
-  ? keyof E['_typesOnly']['_entityItemOverlay']
+  ? ParsedAttributes<keyof E['_typesOnly']['_entityItemOverlay']>
   : ParseAttributes<
       A.Cast<O.Writable<E['attributes'], A.Key, 'deep'>, AttributeDefinitions>,
       E['timestamps'],
       E['createdAlias'],
       E['modifiedAlias'],
       E['typeAlias']
-    >['all']
+    >
 
 export type GetOptions<
   E extends EntityDef,
-  A extends A.Key = ExtractAttributes<E>
-> = AttributesGetOptions<A, boolean | undefined, boolean | undefined>
+  A extends ParsedAttributes = ExtractAttributes<E>
+> = AttributesGetOptions<A['shown'], boolean | undefined, boolean | undefined>
 
 export type QueryOptions<
   E extends EntityDef,
-  A extends A.Key = ExtractAttributes<E>
-> = AttributesQueryOptions<A, A, boolean | undefined, boolean | undefined>
+  A extends ParsedAttributes = ExtractAttributes<E>
+> = AttributesQueryOptions<A['shown'], A['all'], boolean | undefined, boolean | undefined>
 
 export type PutOptions<
   E extends EntityDef,
-  A extends A.Key = ExtractAttributes<E>
-> = AttributesPutOptions<A, PutOptionsReturnValues, boolean | undefined, boolean | undefined>
+  A extends ParsedAttributes = ExtractAttributes<E>
+> = AttributesPutOptions<A['all'], PutOptionsReturnValues, boolean | undefined, boolean | undefined>
 
 export type DeleteOptions<
   E extends EntityDef,
-  A extends A.Key = ExtractAttributes<E>
-> = RawDeleteOptions<A, DeleteOptionsReturnValues, boolean | undefined, boolean | undefined>
+  A extends ParsedAttributes = ExtractAttributes<E>
+> = RawDeleteOptions<A['all'], DeleteOptionsReturnValues, boolean | undefined, boolean | undefined>
 
 export type UpdateOptions<
   E extends EntityDef,
-  A extends A.Key = ExtractAttributes<E>
-> = AttributesUpdateOptions<A, UpdateOptionsReturnValues, boolean | undefined, boolean | undefined>
+  A extends ParsedAttributes = ExtractAttributes<E>
+> = AttributesUpdateOptions<
+  A['all'],
+  UpdateOptionsReturnValues,
+  boolean | undefined,
+  boolean | undefined
+>


Test patch:
diff --git a/src/__tests__/type-infering.unit.test.ts b/src/__tests__/type-infering.unit.test.ts
index 36a881d5..1b27a64f 100644
--- a/src/__tests__/type-infering.unit.test.ts
+++ b/src/__tests__/type-infering.unit.test.ts
@@ -39,14 +39,17 @@ type ExpectedGetOpts<Attributes extends A.Key = A.Key> = Partial<
   ExpectedReadOpts<Attributes> & { include: string[] }
 >
 
-type ExpectedQueryOpts<Attributes extends A.Key = A.Key> = Partial<
-  ExpectedReadOpts<Attributes> & {
+type ExpectedQueryOpts<
+  ResponseAttributes extends A.Key = A.Key,
+  FilteredAttributes extends A.Key = A.Key
+> = Partial<
+  ExpectedReadOpts<ResponseAttributes> & {
     index: string
     limit: number
     reverse: boolean
     entity: string
     select: DocumentClientType.Select
-    filters: ConditionsOrFilters<Attributes>
+    filters: ConditionsOrFilters<FilteredAttributes>
     eq: string | number
     lt: string | number
     lte: string | number
@@ -58,16 +61,18 @@ type ExpectedQueryOpts<Attributes extends A.Key = A.Key> = Partial<
   }
 >
 
-type ExpectedWriteOpts<Attributes extends A.Key = A.Key, ReturnValues extends string = string> =
-  Partial<{
-    capacity: string
-    execute: boolean
-    parse: boolean
-    conditions: ConditionsOrFilters<Attributes>
-    metrics: string
-    include: string[]
-    returnValues: ReturnValues
-  }>
+type ExpectedWriteOpts<
+  Attributes extends A.Key = A.Key,
+  ReturnValues extends string = string
+> = Partial<{
+  capacity: string
+  execute: boolean
+  parse: boolean
+  conditions: ConditionsOrFilters<Attributes>
+  metrics: string
+  include: string[]
+  returnValues: ReturnValues
+}>
 
 describe('Entity', () => {
   const mockedDate = '2020-11-22T23:00:00.000Z'
@@ -205,9 +210,10 @@ describe('Entity', () => {
     const ent = new Entity({
       name: entityName,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
+        pk: { type: 'string', partitionKey: true },
         pkMap1: ['pk', 0],
-        pkMap2: ['pk', 1]
+        pkMap2: ['pk', 1],
+        hidden: { type: 'string', hidden: true }
       },
       table: tableWithoutSK
     } as const)
@@ -216,7 +222,7 @@ describe('Entity', () => {
       name: entityName,
       autoExecute: false,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
+        pk: { type: 'string', partitionKey: true },
         pkMap1: ['pk', 0],
         pkMap2: ['pk', 1]
       },
@@ -227,7 +233,7 @@ describe('Entity', () => {
       name: entityName,
       autoParse: false,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
+        pk: { type: 'string', partitionKey: true },
         pkMap1: ['pk', 0],
         pkMap2: ['pk', 1]
       },
@@ -238,7 +244,7 @@ describe('Entity', () => {
       name: entityName,
       timestamps: false,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
+        pk: { type: 'string', partitionKey: true },
         pkMap1: ['pk', 0],
         pkMap2: ['pk', 1]
       },
@@ -264,7 +270,10 @@ describe('Entity', () => {
         testGetItem
 
         type GetItemOptions = GetOptions<typeof ent>
-        type TestGetItemOptions = A.Equals<GetItemOptions, ExpectedGetOpts<keyof ExpectedItem>>
+        type TestGetItemOptions = A.Equals<
+          GetItemOptions,
+          ExpectedGetOpts<Exclude<keyof ExpectedItem, 'hidden'>>
+        >
         const testGetItemOptions: TestGetItemOptions = 1
         testGetItemOptions
       })
@@ -374,7 +383,7 @@ describe('Entity', () => {
         type DeleteItemOptions = DeleteOptions<typeof ent>
         type TestDeleteItemOptions = A.Equals<
           DeleteItemOptions,
-          ExpectedWriteOpts<keyof ExpectedItem, 'NONE' | 'ALL_OLD'>
+          ExpectedWriteOpts<keyof ExpectedItem | 'hidden', 'NONE' | 'ALL_OLD'>
         >
         const testDeleteItemOptions: TestDeleteItemOptions = 1
         testDeleteItemOptions
@@ -481,7 +490,7 @@ describe('Entity', () => {
 
     describe('put method', () => {
       it('nominal case', () => {
-        const item1 = { pk }
+        const item1 = { pk, hidden: 'test' }
         ent.putParams(item1, { returnValues: 'ALL_OLD' })
         const putPromise1 = () => ent.put({ pk }, { returnValues: 'ALL_OLD' })
         type PutItem1 = C.PromiseOf<F.Return<typeof putPromise1>>['Attributes']
@@ -500,7 +509,7 @@ describe('Entity', () => {
         type PutItemOptions = PutOptions<typeof ent>
         type TestPutItemOptions = A.Equals<
           PutItemOptions,
-          ExpectedWriteOpts<keyof ExpectedItem, 'NONE' | 'ALL_OLD'>
+          ExpectedWriteOpts<keyof ExpectedItem | 'hidden', 'NONE' | 'ALL_OLD'>
         >
         const testPutItemOptions: TestPutItemOptions = 1
         testPutItemOptions
@@ -596,7 +605,7 @@ describe('Entity', () => {
 
     describe('update method', () => {
       it('nominal case', () => {
-        const item1 = { pk }
+        const item1 = { pk, hidden: 'test' }
         ent.updateParams(item1)
         const updatePromise1 = () => ent.update(item1, { returnValues: 'ALL_OLD' })
         type UpdateItem1 = C.PromiseOf<F.Return<typeof updatePromise1>>['Attributes']
@@ -616,7 +625,7 @@ describe('Entity', () => {
         type TestUpdateItemOptions = A.Equals<
           UpdateItemOptions,
           ExpectedWriteOpts<
-            keyof ExpectedItem,
+            keyof ExpectedItem | 'hidden',
             'NONE' | 'UPDATED_OLD' | 'UPDATED_NEW' | 'ALL_OLD' | 'ALL_NEW'
           >
         >
@@ -731,7 +740,7 @@ describe('Entity', () => {
         type QueryItemsOptions = QueryOptions<typeof ent>
         type TestQueryItemsOptions = A.Equals<
           QueryItemsOptions,
-          ExpectedQueryOpts<keyof ExpectedItem>
+          ExpectedQueryOpts<keyof ExpectedItem, keyof ExpectedItem | 'hidden'>
         >
         const testQueryItemsOptions: TestQueryItemsOptions = 1
         testQueryItemsOptions
@@ -773,10 +782,10 @@ describe('Entity', () => {
       modifiedAlias: mod,
       typeAlias: en,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
+        pk: { type: 'string', partitionKey: true },
         pkMap1: ['pk', 0],
         pkMap2: ['pk', 1],
-        sk: { type: 'string', sortKey: true, hidden: true },
+        sk: { type: 'string', sortKey: true },
         skMap1: ['sk', 0],
         skMap2: ['sk', 1],
         alwAttr: { type: 'string', required: 'always' },
@@ -788,7 +797,8 @@ describe('Entity', () => {
         map2: ['mapped', 1, { required: true, default: '2' }],
         map3: ['mapped', 2, { required: 'always' }],
         map4: ['mapped', 3, { required: 'always', default: '4' }],
-        mapped: { type: 'string' }
+        mapped: { type: 'string' },
+        hidden: { type: 'string', hidden: true }
       },
       table
     } as const)
@@ -947,7 +957,7 @@ describe('Entity', () => {
         type DeleteItemOptions = DeleteOptions<typeof ent>
         type TestDeleteItemOptions = A.Equals<
           DeleteItemOptions,
-          ExpectedWriteOpts<keyof ExpectedItem, 'NONE' | 'ALL_OLD'>
+          ExpectedWriteOpts<keyof ExpectedItem | 'hidden', 'NONE' | 'ALL_OLD'>
         >
         const testDeleteItemOptions: TestDeleteItemOptions = 1
         testDeleteItemOptions
@@ -1053,7 +1063,7 @@ describe('Entity', () => {
         type PutItemOptions = PutOptions<typeof ent>
         type TestPutItemOptions = A.Equals<
           PutItemOptions,
-          ExpectedWriteOpts<keyof ExpectedItem, 'NONE' | 'ALL_OLD'>
+          ExpectedWriteOpts<keyof ExpectedItem | 'hidden', 'NONE' | 'ALL_OLD'>
         >
         const testPutItemOptions: TestPutItemOptions = 1
         testPutItemOptions
@@ -1197,7 +1207,7 @@ describe('Entity', () => {
         type TestUpdateItemOptions = A.Equals<
           UpdateItemOptions,
           ExpectedWriteOpts<
-            keyof ExpectedItem,
+            keyof ExpectedItem | 'hidden',
             'NONE' | 'UPDATED_OLD' | 'UPDATED_NEW' | 'ALL_OLD' | 'ALL_NEW'
           >
         >
@@ -1370,7 +1380,7 @@ describe('Entity', () => {
         type QueryItemsOptions = QueryOptions<typeof ent>
         type TestQueryItemsOptions = A.Equals<
           QueryItemsOptions,
-          ExpectedQueryOpts<keyof ExpectedItem>
+          ExpectedQueryOpts<keyof ExpectedItem, keyof ExpectedItem | 'hidden'>
         >
         const testQueryItemsOptions: TestQueryItemsOptions = 1
         testQueryItemsOptions
@@ -1388,8 +1398,8 @@ describe('Entity', () => {
     const ent = new Entity({
       name: entityName,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true, default: pk },
-        sk: { type: 'string', sortKey: true, hidden: true }
+        pk: { type: 'string', partitionKey: true, default: pk },
+        sk: { type: 'string', sortKey: true }
       },
       table
     } as const)
@@ -1445,8 +1455,8 @@ describe('Entity', () => {
     const ent = new Entity({
       name: entityName,
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
-        sk: { type: 'string', sortKey: true, hidden: true, default: sk }
+        pk: { type: 'string', partitionKey: true },
+        sk: { type: 'string', sortKey: true, default: sk }
       },
       table
     } as const)
@@ -1737,8 +1747,8 @@ describe('Entity', () => {
     const ent = new Entity<EntityItemOverlay, EntityCompositeKeyOverlay, typeof table>({
       name: 'TestEntity',
       attributes: {
-        pk: { type: 'string', partitionKey: true, hidden: true },
-        sk: { type: 'string', sortKey: true, hidden: true, default: sk }
+        pk: { type: 'string', partitionKey: true },
+        sk: { type: 'string', sortKey: true, default: sk }
       },
       table
     } as const)
@@ -2228,7 +2238,7 @@ describe('Entity', () => {
           type QueryItemsOptions = QueryOptions<typeof ent>
           type TestQueryItemsOptions = A.Equals<
             QueryItemsOptions,
-            ExpectedQueryOpts<keyof EntityItemOverlay>
+            ExpectedQueryOpts<keyof EntityItemOverlay, keyof EntityItemOverlay>
           >
           const testQueryItemsOptions: TestQueryItemsOptions = 1
           testQueryItemsOptions