@minecraft-docker/mod-source-modrinth 1.0.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 (33) hide show
  1. package/dist/ModrinthAdapter.d.ts +62 -0
  2. package/dist/ModrinthAdapter.d.ts.map +1 -0
  3. package/dist/ModrinthAdapter.js +103 -0
  4. package/dist/ModrinthAdapter.js.map +1 -0
  5. package/dist/index.d.ts +47 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +51 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/infrastructure/api/ModrinthApiClient.d.ts +62 -0
  10. package/dist/infrastructure/api/ModrinthApiClient.d.ts.map +1 -0
  11. package/dist/infrastructure/api/ModrinthApiClient.js +102 -0
  12. package/dist/infrastructure/api/ModrinthApiClient.js.map +1 -0
  13. package/dist/infrastructure/api/index.d.ts +3 -0
  14. package/dist/infrastructure/api/index.d.ts.map +1 -0
  15. package/dist/infrastructure/api/index.js +2 -0
  16. package/dist/infrastructure/api/index.js.map +1 -0
  17. package/dist/infrastructure/index.d.ts +10 -0
  18. package/dist/infrastructure/index.d.ts.map +1 -0
  19. package/dist/infrastructure/index.js +10 -0
  20. package/dist/infrastructure/index.js.map +1 -0
  21. package/dist/infrastructure/mappers/ModrinthMapper.d.ts +53 -0
  22. package/dist/infrastructure/mappers/ModrinthMapper.d.ts.map +1 -0
  23. package/dist/infrastructure/mappers/ModrinthMapper.js +140 -0
  24. package/dist/infrastructure/mappers/ModrinthMapper.js.map +1 -0
  25. package/dist/infrastructure/mappers/index.d.ts +2 -0
  26. package/dist/infrastructure/mappers/index.d.ts.map +1 -0
  27. package/dist/infrastructure/mappers/index.js +2 -0
  28. package/dist/infrastructure/mappers/index.js.map +1 -0
  29. package/dist/types.d.ts +126 -0
  30. package/dist/types.d.ts.map +1 -0
  31. package/dist/types.js +7 -0
  32. package/dist/types.js.map +1 -0
  33. package/package.json +49 -0
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ModrinthAdapter - Modrinth API implementation of IModSourcePort
3
+ *
4
+ * This adapter composes infrastructure components to provide
5
+ * access to Modrinth's mod repository.
6
+ *
7
+ * Architecture:
8
+ * - ModrinthApiClient: HTTP requests to Modrinth API
9
+ * - ModrinthMapper: Raw API responses → Domain models
10
+ * - ModrinthAdapter: Orchestrates client and mapper, implements IModSourcePort
11
+ *
12
+ * @see https://docs.modrinth.com/api-spec
13
+ */
14
+ import type { IModSourcePort, ModProject, ModVersion, ModSearchResult, ModSearchOptions, ModVersionOptions } from '@minecraft-docker/shared';
15
+ import { ModrinthApiClient } from './infrastructure/api/index.js';
16
+ import { ModrinthMapper } from './infrastructure/mappers/index.js';
17
+ /**
18
+ * Modrinth adapter implementing IModSourcePort
19
+ *
20
+ * Uses composition to combine API client and mapper.
21
+ * Follows Single Responsibility Principle - this class only
22
+ * orchestrates the components, not implement HTTP or mapping logic.
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const adapter = new ModrinthAdapter();
27
+ * const result = await adapter.search('sodium');
28
+ * const project = await adapter.getProject('sodium');
29
+ * ```
30
+ */
31
+ export declare class ModrinthAdapter implements IModSourcePort {
32
+ readonly sourceName = "modrinth";
33
+ readonly displayName = "Modrinth";
34
+ private readonly apiClient;
35
+ private readonly mapper;
36
+ constructor(apiClient?: ModrinthApiClient, mapper?: ModrinthMapper);
37
+ /**
38
+ * Search for mods on Modrinth
39
+ */
40
+ search(query: string, options?: ModSearchOptions): Promise<ModSearchResult>;
41
+ /**
42
+ * Get project details by slug or ID
43
+ */
44
+ getProject(slugOrId: string): Promise<ModProject | null>;
45
+ /**
46
+ * Get versions for a project
47
+ */
48
+ getVersions(slugOrId: string, options?: ModVersionOptions): Promise<ModVersion[]>;
49
+ /**
50
+ * Check if Modrinth API is available
51
+ */
52
+ isAvailable(): Promise<boolean>;
53
+ /**
54
+ * Get environment variable key for Modrinth
55
+ */
56
+ getEnvKey(): string;
57
+ /**
58
+ * Format project for config.env
59
+ */
60
+ formatForEnv(project: ModProject): string;
61
+ }
62
+ //# sourceMappingURL=ModrinthAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthAdapter.d.ts","sourceRoot":"","sources":["../src/ModrinthAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAgB,YAAW,cAAc;IACpD,QAAQ,CAAC,UAAU,cAAc;IACjC,QAAQ,CAAC,WAAW,cAAc;IAElC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoB;IAC9C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;gBAGtC,SAAS,GAAE,iBAA2C,EACtD,MAAM,GAAE,cAAqC;IAM/C;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAqBjF;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAc9D;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAUvF;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAIrC;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;OAEG;IACH,YAAY,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM;CAG1C"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * ModrinthAdapter - Modrinth API implementation of IModSourcePort
3
+ *
4
+ * This adapter composes infrastructure components to provide
5
+ * access to Modrinth's mod repository.
6
+ *
7
+ * Architecture:
8
+ * - ModrinthApiClient: HTTP requests to Modrinth API
9
+ * - ModrinthMapper: Raw API responses → Domain models
10
+ * - ModrinthAdapter: Orchestrates client and mapper, implements IModSourcePort
11
+ *
12
+ * @see https://docs.modrinth.com/api-spec
13
+ */
14
+ import { ModrinthApiClient } from './infrastructure/api/index.js';
15
+ import { ModrinthMapper } from './infrastructure/mappers/index.js';
16
+ /**
17
+ * Modrinth adapter implementing IModSourcePort
18
+ *
19
+ * Uses composition to combine API client and mapper.
20
+ * Follows Single Responsibility Principle - this class only
21
+ * orchestrates the components, not implement HTTP or mapping logic.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const adapter = new ModrinthAdapter();
26
+ * const result = await adapter.search('sodium');
27
+ * const project = await adapter.getProject('sodium');
28
+ * ```
29
+ */
30
+ export class ModrinthAdapter {
31
+ sourceName = 'modrinth';
32
+ displayName = 'Modrinth';
33
+ apiClient;
34
+ mapper;
35
+ constructor(apiClient = new ModrinthApiClient(), mapper = new ModrinthMapper()) {
36
+ this.apiClient = apiClient;
37
+ this.mapper = mapper;
38
+ }
39
+ /**
40
+ * Search for mods on Modrinth
41
+ */
42
+ async search(query, options) {
43
+ // Build facets for filtering
44
+ const facets = [];
45
+ if (options?.gameVersions?.length) {
46
+ facets.push(options.gameVersions.map(v => `versions:${v}`));
47
+ }
48
+ if (options?.loaders?.length) {
49
+ facets.push(options.loaders.map(l => `categories:${l}`));
50
+ }
51
+ const raw = await this.apiClient.search({
52
+ query,
53
+ limit: options?.limit,
54
+ offset: options?.offset,
55
+ index: options?.index,
56
+ facets: facets.length > 0 ? facets : undefined,
57
+ });
58
+ return this.mapper.toSearchResult(raw);
59
+ }
60
+ /**
61
+ * Get project details by slug or ID
62
+ */
63
+ async getProject(slugOrId) {
64
+ const raw = await this.apiClient.getProject(slugOrId);
65
+ if (!raw) {
66
+ return null;
67
+ }
68
+ // Get author from team
69
+ const members = await this.apiClient.getTeamMembers(raw.team);
70
+ const author = this.mapper.extractAuthor(members);
71
+ return this.mapper.toProject(raw, author);
72
+ }
73
+ /**
74
+ * Get versions for a project
75
+ */
76
+ async getVersions(slugOrId, options) {
77
+ const rawVersions = await this.apiClient.getVersions(slugOrId, {
78
+ loaders: options?.loaders,
79
+ gameVersions: options?.gameVersions,
80
+ featured: options?.featured,
81
+ });
82
+ return rawVersions.map(v => this.mapper.toVersion(v));
83
+ }
84
+ /**
85
+ * Check if Modrinth API is available
86
+ */
87
+ async isAvailable() {
88
+ return this.apiClient.isAvailable();
89
+ }
90
+ /**
91
+ * Get environment variable key for Modrinth
92
+ */
93
+ getEnvKey() {
94
+ return 'MODRINTH_PROJECTS';
95
+ }
96
+ /**
97
+ * Format project for config.env
98
+ */
99
+ formatForEnv(project) {
100
+ return project.slug;
101
+ }
102
+ }
103
+ //# sourceMappingURL=ModrinthAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthAdapter.js","sourceRoot":"","sources":["../src/ModrinthAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAEnE;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,eAAe;IACjB,UAAU,GAAG,UAAU,CAAC;IACxB,WAAW,GAAG,UAAU,CAAC;IAEjB,SAAS,CAAoB;IAC7B,MAAM,CAAiB;IAExC,YACE,YAA+B,IAAI,iBAAiB,EAAE,EACtD,SAAyB,IAAI,cAAc,EAAE;QAE7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa,EAAE,OAA0B;QACpD,6BAA6B;QAC7B,MAAM,MAAM,GA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AAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,QAAgB,EAAE,OAA2B;QAC7D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE;YAC7D,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,YAAY,EAAE,OAAO,EAAE,YAAY;YACnC,QAAQ,EAAE,OAAO,EAAE,QAAQ;SAC5B,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,SAAS;QACP,OAAO,mBAAmB,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,OAAmB;QAC9B,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;CACF"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @minecraft-docker/mod-source-modrinth
3
+ *
4
+ * Modrinth adapter for the mod source system.
5
+ * Auto-registers with ModSourceFactory on import.
6
+ *
7
+ * Architecture:
8
+ * ```
9
+ * mod-source-modrinth/src/
10
+ * ├── infrastructure/
11
+ * │ ├── api/
12
+ * │ │ └── ModrinthApiClient.ts # HTTP client (single responsibility)
13
+ * │ └── mappers/
14
+ * │ └── ModrinthMapper.ts # Raw → Domain transformation
15
+ * │
16
+ * ├── types.ts # Raw Modrinth API types
17
+ * ├── ModrinthAdapter.ts # IModSourcePort implementation (composition)
18
+ * └── index.ts # Auto-registration & exports
19
+ * ```
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Just import to register
24
+ * import '@minecraft-docker/mod-source-modrinth';
25
+ *
26
+ * // Then use via factory
27
+ * import { ModSourceFactory } from '@minecraft-docker/shared';
28
+ * const modrinth = ModSourceFactory.get('modrinth');
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Or use components directly for testing
34
+ * import { ModrinthApiClient, ModrinthMapper, ModrinthAdapter } from '@minecraft-docker/mod-source-modrinth';
35
+ *
36
+ * const mockClient = new MockModrinthApiClient();
37
+ * const adapter = new ModrinthAdapter(mockClient, new ModrinthMapper());
38
+ * ```
39
+ */
40
+ import { ModrinthAdapter } from './ModrinthAdapter.js';
41
+ export { ModrinthAdapter } from './ModrinthAdapter.js';
42
+ export { ModrinthApiClient, ModrinthMapper } from './infrastructure/index.js';
43
+ export type { ModrinthSearchParams, ModrinthVersionParams } from './infrastructure/index.js';
44
+ export type * from './types.js';
45
+ declare const adapter: ModrinthAdapter;
46
+ export { adapter as modrinthAdapter };
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGvD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAG7F,mBAAmB,YAAY,CAAC;AAGhC,QAAA,MAAM,OAAO,iBAAwB,CAAC;AAItC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @minecraft-docker/mod-source-modrinth
3
+ *
4
+ * Modrinth adapter for the mod source system.
5
+ * Auto-registers with ModSourceFactory on import.
6
+ *
7
+ * Architecture:
8
+ * ```
9
+ * mod-source-modrinth/src/
10
+ * ├── infrastructure/
11
+ * │ ├── api/
12
+ * │ │ └── ModrinthApiClient.ts # HTTP client (single responsibility)
13
+ * │ └── mappers/
14
+ * │ └── ModrinthMapper.ts # Raw → Domain transformation
15
+ * │
16
+ * ├── types.ts # Raw Modrinth API types
17
+ * ├── ModrinthAdapter.ts # IModSourcePort implementation (composition)
18
+ * └── index.ts # Auto-registration & exports
19
+ * ```
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * // Just import to register
24
+ * import '@minecraft-docker/mod-source-modrinth';
25
+ *
26
+ * // Then use via factory
27
+ * import { ModSourceFactory } from '@minecraft-docker/shared';
28
+ * const modrinth = ModSourceFactory.get('modrinth');
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * // Or use components directly for testing
34
+ * import { ModrinthApiClient, ModrinthMapper, ModrinthAdapter } from '@minecraft-docker/mod-source-modrinth';
35
+ *
36
+ * const mockClient = new MockModrinthApiClient();
37
+ * const adapter = new ModrinthAdapter(mockClient, new ModrinthMapper());
38
+ * ```
39
+ */
40
+ import { ModSourceFactory } from '@minecraft-docker/shared';
41
+ import { ModrinthAdapter } from './ModrinthAdapter.js';
42
+ // Export the adapter class for direct use if needed
43
+ export { ModrinthAdapter } from './ModrinthAdapter.js';
44
+ // Export infrastructure components for advanced usage and testing
45
+ export { ModrinthApiClient, ModrinthMapper } from './infrastructure/index.js';
46
+ // Auto-register with factory
47
+ const adapter = new ModrinthAdapter();
48
+ ModSourceFactory.register(adapter);
49
+ // Export the registered instance
50
+ export { adapter as modrinthAdapter };
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,oDAAoD;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,kEAAkE;AAClE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAM9E,6BAA6B;AAC7B,MAAM,OAAO,GAAG,IAAI,eAAe,EAAE,CAAC;AACtC,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEnC,iCAAiC;AACjC,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * ModrinthApiClient - HTTP client for Modrinth API
3
+ *
4
+ * Single responsibility: Make HTTP requests to Modrinth API
5
+ * Returns raw API responses without transformation
6
+ *
7
+ * @see https://docs.modrinth.com/api-spec
8
+ */
9
+ import type { ModrinthProjectRaw, ModrinthSearchResultRaw, ModrinthVersionRaw, ModrinthTeamMemberRaw } from '../../types.js';
10
+ /**
11
+ * Search options for Modrinth API
12
+ */
13
+ export interface ModrinthSearchParams {
14
+ query: string;
15
+ limit?: number;
16
+ offset?: number;
17
+ index?: 'relevance' | 'downloads' | 'follows' | 'newest' | 'updated';
18
+ facets?: string[][];
19
+ }
20
+ /**
21
+ * Version filter options for Modrinth API
22
+ */
23
+ export interface ModrinthVersionParams {
24
+ loaders?: string[];
25
+ gameVersions?: string[];
26
+ featured?: boolean;
27
+ }
28
+ /**
29
+ * HTTP client for Modrinth API
30
+ *
31
+ * @example
32
+ * ```typescript
33
+ * const client = new ModrinthApiClient();
34
+ * const result = await client.search({ query: 'sodium' });
35
+ * const project = await client.getProject('sodium');
36
+ * ```
37
+ */
38
+ export declare class ModrinthApiClient {
39
+ private readonly baseUrl;
40
+ constructor(baseUrl?: string);
41
+ /**
42
+ * Search for projects
43
+ */
44
+ search(params: ModrinthSearchParams): Promise<ModrinthSearchResultRaw>;
45
+ /**
46
+ * Get project by slug or ID
47
+ */
48
+ getProject(slugOrId: string): Promise<ModrinthProjectRaw | null>;
49
+ /**
50
+ * Get project versions
51
+ */
52
+ getVersions(slugOrId: string, params?: ModrinthVersionParams): Promise<ModrinthVersionRaw[]>;
53
+ /**
54
+ * Get team members for a project
55
+ */
56
+ getTeamMembers(teamId: string): Promise<ModrinthTeamMemberRaw[]>;
57
+ /**
58
+ * Check if API is available
59
+ */
60
+ isAvailable(): Promise<boolean>;
61
+ }
62
+ //# sourceMappingURL=ModrinthApiClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthApiClient.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/api/ModrinthApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAIxB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACrE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,GAAE,MAAqB;IAI1C;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAqB5E;;OAEG;IACG,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IActE;;OAEG;IACG,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAwBlG;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC;IAUtE;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAQtC"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * ModrinthApiClient - HTTP client for Modrinth API
3
+ *
4
+ * Single responsibility: Make HTTP requests to Modrinth API
5
+ * Returns raw API responses without transformation
6
+ *
7
+ * @see https://docs.modrinth.com/api-spec
8
+ */
9
+ const MODRINTH_API = 'https://api.modrinth.com/v2';
10
+ /**
11
+ * HTTP client for Modrinth API
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const client = new ModrinthApiClient();
16
+ * const result = await client.search({ query: 'sodium' });
17
+ * const project = await client.getProject('sodium');
18
+ * ```
19
+ */
20
+ export class ModrinthApiClient {
21
+ baseUrl;
22
+ constructor(baseUrl = MODRINTH_API) {
23
+ this.baseUrl = baseUrl;
24
+ }
25
+ /**
26
+ * Search for projects
27
+ */
28
+ async search(params) {
29
+ const urlParams = new URLSearchParams({
30
+ query: params.query,
31
+ limit: String(params.limit ?? 10),
32
+ offset: String(params.offset ?? 0),
33
+ index: params.index ?? 'relevance',
34
+ });
35
+ if (params.facets && params.facets.length > 0) {
36
+ urlParams.set('facets', JSON.stringify(params.facets));
37
+ }
38
+ const response = await fetch(`${this.baseUrl}/search?${urlParams}`);
39
+ if (!response.ok) {
40
+ throw new Error(`Modrinth API error: ${response.status} ${response.statusText}`);
41
+ }
42
+ return response.json();
43
+ }
44
+ /**
45
+ * Get project by slug or ID
46
+ */
47
+ async getProject(slugOrId) {
48
+ const response = await fetch(`${this.baseUrl}/project/${slugOrId}`);
49
+ if (response.status === 404) {
50
+ return null;
51
+ }
52
+ if (!response.ok) {
53
+ throw new Error(`Modrinth API error: ${response.status} ${response.statusText}`);
54
+ }
55
+ return response.json();
56
+ }
57
+ /**
58
+ * Get project versions
59
+ */
60
+ async getVersions(slugOrId, params) {
61
+ const urlParams = new URLSearchParams();
62
+ if (params?.loaders?.length) {
63
+ urlParams.set('loaders', JSON.stringify(params.loaders));
64
+ }
65
+ if (params?.gameVersions?.length) {
66
+ urlParams.set('game_versions', JSON.stringify(params.gameVersions));
67
+ }
68
+ if (params?.featured !== undefined) {
69
+ urlParams.set('featured', String(params.featured));
70
+ }
71
+ const queryString = urlParams.toString();
72
+ const url = `${this.baseUrl}/project/${slugOrId}/version${queryString ? '?' + queryString : ''}`;
73
+ const response = await fetch(url);
74
+ if (!response.ok) {
75
+ throw new Error(`Modrinth API error: ${response.status} ${response.statusText}`);
76
+ }
77
+ return response.json();
78
+ }
79
+ /**
80
+ * Get team members for a project
81
+ */
82
+ async getTeamMembers(teamId) {
83
+ const response = await fetch(`${this.baseUrl}/team/${teamId}/members`);
84
+ if (!response.ok) {
85
+ return [];
86
+ }
87
+ return response.json();
88
+ }
89
+ /**
90
+ * Check if API is available
91
+ */
92
+ async isAvailable() {
93
+ try {
94
+ const response = await fetch(`${this.baseUrl}/`);
95
+ return response.ok;
96
+ }
97
+ catch {
98
+ return false;
99
+ }
100
+ }
101
+ }
102
+ //# sourceMappingURL=ModrinthApiClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthApiClient.js","sourceRoot":"","sources":["../../../src/infrastructure/api/ModrinthApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAsBnD;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IACX,OAAO,CAAS;IAEjC,YAAY,UAAkB,YAAY;QACxC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,MAA4B;QACvC,MAAM,SAAS,GAAG,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AEvE,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAsC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW;QACf,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;YACjD,OAAO,QAAQ,CAAC,EAAE,CAAC;QACrB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export { ModrinthApiClient } from './ModrinthApiClient.js';
2
+ export type { ModrinthSearchParams, ModrinthVersionParams } from './ModrinthApiClient.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,YAAY,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ModrinthApiClient } from './ModrinthApiClient.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Infrastructure Layer
3
+ *
4
+ * Contains adapters for external systems:
5
+ * - api/: HTTP clients for external APIs
6
+ * - mappers/: Data transformation between external and domain models
7
+ */
8
+ export * from './api/index.js';
9
+ export * from './mappers/index.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Infrastructure Layer
3
+ *
4
+ * Contains adapters for external systems:
5
+ * - api/: HTTP clients for external APIs
6
+ * - mappers/: Data transformation between external and domain models
7
+ */
8
+ export * from './api/index.js';
9
+ export * from './mappers/index.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/infrastructure/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * ModrinthMapper - Maps Modrinth API responses to domain models
3
+ *
4
+ * Single responsibility: Transform raw API types to domain models
5
+ * No HTTP calls, pure data transformation
6
+ */
7
+ import type { ModProject, ModVersion, ModFile, ModDependency, ModSearchResult } from '@minecraft-docker/shared';
8
+ import type { ModrinthProjectRaw, ModrinthSearchResultRaw, ModrinthSearchHitRaw, ModrinthVersionRaw, ModrinthFileRaw, ModrinthDependencyRaw, ModrinthTeamMemberRaw } from '../../types.js';
9
+ /**
10
+ * Mapper for transforming Modrinth API responses to domain models
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * const mapper = new ModrinthMapper();
15
+ * const domainProject = mapper.toProject(rawProject, 'AuthorName');
16
+ * const domainVersion = mapper.toVersion(rawVersion);
17
+ * ```
18
+ */
19
+ export declare class ModrinthMapper {
20
+ /**
21
+ * Map search result to domain model
22
+ */
23
+ toSearchResult(raw: ModrinthSearchResultRaw): ModSearchResult;
24
+ /**
25
+ * Map search hit to ModProject
26
+ */
27
+ searchHitToProject(hit: ModrinthSearchHitRaw): ModProject;
28
+ /**
29
+ * Map raw project to ModProject
30
+ */
31
+ toProject(raw: ModrinthProjectRaw, author: string): ModProject;
32
+ /**
33
+ * Map raw version to ModVersion
34
+ */
35
+ toVersion(raw: ModrinthVersionRaw): ModVersion;
36
+ /**
37
+ * Map raw file to ModFile
38
+ */
39
+ toFile(raw: ModrinthFileRaw): ModFile;
40
+ /**
41
+ * Map raw dependency to ModDependency
42
+ */
43
+ toDependency(raw: ModrinthDependencyRaw): ModDependency;
44
+ /**
45
+ * Extract author from team members
46
+ */
47
+ extractAuthor(members: ModrinthTeamMemberRaw[]): string;
48
+ /**
49
+ * Map Modrinth project type to domain type
50
+ */
51
+ private toProjectType;
52
+ }
53
+ //# sourceMappingURL=ModrinthMapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthMapper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/mappers/ModrinthMapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,aAAa,EAEb,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACtB,MAAM,gBAAgB,CAAC;AAOxB;;;;;;;;;GASG;AACH,qBAAa,cAAc;IACzB;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,uBAAuB,GAAG,eAAe;IAS7D;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,oBAAoB,GAAG,UAAU;IAkBzD;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU;IAkB9D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,kBAAkB,GAAG,UAAU;IAiB9C;;OAEG;IACH,MAAM,CAAC,GAAG,EAAE,eAAe,GAAG,OAAO;IAarC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,qBAAqB,GAAG,aAAa;IAQvD;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,qBAAqB,EAAE,GAAG,MAAM;IAQvD;;OAEG;IACH,OAAO,CAAC,aAAa;CAStB"}
@@ -0,0 +1,140 @@
1
+ /**
2
+ * ModrinthMapper - Maps Modrinth API responses to domain models
3
+ *
4
+ * Single responsibility: Transform raw API types to domain models
5
+ * No HTTP calls, pure data transformation
6
+ */
7
+ /**
8
+ * Source name constant for Modrinth
9
+ */
10
+ const SOURCE_NAME = 'modrinth';
11
+ /**
12
+ * Mapper for transforming Modrinth API responses to domain models
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const mapper = new ModrinthMapper();
17
+ * const domainProject = mapper.toProject(rawProject, 'AuthorName');
18
+ * const domainVersion = mapper.toVersion(rawVersion);
19
+ * ```
20
+ */
21
+ export class ModrinthMapper {
22
+ /**
23
+ * Map search result to domain model
24
+ */
25
+ toSearchResult(raw) {
26
+ return {
27
+ hits: raw.hits.map(hit => this.searchHitToProject(hit)),
28
+ totalHits: raw.total_hits,
29
+ offset: raw.offset,
30
+ limit: raw.limit,
31
+ };
32
+ }
33
+ /**
34
+ * Map search hit to ModProject
35
+ */
36
+ searchHitToProject(hit) {
37
+ return {
38
+ slug: hit.slug,
39
+ title: hit.title,
40
+ description: hit.description,
41
+ downloads: hit.downloads,
42
+ iconUrl: hit.icon_url,
43
+ serverSide: hit.server_side,
44
+ clientSide: hit.client_side,
45
+ projectType: this.toProjectType(hit.project_type),
46
+ categories: hit.categories,
47
+ author: hit.author,
48
+ license: hit.license,
49
+ sourceId: hit.project_id,
50
+ sourceName: SOURCE_NAME,
51
+ };
52
+ }
53
+ /**
54
+ * Map raw project to ModProject
55
+ */
56
+ toProject(raw, author) {
57
+ return {
58
+ slug: raw.slug,
59
+ title: raw.title,
60
+ description: raw.description,
61
+ downloads: raw.downloads,
62
+ iconUrl: raw.icon_url,
63
+ serverSide: raw.server_side,
64
+ clientSide: raw.client_side,
65
+ projectType: this.toProjectType(raw.project_type),
66
+ categories: raw.categories,
67
+ author,
68
+ license: raw.license.id,
69
+ sourceId: raw.id,
70
+ sourceName: SOURCE_NAME,
71
+ };
72
+ }
73
+ /**
74
+ * Map raw version to ModVersion
75
+ */
76
+ toVersion(raw) {
77
+ return {
78
+ id: raw.id,
79
+ projectId: raw.project_id,
80
+ name: raw.name,
81
+ versionNumber: raw.version_number,
82
+ versionType: raw.version_type,
83
+ gameVersions: raw.game_versions,
84
+ loaders: raw.loaders,
85
+ files: raw.files.map(f => this.toFile(f)),
86
+ dependencies: raw.dependencies.map(d => this.toDependency(d)),
87
+ downloads: raw.downloads,
88
+ datePublished: raw.date_published,
89
+ changelog: raw.changelog || undefined,
90
+ };
91
+ }
92
+ /**
93
+ * Map raw file to ModFile
94
+ */
95
+ toFile(raw) {
96
+ return {
97
+ url: raw.url,
98
+ filename: raw.filename,
99
+ size: raw.size,
100
+ hashes: {
101
+ sha1: raw.hashes.sha1,
102
+ sha512: raw.hashes.sha512,
103
+ },
104
+ primary: raw.primary,
105
+ };
106
+ }
107
+ /**
108
+ * Map raw dependency to ModDependency
109
+ */
110
+ toDependency(raw) {
111
+ return {
112
+ projectId: raw.project_id,
113
+ dependencyType: raw.dependency_type,
114
+ versionId: raw.version_id ?? undefined,
115
+ };
116
+ }
117
+ /**
118
+ * Extract author from team members
119
+ */
120
+ extractAuthor(members) {
121
+ if (members.length === 0) {
122
+ return 'Unknown';
123
+ }
124
+ const owner = members.find(m => m.role === 'Owner') ?? members[0];
125
+ return owner?.user?.username ?? 'Unknown';
126
+ }
127
+ /**
128
+ * Map Modrinth project type to domain type
129
+ */
130
+ toProjectType(type) {
131
+ const typeMap = {
132
+ mod: 'mod',
133
+ modpack: 'modpack',
134
+ resourcepack: 'resourcepack',
135
+ shader: 'shader',
136
+ };
137
+ return typeMap[type] ?? 'mod';
138
+ }
139
+ }
140
+ //# sourceMappingURL=ModrinthMapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModrinthMapper.js","sourceRoot":"","sources":["../../../src/infrastructure/mappers/Modrin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AM,CAAC,IAAI;gBACrB,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,MAAM;aAC1B;YACD,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,GAA0B;QACrC,OAAO;YACL,SAAS,EAAE,GAAG,CAAC,UAAU;YACzB,cAAc,EAAE,GAAG,CAAC,eAAe;YACnC,SAAS,EAAE,GAAG,CAAC,UAAU,IAAI,SAAS;SACvC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAgC;QAC5C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QAClE,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,SAAS,CAAC;IAC5C,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,IAAY;QAChC,MAAM,OAAO,GAAmC;YAC9C,GAAG,EAAE,KAAK;YACV,OAAO,EAAE,SAAS;YAClB,YAAY,EAAE,cAAc;YAC5B,MAAM,EAAE,QAAQ;SACjB,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC;IAChC,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export { ModrinthMapper } from './ModrinthMapper.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { ModrinthMapper } from './ModrinthMapper.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/infrastructure/mappers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Modrinth API Raw Types
3
+ * Types matching the Modrinth API responses
4
+ * https://docs.modrinth.com/api-spec
5
+ */
6
+ /**
7
+ * Raw project from Modrinth API
8
+ */
9
+ export interface ModrinthProjectRaw {
10
+ slug: string;
11
+ title: string;
12
+ description: string;
13
+ categories: string[];
14
+ client_side: 'required' | 'optional' | 'unsupported';
15
+ server_side: 'required' | 'optional' | 'unsupported';
16
+ project_type: 'mod' | 'modpack' | 'resourcepack' | 'shader';
17
+ downloads: number;
18
+ icon_url: string | null;
19
+ id: string;
20
+ team: string;
21
+ versions: string[];
22
+ follows: number;
23
+ date_created: string;
24
+ date_modified: string;
25
+ license: {
26
+ id: string;
27
+ name: string;
28
+ url: string | null;
29
+ };
30
+ gallery: Array<{
31
+ url: string;
32
+ featured: boolean;
33
+ title: string | null;
34
+ description: string | null;
35
+ created: string;
36
+ ordering: number;
37
+ }>;
38
+ }
39
+ /**
40
+ * Raw search result from Modrinth API
41
+ */
42
+ export interface ModrinthSearchResultRaw {
43
+ hits: ModrinthSearchHitRaw[];
44
+ offset: number;
45
+ limit: number;
46
+ total_hits: number;
47
+ }
48
+ /**
49
+ * Raw search hit from Modrinth API
50
+ */
51
+ export interface ModrinthSearchHitRaw {
52
+ slug: string;
53
+ title: string;
54
+ description: string;
55
+ categories: string[];
56
+ client_side: 'required' | 'optional' | 'unsupported';
57
+ server_side: 'required' | 'optional' | 'unsupported';
58
+ project_type: 'mod' | 'modpack' | 'resourcepack' | 'shader';
59
+ downloads: number;
60
+ icon_url: string | null;
61
+ project_id: string;
62
+ author: string;
63
+ versions: string[];
64
+ follows: number;
65
+ date_created: string;
66
+ date_modified: string;
67
+ license: string;
68
+ gallery: string[];
69
+ }
70
+ /**
71
+ * Raw version from Modrinth API
72
+ */
73
+ export interface ModrinthVersionRaw {
74
+ id: string;
75
+ project_id: string;
76
+ author_id: string;
77
+ name: string;
78
+ version_number: string;
79
+ changelog: string;
80
+ date_published: string;
81
+ downloads: number;
82
+ version_type: 'release' | 'beta' | 'alpha';
83
+ files: ModrinthFileRaw[];
84
+ dependencies: ModrinthDependencyRaw[];
85
+ game_versions: string[];
86
+ loaders: string[];
87
+ featured: boolean;
88
+ }
89
+ /**
90
+ * Raw file from Modrinth API
91
+ */
92
+ export interface ModrinthFileRaw {
93
+ hashes: {
94
+ sha1: string;
95
+ sha512: string;
96
+ };
97
+ url: string;
98
+ filename: string;
99
+ primary: boolean;
100
+ size: number;
101
+ }
102
+ /**
103
+ * Raw dependency from Modrinth API
104
+ */
105
+ export interface ModrinthDependencyRaw {
106
+ version_id: string | null;
107
+ project_id: string;
108
+ file_name: string | null;
109
+ dependency_type: 'required' | 'optional' | 'incompatible' | 'embedded';
110
+ }
111
+ /**
112
+ * Team member from Modrinth API (for author lookup)
113
+ */
114
+ export interface ModrinthTeamMemberRaw {
115
+ team_id: string;
116
+ user: {
117
+ id: string;
118
+ username: string;
119
+ name: string | null;
120
+ avatar_url: string | null;
121
+ };
122
+ role: string;
123
+ accepted: boolean;
124
+ ordering: number;
125
+ }
126
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IACrD,WAAW,EAAE,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IACrD,YAAY,EAAE,KAAK,GAAG,SAA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GAAG,UAAU,GAAG,cAAc,GAAG,UAAU,CAAC;CACxE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Modrinth API Raw Types
3
+ * Types matching the Modrinth API responses
4
+ * https://docs.modrinth.com/api-spec
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@minecraft-docker/mod-source-modrinth",
3
+ "version": "1.0.0",
4
+ "description": "Modrinth adapter for minecraft-docker mod source system",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "scripts": {
21
+ "build": "tsc",
22
+ "clean": "rm -rf dist",
23
+ "prepublishOnly": "pnpm build"
24
+ },
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ },
28
+ "dependencies": {
29
+ "@minecraft-docker/shared": "^1.6.3"
30
+ },
31
+ "devDependencies": {
32
+ "@types/node": "^20.10.0",
33
+ "typescript": "^5.3.0"
34
+ },
35
+ "keywords": [
36
+ "minecraft",
37
+ "modrinth",
38
+ "mods",
39
+ "plugins"
40
+ ],
41
+ "author": "smallmiro",
42
+ "license": "MIT",
43
+ "repository": {
44
+ "type": "git",
45
+ "url": "https://github.com/smallmiro/minecraft-server-manager.git",
46
+ "directory": "platform/services/mod-source-modrinth"
47
+ },
48
+ "homepage": "https://minecraft-server-manager.readthedocs.io/"
49
+ }