@izumisy-tailor/omakase-modules 0.5.0 → 0.6.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 (39) hide show
  1. package/docs/generated/_media/creating-modules.md +6 -15
  2. package/docs/generated/_media/using-modules.md +10 -29
  3. package/docs/generated/builder/functions/defineModule.md +1 -1
  4. package/docs/generated/builder/functions/withModuleConfiguration.md +2 -2
  5. package/docs/generated/builder/type-aliases/AnyDefinedModule.md +4 -4
  6. package/docs/generated/builder/type-aliases/ConfiguredDependencies.md +1 -1
  7. package/docs/generated/builder/type-aliases/ConfiguredModule.md +3 -3
  8. package/docs/generated/builder/type-aliases/DefinedModule.md +5 -5
  9. package/docs/generated/builder/type-aliases/DependencyModules.md +1 -1
  10. package/docs/generated/builder/type-aliases/EmptyDependencies.md +2 -2
  11. package/docs/generated/builder/type-aliases/ModuleBuilder.md +4 -4
  12. package/docs/generated/builder/type-aliases/ModuleBuilderProps.md +1 -1
  13. package/docs/generated/builder/type-aliases/ModuleFactoryContext.md +2 -2
  14. package/docs/generated/builder/type-aliases/TablesFromNames.md +1 -1
  15. package/docs/generated/config/classes/ModuleLoader.md +2 -2
  16. package/docs/generated/config/functions/loadModules.md +1 -1
  17. package/docs/generated/config/sdk/README.md +2 -2
  18. package/docs/generated/config/sdk/functions/getModules.md +88 -0
  19. package/docs/generated/config/sdk/functions/loadModuleForDev.md +5 -6
  20. package/docs/generated/config/sdk/type-aliases/GetModulesOptions.md +59 -0
  21. package/docs/generated/config/type-aliases/LoadedModules.md +8 -9
  22. package/package.json +1 -1
  23. package/src/builder/helpers.test-d.ts +209 -0
  24. package/src/builder/register.test.ts +319 -0
  25. package/src/builder/register.ts +4 -4
  26. package/src/config/module-loader.test.ts +321 -0
  27. package/src/config/module-loader.ts +10 -11
  28. package/src/config/sdk/dev-context.test.ts +306 -0
  29. package/src/config/sdk/dev-context.ts +8 -9
  30. package/src/config/sdk/index.ts +1 -1
  31. package/src/config/sdk/paths.test.ts +111 -0
  32. package/src/config/sdk/paths.ts +134 -32
  33. package/src/config/sdk/wrapper/base.test.ts +287 -0
  34. package/src/config/sdk/wrapper/base.ts +59 -34
  35. package/src/config/sdk/wrapper/generator.test.ts +396 -0
  36. package/src/config/sdk/wrapper/generator.ts +36 -16
  37. package/src/config/sdk/wrapper/strategies.ts +29 -7
  38. package/docs/generated/config/sdk/functions/getModulesReference.md +0 -81
  39. package/docs/generated/config/sdk/type-aliases/GetModulesReferenceOptions.md +0 -60
@@ -30,7 +30,6 @@ Your module's `tsconfig.json` must include the following path aliases for the mo
30
30
  {
31
31
  "compilerOptions": {
32
32
  "paths": {
33
- "@omakase-modules/config": ["./src/module"],
34
33
  "@/*": ["./src/*"]
35
34
  }
36
35
  }
@@ -39,7 +38,6 @@ Your module's `tsconfig.json` must include the following path aliases for the mo
39
38
 
40
39
  | Alias | Path | Purpose |
41
40
  |-------|------|---------|
42
- | `@omakase-modules/config` | `["./src/module"]` | **Required**. Points to your module definition file. The wrapper generator uses this alias to import your module's configuration during code generation. |
43
41
  | `@/*` | `["./src/*"]` | **Required**. Provides a shorthand for importing from the `src/` directory. Used internally during development mode to resolve local source files. |
44
42
 
45
43
  ## 1. Define the Module
@@ -114,7 +112,7 @@ export const tableNames = ["product", "category"] as const;
114
112
 
115
113
  /**
116
114
  * Factory function that creates tailordb tables with the given module configuration.
117
- * This is called by the wrapper files generated by getModulesReference.
115
+ * This is called by the wrapper files generated by getModules.
118
116
  */
119
117
  export default withModuleConfiguration(moduleDef, (context) => {
120
118
  const category = buildCategoryTable(context);
@@ -321,22 +319,16 @@ The generated Kysely types (`src/generated/tailordb.ts`) enable:
321
319
  ```typescript
322
320
  // tailor.config.ts
323
321
  import { defineConfig, defineGenerators } from "@tailor-platform/sdk";
324
- import {
325
- loadModuleForDev,
326
- getModulesReference,
327
- } from "@izumisy-tailor/omakase-modules/config/sdk";
328
- import myModule from "./src/module";
322
+ import { getModules } from "@izumisy-tailor/omakase-modules/config/sdk";
329
323
 
330
- const moduleReference = await getModulesReference(
331
- loadModuleForDev(myModule)
332
- );
324
+ const modules = await getModules("./src/module.ts");
333
325
 
334
326
  export default defineConfig({
335
327
  name: "my-module",
336
328
 
337
329
  db: {
338
330
  "main-db": {
339
- files: [...moduleReference.tailordb],
331
+ files: [...modules.tailordb],
340
332
  },
341
333
  },
342
334
  });
@@ -404,9 +396,8 @@ export default defineModule<ModuleConfig, TablesFromNames<typeof tableNames>>({
404
396
  .build();
405
397
 
406
398
  // In tailor.config.ts - dependencies are auto-registered
407
- const moduleReference = await getModulesReference(
408
- loadModuleForDev(myModule) // commerceModule is automatically loaded with {}
409
- );
399
+ const modules = await getModules("./src/module.ts");
400
+ // commerceModule is automatically loaded with {}
410
401
  ```
411
402
 
412
403
  > **Note**: In development context, dependency modules are registered with empty configurations (`{}`). Actual configuration for dependencies is provided when your module is used in an application via `loadModules`.
@@ -39,57 +39,38 @@ export default loadModules((loader) => {
39
39
 
40
40
  Each module exposes a `configure()` method that accepts a type-safe configuration object. The available options are defined by the module author.
41
41
 
42
- > **Note**: The `loadModules` function registers all configured modules in a global registry, which is later used by `getModulesReference` to generate wrapper files.
42
+ > **Note**: The `loadModules` function registers all configured modules in a global registry, which is later used by `getModules` to generate wrapper files.
43
43
 
44
- ## 2. Configure TypeScript Path Alias
44
+ ## 2. Reference Modules in tailor.config.ts
45
45
 
46
- You must configure a path alias in your `tsconfig.json` to point to the `modules.ts` file you created above. This alias is required for the generated wrapper files to correctly import your module configuration:
47
-
48
- ```jsonc
49
- // tsconfig.json
50
- {
51
- "compilerOptions": {
52
- // ... other options
53
- "paths": {
54
- "@omakase-modules/config": ["./modules"]
55
- }
56
- }
57
- }
58
- ```
59
-
60
- The `@omakase-modules/config` alias should point to your `modules.ts` file (without the `.ts` extension). The wrapper files generated by `getModulesReference` use this alias to import the configured modules.
61
-
62
- ## 3. Reference Modules in tailor.config.ts
63
-
64
- Use `getModulesReference` to include module files in your Tailor configuration:
46
+ Use `getModules` to include module files in your Tailor configuration:
65
47
 
66
48
  ```typescript
67
49
  // tailor.config.ts
68
50
  import { defineConfig } from "@tailor-platform/sdk";
69
- import { getModulesReference } from "@izumisy-tailor/omakase-modules/config/sdk";
70
- import modules from "./modules";
51
+ import { getModules } from "@izumisy-tailor/omakase-modules/config/sdk";
71
52
 
72
- const moduleReference = await getModulesReference(modules);
53
+ const modules = await getModules("./modules.ts");
73
54
 
74
55
  export default defineConfig({
75
56
  name: "my-app",
76
57
  db: {
77
58
  main: {
78
- files: ["./src/tailordb/*.ts", ...moduleReference.tailordb],
59
+ files: ["./src/tailordb/*.ts", ...modules.tailordb],
79
60
  },
80
61
  },
81
62
  resolver: {
82
63
  "main-pipeline": {
83
- files: ["./src/resolvers/*.ts", ...moduleReference.resolver],
64
+ files: ["./src/resolvers/*.ts", ...modules.resolver],
84
65
  },
85
66
  },
86
67
  executor: {
87
- files: ["./src/executors/**/*.ts", ...moduleReference.executor],
68
+ files: ["./src/executors/**/*.ts", ...modules.executor],
88
69
  },
89
70
  });
90
71
  ```
91
72
 
92
- `getModulesReference` generates wrapper files in `.tailor-sdk/.omakase` that properly inject module configurations and create named exports for each table. Make sure to add this directory to your `.gitignore`.
73
+ `getModules` generates wrapper files in `.tailor-sdk/.omakase` that properly inject module configurations and create named exports for each table. Make sure to add this directory to your `.gitignore`.
93
74
 
94
75
  ### Generated Wrapper Files
95
76
 
@@ -98,7 +79,7 @@ The wrapper generator creates files that:
98
79
  2. Call it with the loaded modules from your `modules.ts`
99
80
  3. Export the results (tables, resolvers, executors) for use by Tailor SDK
100
81
 
101
- ## 4. Handle Module Dependencies
82
+ ## 3. Handle Module Dependencies
102
83
 
103
84
  When modules depend on other modules, you need to wire them together. The `loader.add()` method returns the configured module, which can then be passed as a dependency to other modules via the `dependencies` property:
104
85
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **defineModule**\<`C`, `Tables`\>(`baseProps`): [`ModuleBuilder`](../type-aliases/ModuleBuilder.md)\<`C`, `Tables`\>
10
10
 
11
- Defined in: [builder/helpers.ts:341](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L341)
11
+ Defined in: [builder/helpers.ts:341](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L341)
12
12
 
13
13
  Defines a reusable module with optional dependencies on other modules.
14
14
 
@@ -8,13 +8,13 @@
8
8
 
9
9
  > **withModuleConfiguration**\<`C`, `Tables`, `Deps`, `Result`\>(`module`, `factory`): (`loadedModules`) => `Promise`\<`Result`\>
10
10
 
11
- Defined in: [builder/register.ts:31](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/register.ts#L31)
11
+ Defined in: [builder/register.ts:31](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/register.ts#L31)
12
12
 
13
13
  Define module exports that depend on configuration from loadModules.
14
14
 
15
15
  This function returns a factory function that takes LoadedModules as input
16
16
  and produces the configured exports. The wrapper files generated by
17
- getModulesReference will call this factory with the app's loadModules result.
17
+ getModules will call this factory with the app's loadModules result.
18
18
 
19
19
  ## Type Parameters
20
20
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **AnyDefinedModule** = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:127](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L127)
11
+ Defined in: [builder/helpers.ts:127](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L127)
12
12
 
13
13
  A loosely-typed representation of any defined module.
14
14
 
@@ -28,7 +28,7 @@ For strongly-typed module definitions, use [DefinedModule](DefinedModule.md) ins
28
28
 
29
29
  > **configure**: (`props`) => [`ConfiguredModule`](ConfiguredModule.md)\<`any`\>
30
30
 
31
- Defined in: [builder/helpers.ts:130](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L130)
31
+ Defined in: [builder/helpers.ts:130](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L130)
32
32
 
33
33
  #### Parameters
34
34
 
@@ -46,7 +46,7 @@ Defined in: [builder/helpers.ts:130](https://github.com/tailor-sandbox/omakase-m
46
46
 
47
47
  > **dependencies**: `Record`\<`string`, `any`\>
48
48
 
49
- Defined in: [builder/helpers.ts:129](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L129)
49
+ Defined in: [builder/helpers.ts:129](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L129)
50
50
 
51
51
  ***
52
52
 
@@ -54,4 +54,4 @@ Defined in: [builder/helpers.ts:129](https://github.com/tailor-sandbox/omakase-m
54
54
 
55
55
  > **packageName**: `string`
56
56
 
57
- Defined in: [builder/helpers.ts:128](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L128)
57
+ Defined in: [builder/helpers.ts:128](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L128)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **ConfiguredDependencies**\<`Deps`\> = `{ [K in keyof Deps as K extends "__empty" ? never : K]: Deps[K] extends { __configBrand?: infer C } ? C extends Record<string, unknown> ? ConfiguredModule<C> : never : never }`
10
10
 
11
- Defined in: [builder/helpers.ts:170](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L170)
11
+ Defined in: [builder/helpers.ts:170](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L170)
12
12
 
13
13
  Transforms a record of [DefinedModule](DefinedModule.md)s into a record of [ConfiguredModule](ConfiguredModule.md)s.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **ConfiguredModule**\<`C`\> = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:80](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L80)
11
+ Defined in: [builder/helpers.ts:80](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L80)
12
12
 
13
13
  A module that has been configured with specific settings.
14
14
 
@@ -45,7 +45,7 @@ const $inventoryModule = inventoryModule.configure({
45
45
 
46
46
  > **moduleProps**: `object`
47
47
 
48
- Defined in: [builder/helpers.ts:87](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L87)
48
+ Defined in: [builder/helpers.ts:87](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L87)
49
49
 
50
50
  #### config
51
51
 
@@ -57,4 +57,4 @@ Defined in: [builder/helpers.ts:87](https://github.com/tailor-sandbox/omakase-mo
57
57
 
58
58
  > **packageName**: `string`
59
59
 
60
- Defined in: [builder/helpers.ts:86](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L86)
60
+ Defined in: [builder/helpers.ts:86](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L86)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **DefinedModule**\<`C`, `Tables`, `Deps`\> = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:214](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L214)
11
+ Defined in: [builder/helpers.ts:214](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L214)
12
12
 
13
13
  A fully defined, reusable module that can be configured and composed.
14
14
 
@@ -53,7 +53,7 @@ const $inventory = inventoryModule.configure({
53
53
 
54
54
  > **configure**: (`props`) => [`ConfiguredModule`](ConfiguredModule.md)\<`C`\>
55
55
 
56
- Defined in: [builder/helpers.ts:230](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L230)
56
+ Defined in: [builder/helpers.ts:230](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L230)
57
57
 
58
58
  #### Parameters
59
59
 
@@ -71,7 +71,7 @@ Defined in: [builder/helpers.ts:230](https://github.com/tailor-sandbox/omakase-m
71
71
 
72
72
  > **dependencies**: `Deps`
73
73
 
74
- Defined in: [builder/helpers.ts:229](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L229)
74
+ Defined in: [builder/helpers.ts:229](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L229)
75
75
 
76
76
  ***
77
77
 
@@ -79,7 +79,7 @@ Defined in: [builder/helpers.ts:229](https://github.com/tailor-sandbox/omakase-m
79
79
 
80
80
  > `optional` **devConfig**: `C`
81
81
 
82
- Defined in: [builder/helpers.ts:235](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L235)
82
+ Defined in: [builder/helpers.ts:235](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L235)
83
83
 
84
84
  Default configuration for module development.
85
85
  Used by loadModuleForDev when no config is provided.
@@ -90,4 +90,4 @@ Used by loadModuleForDev when no config is provided.
90
90
 
91
91
  > **packageName**: `string`
92
92
 
93
- Defined in: [builder/helpers.ts:228](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L228)
93
+ Defined in: [builder/helpers.ts:228](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L228)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **DependencyModules** = `Record`\<`string`, [`AnyDefinedModule`](AnyDefinedModule.md)\> \| [`EmptyDependencies`](EmptyDependencies.md)
10
10
 
11
- Defined in: [builder/helpers.ts:112](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L112)
11
+ Defined in: [builder/helpers.ts:112](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L112)
12
12
 
13
13
  A record of module dependencies or an empty dependency set.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **EmptyDependencies** = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:18](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L18)
11
+ Defined in: [builder/helpers.ts:18](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L18)
12
12
 
13
13
  Represents a module with no dependencies.
14
14
 
@@ -31,4 +31,4 @@ export default defineModule<MyConfig, MyTables>({
31
31
 
32
32
  > `readonly` `optional` **\_\_empty**: `never`
33
33
 
34
- Defined in: [builder/helpers.ts:18](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L18)
34
+ Defined in: [builder/helpers.ts:18](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L18)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **ModuleBuilder**\<`C`, `Tables`, `Deps`\> = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:251](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L251)
11
+ Defined in: [builder/helpers.ts:251](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L251)
12
12
 
13
13
  Intermediate builder type returned by defineModule.
14
14
  Use .withDependencies() to add dependencies, then call .build() to finalize.
@@ -28,7 +28,7 @@ Modules without dependencies can call .build() directly.
28
28
 
29
29
  > **build**: () => [`DefinedModule`](DefinedModule.md)\<`C`, `Tables`, `Deps`\>
30
30
 
31
- Defined in: [builder/helpers.ts:307](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L307)
31
+ Defined in: [builder/helpers.ts:307](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L307)
32
32
 
33
33
  Finalizes the module definition and returns the DefinedModule.
34
34
  This must be called at the end of the builder chain to get the actual module.
@@ -60,7 +60,7 @@ export default defineModule<ModuleConfig, Tables>({
60
60
 
61
61
  > **withDependencies**: \<`NewDeps`\>(`deps`) => `ModuleBuilder`\<`C`, `Tables`, `NewDeps`\>
62
62
 
63
- Defined in: [builder/helpers.ts:270](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L270)
63
+ Defined in: [builder/helpers.ts:270](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L270)
64
64
 
65
65
  Adds dependencies to the module definition.
66
66
  The Deps type is automatically inferred from the record.
@@ -98,7 +98,7 @@ export default defineModule<ModuleConfig, Tables>({
98
98
 
99
99
  > **withDevConfig**: (`config`) => `ModuleBuilder`\<`C`, `Tables`, `Deps`\>
100
100
 
101
- Defined in: [builder/helpers.ts:286](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L286)
101
+ Defined in: [builder/helpers.ts:286](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L286)
102
102
 
103
103
  Sets the default configuration for module development.
104
104
  This config is used by loadModuleForDev when no config is provided.
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **ModuleBuilderProps**\<`C`, `Deps`\> = `Deps` *extends* [`EmptyDependencies`](EmptyDependencies.md) ? `object` : `object`
10
10
 
11
- Defined in: [builder/helpers.ts:44](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L44)
11
+ Defined in: [builder/helpers.ts:44](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L44)
12
12
 
13
13
  Properties required when configuring a module via `configure()`.
14
14
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **ModuleFactoryContext**\<`C`\> = `object`
10
10
 
11
- Defined in: [builder/helpers.ts:409](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L409)
11
+ Defined in: [builder/helpers.ts:409](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L409)
12
12
 
13
13
  Context passed to table builder functions.
14
14
  Provides access to the module's configuration.
@@ -37,4 +37,4 @@ export const buildProductTable = (
37
37
 
38
38
  > **config**: `C`
39
39
 
40
- Defined in: [builder/helpers.ts:410](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L410)
40
+ Defined in: [builder/helpers.ts:410](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L410)
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **TablesFromNames**\<`T`\> = `{ [K in T[number]]: TailorDBType }`
10
10
 
11
- Defined in: [builder/helpers.ts:390](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L390)
11
+ Defined in: [builder/helpers.ts:390](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/builder/helpers.ts#L390)
12
12
 
13
13
  Derives a tables type from a tableNames array.
14
14
  Use this to avoid manually defining a separate Tables type.
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Class: ModuleLoader
8
8
 
9
- Defined in: [config/module-loader.ts:49](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L49)
9
+ Defined in: [config/module-loader.ts:49](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/module-loader.ts#L49)
10
10
 
11
11
  Module loader for registering and configuring modules.
12
12
 
@@ -70,7 +70,7 @@ export default loadModules((loader) => {
70
70
 
71
71
  > **add**\<`C`\>(`module`): [`ConfiguredModule`](../../builder/type-aliases/ConfiguredModule.md)\<`C`\>
72
72
 
73
- Defined in: [config/module-loader.ts:92](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L92)
73
+ Defined in: [config/module-loader.ts:92](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/module-loader.ts#L92)
74
74
 
75
75
  Add a configured module to the loader.
76
76
 
@@ -8,7 +8,7 @@
8
8
 
9
9
  > **loadModules**(`configurator`): [`LoadedModules`](../type-aliases/LoadedModules.md)
10
10
 
11
- Defined in: [config/module-loader.ts:277](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L277)
11
+ Defined in: [config/module-loader.ts:276](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/module-loader.ts#L276)
12
12
 
13
13
  Load and configure modules for your Tailor application.
14
14
 
@@ -8,9 +8,9 @@
8
8
 
9
9
  ## Type Aliases
10
10
 
11
- - [GetModulesReferenceOptions](type-aliases/GetModulesReferenceOptions.md)
11
+ - [GetModulesOptions](type-aliases/GetModulesOptions.md)
12
12
 
13
13
  ## Functions
14
14
 
15
- - [getModulesReference](functions/getModulesReference.md)
15
+ - [getModules](functions/getModules.md)
16
16
  - [loadModuleForDev](functions/loadModuleForDev.md)
@@ -0,0 +1,88 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../../modules.md) / [config/sdk](../README.md) / getModules
6
+
7
+ # Function: getModules()
8
+
9
+ > **getModules**(`modulesPath`, `options`): `Promise`\<\{ `executor`: `string`[]; `resolver`: `string`[]; `tailordb`: `string`[]; \}\>
10
+
11
+ Defined in: [config/sdk/paths.ts:128](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/sdk/paths.ts#L128)
12
+
13
+ Get file path patterns for modules to use in Tailor configuration.
14
+
15
+ This function processes your loaded modules and returns glob patterns
16
+ that can be spread into your `defineConfig`. It handles all the necessary
17
+ setup to make module TailorDB types, resolvers, and executors available
18
+ to Tailor's configuration system.
19
+
20
+ Supports both app context (modules.ts with loadModules) and dev context
21
+ (src/module.ts with defineModule). When a DefinedModule is detected,
22
+ it's automatically converted using loadModuleForDev.
23
+
24
+ ## Parameters
25
+
26
+ | Parameter | Type | Description |
27
+ | ------ | ------ | ------ |
28
+ | `modulesPath` | `string` | Path to the modules file (relative or absolute) |
29
+ | `options` | [`GetModulesOptions`](../type-aliases/GetModulesOptions.md) | Optional configuration for path resolution and logging |
30
+
31
+ ## Returns
32
+
33
+ `Promise`\<\{ `executor`: `string`[]; `resolver`: `string`[]; `tailordb`: `string`[]; \}\>
34
+
35
+ An object containing glob patterns for `tailordb`, `resolver`, and `executor` files
36
+
37
+ ## Examples
38
+
39
+ ```typescript
40
+ // tailor.config.ts (App context)
41
+ import { defineConfig } from "@tailor-platform/sdk";
42
+ import { getModules } from "@izumisy-tailor/omakase-modules/config/sdk";
43
+
44
+ const modules = await getModules("./modules.ts");
45
+
46
+ export default defineConfig({
47
+ name: "my-app",
48
+ db: {
49
+ "main-db": {
50
+ files: ["./src/tailordb/*.ts", ...modules.tailordb],
51
+ },
52
+ },
53
+ resolver: {
54
+ "main-pipeline": {
55
+ files: ["./src/resolvers/*.ts", ...modules.resolver],
56
+ },
57
+ },
58
+ executor: {
59
+ files: ["./src/executors/*.ts", ...modules.executor],
60
+ },
61
+ });
62
+ ```
63
+
64
+ ```typescript
65
+ // tailor.config.ts (Dev context - module development)
66
+ import { defineConfig } from "@tailor-platform/sdk";
67
+ import { getModules } from "@izumisy-tailor/omakase-modules/config/sdk";
68
+
69
+ const modules = await getModules("./src/module.ts");
70
+
71
+ export default defineConfig({
72
+ name: "my-module",
73
+ db: {
74
+ "main-db": {
75
+ files: [...modules.tailordb],
76
+ },
77
+ },
78
+ });
79
+ ```
80
+
81
+ ## Remarks
82
+
83
+ The returned object contains three arrays:
84
+ - `tailordb` - Paths to TailorDB type definitions from modules
85
+ - `resolver` - Paths to GraphQL resolver definitions from modules
86
+ - `executor` - Paths to event executor definitions from modules
87
+
88
+ If a module has no files of a certain type, that array will be empty.
@@ -8,11 +8,11 @@
8
8
 
9
9
  > **loadModuleForDev**\<`C`, `Tables`, `Deps`\>(`module`, `config?`): [`LoadedModules`](../../type-aliases/LoadedModules.md)
10
10
 
11
- Defined in: [config/sdk/dev-context.ts:29](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/sdk/dev-context.ts#L29)
11
+ Defined in: [config/sdk/dev-context.ts:28](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/sdk/dev-context.ts#L28)
12
12
 
13
13
  Creates a LoadedModules context for individual module development.
14
14
 
15
- This allows using `getModulesReference` in a module's own `tailor.config.ts`,
15
+ This allows using `getModules` in a module's own `tailor.config.ts`,
16
16
  enabling the kysely-type generator to work during module development.
17
17
 
18
18
  Dependencies declared in the module's `defineModule` are automatically
@@ -37,17 +37,16 @@ registered with default (empty) configurations.
37
37
 
38
38
  [`LoadedModules`](../../type-aliases/LoadedModules.md)
39
39
 
40
- A LoadedModules object that can be passed to getModulesReference
40
+ A LoadedModules object that can be passed to getModules
41
41
 
42
42
  ## Example
43
43
 
44
44
  ```typescript
45
45
  // tailor.config.ts
46
- import { loadModuleForDev, getModulesReference } from "@izumisy-tailor/omakase-modules/config/sdk";
46
+ import { getModules } from "@izumisy-tailor/omakase-modules/config/sdk";
47
47
  import inventoryModule from "./src/module";
48
48
 
49
- const modules = loadModuleForDev(inventoryModule);
50
- const moduleReference = await getModulesReference(modules);
49
+ const modules = await getModules("./src/module.ts");
51
50
 
52
51
  export default defineConfig({ ... });
53
52
  ```
@@ -0,0 +1,59 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../../modules.md) / [config/sdk](../README.md) / GetModulesOptions
6
+
7
+ # Type Alias: GetModulesOptions
8
+
9
+ > **GetModulesOptions** = `object`
10
+
11
+ Defined in: [config/sdk/paths.ts:40](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/sdk/paths.ts#L40)
12
+
13
+ Options for configuring [getModules](../functions/getModules.md) behavior.
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ // With logging enabled
19
+ const moduleReference = await getModules("./modules.ts", {
20
+ log: true,
21
+ });
22
+ ```
23
+
24
+ ## Properties
25
+
26
+ ### basePath?
27
+
28
+ > `optional` **basePath**: `string`
29
+
30
+ Defined in: [config/sdk/paths.ts:48](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/sdk/paths.ts#L48)
31
+
32
+ Base path for resolving relative modulesPath and generating wrapper files.
33
+
34
+ Defaults to `process.cwd()`.
35
+
36
+ #### Default
37
+
38
+ ```ts
39
+ process.cwd()
40
+ ```
41
+
42
+ ***
43
+
44
+ ### log?
45
+
46
+ > `optional` **log**: `boolean`
47
+
48
+ Defined in: [config/sdk/paths.ts:57](https://github.com/tailor-sandbox/omakase-modules/blob/366d1daa5ebf7874ce9b71af8ea6e8a4feb6c539/packages/core/src/config/sdk/paths.ts#L57)
49
+
50
+ Whether to enable log output.
51
+
52
+ When `true`, console output will be printed during module loading.
53
+ Useful for debugging or when you want to see which modules are loaded.
54
+
55
+ #### Default
56
+
57
+ ```ts
58
+ false
59
+ ```