All files / src/core index.ts

0% Statements 0/27
100% Branches 0/0
0% Functions 0/23
0% Lines 0/25

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76                                                                                                                                                       
/**
 * The domain layer — what this library actually does.
 *
 * @remarks
 * Two halves, and the split is the whole point of the package:
 *
 * - [`bindings/`](./bindings/index.ts) — one accessor per Cloudflare binding.
 *   An accessor holds a binding's *name*, never the binding, and resolves it
 *   from the `Env` handed to each call. That is what makes a single
 *   module-scope instance safe to share across requests.
 * - [`services/`](./services/index.ts) — one capability service per accessor,
 *   each implementing an interface `@bayudwiyansatria/core` declares.
 *   {@link KVService} is a `CacheStore`, {@link D1Service} a `DataStore`, so a
 *   caller depends on the capability and never names Cloudflare.
 *
 * Everything else in `src/` is supporting cast:
 *
 * | Layer          | Holds                                    | May import        |
 * | -------------- | ---------------------------------------- | ----------------- |
 * | `@/core`       | behaviour                                | every layer below |
 * | `@/types`      | the shapes exchanged with callers        | nothing in `src/` |
 * | `@/constants`  | values fixed for every caller            | `@/types`         |
 * | `@/exceptions` | the faults raised                        | the kernel only   |
 * | `@/utils`      | helpers that do not know the domain      | the kernel only   |
 *
 * The Hono middleware sits outside this directory, in
 * [`../middlewares/`](../middlewares/index.ts), and is published as its own
 * subpath. It stays out because `hono` is an *optional* peer dependency: the
 * moment anything under `@/core` imports it, resolving the package's main
 * entry drags the framework in and the peer stops being optional. A
 * `no-restricted-imports` rule in
 * [`eslint.config.ts`](../../eslint.config.ts) enforces that, along with the
 * one-way arrow above.
 *
 * @example
 * ```ts
 * import { KVBinding } from '@/core/bindings'
 * import { KVService } from '@/core/services'
 * ```
 *
 * @module
 * @author Bayu Dwiyan Satria
 * @version 1.0.0
 * @since 1.0.0
 */
export {
  AIBinding,
  AnalyticsBinding,
  Binding,
  D1Binding,
  DurableObjectBinding,
  HyperdriveBinding,
  KVBinding,
  QueueBinding,
  R2Binding,
  RateLimitBinding,
  VectorizeBinding
} from '@/core/bindings'
 
export {
  AIService,
  AnalyticsService,
  D1Service,
  DurableObjectService,
  HyperdriveService,
  KVService,
  QueueService,
  R2Service,
  RateLimitService,
  VectorizeService
} from '@/core/services'
 
export { CloudflareRequestMetadata } from '@/core/services/CloudflareRequestMetadata'
 
export { RequestCorrelation } from '@/core/observability'