@izumisy-tailor/omakase-modules 0.2.0 → 0.4.0

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 (47) hide show
  1. package/README.md +0 -28
  2. package/docs/generated/README.md +35 -0
  3. package/docs/generated/_media/creating-modules.md +471 -0
  4. package/docs/{tutorials → generated/_media}/using-modules.md +69 -20
  5. package/docs/generated/builder/README.md +25 -0
  6. package/docs/generated/builder/functions/defineModule.md +60 -0
  7. package/docs/generated/builder/functions/withModuleConfiguration.md +68 -0
  8. package/docs/generated/builder/type-aliases/AnyDefinedModule.md +57 -0
  9. package/docs/generated/builder/type-aliases/ConfiguredDependencies.md +44 -0
  10. package/docs/generated/builder/type-aliases/ConfiguredModule.md +60 -0
  11. package/docs/generated/builder/type-aliases/DefinedModule.md +93 -0
  12. package/docs/generated/builder/type-aliases/DependencyModules.md +29 -0
  13. package/docs/generated/builder/type-aliases/EmptyDependencies.md +34 -0
  14. package/docs/generated/builder/type-aliases/ModuleBuilder.md +124 -0
  15. package/docs/generated/builder/type-aliases/ModuleBuilderProps.md +42 -0
  16. package/docs/generated/builder/type-aliases/ModuleFactoryContext.md +40 -0
  17. package/docs/generated/builder/type-aliases/TablesFromNames.md +28 -0
  18. package/docs/generated/config/README.md +19 -0
  19. package/docs/generated/config/classes/ModuleLoader.md +128 -0
  20. package/docs/generated/config/functions/loadModules.md +79 -0
  21. package/docs/generated/config/sdk/README.md +16 -0
  22. package/docs/generated/config/sdk/functions/getModulesReference.md +81 -0
  23. package/docs/generated/config/sdk/functions/loadModuleForDev.md +53 -0
  24. package/docs/generated/config/sdk/type-aliases/GetModulesReferenceOptions.md +60 -0
  25. package/docs/generated/config/type-aliases/LoadedModules.md +162 -0
  26. package/docs/generated/modules.md +11 -0
  27. package/package.json +17 -18
  28. package/src/builder/helpers.ts +388 -28
  29. package/src/builder/index.ts +8 -1
  30. package/src/builder/register.ts +38 -25
  31. package/src/config/module-loader.ts +251 -21
  32. package/src/config/sdk/dev-context.ts +82 -0
  33. package/src/config/sdk/index.ts +2 -1
  34. package/src/config/sdk/paths.ts +124 -13
  35. package/src/config/sdk/wrapper/base.ts +185 -0
  36. package/src/config/sdk/wrapper/generator.ts +89 -0
  37. package/src/config/sdk/wrapper/strategies.ts +121 -0
  38. package/docs/examples/data-models/core/inventory-module.md +0 -230
  39. package/docs/examples/data-models/core/order-module.md +0 -132
  40. package/docs/examples/data-models/scenarios/inventory-reservation-scenario.md +0 -73
  41. package/docs/examples/data-models/scenarios/multi-storefront-order-scenario.md +0 -99
  42. package/docs/examples/data-models/scenarios/order-payment-status-scenario.md +0 -92
  43. package/docs/examples/data-models/scenarios/procurement-order-scenario.md +0 -95
  44. package/docs/tutorials/creating-modules.md +0 -256
  45. package/src/config/module-registry.ts +0 -22
  46. package/src/stub-loader/index.ts +0 -3
  47. package/src/stub-loader/interface.ts +0 -40
@@ -0,0 +1,28 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../modules.md) / [builder](../README.md) / TablesFromNames
6
+
7
+ # Type Alias: TablesFromNames\<T\>
8
+
9
+ > **TablesFromNames**\<`T`\> = `{ [K in T[number]]: TailorDBType }`
10
+
11
+ Defined in: [builder/helpers.ts:390](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/builder/helpers.ts#L390)
12
+
13
+ Derives a tables type from a tableNames array.
14
+ Use this to avoid manually defining a separate Tables type.
15
+
16
+ ## Type Parameters
17
+
18
+ | Type Parameter |
19
+ | ------ |
20
+ | `T` *extends* readonly `string`[] |
21
+
22
+ ## Example
23
+
24
+ ```typescript
25
+ export const tableNames = ["product", "category"] as const;
26
+ type MyTables = TablesFromNames<typeof tableNames>;
27
+ // Result: { product: TailorDBType; category: TailorDBType }
28
+ ```
@@ -0,0 +1,19 @@
1
+ [**@izumisy-tailor/omakase-modules**](../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../modules.md) / config
6
+
7
+ # config
8
+
9
+ ## Classes
10
+
11
+ - [ModuleLoader](classes/ModuleLoader.md)
12
+
13
+ ## Type Aliases
14
+
15
+ - [LoadedModules](type-aliases/LoadedModules.md)
16
+
17
+ ## Functions
18
+
19
+ - [loadModules](functions/loadModules.md)
@@ -0,0 +1,128 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../modules.md) / [config](../README.md) / ModuleLoader
6
+
7
+ # Class: ModuleLoader
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)
10
+
11
+ Module loader for registering and configuring modules.
12
+
13
+ The `ModuleLoader` is used within the [loadModules](../functions/loadModules.md) function to register
14
+ configured modules. Modules can depend on each other, and the loader ensures
15
+ proper dependency management.
16
+
17
+ ## Example
18
+
19
+ ```typescript
20
+ import { loadModules } from "@izumisy-tailor/omakase-modules";
21
+ import commerceModule from "omakase-module-commerce-core";
22
+ import orderModule from "omakase-module-order";
23
+ import inventoryModule from "omakase-module-inventory";
24
+
25
+ export default loadModules((loader) => {
26
+ // Add a module without dependencies
27
+ const $commerce = loader.add(
28
+ commerceModule.configure({
29
+ config: {
30
+ dataModel: {
31
+ product: { docNumberPrefix: "PROD" },
32
+ },
33
+ },
34
+ })
35
+ );
36
+
37
+ // Add a module that depends on commerce
38
+ const $order = loader.add(
39
+ orderModule.configure({
40
+ config: { dataModel: {} },
41
+ dependencies: { commerce: $commerce },
42
+ })
43
+ );
44
+
45
+ // Add a module that depends on both commerce and order
46
+ loader.add(
47
+ inventoryModule.configure({
48
+ config: { dbNamespace: "main-db" },
49
+ dependencies: { commerce: $commerce, order: $order },
50
+ })
51
+ );
52
+
53
+ return loader;
54
+ });
55
+ ```
56
+
57
+ ## Constructors
58
+
59
+ ### Constructor
60
+
61
+ > **new ModuleLoader**(): `ModuleLoader`
62
+
63
+ #### Returns
64
+
65
+ `ModuleLoader`
66
+
67
+ ## Methods
68
+
69
+ ### add()
70
+
71
+ > **add**\<`C`\>(`module`): [`ConfiguredModule`](../../builder/type-aliases/ConfiguredModule.md)\<`C`\>
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)
74
+
75
+ Add a configured module to the loader.
76
+
77
+ Returns the added module so it can be used as a dependency for other modules.
78
+ This enables type-safe dependency wiring between modules.
79
+
80
+ #### Type Parameters
81
+
82
+ | Type Parameter |
83
+ | ------ |
84
+ | `C` *extends* `Record`\<`string`, `unknown`\> |
85
+
86
+ #### Parameters
87
+
88
+ | Parameter | Type | Description |
89
+ | ------ | ------ | ------ |
90
+ | `module` | [`ConfiguredModule`](../../builder/type-aliases/ConfiguredModule.md)\<`C`\> | A configured module created by calling `moduleDefinition.configure()` |
91
+
92
+ #### Returns
93
+
94
+ [`ConfiguredModule`](../../builder/type-aliases/ConfiguredModule.md)\<`C`\>
95
+
96
+ The same configured module, to be used as a dependency for other modules
97
+
98
+ #### Example
99
+
100
+ ```typescript
101
+ loadModules((loader) => {
102
+ // Capture the returned value to use as a dependency
103
+ const $commerce = loader.add(
104
+ commerceModule.configure({
105
+ config: {
106
+ dataModel: {
107
+ product: {
108
+ docNumberPrefix: "PP-PROD",
109
+ customAttributes: {
110
+ customStatus: db.enum(["new", "used", "refurbished"]),
111
+ },
112
+ },
113
+ },
114
+ },
115
+ })
116
+ );
117
+
118
+ // Use the captured module as a dependency
119
+ loader.add(
120
+ orderModule.configure({
121
+ config: { dataModel: {} },
122
+ dependencies: { commerce: $commerce },
123
+ })
124
+ );
125
+
126
+ return loader;
127
+ });
128
+ ```
@@ -0,0 +1,79 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../modules.md) / [config](../README.md) / loadModules
6
+
7
+ # Function: loadModules()
8
+
9
+ > **loadModules**(`configurator`): [`LoadedModules`](../type-aliases/LoadedModules.md)
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)
12
+
13
+ Load and configure modules for your Tailor application.
14
+
15
+ This is the main entry point for setting up omakase modules. Use this function
16
+ to register all modules your application needs, configure them with your settings,
17
+ and wire up dependencies between modules.
18
+
19
+ ## Parameters
20
+
21
+ | Parameter | Type | Description |
22
+ | ------ | ------ | ------ |
23
+ | `configurator` | (`loader`) => [`ModuleLoader`](../classes/ModuleLoader.md) | A function that receives a [ModuleLoader](../classes/ModuleLoader.md) and returns it after adding modules |
24
+
25
+ ## Returns
26
+
27
+ [`LoadedModules`](../type-aliases/LoadedModules.md)
28
+
29
+ A [LoadedModules](../type-aliases/LoadedModules.md) object containing all registered modules and utilities
30
+
31
+ ## Example
32
+
33
+ ```typescript
34
+ // modules.ts - Define your module configuration
35
+ import { loadModules } from "@izumisy-tailor/omakase-modules";
36
+ import { db } from "@tailor-platform/sdk";
37
+ import commerceModule from "omakase-module-commerce-core";
38
+ import orderModule from "omakase-module-order";
39
+ import inventoryModule from "omakase-module-inventory";
40
+
41
+ export default loadModules((loader) => {
42
+ // Configure and add the commerce module
43
+ const $commerce = loader.add(
44
+ commerceModule.configure({
45
+ config: {
46
+ dataModel: {
47
+ product: {
48
+ docNumberPrefix: "PP-PROD",
49
+ customAttributes: {
50
+ customStatus: db.enum(["new", "used", "refurbished"]),
51
+ },
52
+ },
53
+ },
54
+ },
55
+ })
56
+ );
57
+
58
+ // Configure order module with commerce as a dependency
59
+ const $order = loader.add(
60
+ orderModule.configure({
61
+ config: { dataModel: {} },
62
+ dependencies: { commerce: $commerce },
63
+ })
64
+ );
65
+
66
+ // Configure inventory module with both dependencies
67
+ loader.add(
68
+ inventoryModule.configure({
69
+ config: {
70
+ dbNamespace: "main-db",
71
+ invantoryBootstrapBaseValue: 300,
72
+ },
73
+ dependencies: { commerce: $commerce, order: $order },
74
+ })
75
+ );
76
+
77
+ return loader;
78
+ });
79
+ ```
@@ -0,0 +1,16 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../modules.md) / config/sdk
6
+
7
+ # config/sdk
8
+
9
+ ## Type Aliases
10
+
11
+ - [GetModulesReferenceOptions](type-aliases/GetModulesReferenceOptions.md)
12
+
13
+ ## Functions
14
+
15
+ - [getModulesReference](functions/getModulesReference.md)
16
+ - [loadModuleForDev](functions/loadModuleForDev.md)
@@ -0,0 +1,81 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../../modules.md) / [config/sdk](../README.md) / getModulesReference
6
+
7
+ # Function: getModulesReference()
8
+
9
+ > **getModulesReference**(`loadedModules`, `options`): `Promise`\<\{ `executor`: `string`[]; `resolver`: `string`[]; `tailordb`: `string`[]; \}\>
10
+
11
+ Defined in: [config/sdk/paths.ts:98](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/sdk/paths.ts#L98)
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
+ ## Parameters
21
+
22
+ | Parameter | Type | Description |
23
+ | ------ | ------ | ------ |
24
+ | `loadedModules` | [`LoadedModules`](../../type-aliases/LoadedModules.md) | The result of calling `loadModules()` |
25
+ | `options` | [`GetModulesReferenceOptions`](../type-aliases/GetModulesReferenceOptions.md) | Optional configuration for path resolution and logging |
26
+
27
+ ## Returns
28
+
29
+ `Promise`\<\{ `executor`: `string`[]; `resolver`: `string`[]; `tailordb`: `string`[]; \}\>
30
+
31
+ An object containing glob patterns for `tailordb`, `resolver`, and `executor` files
32
+
33
+ ## Examples
34
+
35
+ ```typescript
36
+ // tailor.config.ts
37
+ import { defineConfig, defineGenerators } from "@tailor-platform/sdk";
38
+ import { getModulesReference } from "@izumisy-tailor/omakase-modules/config/sdk";
39
+ import modules from "./modules";
40
+
41
+ // Get module path patterns
42
+ const moduleReference = await getModulesReference(modules);
43
+
44
+ export default defineConfig({
45
+ name: "my-app",
46
+
47
+ // Spread module paths alongside your local files
48
+ db: {
49
+ "main-db": {
50
+ files: ["./src/tailordb/*.ts", ...moduleReference.tailordb],
51
+ },
52
+ },
53
+
54
+ resolver: {
55
+ "main-pipeline": {
56
+ files: ["./src/resolvers/*.ts", ...moduleReference.resolver],
57
+ },
58
+ },
59
+
60
+ executor: {
61
+ files: ["./src/executors/*.ts", ...moduleReference.executor],
62
+ },
63
+ });
64
+ ```
65
+
66
+ ```typescript
67
+ // With custom options
68
+ const moduleReference = await getModulesReference(modules, {
69
+ basePath: import.meta.dirname, // Use ESM module directory
70
+ silent: true, // No console output
71
+ });
72
+ ```
73
+
74
+ ## Remarks
75
+
76
+ The returned object contains three arrays:
77
+ - `tailordb` - Paths to TailorDB type definitions from modules
78
+ - `resolver` - Paths to GraphQL resolver definitions from modules
79
+ - `executor` - Paths to event executor definitions from modules
80
+
81
+ If a module has no files of a certain type, that array will be empty.
@@ -0,0 +1,53 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../../modules.md) / [config/sdk](../README.md) / loadModuleForDev
6
+
7
+ # Function: loadModuleForDev()
8
+
9
+ > **loadModuleForDev**\<`C`, `Tables`, `Deps`\>(`module`, `config?`): [`LoadedModules`](../../type-aliases/LoadedModules.md)
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)
12
+
13
+ Creates a LoadedModules context for individual module development.
14
+
15
+ This allows using `getModulesReference` in a module's own `tailor.config.ts`,
16
+ enabling the kysely-type generator to work during module development.
17
+
18
+ Dependencies declared in the module's `defineModule` are automatically
19
+ registered with default (empty) configurations.
20
+
21
+ ## Type Parameters
22
+
23
+ | Type Parameter |
24
+ | ------ |
25
+ | `C` *extends* `Record`\<`string`, `unknown`\> |
26
+ | `Tables` *extends* `Record`\<`string`, `unknown`\> |
27
+ | `Deps` *extends* [`DependencyModules`](../../../builder/type-aliases/DependencyModules.md) |
28
+
29
+ ## Parameters
30
+
31
+ | Parameter | Type | Description |
32
+ | ------ | ------ | ------ |
33
+ | `module` | [`DefinedModule`](../../../builder/type-aliases/DefinedModule.md)\<`C`, `Tables`, `Deps`\> | The module being developed |
34
+ | `config?` | `C` | Optional development configuration. If omitted, uses module.devConfig. |
35
+
36
+ ## Returns
37
+
38
+ [`LoadedModules`](../../type-aliases/LoadedModules.md)
39
+
40
+ A LoadedModules object that can be passed to getModulesReference
41
+
42
+ ## Example
43
+
44
+ ```typescript
45
+ // tailor.config.ts
46
+ import { loadModuleForDev, getModulesReference } from "@izumisy-tailor/omakase-modules/config/sdk";
47
+ import inventoryModule from "./src/module";
48
+
49
+ const modules = loadModuleForDev(inventoryModule);
50
+ const moduleReference = await getModulesReference(modules);
51
+
52
+ export default defineConfig({ ... });
53
+ ```
@@ -0,0 +1,60 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../../modules.md) / [config/sdk](../README.md) / GetModulesReferenceOptions
6
+
7
+ # Type Alias: GetModulesReferenceOptions
8
+
9
+ > **GetModulesReferenceOptions** = `object`
10
+
11
+ Defined in: [config/sdk/paths.ts:16](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/sdk/paths.ts#L16)
12
+
13
+ Options for configuring [getModulesReference](../functions/getModulesReference.md) behavior.
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ const moduleReference = await getModulesReference(modules, {
19
+ basePath: "/custom/path",
20
+ silent: true, // Suppress console output
21
+ });
22
+ ```
23
+
24
+ ## Properties
25
+
26
+ ### basePath?
27
+
28
+ > `optional` **basePath**: `string`
29
+
30
+ Defined in: [config/sdk/paths.ts:25](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/sdk/paths.ts#L25)
31
+
32
+ Base path for the application.
33
+
34
+ This determines where wrapper files are generated and where module
35
+ paths are resolved from. Defaults to `process.cwd()`.
36
+
37
+ #### Default
38
+
39
+ ```ts
40
+ process.cwd()
41
+ ```
42
+
43
+ ***
44
+
45
+ ### silent?
46
+
47
+ > `optional` **silent**: `boolean`
48
+
49
+ Defined in: [config/sdk/paths.ts:34](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/sdk/paths.ts#L34)
50
+
51
+ Whether to suppress log output.
52
+
53
+ When `true`, no console output will be printed during module loading.
54
+ Useful for testing or when you want cleaner build output.
55
+
56
+ #### Default
57
+
58
+ ```ts
59
+ false
60
+ ```
@@ -0,0 +1,162 @@
1
+ [**@izumisy-tailor/omakase-modules**](../../README.md)
2
+
3
+ ***
4
+
5
+ [@izumisy-tailor/omakase-modules](../../modules.md) / [config](../README.md) / LoadedModules
6
+
7
+ # Type Alias: LoadedModules
8
+
9
+ > **LoadedModules** = `object`
10
+
11
+ Defined in: [config/module-loader.ts:135](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L135)
12
+
13
+ The result of loading modules, providing access to module configurations and tables.
14
+
15
+ This type is returned by [loadModules](../functions/loadModules.md) and passed to module factory functions.
16
+ It provides utilities for:
17
+ - Accessing configured module instances
18
+ - Loading module configurations
19
+ - Retrieving tables from dependency modules
20
+
21
+ ## Example
22
+
23
+ ```typescript
24
+ // In tailor.config.ts - using getModulesReference with LoadedModules
25
+ import { getModulesReference } from "@izumisy-tailor/omakase-modules/config/sdk";
26
+ import modules from "./modules";
27
+
28
+ const moduleReference = await getModulesReference(modules);
29
+
30
+ export default defineConfig({
31
+ db: {
32
+ "main-db": {
33
+ files: ["./src/tailordb/*.ts", ...moduleReference.tailordb],
34
+ },
35
+ },
36
+ // ...
37
+ });
38
+ ```
39
+
40
+ ## Properties
41
+
42
+ ### getTables()
43
+
44
+ > **getTables**: \<`T`\>(`factory`) => `Promise`\<`T`\>
45
+
46
+ Defined in: [config/module-loader.ts:204](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L204)
47
+
48
+ Get the tables from a dependency module by calling its factory function.
49
+
50
+ Use this when a module needs to reference tables from another module,
51
+ such as creating foreign key relationships or using shared types.
52
+
53
+ #### Type Parameters
54
+
55
+ | Type Parameter |
56
+ | ------ |
57
+ | `T` |
58
+
59
+ #### Parameters
60
+
61
+ | Parameter | Type | Description |
62
+ | ------ | ------ | ------ |
63
+ | `factory` | (`loadedModules`) => `Promise`\<`T`\> | The factory function exported by the dependency module's `tailordb/index.ts` |
64
+
65
+ #### Returns
66
+
67
+ `Promise`\<`T`\>
68
+
69
+ A promise resolving to the tables created by the factory
70
+
71
+ #### Example
72
+
73
+ ```typescript
74
+ // In inventory-module's tailordb/index.ts
75
+ import commerceModuleTables from "omakase-module-commerce-core/backend/tailordb";
76
+ import orderModuleTables from "omakase-module-order/backend/tailordb";
77
+
78
+ export default withModuleConfiguration(
79
+ moduleDef,
80
+ async (context, loadedModules) => {
81
+ // Get tables from commerce module to reference product/productVariant
82
+ const { product, productVariant } = await loadedModules.getTables(
83
+ commerceModuleTables
84
+ );
85
+
86
+ // Get tables from order module to reference order
87
+ const { order } = await loadedModules.getTables(orderModuleTables);
88
+
89
+ // Use dependency tables when building this module's tables
90
+ const inventory = buildInventoryTable(context, { product, productVariant });
91
+ const inventoryTransaction = buildInventoryTransactionTable(context, {
92
+ inventory,
93
+ order,
94
+ });
95
+
96
+ return { inventory, inventoryTransaction };
97
+ }
98
+ );
99
+ ```
100
+
101
+ ***
102
+
103
+ ### loadConfig()
104
+
105
+ > **loadConfig**: \<`C`\>(`module`) => `object`
106
+
107
+ Defined in: [config/module-loader.ts:161](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L161)
108
+
109
+ Load the configuration for a specific module.
110
+
111
+ Use this in module factory functions to access the user-provided configuration.
112
+ Throws an error if the module has not been registered via `loadModules`.
113
+
114
+ #### Type Parameters
115
+
116
+ | Type Parameter |
117
+ | ------ |
118
+ | `C` *extends* `Record`\<`string`, `unknown`\> |
119
+
120
+ #### Parameters
121
+
122
+ | Parameter | Type | Description |
123
+ | ------ | ------ | ------ |
124
+ | `module` | \{ `packageName`: `string`; \} | An object with `packageName` (typically the module definition) |
125
+ | `module.packageName` | `string` | - |
126
+
127
+ #### Returns
128
+
129
+ `object`
130
+
131
+ An object containing the module's configuration
132
+
133
+ ##### config
134
+
135
+ > **config**: `C`
136
+
137
+ #### Throws
138
+
139
+ Error if the module has not been configured
140
+
141
+ #### Example
142
+
143
+ ```typescript
144
+ // In a module's tailordb/index.ts
145
+ import moduleDef from "../module";
146
+
147
+ export default withModuleConfiguration(moduleDef, (context, loadedModules) => {
148
+ // Access this module's configuration
149
+ const { config } = loadedModules.loadConfig<ModuleConfig>(moduleDef);
150
+ const prefix = config.dataModel?.product?.docNumberPrefix ?? "PROD";
151
+
152
+ return { product: buildProductTable(context) };
153
+ });
154
+ ```
155
+
156
+ ***
157
+
158
+ ### loadedModules
159
+
160
+ > **loadedModules**: `Record`\<`string`, [`ConfiguredModule`](../../builder/type-aliases/ConfiguredModule.md)\<`any`\>\>
161
+
162
+ Defined in: [config/module-loader.ts:136](https://github.com/tailor-sandbox/omakase-modules/blob/c8d6563533665d8bb159b4602b5c906b40e938f2/packages/core/src/config/module-loader.ts#L136)
@@ -0,0 +1,11 @@
1
+ [**@izumisy-tailor/omakase-modules**](README.md)
2
+
3
+ ***
4
+
5
+ # @izumisy-tailor/omakase-modules
6
+
7
+ ## Modules
8
+
9
+ - [builder](builder/README.md)
10
+ - [config](config/README.md)
11
+ - [config/sdk](config/sdk/README.md)