hono-crud 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/adapters/drizzle/index.d.ts +18 -30
  3. package/dist/adapters/drizzle/index.js +4 -1668
  4. package/dist/adapters/memory/index.d.ts +2 -2
  5. package/dist/adapters/memory/index.js +1 -5
  6. package/dist/adapters/prisma/index.d.ts +1 -1
  7. package/dist/adapters/prisma/index.js +1 -1356
  8. package/dist/auth/index.js +1 -4
  9. package/dist/{bulk-patch-B6j0q_p_.d.ts → bulk-patch-f4TR8L-q.d.ts} +1 -1
  10. package/dist/cache/index.js +1 -5
  11. package/dist/chunk-3UFSQECZ.js +1 -0
  12. package/dist/chunk-4O2JRCJE.js +10 -0
  13. package/dist/chunk-6UMKXMI6.js +1 -0
  14. package/dist/chunk-GPY4KIVI.js +1 -0
  15. package/dist/chunk-HFAUW4XN.js +33 -0
  16. package/dist/chunk-OF4XNWYW.js +1 -0
  17. package/dist/chunk-OG6VCZ64.js +1 -0
  18. package/dist/chunk-RRA3AHAE.js +1 -0
  19. package/dist/chunk-SPICOFUM.js +84 -0
  20. package/dist/chunk-STVUWSWZ.js +1 -0
  21. package/dist/chunk-T7HH5Y3I.js +1 -0
  22. package/dist/chunk-TXBOO4S5.js +1 -0
  23. package/dist/chunk-UXKMF6AR.js +1 -0
  24. package/dist/{import-B7KS4Wvh.d.ts → import-BZ05PJMa.d.ts} +11 -0
  25. package/dist/{index-Dm8-ODYA.d.ts → index-431Ovi2o.d.ts} +2 -2
  26. package/dist/{index-5BEg0ty5.d.ts → index-bSnRLgcs.d.ts} +1 -1
  27. package/dist/index.d.ts +25 -10
  28. package/dist/index.js +1 -2267
  29. package/dist/logging/index.d.ts +4 -4
  30. package/dist/logging/index.js +1 -5
  31. package/dist/rate-limit/index.d.ts +2 -2
  32. package/dist/rate-limit/index.js +1 -5
  33. package/dist/storage/index.d.ts +2 -2
  34. package/dist/storage/index.js +1 -5
  35. package/dist/{types-Bc7ebF5x.d.ts → types-BO3G_MZk.d.ts} +2 -2
  36. package/dist/{types-B8CWg4nO.d.ts → types-DnQWCfXp.d.ts} +1 -1
  37. package/dist/ui.js +1 -1
  38. package/package.json +2 -1
  39. package/dist/chunk-6LS3LNIH.js +0 -158
  40. package/dist/chunk-CDCGYMC6.js +0 -149
  41. package/dist/chunk-CNE7UR5E.js +0 -175
  42. package/dist/chunk-FST5S5UY.js +0 -304
  43. package/dist/chunk-G7OXZ24G.js +0 -1695
  44. package/dist/chunk-IPGNLIJV.js +0 -199
  45. package/dist/chunk-KP4HGONO.js +0 -947
  46. package/dist/chunk-LCRNKT65.js +0 -6589
  47. package/dist/chunk-MANRQHEB.js +0 -330
  48. package/dist/chunk-U3SUUXJK.js +0 -770
  49. package/dist/chunk-WOFE46VS.js +0 -1214
  50. package/dist/chunk-YJMGFVHZ.js +0 -220
  51. package/dist/chunk-ZCHXXN7T.js +0 -44
package/CHANGELOG.md CHANGED
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
13
13
  %b
14
14
  %b
15
15
  %b
16
+ %b
17
+ %b
16
18
  ## [0.1.0] - 2025-01-29
17
19
 
18
20
  ### Added
@@ -42,3 +44,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
42
44
  [0.3.0]: https://github.com/kshdotdev/hono-crud/compare/v0.2.0...v0.3.0
43
45
  [0.3.1]: https://github.com/kshdotdev/hono-crud/compare/v0.3.0...v0.3.1
44
46
  [0.3.2]: https://github.com/kshdotdev/hono-crud/compare/v0.3.1...v0.3.2
47
+ [0.4.0]: https://github.com/kshdotdev/hono-crud/compare/v0.3.2...v0.4.0
48
+ [0.4.1]: https://github.com/kshdotdev/hono-crud/compare/v0.4.0...v0.4.1
@@ -1,8 +1,8 @@
1
1
  import { Table, SQL, Column } from 'drizzle-orm';
2
2
  import { M as MetaInput, I as IncludeOptions, F as FilterCondition, g as RelationConfig, h as NestedUpdateInput, i as NestedWriteResult, L as ListFilters, P as PaginatedResult, j as AggregateOptions, k as AggregateResult, S as SearchOptions, l as SearchResult } from '../../types-CA784ZtV.js';
3
3
  import { Env } from 'hono';
4
- import { C as CreateEndpoint, M as ModelObject, R as ReadEndpoint, U as UpdateEndpoint, D as DeleteEndpoint, L as ListEndpoint, a as RestoreEndpoint, B as BatchCreateEndpoint, b as BatchDeleteEndpoint, c as BatchRestoreEndpoint, d as BatchUpdateEndpoint, e as BatchUpdateItem, A as AggregateEndpoint, f as BatchUpsertEndpoint, g as UpsertEndpoint, E as ExportEndpoint, I as ImportEndpoint, S as SearchEndpoint, V as VersionCompareEndpoint, h as VersionHistoryEndpoint, i as VersionReadEndpoint, j as VersionRollbackEndpoint } from '../../import-B7KS4Wvh.js';
5
- import { A as AdapterBundle } from '../../index-5BEg0ty5.js';
4
+ import { C as CreateEndpoint, M as ModelObject, R as ReadEndpoint, U as UpdateEndpoint, D as DeleteEndpoint, L as ListEndpoint, a as RestoreEndpoint, B as BatchCreateEndpoint, b as BatchDeleteEndpoint, c as BatchRestoreEndpoint, d as BatchUpdateEndpoint, e as BatchUpdateItem, A as AggregateEndpoint, f as BatchUpsertEndpoint, g as UpsertEndpoint, E as ExportEndpoint, I as ImportEndpoint, S as SearchEndpoint, V as VersionCompareEndpoint, h as VersionHistoryEndpoint, i as VersionReadEndpoint, j as VersionRollbackEndpoint } from '../../import-BZ05PJMa.js';
5
+ import { A as AdapterBundle } from '../../index-bSnRLgcs.js';
6
6
  import { z } from 'zod';
7
7
  import '@hono/zod-openapi';
8
8
  import '../../route-DwSID3du.js';
@@ -731,7 +731,7 @@ declare const DrizzleAdapters: AdapterBundle;
731
731
  * createdAt: timestamp('created_at').defaultNow(),
732
732
  * });
733
733
  *
734
- * const { select: UserSchema, insert: CreateUserSchema } = createDrizzleSchemas(users);
734
+ * const { select: UserSchema, insert: CreateUserSchema } = await createDrizzleSchemas(users);
735
735
  * ```
736
736
  */
737
737
 
@@ -751,36 +751,36 @@ type DrizzleTable = {
751
751
  *
752
752
  * @param table - Drizzle table definition
753
753
  * @param refine - Optional refinements for specific columns
754
- * @returns Zod schema for the table's select type
754
+ * @returns Promise resolving to a Zod schema for the table's select type
755
755
  *
756
756
  * @example
757
757
  * ```ts
758
758
  * import { users } from './schema';
759
759
  * import { createSelectSchema } from 'hono-crud/adapters/drizzle';
760
760
  *
761
- * const UserSchema = createSelectSchema(users);
761
+ * const UserSchema = await createSelectSchema(users);
762
762
  * type User = z.infer<typeof UserSchema>;
763
763
  * ```
764
764
  */
765
- declare function createSelectSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): z.ZodObject<Record<string, z.ZodTypeAny>>;
765
+ declare function createSelectSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): Promise<z.ZodObject<Record<string, z.ZodTypeAny>>>;
766
766
  /**
767
767
  * Re-export createInsertSchema from drizzle-zod.
768
768
  * Creates a Zod schema for INSERT queries (columns with defaults become optional).
769
769
  *
770
770
  * @param table - Drizzle table definition
771
771
  * @param refine - Optional refinements for specific columns
772
- * @returns Zod schema for the table's insert type
772
+ * @returns Promise resolving to a Zod schema for the table's insert type
773
773
  *
774
774
  * @example
775
775
  * ```ts
776
776
  * import { users } from './schema';
777
777
  * import { createInsertSchema } from 'hono-crud/adapters/drizzle';
778
778
  *
779
- * const CreateUserSchema = createInsertSchema(users);
779
+ * const CreateUserSchema = await createInsertSchema(users);
780
780
  * type CreateUser = z.infer<typeof CreateUserSchema>;
781
781
  * ```
782
782
  */
783
- declare function createInsertSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): z.ZodObject<Record<string, z.ZodTypeAny>>;
783
+ declare function createInsertSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): Promise<z.ZodObject<Record<string, z.ZodTypeAny>>>;
784
784
  /**
785
785
  * Re-export createUpdateSchema from drizzle-zod (if available).
786
786
  * Creates a Zod schema for UPDATE queries (all columns become optional).
@@ -790,18 +790,18 @@ declare function createInsertSchema<T extends DrizzleTable>(table: T, refine?: R
790
790
  *
791
791
  * @param table - Drizzle table definition
792
792
  * @param refine - Optional refinements for specific columns
793
- * @returns Zod schema for the table's update type
793
+ * @returns Promise resolving to a Zod schema for the table's update type
794
794
  *
795
795
  * @example
796
796
  * ```ts
797
797
  * import { users } from './schema';
798
798
  * import { createUpdateSchema } from 'hono-crud/adapters/drizzle';
799
799
  *
800
- * const UpdateUserSchema = createUpdateSchema(users);
800
+ * const UpdateUserSchema = await createUpdateSchema(users);
801
801
  * type UpdateUser = z.infer<typeof UpdateUserSchema>;
802
802
  * ```
803
803
  */
804
- declare function createUpdateSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): z.ZodObject<Record<string, z.ZodTypeAny>>;
804
+ declare function createUpdateSchema<T extends DrizzleTable>(table: T, refine?: Record<string, z.ZodTypeAny>): Promise<z.ZodObject<Record<string, z.ZodTypeAny>>>;
805
805
  /**
806
806
  * Result of createDrizzleSchemas helper.
807
807
  */
@@ -830,7 +830,7 @@ interface DrizzleSchemas {
830
830
  * @param options.selectRefine - Refinements for select schema
831
831
  * @param options.updateRefine - Refinements for update schema
832
832
  * @param options.coerceDates - Whether to coerce date strings to Date objects (default: true)
833
- * @returns Object containing select, insert, and update schemas
833
+ * @returns Promise resolving to object containing select, insert, and update schemas
834
834
  *
835
835
  * @example
836
836
  * ```ts
@@ -845,7 +845,7 @@ interface DrizzleSchemas {
845
845
  * });
846
846
  *
847
847
  * // Generate schemas from table
848
- * const schemas = createDrizzleSchemas(users, {
848
+ * const schemas = await createDrizzleSchemas(users, {
849
849
  * insertRefine: {
850
850
  * email: z.string().email(), // Add email validation
851
851
  * },
@@ -866,24 +866,12 @@ declare function createDrizzleSchemas<T extends DrizzleTable>(table: T, options?
866
866
  updateRefine?: Record<string, z.ZodTypeAny>;
867
867
  /** Whether to coerce date strings to Date objects. Default: true */
868
868
  coerceDates?: boolean;
869
- }): DrizzleSchemas;
870
- /**
871
- * Async version of createDrizzleSchemas that handles lazy loading.
872
- * Use this if you're not sure drizzle-zod is already loaded.
873
- *
874
- * @param table - Drizzle table definition
875
- * @param options - Optional configuration
876
- * @returns Promise resolving to schemas object
877
- */
878
- declare function createDrizzleSchemasAsync<T extends DrizzleTable>(table: T, options?: {
879
- insertRefine?: Record<string, z.ZodTypeAny>;
880
- selectRefine?: Record<string, z.ZodTypeAny>;
881
- updateRefine?: Record<string, z.ZodTypeAny>;
882
869
  }): Promise<DrizzleSchemas>;
883
870
  /**
884
- * Checks if drizzle-zod is available.
885
- * @returns true if drizzle-zod can be imported
871
+ * Checks if drizzle-zod is available (from cache only).
872
+ * Returns true only if drizzle-zod has been successfully loaded before.
873
+ * @returns true if drizzle-zod has been loaded
886
874
  */
887
875
  declare function isDrizzleZodAvailable(): boolean;
888
876
 
889
- export { type Database, DrizzleAdapters, DrizzleAggregateEndpoint, DrizzleBatchCreateEndpoint, DrizzleBatchDeleteEndpoint, DrizzleBatchRestoreEndpoint, DrizzleBatchUpdateEndpoint, DrizzleBatchUpsertEndpoint, DrizzleCreateEndpoint, type DrizzleCrudClasses, type DrizzleDB, type DrizzleDatabase, type DrizzleDatabaseConstraint, DrizzleDeleteEndpoint, type DrizzleEnv, DrizzleExportEndpoint, DrizzleImportEndpoint, DrizzleListEndpoint, DrizzleReadEndpoint, DrizzleRestoreEndpoint, type DrizzleSchemas, DrizzleSearchEndpoint, DrizzleUpdateEndpoint, DrizzleUpsertEndpoint, DrizzleVersionCompareEndpoint, DrizzleVersionHistoryEndpoint, DrizzleVersionReadEndpoint, DrizzleVersionRollbackEndpoint, type QueryBuilder, batchLoadDrizzleRelations, buildWhereCondition, cast, createDrizzleCrud, createDrizzleSchemas, createDrizzleSchemasAsync, createInsertSchema, createSelectSchema, createUpdateSchema, getColumn, getTable, isDrizzleZodAvailable, loadDrizzleRelation, loadDrizzleRelations };
877
+ export { type Database, DrizzleAdapters, DrizzleAggregateEndpoint, DrizzleBatchCreateEndpoint, DrizzleBatchDeleteEndpoint, DrizzleBatchRestoreEndpoint, DrizzleBatchUpdateEndpoint, DrizzleBatchUpsertEndpoint, DrizzleCreateEndpoint, type DrizzleCrudClasses, type DrizzleDB, type DrizzleDatabase, type DrizzleDatabaseConstraint, DrizzleDeleteEndpoint, type DrizzleEnv, DrizzleExportEndpoint, DrizzleImportEndpoint, DrizzleListEndpoint, DrizzleReadEndpoint, DrizzleRestoreEndpoint, type DrizzleSchemas, DrizzleSearchEndpoint, DrizzleUpdateEndpoint, DrizzleUpsertEndpoint, DrizzleVersionCompareEndpoint, DrizzleVersionHistoryEndpoint, DrizzleVersionReadEndpoint, DrizzleVersionRollbackEndpoint, type QueryBuilder, batchLoadDrizzleRelations, buildWhereCondition, cast, createDrizzleCrud, createDrizzleSchemas, createInsertSchema, createSelectSchema, createUpdateSchema, getColumn, getTable, isDrizzleZodAvailable, loadDrizzleRelation, loadDrizzleRelations };