@lpdjs/firestore-repo-service 2.2.9-beta.6 → 2.2.9-beta.8

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 (45) hide show
  1. package/dist/{create-servers-Ddp7HOPS.d.ts → create-servers-BbsqzP1y.d.ts} +6 -6
  2. package/dist/{create-servers-JSHyXgFB.d.cts → create-servers-Bm58QZze.d.cts} +6 -6
  3. package/dist/{firebase-auth-CBqtAeb5.d.cts → firebase-auth-D1APf9PA.d.cts} +1 -1
  4. package/dist/{firebase-auth-CBqtAeb5.d.ts → firebase-auth-D1APf9PA.d.ts} +1 -1
  5. package/dist/history/index.d.cts +2 -2
  6. package/dist/history/index.d.ts +2 -2
  7. package/dist/{index-BTrgC2ZA.d.cts → index-BmagC7uw.d.cts} +3 -3
  8. package/dist/{index-CP4WoShV.d.ts → index-BxurOEz1.d.ts} +3 -3
  9. package/dist/index.d.cts +9 -9
  10. package/dist/index.d.ts +9 -9
  11. package/dist/{openapi-BSdeinkq.d.ts → openapi-DIoQV_yQ.d.ts} +1 -1
  12. package/dist/{openapi-BSp3x2yW.d.cts → openapi-ML_1hTx2.d.cts} +1 -1
  13. package/dist/{queue-DSzvdhYk.d.ts → queue-7d2-Y-o-.d.ts} +1 -1
  14. package/dist/{queue-2NvFI_vy.d.cts → queue-CC5cnIFv.d.cts} +1 -1
  15. package/dist/{read-D4xAmsbE.d.cts → read-BSyLao3I.d.cts} +1 -1
  16. package/dist/{read-D4xAmsbE.d.ts → read-BSyLao3I.d.ts} +1 -1
  17. package/dist/servers/admin/index.d.cts +4 -4
  18. package/dist/servers/admin/index.d.ts +4 -4
  19. package/dist/servers/auth/index.d.cts +1 -1
  20. package/dist/servers/auth/index.d.ts +1 -1
  21. package/dist/servers/crud/index.d.cts +6 -6
  22. package/dist/servers/crud/index.d.ts +6 -6
  23. package/dist/servers/hono/cli.cjs +124 -0
  24. package/dist/servers/hono/cli.cjs.map +1 -0
  25. package/dist/servers/hono/cli.d.cts +1 -0
  26. package/dist/servers/hono/cli.d.ts +1 -0
  27. package/dist/servers/hono/cli.js +124 -0
  28. package/dist/servers/hono/cli.js.map +1 -0
  29. package/dist/servers/hono/index.cjs +30 -0
  30. package/dist/servers/hono/index.cjs.map +1 -0
  31. package/dist/servers/hono/index.d.cts +382 -0
  32. package/dist/servers/hono/index.d.ts +382 -0
  33. package/dist/servers/hono/index.js +30 -0
  34. package/dist/servers/hono/index.js.map +1 -0
  35. package/dist/servers/index.d.cts +9 -9
  36. package/dist/servers/index.d.ts +9 -9
  37. package/dist/sync/bigquery.d.cts +2 -2
  38. package/dist/sync/bigquery.d.ts +2 -2
  39. package/dist/sync/index.d.cts +5 -5
  40. package/dist/sync/index.d.ts +5 -5
  41. package/dist/{types-CqXbEeXp.d.ts → types-5vgXdUM2.d.ts} +3 -3
  42. package/dist/{types-DcyNkfY4.d.cts → types-BTt_FmeC.d.cts} +2 -2
  43. package/dist/{types-DptSRAK6.d.cts → types-BtdC0Qhu.d.cts} +3 -3
  44. package/dist/{types-DrARZ6H4.d.ts → types-DXoT10nB.d.ts} +2 -2
  45. package/package.json +19 -1
@@ -1,11 +1,11 @@
1
- import { S as SyncQueue } from './queue-DSzvdhYk.js';
2
- import { F as FirestoreSyncConfig, S as SyncEvent } from './types-DrARZ6H4.js';
3
- import { O as OpenAPIDocument } from './openapi-BSdeinkq.js';
1
+ import { S as SyncQueue } from './queue-7d2-Y-o-.js';
2
+ import { F as FirestoreSyncConfig, S as SyncEvent } from './types-DXoT10nB.js';
3
+ import { O as OpenAPIDocument } from './openapi-DIoQV_yQ.js';
4
4
  import * as firebase_functions_v2_https from 'firebase-functions/v2/https';
5
5
  import { onRequest, HttpsOptions } from 'firebase-functions/v2/https';
6
- import { a as HistoryTriggersConfig } from './read-D4xAmsbE.js';
7
- import { C as ConfiguredRepository, m as CrudServerOptions, l as CrudRepoConfig } from './types-CqXbEeXp.js';
8
- import { b as AdminServerOptions, A as AdminRepoConfig } from './index-CP4WoShV.js';
6
+ import { H as HistoryTriggersConfig } from './read-BSyLao3I.js';
7
+ import { C as ConfiguredRepository, a as CrudServerOptions, b as CrudRepoConfig } from './types-5vgXdUM2.js';
8
+ import { A as AdminServerOptions, a as AdminRepoConfig } from './index-BxurOEz1.js';
9
9
 
10
10
  /** Per-repo admin config with `repo` omitted (auto-bound from the registry key). */
11
11
  type BoundAdminRepoConfig<TRepo extends ConfiguredRepository<any>> = Omit<AdminRepoConfig<TRepo>, "repo">;
@@ -1,11 +1,11 @@
1
- import { S as SyncQueue } from './queue-2NvFI_vy.cjs';
2
- import { F as FirestoreSyncConfig, S as SyncEvent } from './types-DcyNkfY4.cjs';
3
- import { O as OpenAPIDocument } from './openapi-BSp3x2yW.cjs';
1
+ import { S as SyncQueue } from './queue-CC5cnIFv.cjs';
2
+ import { F as FirestoreSyncConfig, S as SyncEvent } from './types-BTt_FmeC.cjs';
3
+ import { O as OpenAPIDocument } from './openapi-ML_1hTx2.cjs';
4
4
  import * as firebase_functions_v2_https from 'firebase-functions/v2/https';
5
5
  import { onRequest, HttpsOptions } from 'firebase-functions/v2/https';
6
- import { a as HistoryTriggersConfig } from './read-D4xAmsbE.cjs';
7
- import { C as ConfiguredRepository, m as CrudServerOptions, l as CrudRepoConfig } from './types-DptSRAK6.cjs';
8
- import { b as AdminServerOptions, A as AdminRepoConfig } from './index-BTrgC2ZA.cjs';
6
+ import { H as HistoryTriggersConfig } from './read-BSyLao3I.cjs';
7
+ import { C as ConfiguredRepository, a as CrudServerOptions, b as CrudRepoConfig } from './types-BtdC0Qhu.cjs';
8
+ import { A as AdminServerOptions, a as AdminRepoConfig } from './index-BmagC7uw.cjs';
9
9
 
10
10
  /** Per-repo admin config with `repo` omitted (auto-bound from the registry key). */
11
11
  type BoundAdminRepoConfig<TRepo extends ConfiguredRepository<any>> = Omit<AdminRepoConfig<TRepo>, "repo">;
@@ -306,4 +306,4 @@ declare function isAuthExtension(value: unknown): value is AuthExtension;
306
306
  */
307
307
  declare const allowAll: () => true;
308
308
 
309
- export { type AuthExtension as A, type DecodedIdTokenLike as D, type FirebaseAdminAuthLike as F, MiniRouter as M, type RouteHandler as R, type Middleware as a, type AuthUser as b, allowAll as c, type AuthRoute as d, type FirebaseAuthConfig as e, firebaseAuth as f, type FirebaseAuthLoginPageConfig as g, type FirebaseAuthMode as h, isAuthExtension as i };
309
+ export { type AuthExtension as A, type DecodedIdTokenLike as D, type FirebaseAdminAuthLike as F, MiniRouter as M, type RouteHandler as R, allowAll as a, type AuthRoute as b, type AuthUser as c, type FirebaseAuthConfig as d, type FirebaseAuthLoginPageConfig as e, firebaseAuth as f, type FirebaseAuthMode as g, type Middleware as h, isAuthExtension as i };
@@ -306,4 +306,4 @@ declare function isAuthExtension(value: unknown): value is AuthExtension;
306
306
  */
307
307
  declare const allowAll: () => true;
308
308
 
309
- export { type AuthExtension as A, type DecodedIdTokenLike as D, type FirebaseAdminAuthLike as F, MiniRouter as M, type RouteHandler as R, type Middleware as a, type AuthUser as b, allowAll as c, type AuthRoute as d, type FirebaseAuthConfig as e, firebaseAuth as f, type FirebaseAuthLoginPageConfig as g, type FirebaseAuthMode as h, isAuthExtension as i };
309
+ export { type AuthExtension as A, type DecodedIdTokenLike as D, type FirebaseAdminAuthLike as F, MiniRouter as M, type RouteHandler as R, allowAll as a, type AuthRoute as b, type AuthUser as c, type FirebaseAuthConfig as d, type FirebaseAuthLoginPageConfig as e, firebaseAuth as f, type FirebaseAuthMode as g, type Middleware as h, isAuthExtension as i };
@@ -1,5 +1,5 @@
1
- import { a as HistoryTriggersConfig, c as HistoryOperation, d as HistoryFieldChange, e as HistoryMeta, H as HistoryConfigForModel, V as V2HistoryDoc, f as HistoryValueType, g as V1HistoryDoc, h as HistoryEntry } from '../read-D4xAmsbE.cjs';
2
- export { j as HistoryConfigBase, k as HistoryFirestoreTriggersDep, l as HistoryListOptions, b as HistoryMethods, m as HistoryRawListOptions, n as HistoryTriggerRepoOverride, i as createHistoryMethods } from '../read-D4xAmsbE.cjs';
1
+ import { H as HistoryTriggersConfig, c as HistoryOperation, d as HistoryFieldChange, e as HistoryMeta, a as HistoryConfigForModel, V as V2HistoryDoc, f as HistoryValueType, g as V1HistoryDoc, h as HistoryEntry } from '../read-BSyLao3I.cjs';
2
+ export { j as HistoryConfigBase, k as HistoryFirestoreTriggersDep, l as HistoryListOptions, b as HistoryMethods, m as HistoryRawListOptions, n as HistoryTriggerRepoOverride, i as createHistoryMethods } from '../read-BSyLao3I.cjs';
3
3
  import { CollectionReference } from 'firebase-admin/firestore';
4
4
  import 'firebase-functions/v2/firestore';
5
5
 
@@ -1,5 +1,5 @@
1
- import { a as HistoryTriggersConfig, c as HistoryOperation, d as HistoryFieldChange, e as HistoryMeta, H as HistoryConfigForModel, V as V2HistoryDoc, f as HistoryValueType, g as V1HistoryDoc, h as HistoryEntry } from '../read-D4xAmsbE.js';
2
- export { j as HistoryConfigBase, k as HistoryFirestoreTriggersDep, l as HistoryListOptions, b as HistoryMethods, m as HistoryRawListOptions, n as HistoryTriggerRepoOverride, i as createHistoryMethods } from '../read-D4xAmsbE.js';
1
+ import { H as HistoryTriggersConfig, c as HistoryOperation, d as HistoryFieldChange, e as HistoryMeta, a as HistoryConfigForModel, V as V2HistoryDoc, f as HistoryValueType, g as V1HistoryDoc, h as HistoryEntry } from '../read-BSyLao3I.js';
2
+ export { j as HistoryConfigBase, k as HistoryFirestoreTriggersDep, l as HistoryListOptions, b as HistoryMethods, m as HistoryRawListOptions, n as HistoryTriggerRepoOverride, i as createHistoryMethods } from '../read-BSyLao3I.js';
3
3
  import { CollectionReference } from 'firebase-admin/firestore';
4
4
  import 'firebase-functions/v2/firestore';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { HttpsOptions } from 'firebase-functions/v2/https';
3
- import { C as ConfiguredRepository, R as RepositoryConfig, F as FieldPath, n as FieldRole } from './types-DptSRAK6.cjs';
4
- import { A as AuthExtension, a as Middleware } from './firebase-auth-CBqtAeb5.cjs';
3
+ import { C as ConfiguredRepository, f as RepositoryConfig, g as FieldPath, F as FieldRole } from './types-BtdC0Qhu.cjs';
4
+ import { A as AuthExtension, h as Middleware } from './firebase-auth-D1APf9PA.cjs';
5
5
 
6
6
  interface PageOptions {
7
7
  title: string;
@@ -458,4 +458,4 @@ declare function createAdminServer<TRepos extends Record<string, ConfiguredRepos
458
458
  httpsOptions?: HttpsOptions;
459
459
  };
460
460
 
461
- export { type AdminRepoConfig as A, type BasicAuthConfig as B, type ColumnMeta as C, type FilterState as F, type PageOptions as P, type QueryError as Q, type RelationalFieldMeta as R, type SortState as S, type AdminRepoEntry as a, type AdminServerOptions as b, type RepoRegistry as c, createAdminServer as d };
461
+ export { type AdminServerOptions as A, type BasicAuthConfig as B, type ColumnMeta as C, type FilterState as F, type PageOptions as P, type QueryError as Q, type RelationalFieldMeta as R, type SortState as S, type AdminRepoConfig as a, type AdminRepoEntry as b, type RepoRegistry as c, createAdminServer as d };
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { HttpsOptions } from 'firebase-functions/v2/https';
3
- import { C as ConfiguredRepository, R as RepositoryConfig, F as FieldPath, n as FieldRole } from './types-CqXbEeXp.js';
4
- import { A as AuthExtension, a as Middleware } from './firebase-auth-CBqtAeb5.js';
3
+ import { C as ConfiguredRepository, f as RepositoryConfig, g as FieldPath, F as FieldRole } from './types-5vgXdUM2.js';
4
+ import { A as AuthExtension, h as Middleware } from './firebase-auth-D1APf9PA.js';
5
5
 
6
6
  interface PageOptions {
7
7
  title: string;
@@ -458,4 +458,4 @@ declare function createAdminServer<TRepos extends Record<string, ConfiguredRepos
458
458
  httpsOptions?: HttpsOptions;
459
459
  };
460
460
 
461
- export { type AdminRepoConfig as A, type BasicAuthConfig as B, type ColumnMeta as C, type FilterState as F, type PageOptions as P, type QueryError as Q, type RelationalFieldMeta as R, type SortState as S, type AdminRepoEntry as a, type AdminServerOptions as b, type RepoRegistry as c, createAdminServer as d };
461
+ export { type AdminServerOptions as A, type BasicAuthConfig as B, type ColumnMeta as C, type FilterState as F, type PageOptions as P, type QueryError as Q, type RelationalFieldMeta as R, type SortState as S, type AdminRepoConfig as a, type AdminRepoEntry as b, type RepoRegistry as c, createAdminServer as d };
package/dist/index.d.cts CHANGED
@@ -1,17 +1,17 @@
1
- import { H as HistoryConfigForModel } from './read-D4xAmsbE.cjs';
1
+ import { a as HistoryConfigForModel } from './read-BSyLao3I.cjs';
2
2
  import { Query, QuerySnapshot, Firestore } from 'firebase-admin/firestore';
3
3
  import { z } from 'zod';
4
- import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-DptSRAK6.cjs';
5
- export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-DptSRAK6.cjs';
6
- export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from './create-servers-JSHyXgFB.cjs';
7
- export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig } from './index-BTrgC2ZA.cjs';
8
- export { M as MiniRouter } from './firebase-auth-CBqtAeb5.cjs';
4
+ import { h as QueryOptions, P as PaginationOptions, f as RepositoryConfig, i as RelationConfig, C as ConfiguredRepository } from './types-BtdC0Qhu.cjs';
5
+ export { A as ApiResponse, b as CrudRepoConfig, a as CrudServerOptions, E as ExtractDocumentRefSignature, j as ExtractUpdateSignature, g as FieldPath, F as FieldRole, p as GenerateGetMethods, q as GenerateQueryMethods, G as GetOptions, k as GetResult, I as IncludeConfigTyped, L as ListResponseData, o as PaginationResult, r as PaginationWithIncludeOptionsTyped, s as PopulateOptionsTyped, Q as QueryRequestBody, l as RelationalKeys, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath, W as WhereClause, m as createPaginationIterator, n as executePaginatedQuery } from './types-BtdC0Qhu.cjs';
6
+ export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from './create-servers-Bm58QZze.cjs';
7
+ export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig } from './index-BmagC7uw.cjs';
8
+ export { M as MiniRouter } from './firebase-auth-D1APf9PA.cjs';
9
9
  import 'firebase-functions/v2/firestore';
10
10
  import 'firebase-functions/v2/https';
11
- import './queue-2NvFI_vy.cjs';
12
- import './types-DcyNkfY4.cjs';
11
+ import './queue-CC5cnIFv.cjs';
12
+ import './types-BTt_FmeC.cjs';
13
13
  import 'firebase-functions/v2/pubsub';
14
- import './openapi-BSp3x2yW.cjs';
14
+ import './openapi-ML_1hTx2.cjs';
15
15
 
16
16
  /**
17
17
  * Apply QueryOptions to a Firestore query.
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { H as HistoryConfigForModel } from './read-D4xAmsbE.js';
1
+ import { a as HistoryConfigForModel } from './read-BSyLao3I.js';
2
2
  import { Query, QuerySnapshot, Firestore } from 'firebase-admin/firestore';
3
3
  import { z } from 'zod';
4
- import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-CqXbEeXp.js';
5
- export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-CqXbEeXp.js';
6
- export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from './create-servers-Ddp7HOPS.js';
7
- export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig } from './index-CP4WoShV.js';
8
- export { M as MiniRouter } from './firebase-auth-CBqtAeb5.js';
4
+ import { h as QueryOptions, P as PaginationOptions, f as RepositoryConfig, i as RelationConfig, C as ConfiguredRepository } from './types-5vgXdUM2.js';
5
+ export { A as ApiResponse, b as CrudRepoConfig, a as CrudServerOptions, E as ExtractDocumentRefSignature, j as ExtractUpdateSignature, g as FieldPath, F as FieldRole, p as GenerateGetMethods, q as GenerateQueryMethods, G as GetOptions, k as GetResult, I as IncludeConfigTyped, L as ListResponseData, o as PaginationResult, r as PaginationWithIncludeOptionsTyped, s as PopulateOptionsTyped, Q as QueryRequestBody, l as RelationalKeys, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath, W as WhereClause, m as createPaginationIterator, n as executePaginatedQuery } from './types-5vgXdUM2.js';
6
+ export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from './create-servers-BbsqzP1y.js';
7
+ export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig } from './index-BxurOEz1.js';
8
+ export { M as MiniRouter } from './firebase-auth-D1APf9PA.js';
9
9
  import 'firebase-functions/v2/firestore';
10
10
  import 'firebase-functions/v2/https';
11
- import './queue-DSzvdhYk.js';
12
- import './types-DrARZ6H4.js';
11
+ import './queue-7d2-Y-o-.js';
12
+ import './types-DXoT10nB.js';
13
13
  import 'firebase-functions/v2/pubsub';
14
- import './openapi-BSdeinkq.js';
14
+ import './openapi-DIoQV_yQ.js';
15
15
 
16
16
  /**
17
17
  * Apply QueryOptions to a Firestore query.
@@ -1,4 +1,4 @@
1
- import { s as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-CqXbEeXp.js';
1
+ import { d as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-5vgXdUM2.js';
2
2
 
3
3
  /**
4
4
  * OpenAPI 3.1 specification generator for the CRUD server.
@@ -1,4 +1,4 @@
1
- import { s as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-DptSRAK6.cjs';
1
+ import { d as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-BtdC0Qhu.cjs';
2
2
 
3
3
  /**
4
4
  * OpenAPI 3.1 specification generator for the CRUD server.
@@ -1,4 +1,4 @@
1
- import { a as SqlAdapter, S as SyncEvent } from './types-DrARZ6H4.js';
1
+ import { a as SqlAdapter, S as SyncEvent } from './types-DXoT10nB.js';
2
2
 
3
3
  /**
4
4
  * Per-repo in-memory batch buffer.
@@ -1,4 +1,4 @@
1
- import { a as SqlAdapter, S as SyncEvent } from './types-DcyNkfY4.cjs';
1
+ import { a as SqlAdapter, S as SyncEvent } from './types-BTt_FmeC.cjs';
2
2
 
3
3
  /**
4
4
  * Per-repo in-memory batch buffer.
@@ -357,4 +357,4 @@ interface HistoryMethods<T, PathArgs extends readonly unknown[] = [string]> {
357
357
  ]): Promise<HistoryEntry<T> | null>;
358
358
  }
359
359
 
360
- export { type HistoryConfigForModel as H, type V2HistoryDoc as V, type HistoryTriggersConfig as a, type HistoryMethods as b, type HistoryOperation as c, type HistoryFieldChange as d, type HistoryMeta as e, type HistoryValueType as f, type V1HistoryDoc as g, type HistoryEntry as h, createHistoryMethods as i, type HistoryConfigBase as j, type HistoryFirestoreTriggersDep as k, type HistoryListOptions as l, type HistoryRawListOptions as m, type HistoryTriggerRepoOverride as n };
360
+ export { type HistoryTriggersConfig as H, type V2HistoryDoc as V, type HistoryConfigForModel as a, type HistoryMethods as b, type HistoryOperation as c, type HistoryFieldChange as d, type HistoryMeta as e, type HistoryValueType as f, type V1HistoryDoc as g, type HistoryEntry as h, createHistoryMethods as i, type HistoryConfigBase as j, type HistoryFirestoreTriggersDep as k, type HistoryListOptions as l, type HistoryRawListOptions as m, type HistoryTriggerRepoOverride as n };
@@ -357,4 +357,4 @@ interface HistoryMethods<T, PathArgs extends readonly unknown[] = [string]> {
357
357
  ]): Promise<HistoryEntry<T> | null>;
358
358
  }
359
359
 
360
- export { type HistoryConfigForModel as H, type V2HistoryDoc as V, type HistoryTriggersConfig as a, type HistoryMethods as b, type HistoryOperation as c, type HistoryFieldChange as d, type HistoryMeta as e, type HistoryValueType as f, type V1HistoryDoc as g, type HistoryEntry as h, createHistoryMethods as i, type HistoryConfigBase as j, type HistoryFirestoreTriggersDep as k, type HistoryListOptions as l, type HistoryRawListOptions as m, type HistoryTriggerRepoOverride as n };
360
+ export { type HistoryTriggersConfig as H, type V2HistoryDoc as V, type HistoryConfigForModel as a, type HistoryMethods as b, type HistoryOperation as c, type HistoryFieldChange as d, type HistoryMeta as e, type HistoryValueType as f, type V1HistoryDoc as g, type HistoryEntry as h, createHistoryMethods as i, type HistoryConfigBase as j, type HistoryFirestoreTriggersDep as k, type HistoryListOptions as l, type HistoryRawListOptions as m, type HistoryTriggerRepoOverride as n };
@@ -1,8 +1,8 @@
1
1
  import 'zod';
2
2
  import 'firebase-functions/v2/https';
3
- import '../../types-DptSRAK6.cjs';
4
- export { a as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-CBqtAeb5.cjs';
5
- export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-BTrgC2ZA.cjs';
6
- import '../../read-D4xAmsbE.cjs';
3
+ import '../../types-BtdC0Qhu.cjs';
4
+ export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-D1APf9PA.cjs';
5
+ export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-BmagC7uw.cjs';
6
+ import '../../read-BSyLao3I.cjs';
7
7
  import 'firebase-admin/firestore';
8
8
  import 'firebase-functions/v2/firestore';
@@ -1,8 +1,8 @@
1
1
  import 'zod';
2
2
  import 'firebase-functions/v2/https';
3
- import '../../types-CqXbEeXp.js';
4
- export { a as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-CBqtAeb5.js';
5
- export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-CP4WoShV.js';
6
- import '../../read-D4xAmsbE.js';
3
+ import '../../types-5vgXdUM2.js';
4
+ export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-D1APf9PA.js';
5
+ export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-BxurOEz1.js';
6
+ import '../../read-BSyLao3I.js';
7
7
  import 'firebase-admin/firestore';
8
8
  import 'firebase-functions/v2/firestore';
@@ -1,4 +1,4 @@
1
- export { A as AuthExtension, d as AuthRoute, b as AuthUser, D as DecodedIdTokenLike, F as FirebaseAdminAuthLike, e as FirebaseAuthConfig, g as FirebaseAuthLoginPageConfig, h as FirebaseAuthMode, c as allowAll, f as firebaseAuth, i as isAuthExtension } from '../../firebase-auth-CBqtAeb5.cjs';
1
+ export { A as AuthExtension, b as AuthRoute, c as AuthUser, D as DecodedIdTokenLike, F as FirebaseAdminAuthLike, d as FirebaseAuthConfig, e as FirebaseAuthLoginPageConfig, g as FirebaseAuthMode, a as allowAll, f as firebaseAuth, i as isAuthExtension } from '../../firebase-auth-D1APf9PA.cjs';
2
2
 
3
3
  /**
4
4
  * Session cookie + logout handlers for `firebaseAuth`.
@@ -1,4 +1,4 @@
1
- export { A as AuthExtension, d as AuthRoute, b as AuthUser, D as DecodedIdTokenLike, F as FirebaseAdminAuthLike, e as FirebaseAuthConfig, g as FirebaseAuthLoginPageConfig, h as FirebaseAuthMode, c as allowAll, f as firebaseAuth, i as isAuthExtension } from '../../firebase-auth-CBqtAeb5.js';
1
+ export { A as AuthExtension, b as AuthRoute, c as AuthUser, D as DecodedIdTokenLike, F as FirebaseAdminAuthLike, d as FirebaseAuthConfig, e as FirebaseAuthLoginPageConfig, g as FirebaseAuthMode, a as allowAll, f as firebaseAuth, i as isAuthExtension } from '../../firebase-auth-D1APf9PA.js';
2
2
 
3
3
  /**
4
4
  * Session cookie + logout handlers for `firebaseAuth`.
@@ -1,11 +1,11 @@
1
1
  import { HttpsOptions } from 'firebase-functions/v2/https';
2
- import { C as ConfiguredRepository, m as CrudServerOptions } from '../../types-DptSRAK6.cjs';
3
- export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry, s as CrudRepoRegistry, n as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, o as QueryRequestBody, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath } from '../../types-DptSRAK6.cjs';
4
- import { O as OpenAPIDocument } from '../../openapi-BSp3x2yW.cjs';
5
- export { g as generateOpenAPISpec } from '../../openapi-BSp3x2yW.cjs';
6
- import '../../firebase-auth-CBqtAeb5.cjs';
2
+ import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-BtdC0Qhu.cjs';
3
+ export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-BtdC0Qhu.cjs';
4
+ import { O as OpenAPIDocument } from '../../openapi-ML_1hTx2.cjs';
5
+ export { g as generateOpenAPISpec } from '../../openapi-ML_1hTx2.cjs';
6
+ import '../../firebase-auth-D1APf9PA.cjs';
7
7
  import 'zod';
8
- import '../../read-D4xAmsbE.cjs';
8
+ import '../../read-BSyLao3I.cjs';
9
9
  import 'firebase-admin/firestore';
10
10
  import 'firebase-functions/v2/firestore';
11
11
 
@@ -1,11 +1,11 @@
1
1
  import { HttpsOptions } from 'firebase-functions/v2/https';
2
- import { C as ConfiguredRepository, m as CrudServerOptions } from '../../types-CqXbEeXp.js';
3
- export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry, s as CrudRepoRegistry, n as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, o as QueryRequestBody, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath } from '../../types-CqXbEeXp.js';
4
- import { O as OpenAPIDocument } from '../../openapi-BSdeinkq.js';
5
- export { g as generateOpenAPISpec } from '../../openapi-BSdeinkq.js';
6
- import '../../firebase-auth-CBqtAeb5.js';
2
+ import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-5vgXdUM2.js';
3
+ export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-5vgXdUM2.js';
4
+ import { O as OpenAPIDocument } from '../../openapi-DIoQV_yQ.js';
5
+ export { g as generateOpenAPISpec } from '../../openapi-DIoQV_yQ.js';
6
+ import '../../firebase-auth-D1APf9PA.js';
7
7
  import 'zod';
8
- import '../../read-D4xAmsbE.js';
8
+ import '../../read-BSyLao3I.js';
9
9
  import 'firebase-admin/firestore';
10
10
  import 'firebase-functions/v2/firestore';
11
11
 
@@ -0,0 +1,124 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';var path=require('path'),fs=require('fs');var v={skipSegments:["useCases","useCase","use-cases","use-case"],casing:"preserve"};function P(e,t=v){let s=new Set(t.skipSegments.map(o=>o.toLowerCase()));return "/"+e.split("/").filter(Boolean).filter(o=>!s.has(o.toLowerCase())).map(o=>t.casing==="kebab"?G(o):o).join("/")}function G(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function O(e,t,s){let r=_(e),o=_(t),i=0;for(;i<r.length&&i<o.length&&r[i]===o[i];)i++;let a=r.length-i,n=o.slice(i),c=(n[n.length-1]??"").replace(/\.[mc]?[tj]sx?$/i,""),m=s===""?c:`${c}${s}`;return n[n.length-1]=m,(a===0?"./":"../".repeat(a))+n.join("/")}function _(e){return e.replace(/\\/g,"/").replace(/\/+$/,"").split("/").filter((s,r)=>!(r===0&&s===""))}var b={routesFile:"routes.ts",excludeSegments:["node_modules","__generated__","tests","__tests__",".turbo","dist","build",".next"]};function D(e,t=b){let s=[];return C(e,e,t,s),s.sort((r,o)=>r.relPath.localeCompare(o.relPath)),s}function C(e,t,s,r){let o;try{o=fs.readdirSync(t);}catch{return}for(let i of o){if(s.excludeSegments.includes(i))continue;let a=path.join(t,i),n;try{n=fs.statSync(a);}catch{continue}if(n.isDirectory())C(e,a,s,r);else if(n.isFile()&&i===s.routesFile){let d=path.relative(e,a).split(path.sep).join("/"),c=d.replace(/\/?[^/]+$/,"");r.push({absPath:a,relPath:d,relDir:c});}}}var Z="/**\n * AUTO-GENERATED by `@lpdjs/firestore-repo-service` Hono codegen.\n * Do not edit by hand \u2014 re-run `hono:gen` after adding / removing route files.\n */\n";function R(e,t){let s=path.dirname(t.outFile);fs.mkdirSync(s,{recursive:true});let r=t.banner??Z,o=(t.now??new Date).toISOString(),i=t.importExtension,a=[],n=[],d=[];e.forEach((m,u)=>{let g=O(s,m.absPath,i),x=P(m.relDir,t.derive);a.push(`import mod${u} from ${JSON.stringify(g)};`),n.push(` { __derivedPath: ${JSON.stringify(x)}, mod: mod${u} },`),d.push({source:m.relPath,url:x});});let c=`${r}// Generated at ${o} \u2014 ${e.length} route file${e.length===1?"":"s"}.
3
+
4
+ import type { AnyRouteDef, RouteModuleDefault } from "@lpdjs/firestore-repo-service/servers/hono";
5
+
6
+ `+a.join(`
7
+ `)+(a.length?`
8
+
9
+ `:`
10
+ `)+`const __defs: { __derivedPath: string; mod: RouteModuleDefault }[] = [
11
+ `+n.join(`
12
+ `)+(n.length?`
13
+ `:"")+`];
14
+
15
+ export const routes: AnyRouteDef[] = __defs.flatMap(({ __derivedPath, mod }) => {
16
+ const list = Array.isArray(mod) ? mod : [mod];
17
+ return list.map((route) => ({ ...route, path: route.path ?? __derivedPath }));
18
+ });
19
+ `;return fs.writeFileSync(t.outFile,c,"utf8"),{outFile:t.outFile,routeCount:e.length,derivedPaths:d}}function Q(e){let[t,...s]=e,r={};for(let o=0;o<s.length;o++){let i=s[o];if(!i.startsWith("--"))continue;let a=i.slice(2),n=s[o+1];n&&!n.startsWith("--")?(r[a]=n,o++):r[a]=true;}return {command:t??"help",flags:r}}function F(){console.log(`frs-hono \u2014 Hono file-based codegen
20
+
21
+ Usage:
22
+ frs-hono gen [flags]
23
+ frs-hono new <name> [flags]
24
+ frs-hono help
25
+
26
+ Flags (gen):
27
+ --root <dir> Domain root to scan (required, e.g. src/domains)
28
+ --out <file> Output file relative to --root
29
+ (default: __generated__/routes.ts)
30
+ --routes-file <name> Filename to look for (default: routes.ts)
31
+ --skip <list> Comma-separated path segments to drop from URLs
32
+ (default: useCases,useCase,use-cases,use-case)
33
+ --casing <preserve|kebab>
34
+ Casing applied to remaining segments (default: preserve)
35
+ --ext <.js|.ts|''> Import extension in the generated file
36
+ (default: .js \u2014 required for ESM Node.js)
37
+ --exclude <list> Comma-separated directories to skip
38
+ (default: node_modules,__generated__,tests,__tests__,dist,build)
39
+ --silent Do not print the generated route table
40
+
41
+ Flags (new <name>):
42
+ --root <dir> Domain root (default: src/domains)
43
+ --domain <name> Domain name (required, e.g. posts)
44
+ --method <verb> HTTP method (default: post)
45
+ --api <tag> API tag (default: v1)
46
+ --usecase-folder <name>
47
+ Parent folder under <domain>. Default: useCases
48
+ --with-usecase Also scaffold a sibling useCase.ts file (default: true)
49
+ --with-test Also scaffold a sibling useCase.test.ts (Vitest, default: true)
50
+ --force Overwrite if files already exist
51
+
52
+ Examples:
53
+ frs-hono new createPost --domain posts --method post
54
+ frs-hono new listPosts --domain posts --method get --api v1
55
+ `);}function A(e){if(typeof e=="string")return e.split(",").map(t=>t.trim()).filter(Boolean)}function f(e){return typeof e=="string"?e:void 0}async function X(e){let t=f(e.root);t||(console.error("[frs-hono] --root is required"),process.exit(2));let s=path.resolve(process.cwd(),t);fs.existsSync(s)||(console.error(`[frs-hono] root not found: ${s}`),process.exit(2));let r=f(e.out)??"__generated__/routes.ts",o=A(e.skip)??v.skipSegments,i=f(e.casing)==="kebab"?"kebab":v.casing,a={skipSegments:o,casing:i},n=f(e.ext)??".js",d=A(e.exclude)??b.excludeSegments,c=f(e["routes-file"])??b.routesFile,u=D(s,{routesFile:c,excludeSegments:d});u.length===0&&console.warn(`[frs-hono] no "${c}" files found under ${s} \u2014 generated an empty manifest.`);let g=R(u,{outFile:path.resolve(s,r),derive:a,importExtension:n});if(!e.silent){console.log(`[frs-hono] wrote ${g.outFile} (${g.routeCount} route${g.routeCount===1?"":"s"})`);for(let{source:x,url:S}of g.derivedPaths)console.log(` ${S.padEnd(48)} \u2190 ${x}`);}}async function Y(e,t){(!e||e.startsWith("--"))&&(console.error("[frs-hono] usage: frs-hono new <name> --domain <domain> [flags]"),process.exit(2));let s=f(t.domain);s||(console.error("[frs-hono] --domain is required"),process.exit(2));let r=f(t.root)??"src/domains",o=(f(t.method)??"post").toLowerCase(),i=f(t.api)??"v1",a=f(t["usecase-folder"])??"useCases",n=t["with-usecase"]!==false,d=t["with-test"]!==false,c=t.force===true;["get","post","put","patch","delete"].includes(o)||(console.error(`[frs-hono] invalid --method: ${o}`),process.exit(2));let m=path.resolve(process.cwd(),r),u=path.resolve(m,s,a,e),g=path.resolve(u,"routes.ts"),x=path.resolve(u,"useCase.ts"),S=path.resolve(u,"useCase.test.ts"),{mkdirSync:k,existsSync:E,writeFileSync:j}=await import('fs');k(u,{recursive:true});let p=`${e.charAt(0).toUpperCase()}${e.slice(1)}UseCase`,T=`/**
56
+ * ${p} \u2014 pure business logic, no HTTP awareness.
57
+ * Reusable across multiple routes / cron jobs / triggers.
58
+ */
59
+
60
+ export interface ${p}Input {
61
+ // TODO: define the input shape
62
+ example: string;
63
+ }
64
+
65
+ export interface ${p}Output {
66
+ // TODO: define the output shape
67
+ id: string;
68
+ }
69
+
70
+ export class ${p} {
71
+ // TODO: inject repositories / services via the constructor.
72
+ // constructor(private readonly repo: SomeRepository) {}
73
+
74
+ async execute(input: ${p}Input): Promise<${p}Output> {
75
+ // TODO: implement
76
+ return { id: input.example };
77
+ }
78
+ }
79
+ `,L=o==="get"?`z.object({
80
+ // GET \u2192 lu depuis les query params
81
+ example: z.string(),
82
+ })`:`z.object({
83
+ // ${o.toUpperCase()} \u2192 lu depuis le body JSON
84
+ example: z.string(),
85
+ })`,N=n?` const useCase = new ${p}();
86
+ const data = await useCase.execute(input);
87
+ return data;`:` // TODO: business logic
88
+ return { id: input.example };`,I=`import { z } from "zod";
89
+ import { defineRoute } from "@lpdjs/firestore-repo-service/servers/hono";
90
+ ${n?`import { ${p} } from "./useCase.js";
91
+ `:""}
92
+ export default defineRoute({
93
+ api: "${i}",
94
+ method: "${o}",
95
+
96
+ input: ${L},
97
+
98
+ output: z.object({
99
+ id: z.string(),
100
+ }),
101
+
102
+ summary: "TODO: ${e}",
103
+ tags: ["${s}"],
104
+
105
+ handler: async ({ input }) => {
106
+ ${N}
107
+ },
108
+ });
109
+ `,w=[],y=[],$=(l,U)=>{if(E(l)&&!c){y.push(l);return}j(l,U,"utf8"),w.push(l);};if($(g,I),n&&$(x,T),n&&d){let l=`import { describe, it, expect } from "vitest";
110
+ import { ${p} } from "./useCase.js";
111
+
112
+ describe("${p}", () => {
113
+ it("returns a response shaped like the output schema", async () => {
114
+ const useCase = new ${p}();
115
+ const result = await useCase.execute({ example: "hello" });
116
+ expect(result).toMatchObject({ id: expect.any(String) });
117
+ });
118
+
119
+ // TODO: add error-path tests, repository mocks, etc.
120
+ });
121
+ `;$(S,l);}for(let l of w)console.log(`[frs-hono] wrote ${l}`);for(let l of y)console.log(`[frs-hono] skipped ${l} (use --force to overwrite)`);console.log(`
122
+ [frs-hono] reminder: run "frs-hono gen --root ${r}" to refresh the manifest.`);}async function ee(){let e=process.argv.slice(2),{command:t,flags:s}=Q(e);switch(t){case "gen":await X(s);return;case "new":await Y(e[1],s);return;case "help":case "--help":case "-h":F();return;default:console.error(`[frs-hono] unknown command: ${t}
123
+ `),F(),process.exit(2);}}ee().catch(e=>{console.error(e),process.exit(1);});//# sourceMappingURL=cli.cjs.map
124
+ //# sourceMappingURL=cli.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/servers/hono/codegen/path-utils.ts","../../../src/servers/hono/codegen/scanner.ts","../../../src/servers/hono/codegen/generator.ts","../../../src/servers/hono/cli.ts"],"names":["DEFAULT_DERIVE","derivePath","relativeDir","options","skip","s","p","kebab","toImportSpecifier","fromDir","toFile","ext","fromParts","splitAbs","toParts","common","up","down","stripped","finalLast","part","i","DEFAULT_SCANNER","scanRoutes","rootAbs","found","walk","a","b","root","dir","opts","out","entries","readdirSync","name","abs","join","st","statSync","relPath","relative","sep","relDir","DEFAULT_GENERATOR_BANNER","generateRoutesManifest","routes","outDir","dirname","mkdirSync","banner","now","importLines","entryLines","derivedPaths","r","importPath","url","body","writeFileSync","parseArgs","argv","command","rest","flags","arg","key","next","printHelp","asList","v","asString","runGen","resolve","existsSync","casing","derive","exclude","routesFile","scanned","result","source","runNew","domain","method","api","useCaseFolder","withUseCase","withTest","force","dirAbs","useCaseFile","testFile","className","useCaseSrc","inputZodSnippet","handlerBody","routesS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,CAC3B,OACF,KAAK,MAAA,CACL,KAAK,QAAA,CACL,KAAK,IAAA,CACHI,CAAAA,EAAU,CACV,OACF,QAEE,OAAA,CAAQ,KAAA,CAAM,CAAA,4BAAA,EAA+BN,CAAO;AAAA,CAAI,CAAA,CACxDM,GAAU,CACV,OAAA,CAAQ,KAAK,CAAC,EAClB,CACF,CAEAqC,EAAAA,EAAK,CAAE,MAAOC,CAAAA,EAAQ,CAEpB,QAAQ,KAAA,CAAMA,CAAG,EACjB,OAAA,CAAQ,IAAA,CAAK,CAAC,EAChB,CAAC,CAAA","file":"cli.cjs","sourcesContent":["/**\n * URL path inference from filesystem layout.\n *\n * Convention: every `routes.ts` file under the configured root contributes\n * one route. The URL path is derived from its directory chain, optionally\n * skipping segments such as `useCases` so that\n *\n * domains/activities/useCases/createOrUpdateCustom/routes.ts\n *\n * becomes\n *\n * /activities/createOrUpdateCustom\n */\n\nexport interface PathDeriveOptions {\n /** Segments to drop from the derived path (case-insensitive). */\n skipSegments: string[];\n /**\n * Casing convention applied to each remaining segment.\n * - `\"preserve\"` — keep the directory name as-is (default),\n * - `\"kebab\"` — convert camelCase / PascalCase to kebab-case.\n */\n casing: \"preserve\" | \"kebab\";\n}\n\nexport const DEFAULT_DERIVE: PathDeriveOptions = {\n skipSegments: [\"useCases\", \"useCase\", \"use-cases\", \"use-case\"],\n casing: \"preserve\",\n};\n\n/**\n * @param relativeDir POSIX-style directory path of the routes file relative\n * to the codegen root (no leading slash, no `routes.ts`).\n */\nexport function derivePath(\n relativeDir: string,\n options: PathDeriveOptions = DEFAULT_DERIVE,\n): string {\n const skip = new Set(options.skipSegments.map((s) => s.toLowerCase()));\n const parts = relativeDir\n .split(\"/\")\n .filter(Boolean)\n .filter((p) => !skip.has(p.toLowerCase()))\n .map((p) => (options.casing === \"kebab\" ? kebab(p) : p));\n return \"/\" + parts.join(\"/\");\n}\n\nfunction kebab(s: string): string {\n return s\n .replace(/([a-z0-9])([A-Z])/g, \"$1-$2\")\n .replace(/[\\s_]+/g, \"-\")\n .toLowerCase();\n}\n\n/**\n * Convert an absolute filesystem path to a POSIX-style import specifier\n * relative to a directory (the generated file's directory). Always uses\n * forward slashes and prefixes with `./` or `../` as needed.\n */\nexport function toImportSpecifier(\n fromDir: string,\n toFile: string,\n ext: string,\n): string {\n // Both paths are absolute POSIX (the CLI normalises them).\n const fromParts = splitAbs(fromDir);\n const toParts = splitAbs(toFile);\n let common = 0;\n while (\n common < fromParts.length &&\n common < toParts.length &&\n fromParts[common] === toParts[common]\n ) {\n common++;\n }\n const up = fromParts.length - common;\n const down = toParts.slice(common);\n const last = down[down.length - 1] ?? \"\";\n const stripped = last.replace(/\\.[mc]?[tj]sx?$/i, \"\");\n const finalLast = ext === \"\" ? stripped : `${stripped}${ext}`;\n down[down.length - 1] = finalLast;\n const prefix = up === 0 ? \"./\" : \"../\".repeat(up);\n return prefix + down.join(\"/\");\n}\n\nfunction splitAbs(p: string): string[] {\n const norm = p.replace(/\\\\/g, \"/\").replace(/\\/+$/, \"\");\n return norm.split(\"/\").filter((part, i) => !(i === 0 && part === \"\"));\n}\n","/**\n * Filesystem scanner — walks the configured root and yields every route file.\n * Synchronous and dependency-free (no `fast-glob` etc.) for a tiny CLI footprint.\n */\n\nimport { readdirSync, statSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\n\nexport interface ScannerOptions {\n /** Filename to look for (default: `routes.ts`). */\n routesFile: string;\n /** Glob-like exclude segments (matched against any path part). */\n excludeSegments: string[];\n}\n\nexport const DEFAULT_SCANNER: ScannerOptions = {\n routesFile: \"routes.ts\",\n excludeSegments: [\n \"node_modules\",\n \"__generated__\",\n \"tests\",\n \"__tests__\",\n \".turbo\",\n \"dist\",\n \"build\",\n \".next\",\n ],\n};\n\nexport interface ScannedRoute {\n /** Absolute path to the routes file. */\n absPath: string;\n /** Path relative to the scan root (POSIX style). */\n relPath: string;\n /** Directory portion of `relPath` (what {@link derivePath} consumes). */\n relDir: string;\n}\n\nexport function scanRoutes(\n rootAbs: string,\n options: ScannerOptions = DEFAULT_SCANNER,\n): ScannedRoute[] {\n const found: ScannedRoute[] = [];\n walk(rootAbs, rootAbs, options, found);\n // Stable, deterministic order — important for reproducible builds.\n found.sort((a, b) => a.relPath.localeCompare(b.relPath));\n return found;\n}\n\nfunction walk(\n root: string,\n dir: string,\n opts: ScannerOptions,\n out: ScannedRoute[],\n): void {\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return;\n }\n for (const name of entries) {\n if (opts.excludeSegments.includes(name)) continue;\n const abs = join(dir, name);\n let st;\n try {\n st = statSync(abs);\n } catch {\n continue;\n }\n if (st.isDirectory()) {\n walk(root, abs, opts, out);\n } else if (st.isFile() && name === opts.routesFile) {\n const relPath = relative(root, abs).split(sep).join(\"/\");\n const relDir = relPath.replace(/\\/?[^/]+$/, \"\");\n out.push({ absPath: abs, relPath, relDir });\n }\n }\n}\n","/**\n * Generator — emits `__generated__/routes.ts` from a list of {@link ScannedRoute}s.\n *\n * The generated module statically imports every `routes.ts` so that bundlers\n * (esbuild/tsup) can tree-shake unused dependencies and Cloud Functions get\n * the smallest possible cold-start footprint.\n */\n\nimport { dirname, join } from \"node:path\";\nimport { mkdirSync, writeFileSync } from \"node:fs\";\n\nimport {\n derivePath,\n toImportSpecifier,\n type PathDeriveOptions,\n} from \"./path-utils\";\nimport type { ScannedRoute } from \"./scanner\";\n\nexport interface GeneratorOptions {\n /** Absolute path of the file to write (e.g. `…/__generated__/routes.ts`). */\n outFile: string;\n /** Path-derivation options (skipSegments, casing). */\n derive: PathDeriveOptions;\n /**\n * Import extension used in the generated file:\n * - `\".js\"` (default) — required for ESM Node.js with `\"type\": \"module\"`,\n * - `\"\"` — bundler-friendly (Vite, no extension),\n * - `\".ts\"` — for TS-ESM runners (`tsx`, `bun`).\n */\n importExtension: string;\n /** Friendly banner placed at the top of the generated file. */\n banner?: string;\n /** Generation timestamp included in the banner. Default: `new Date()`. */\n now?: Date;\n}\n\nexport const DEFAULT_GENERATOR_BANNER =\n \"/**\\n\" +\n \" * AUTO-GENERATED by `@lpdjs/firestore-repo-service` Hono codegen.\\n\" +\n \" * Do not edit by hand — re-run `hono:gen` after adding / removing route files.\\n\" +\n \" */\\n\";\n\nexport interface GenerationResult {\n /** Absolute path of the file written. */\n outFile: string;\n /** Number of routes captured in the manifest. */\n routeCount: number;\n /** Human-readable summary of the derived URLs. */\n derivedPaths: { source: string; url: string }[];\n}\n\nexport function generateRoutesManifest(\n routes: ScannedRoute[],\n opts: GeneratorOptions,\n): GenerationResult {\n const outDir = dirname(opts.outFile);\n mkdirSync(outDir, { recursive: true });\n\n const banner = opts.banner ?? DEFAULT_GENERATOR_BANNER;\n const now = (opts.now ?? new Date()).toISOString();\n const ext = opts.importExtension;\n\n const importLines: string[] = [];\n const entryLines: string[] = [];\n const derivedPaths: GenerationResult[\"derivedPaths\"] = [];\n\n routes.forEach((r, i) => {\n const importPath = toImportSpecifier(outDir, r.absPath, ext);\n const url = derivePath(r.relDir, opts.derive);\n importLines.push(\n `import mod${i} from ${JSON.stringify(importPath)};`,\n );\n entryLines.push(` { __derivedPath: ${JSON.stringify(url)}, mod: mod${i} },`);\n derivedPaths.push({ source: r.relPath, url });\n });\n\n const body =\n `${banner}` +\n `// Generated at ${now} — ${routes.length} route file${routes.length === 1 ? \"\" : \"s\"}.\\n` +\n `\\n` +\n `import type { AnyRouteDef, RouteModuleDefault } from \"@lpdjs/firestore-repo-service/servers/hono\";\\n` +\n `\\n` +\n importLines.join(\"\\n\") +\n (importLines.length ? \"\\n\\n\" : \"\\n\") +\n `const __defs: { __derivedPath: string; mod: RouteModuleDefault }[] = [\\n` +\n entryLines.join(\"\\n\") +\n (entryLines.length ? \"\\n\" : \"\") +\n `];\\n\\n` +\n `export const routes: AnyRouteDef[] = __defs.flatMap(({ __derivedPath, mod }) => {\\n` +\n ` const list = Array.isArray(mod) ? mod : [mod];\\n` +\n ` return list.map((route) => ({ ...route, path: route.path ?? __derivedPath }));\\n` +\n `});\\n`;\n\n writeFileSync(opts.outFile, body, \"utf8\");\n return {\n outFile: opts.outFile,\n routeCount: routes.length,\n derivedPaths,\n };\n}\n\n/** Convenience helper used by the CLI — combines scan + generate in one call. */\nexport function generateFromRoot(\n rootAbs: string,\n outFileRel: string,\n derive: PathDeriveOptions,\n importExtension: string,\n scan: (root: string) => ScannedRoute[],\n): GenerationResult {\n const routes = scan(rootAbs);\n const outFile = join(rootAbs, outFileRel);\n return generateRoutesManifest(routes, {\n outFile,\n derive,\n importExtension,\n });\n}\n","#!/usr/bin/env node\n/**\n * `frs-hono` CLI — codegen for the file-based Hono server.\n *\n * Usage:\n * frs-hono gen --root src/domains\n * frs-hono gen --root src/domains --out __generated__/routes.ts \\\n * --skip useCases,useCase --casing preserve --ext .js\n *\n * Designed to be a **prebuild step** (e.g. wired into `npm run build`).\n * Outputs a manifest with static imports — no runtime filesystem scanning.\n */\n\nimport { resolve } from \"node:path\";\nimport { existsSync } from \"node:fs\";\n\nimport { DEFAULT_DERIVE, type PathDeriveOptions } from \"./codegen/path-utils\";\nimport {\n DEFAULT_SCANNER,\n scanRoutes,\n type ScannerOptions,\n} from \"./codegen/scanner\";\nimport { generateRoutesManifest } from \"./codegen/generator\";\n\ninterface ParsedArgs {\n command: string;\n flags: Record<string, string | boolean>;\n}\n\nfunction parseArgs(argv: string[]): ParsedArgs {\n const [command, ...rest] = argv;\n const flags: Record<string, string | boolean> = {};\n for (let i = 0; i < rest.length; i++) {\n const arg = rest[i]!;\n if (!arg.startsWith(\"--\")) continue;\n const key = arg.slice(2);\n const next = rest[i + 1];\n if (next && !next.startsWith(\"--\")) {\n flags[key] = next;\n i++;\n } else {\n flags[key] = true;\n }\n }\n return { command: command ?? \"help\", flags };\n}\n\nfunction printHelp(): void {\n // eslint-disable-next-line no-console\n console.log(`frs-hono — Hono file-based codegen\n\nUsage:\n frs-hono gen [flags]\n frs-hono new <name> [flags]\n frs-hono help\n\nFlags (gen):\n --root <dir> Domain root to scan (required, e.g. src/domains)\n --out <file> Output file relative to --root\n (default: __generated__/routes.ts)\n --routes-file <name> Filename to look for (default: routes.ts)\n --skip <list> Comma-separated path segments to drop from URLs\n (default: useCases,useCase,use-cases,use-case)\n --casing <preserve|kebab>\n Casing applied to remaining segments (default: preserve)\n --ext <.js|.ts|''> Import extension in the generated file\n (default: .js — required for ESM Node.js)\n --exclude <list> Comma-separated directories to skip\n (default: node_modules,__generated__,tests,__tests__,dist,build)\n --silent Do not print the generated route table\n\nFlags (new <name>):\n --root <dir> Domain root (default: src/domains)\n --domain <name> Domain name (required, e.g. posts)\n --method <verb> HTTP method (default: post)\n --api <tag> API tag (default: v1)\n --usecase-folder <name>\n Parent folder under <domain>. Default: useCases\n --with-usecase Also scaffold a sibling useCase.ts file (default: true)\n --with-test Also scaffold a sibling useCase.test.ts (Vitest, default: true)\n --force Overwrite if files already exist\n\nExamples:\n frs-hono new createPost --domain posts --method post\n frs-hono new listPosts --domain posts --method get --api v1\n`);\n}\n\nfunction asList(v: string | boolean | undefined): string[] | undefined {\n if (typeof v !== \"string\") return undefined;\n return v\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean);\n}\n\nfunction asString(v: string | boolean | undefined): string | undefined {\n return typeof v === \"string\" ? v : undefined;\n}\n\nasync function runGen(flags: ParsedArgs[\"flags\"]): Promise<void> {\n const root = asString(flags.root);\n if (!root) {\n // eslint-disable-next-line no-console\n console.error(\"[frs-hono] --root is required\");\n process.exit(2);\n }\n const rootAbs = resolve(process.cwd(), root);\n if (!existsSync(rootAbs)) {\n // eslint-disable-next-line no-console\n console.error(`[frs-hono] root not found: ${rootAbs}`);\n process.exit(2);\n }\n\n const out = asString(flags.out) ?? \"__generated__/routes.ts\";\n\n const skip = asList(flags.skip) ?? DEFAULT_DERIVE.skipSegments;\n const casing =\n asString(flags.casing) === \"kebab\" ? \"kebab\" : DEFAULT_DERIVE.casing;\n const derive: PathDeriveOptions = { skipSegments: skip, casing };\n\n const ext = asString(flags.ext) ?? \".js\";\n const exclude = asList(flags.exclude) ?? DEFAULT_SCANNER.excludeSegments;\n const routesFile = asString(flags[\"routes-file\"]) ?? DEFAULT_SCANNER.routesFile;\n const scannerOpts: ScannerOptions = { routesFile, excludeSegments: exclude };\n\n const scanned = scanRoutes(rootAbs, scannerOpts);\n if (scanned.length === 0) {\n // eslint-disable-next-line no-console\n console.warn(\n `[frs-hono] no \"${routesFile}\" files found under ${rootAbs} — generated an empty manifest.`,\n );\n }\n\n const result = generateRoutesManifest(scanned, {\n outFile: resolve(rootAbs, out),\n derive,\n importExtension: ext,\n });\n\n if (!flags.silent) {\n // eslint-disable-next-line no-console\n console.log(\n `[frs-hono] wrote ${result.outFile} (${result.routeCount} route${\n result.routeCount === 1 ? \"\" : \"s\"\n })`,\n );\n for (const { source, url } of result.derivedPaths) {\n // eslint-disable-next-line no-console\n console.log(` ${url.padEnd(48)} ← ${source}`);\n }\n }\n}\n\nasync function runNew(name: string | undefined, flags: ParsedArgs[\"flags\"]): Promise<void> {\n if (!name || name.startsWith(\"--\")) {\n // eslint-disable-next-line no-console\n console.error(\"[frs-hono] usage: frs-hono new <name> --domain <domain> [flags]\");\n process.exit(2);\n }\n const domain = asString(flags.domain);\n if (!domain) {\n // eslint-disable-next-line no-console\n console.error(\"[frs-hono] --domain is required\");\n process.exit(2);\n }\n\n const root = asString(flags.root) ?? \"src/domains\";\n const method = (asString(flags.method) ?? \"post\").toLowerCase();\n const api = asString(flags.api) ?? \"v1\";\n const useCaseFolder = asString(flags[\"usecase-folder\"]) ?? \"useCases\";\n const withUseCase = flags[\"with-usecase\"] !== false;\n const withTest = flags[\"with-test\"] !== false;\n const force = flags.force === true;\n\n if (![\"get\", \"post\", \"put\", \"patch\", \"delete\"].includes(method)) {\n // eslint-disable-next-line no-console\n console.error(`[frs-hono] invalid --method: ${method}`);\n process.exit(2);\n }\n\n const rootAbs = resolve(process.cwd(), root);\n const dirAbs = resolve(rootAbs, domain, useCaseFolder, name);\n const routesFile = resolve(dirAbs, \"routes.ts\");\n const useCaseFile = resolve(dirAbs, \"useCase.ts\");\n const testFile = resolve(dirAbs, \"useCase.test.ts\");\n\n const { mkdirSync, existsSync, writeFileSync } = await import(\"node:fs\");\n mkdirSync(dirAbs, { recursive: true });\n\n const className = `${name.charAt(0).toUpperCase()}${name.slice(1)}UseCase`;\n\n const useCaseSrc = `/**\n * ${className} — pure business logic, no HTTP awareness.\n * Reusable across multiple routes / cron jobs / triggers.\n */\n\nexport interface ${className}Input {\n // TODO: define the input shape\n example: string;\n}\n\nexport interface ${className}Output {\n // TODO: define the output shape\n id: string;\n}\n\nexport class ${className} {\n // TODO: inject repositories / services via the constructor.\n // constructor(private readonly repo: SomeRepository) {}\n\n async execute(input: ${className}Input): Promise<${className}Output> {\n // TODO: implement\n return { id: input.example };\n }\n}\n`;\n\n const inputZodSnippet =\n method === \"get\"\n ? `z.object({\\n // GET → lu depuis les query params\\n example: z.string(),\\n })`\n : `z.object({\\n // ${method.toUpperCase()} → lu depuis le body JSON\\n example: z.string(),\\n })`;\n\n const handlerBody = withUseCase\n ? ` const useCase = new ${className}();\\n const data = await useCase.execute(input);\\n return data;`\n : ` // TODO: business logic\\n return { id: input.example };`;\n\n const useCaseImport = withUseCase\n ? `import { ${className} } from \"./useCase.js\";\\n`\n : \"\";\n\n const routesSrc = `import { z } from \"zod\";\nimport { defineRoute } from \"@lpdjs/firestore-repo-service/servers/hono\";\n${useCaseImport}\nexport default defineRoute({\n api: \"${api}\",\n method: \"${method}\",\n\n input: ${inputZodSnippet},\n\n output: z.object({\n id: z.string(),\n }),\n\n summary: \"TODO: ${name}\",\n tags: [\"${domain}\"],\n\n handler: async ({ input }) => {\n${handlerBody}\n },\n});\n`;\n\n const written: string[] = [];\n const skipped: string[] = [];\n\n const writeIfPossible = (file: string, content: string) => {\n if (existsSync(file) && !force) {\n skipped.push(file);\n return;\n }\n writeFileSync(file, content, \"utf8\");\n written.push(file);\n };\n\n writeIfPossible(routesFile, routesSrc);\n if (withUseCase) writeIfPossible(useCaseFile, useCaseSrc);\n if (withUseCase && withTest) {\n const testSrc = `import { describe, it, expect } from \"vitest\";\nimport { ${className} } from \"./useCase.js\";\n\ndescribe(\"${className}\", () => {\n it(\"returns a response shaped like the output schema\", async () => {\n const useCase = new ${className}();\n const result = await useCase.execute({ example: \"hello\" });\n expect(result).toMatchObject({ id: expect.any(String) });\n });\n\n // TODO: add error-path tests, repository mocks, etc.\n});\n`;\n writeIfPossible(testFile, testSrc);\n }\n\n // eslint-disable-next-line no-console\n for (const f of written) console.log(`[frs-hono] wrote ${f}`);\n for (const f of skipped)\n // eslint-disable-next-line no-console\n console.log(`[frs-hono] skipped ${f} (use --force to overwrite)`);\n // eslint-disable-next-line no-console\n console.log(\n `\\n[frs-hono] reminder: run \"frs-hono gen --root ${root}\" to refresh the manifest.`,\n );\n}\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n const { command, flags } = parseArgs(argv);\n switch (command) {\n case \"gen\":\n await runGen(flags);\n return;\n case \"new\":\n // First positional after `new` is the route name.\n await runNew(argv[1], flags);\n return;\n case \"help\":\n case \"--help\":\n case \"-h\":\n printHelp();\n return;\n default:\n // eslint-disable-next-line no-console\n console.error(`[frs-hono] unknown command: ${command}\\n`);\n printHelp();\n process.exit(2);\n }\n}\n\nmain().catch((err) => {\n // eslint-disable-next-line no-console\n console.error(err);\n process.exit(1);\n});\n"]}
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node