@mcp-gen-ui/adapters 0.2.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.
- package/LICENSE +202 -0
- package/README.md +40 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +458 -0
- package/dist/index.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @mcp-gen-ui/adapters
|
|
2
|
+
|
|
3
|
+
Composable `BenefitRepository` adapters for bringing public Korean benefit data
|
|
4
|
+
into the gateway without changing MCP tool contracts.
|
|
5
|
+
|
|
6
|
+
## Exports
|
|
7
|
+
|
|
8
|
+
- `CompositeBenefitRepository` — fan-in over multiple repositories with stable
|
|
9
|
+
deduplication by source URL/id.
|
|
10
|
+
- `CachingBenefitRepository` — TTL cache wrapper for on-demand repository reads.
|
|
11
|
+
- `YouthCenterRepository` — live adapter for the 온통청년 / 한국고용정보원 청년정책
|
|
12
|
+
API (data.go.kr dataset 15143273).
|
|
13
|
+
- `BokjiroRepository` — live adapter for 복지로 / 한국사회보장정보원 public welfare services.
|
|
14
|
+
- `SubsidyRepository` — live adapter for 보조금24-style government subsidy service lists.
|
|
15
|
+
|
|
16
|
+
## Live repositories
|
|
17
|
+
|
|
18
|
+
API keys are supplied at runtime only:
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import {
|
|
22
|
+
BokjiroRepository,
|
|
23
|
+
CompositeBenefitRepository,
|
|
24
|
+
SubsidyRepository,
|
|
25
|
+
YouthCenterRepository
|
|
26
|
+
} from "@mcp-gen-ui/adapters";
|
|
27
|
+
|
|
28
|
+
const repository = new CompositeBenefitRepository([
|
|
29
|
+
new YouthCenterRepository({ apiKey: process.env.YOUTH_CENTER_API_KEY }),
|
|
30
|
+
new BokjiroRepository({ apiKey: process.env.BOKJIRO_API_KEY }),
|
|
31
|
+
new SubsidyRepository({ apiKey: process.env.SUBSIDY24_API_KEY })
|
|
32
|
+
]);
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If no key is supplied, or the live API call fails, each repository returns an
|
|
36
|
+
empty result set and emits a warning through the configured logger. Tests use
|
|
37
|
+
recorded fixtures and do not require live keys. Adapters normalize public policy
|
|
38
|
+
fields only (title, provider, public URLs, eligibility text, application periods,
|
|
39
|
+
regions, age bands, household hints, categories, and deadlines); they do not
|
|
40
|
+
persist keys or personal identifiers.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type BenefitRepository } from "@mcp-gen-ui/core";
|
|
2
|
+
import { type BenefitRecord } from "@mcp-gen-ui/schema";
|
|
3
|
+
export interface CompositeBenefitRepositoryOptions {
|
|
4
|
+
warn?: (message: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare class CompositeBenefitRepository implements BenefitRepository {
|
|
7
|
+
private readonly repositories;
|
|
8
|
+
private readonly options;
|
|
9
|
+
constructor(repositories: BenefitRepository[], options?: CompositeBenefitRepositoryOptions);
|
|
10
|
+
search(): Promise<BenefitRecord[]>;
|
|
11
|
+
getById(id: string): Promise<BenefitRecord | undefined>;
|
|
12
|
+
}
|
|
13
|
+
export interface CachingBenefitRepositoryOptions {
|
|
14
|
+
ttlMs: number;
|
|
15
|
+
now?: () => number;
|
|
16
|
+
}
|
|
17
|
+
export declare class CachingBenefitRepository implements BenefitRepository {
|
|
18
|
+
private readonly repository;
|
|
19
|
+
private readonly options;
|
|
20
|
+
private searchCache?;
|
|
21
|
+
private readonly now;
|
|
22
|
+
constructor(repository: BenefitRepository, options: CachingBenefitRepositoryOptions);
|
|
23
|
+
search(): Promise<BenefitRecord[]>;
|
|
24
|
+
getById(id: string): Promise<BenefitRecord | undefined>;
|
|
25
|
+
}
|
|
26
|
+
interface PublicBenefitRepositoryOptions {
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
endpoint?: string;
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
fetch?: typeof fetch;
|
|
31
|
+
now?: () => Date;
|
|
32
|
+
logger?: {
|
|
33
|
+
warn: (message: string) => void;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export interface YouthCenterRepositoryOptions extends PublicBenefitRepositoryOptions {
|
|
37
|
+
}
|
|
38
|
+
export interface BokjiroRepositoryOptions extends PublicBenefitRepositoryOptions {
|
|
39
|
+
}
|
|
40
|
+
export interface SubsidyRepositoryOptions extends PublicBenefitRepositoryOptions {
|
|
41
|
+
}
|
|
42
|
+
type AdapterSource = "youth-center" | "bokjiro" | "subsidy24";
|
|
43
|
+
interface AdapterConfig {
|
|
44
|
+
source: AdapterSource;
|
|
45
|
+
envName: string;
|
|
46
|
+
defaultEndpoint: string;
|
|
47
|
+
sourceLabel: string;
|
|
48
|
+
defaultProvider: string;
|
|
49
|
+
queryParams: (apiKey: string, pageSize: number) => Record<string, string>;
|
|
50
|
+
}
|
|
51
|
+
declare abstract class PublicBenefitApiRepository implements BenefitRepository {
|
|
52
|
+
private readonly config;
|
|
53
|
+
private readonly apiKey?;
|
|
54
|
+
private readonly endpoint;
|
|
55
|
+
private readonly pageSize;
|
|
56
|
+
private readonly fetchImpl;
|
|
57
|
+
private readonly now;
|
|
58
|
+
private readonly logger;
|
|
59
|
+
protected constructor(config: AdapterConfig, options?: PublicBenefitRepositoryOptions);
|
|
60
|
+
search(): Promise<BenefitRecord[]>;
|
|
61
|
+
getById(id: string): Promise<BenefitRecord | undefined>;
|
|
62
|
+
private toBenefitRecord;
|
|
63
|
+
}
|
|
64
|
+
export declare class YouthCenterRepository extends PublicBenefitApiRepository {
|
|
65
|
+
constructor(options?: YouthCenterRepositoryOptions);
|
|
66
|
+
}
|
|
67
|
+
export declare class BokjiroRepository extends PublicBenefitApiRepository {
|
|
68
|
+
constructor(options?: BokjiroRepositoryOptions);
|
|
69
|
+
}
|
|
70
|
+
export declare class SubsidyRepository extends PublicBenefitApiRepository {
|
|
71
|
+
constructor(options?: SubsidyRepositoryOptions);
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
74
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EAIL,KAAK,aAAa,EAGnB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,qBAAa,0BAA2B,YAAW,iBAAiB;IAEhE,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,YAAY,EAAE,iBAAiB,EAAE,EACjC,OAAO,GAAE,iCAAsC;IAG5D,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IAelC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAM9D;AAED,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAED,qBAAa,wBAAyB,YAAW,iBAAiB;IAK9D,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAL1B,O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C,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAa;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAE7D,SAAS,aACU,MAAM,EAAE,aAAa,EACtC,OAAO,GAAE,8BAAmC;IAUxC,MAAM,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IA4BlC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAI7D,OAAO,CAAC,eAAe;CAkFxB;AAED,qBAAa,qBAAsB,SAAQ,0BAA0B;gBACvD,OAAO,GAAE,4BAAiC;CAGvD;AAED,qBAAa,iBAAkB,SAAQ,0BAA0B;gBACnD,OAAO,GAAE,wBAA6B;CAGnD;AAED,qBAAa,iBAAkB,SAAQ,0BAA0B;gBACnD,OAAO,GAAE,wBAA6B;CAGnD"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
import { kstDeadlineToUtc } from "@mcp-gen-ui/core";
|
|
2
|
+
import { BenefitRecordSchema } from "@mcp-gen-ui/schema";
|
|
3
|
+
export class CompositeBenefitRepository {
|
|
4
|
+
repositories;
|
|
5
|
+
options;
|
|
6
|
+
constructor(repositories, options = {}) {
|
|
7
|
+
this.repositories = repositories;
|
|
8
|
+
this.options = options;
|
|
9
|
+
}
|
|
10
|
+
async search() {
|
|
11
|
+
const deduped = new Map();
|
|
12
|
+
for (const repository of this.repositories) {
|
|
13
|
+
try {
|
|
14
|
+
for (const record of await repository.search()) {
|
|
15
|
+
const key = dedupeKey(record);
|
|
16
|
+
if (!deduped.has(key))
|
|
17
|
+
deduped.set(key, record);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
this.options.warn?.(`Benefit repository failed during search: ${messageFrom(error)}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return [...deduped.values()];
|
|
25
|
+
}
|
|
26
|
+
async getById(id) {
|
|
27
|
+
for (const record of await this.search()) {
|
|
28
|
+
if (record.id === id)
|
|
29
|
+
return record;
|
|
30
|
+
}
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export class CachingBenefitRepository {
|
|
35
|
+
repository;
|
|
36
|
+
options;
|
|
37
|
+
searchCache;
|
|
38
|
+
now;
|
|
39
|
+
constructor(repository, options) {
|
|
40
|
+
this.repository = repository;
|
|
41
|
+
this.options = options;
|
|
42
|
+
this.now = options.now ?? Date.now;
|
|
43
|
+
}
|
|
44
|
+
async search() {
|
|
45
|
+
const current = this.now();
|
|
46
|
+
if (this.searchCache && this.searchCache.expiresAt > current) {
|
|
47
|
+
return this.searchCache.records;
|
|
48
|
+
}
|
|
49
|
+
const records = await this.repository.search();
|
|
50
|
+
this.searchCache = { records, expiresAt: current + this.options.ttlMs };
|
|
51
|
+
return records;
|
|
52
|
+
}
|
|
53
|
+
async getById(id) {
|
|
54
|
+
return (await this.search()).find((record) => record.id === id);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const YOUTH_CENTER_CONFIG = {
|
|
58
|
+
source: "youth-center",
|
|
59
|
+
envName: "YOUTH_CENTER_API_KEY",
|
|
60
|
+
defaultEndpoint: "https://apis.data.go.kr/1051000/youthPlcyList/getYouthPlcyList",
|
|
61
|
+
sourceLabel: "YouthCenter",
|
|
62
|
+
defaultProvider: "한국고용정보원",
|
|
63
|
+
queryParams: (apiKey, pageSize) => ({
|
|
64
|
+
serviceKey: apiKey,
|
|
65
|
+
pageNo: "1",
|
|
66
|
+
numOfRows: String(pageSize),
|
|
67
|
+
type: "json"
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
const BOKJIRO_CONFIG = {
|
|
71
|
+
source: "bokjiro",
|
|
72
|
+
envName: "BOKJIRO_API_KEY",
|
|
73
|
+
defaultEndpoint: "https://apis.data.go.kr/B554287/NationalWelfareInformationsV001/NationalWelfarelistV001",
|
|
74
|
+
sourceLabel: "Bokjiro",
|
|
75
|
+
defaultProvider: "한국사회보장정보원",
|
|
76
|
+
queryParams: (apiKey, pageSize) => ({
|
|
77
|
+
serviceKey: apiKey,
|
|
78
|
+
pageNo: "1",
|
|
79
|
+
numOfRows: String(pageSize),
|
|
80
|
+
resultType: "json"
|
|
81
|
+
})
|
|
82
|
+
};
|
|
83
|
+
const SUBSIDY_CONFIG = {
|
|
84
|
+
source: "subsidy24",
|
|
85
|
+
envName: "SUBSIDY24_API_KEY",
|
|
86
|
+
defaultEndpoint: "https://apis.data.go.kr/1741000/gov24SubsidyList/getGov24SubsidyList",
|
|
87
|
+
sourceLabel: "Subsidy24",
|
|
88
|
+
defaultProvider: "행정안전부",
|
|
89
|
+
queryParams: (apiKey, pageSize) => ({
|
|
90
|
+
serviceKey: apiKey,
|
|
91
|
+
pageNo: "1",
|
|
92
|
+
numOfRows: String(pageSize),
|
|
93
|
+
type: "json"
|
|
94
|
+
})
|
|
95
|
+
};
|
|
96
|
+
class PublicBenefitApiRepository {
|
|
97
|
+
config;
|
|
98
|
+
apiKey;
|
|
99
|
+
endpoint;
|
|
100
|
+
pageSize;
|
|
101
|
+
fetchImpl;
|
|
102
|
+
now;
|
|
103
|
+
logger;
|
|
104
|
+
constructor(config, options = {}) {
|
|
105
|
+
this.config = config;
|
|
106
|
+
this.apiKey = options.apiKey ?? process.env[config.envName];
|
|
107
|
+
this.endpoint = options.endpoint ?? config.defaultEndpoint;
|
|
108
|
+
this.pageSize = options.pageSize ?? 100;
|
|
109
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch;
|
|
110
|
+
this.now = options.now ?? (() => new Date());
|
|
111
|
+
this.logger = options.logger ?? console;
|
|
112
|
+
}
|
|
113
|
+
async search() {
|
|
114
|
+
if (!this.apiKey) {
|
|
115
|
+
this.logger.warn(`${this.config.envName} is not configured; returning no ${this.config.sourceLabel} benefits.`);
|
|
116
|
+
return [];
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
const url = new URL(this.endpoint);
|
|
120
|
+
for (const [key, value] of Object.entries(this.config.queryParams(this.apiKey, this.pageSize))) {
|
|
121
|
+
url.searchParams.set(key, value);
|
|
122
|
+
}
|
|
123
|
+
const response = await this.fetchImpl(url);
|
|
124
|
+
if (!response.ok) {
|
|
125
|
+
this.logger.warn(`${this.config.sourceLabel} API request failed with HTTP ${response.status}.`);
|
|
126
|
+
return [];
|
|
127
|
+
}
|
|
128
|
+
const payload = (await response.json());
|
|
129
|
+
return extractBenefitItems(payload)
|
|
130
|
+
.map((item) => this.toBenefitRecord(item))
|
|
131
|
+
.filter((record) => record !== undefined);
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
this.logger.warn(`${this.config.sourceLabel} API request failed: ${messageFrom(error)}`);
|
|
135
|
+
return [];
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async getById(id) {
|
|
139
|
+
return (await this.search()).find((record) => record.id === id);
|
|
140
|
+
}
|
|
141
|
+
toBenefitRecord(item) {
|
|
142
|
+
const sourceId = firstText(item, [
|
|
143
|
+
"plcyNo",
|
|
144
|
+
"policyNo",
|
|
145
|
+
"bizId",
|
|
146
|
+
"id",
|
|
147
|
+
"servId",
|
|
148
|
+
"serviceId",
|
|
149
|
+
"svcId",
|
|
150
|
+
"wlfareInfoId",
|
|
151
|
+
"bizSeCd"
|
|
152
|
+
]);
|
|
153
|
+
const title = firstText(item, [
|
|
154
|
+
"plcyNm",
|
|
155
|
+
"policyName",
|
|
156
|
+
"title",
|
|
157
|
+
"servNm",
|
|
158
|
+
"serviceName",
|
|
159
|
+
"svcNm",
|
|
160
|
+
"wlfareInfoNm",
|
|
161
|
+
"serviceNm",
|
|
162
|
+
"jrsdDptAlltNm"
|
|
163
|
+
]);
|
|
164
|
+
if (!sourceId || !title)
|
|
165
|
+
return undefined;
|
|
166
|
+
const provider = firstText(item, [
|
|
167
|
+
"sprvsnInstCdNm",
|
|
168
|
+
"operInstCdNm",
|
|
169
|
+
"provider",
|
|
170
|
+
"insttNm",
|
|
171
|
+
"jurMnofNm",
|
|
172
|
+
"jrsdDptNm",
|
|
173
|
+
"inqOrgNm",
|
|
174
|
+
"orgNm",
|
|
175
|
+
"serviceProvider"
|
|
176
|
+
]) ?? this.config.defaultProvider;
|
|
177
|
+
const summary = firstText(item, ["plcyExplnCn", "sprtCn", "summary", "plcyCn", "servDgst", "svcPpo", "servicePurpose", "wlfareInfoReldCn"]) ?? title;
|
|
178
|
+
const target = firstText(item, ["sprtTrgtCn", "target", "ageInfo", "earnEtcCn", "trgterIndvdl", "slctCritCn", "supportTarget", "svcPpo"]) ?? "공공서비스 대상자";
|
|
179
|
+
const sourceUrl = normalizeUrl(firstText(item, ["refUrlAddr1", "refUrlAddr2", "sourceUrl", "plcyUrlAddr", "servDtlLink", "serviceUrl", "dtlUrl", "onlineUrl"]), fallbackSourceUrl(this.config.source, sourceId));
|
|
180
|
+
const applicationUrl = normalizeUrl(firstText(item, ["aplyUrlAddr", "applicationUrl", "onlineUrl", "svcUrl", "servDtlLink"]));
|
|
181
|
+
const parsed = BenefitRecordSchema.safeParse({
|
|
182
|
+
id: `${this.config.source}:${sourceId}`,
|
|
183
|
+
title,
|
|
184
|
+
provider,
|
|
185
|
+
category: deriveCategory(item),
|
|
186
|
+
summary,
|
|
187
|
+
target,
|
|
188
|
+
eligibility: splitList(firstText(item, ["sprtTrgtCn", "earnEtcCn", "ageInfo", "trgterIndvdl", "slctCritCn", "supportTarget"])),
|
|
189
|
+
applicationPeriod: firstText(item, ["aplyYmd", "aplyPrd", "applicationPeriod", "reqstBeginEndDe", "svcAvailPrd", "applicationDueDate"]),
|
|
190
|
+
applicationDeadline: deriveApplicationDeadline(item),
|
|
191
|
+
documents: splitList(firstText(item, ["sbmsnDcmntCn", "documents", "requiredDocuments", " 구비서류", "pprsUpdtCn"])).map((label, index) => ({
|
|
192
|
+
id: `document-${index + 1}`,
|
|
193
|
+
label,
|
|
194
|
+
required: true,
|
|
195
|
+
source: this.config.source
|
|
196
|
+
})),
|
|
197
|
+
applicationMethods: splitList(firstText(item, ["aplyMthdCn", "applicationMethods", "reqstMthPapers", "serviceUseMethod", "svcUseMthd"])),
|
|
198
|
+
applicationUrl,
|
|
199
|
+
sourceUrl,
|
|
200
|
+
lastFetchedAt: this.now().toISOString(),
|
|
201
|
+
evidence: [],
|
|
202
|
+
searchableText: [summary, target, firstText(item, ["plcyKywdNm", "keywords", "svcPpo", "servDgst"]), provider]
|
|
203
|
+
.filter(Boolean)
|
|
204
|
+
.join(" "),
|
|
205
|
+
regionTags: deriveRegions(item),
|
|
206
|
+
ageRanges: deriveAgeRanges(item),
|
|
207
|
+
householdTypes: deriveHouseholdTypes(item),
|
|
208
|
+
studentOnly: containsAny(item, ["대학생", "재학생", "학생", "장학"]),
|
|
209
|
+
employmentStatuses: deriveEmploymentStatuses(item)
|
|
210
|
+
});
|
|
211
|
+
if (!parsed.success) {
|
|
212
|
+
this.logger.warn(`${this.config.sourceLabel} policy ${sourceId} did not match BenefitRecordSchema.`);
|
|
213
|
+
return undefined;
|
|
214
|
+
}
|
|
215
|
+
return parsed.data;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
export class YouthCenterRepository extends PublicBenefitApiRepository {
|
|
219
|
+
constructor(options = {}) {
|
|
220
|
+
super(YOUTH_CENTER_CONFIG, options);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
export class BokjiroRepository extends PublicBenefitApiRepository {
|
|
224
|
+
constructor(options = {}) {
|
|
225
|
+
super(BOKJIRO_CONFIG, options);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export class SubsidyRepository extends PublicBenefitApiRepository {
|
|
229
|
+
constructor(options = {}) {
|
|
230
|
+
super(SUBSIDY_CONFIG, options);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
function dedupeKey(record) {
|
|
234
|
+
return `${record.sourceUrl || "no-source"}::${record.id}`.split("::")[0] || record.id;
|
|
235
|
+
}
|
|
236
|
+
function extractBenefitItems(payload) {
|
|
237
|
+
if (!payload || typeof payload !== "object")
|
|
238
|
+
return [];
|
|
239
|
+
const root = payload;
|
|
240
|
+
const directKeys = [
|
|
241
|
+
"youthPolicyList",
|
|
242
|
+
"youthPlcyList",
|
|
243
|
+
"servList",
|
|
244
|
+
"serviceList",
|
|
245
|
+
"wlfareInfoList",
|
|
246
|
+
"subsidyList",
|
|
247
|
+
"items",
|
|
248
|
+
"item",
|
|
249
|
+
"data",
|
|
250
|
+
"list"
|
|
251
|
+
];
|
|
252
|
+
const stack = [root.result, root.response, root.body, root];
|
|
253
|
+
const seen = new Set();
|
|
254
|
+
while (stack.length > 0) {
|
|
255
|
+
const candidate = stack.shift();
|
|
256
|
+
if (!candidate || typeof candidate !== "object" || seen.has(candidate))
|
|
257
|
+
continue;
|
|
258
|
+
seen.add(candidate);
|
|
259
|
+
if (Array.isArray(candidate)) {
|
|
260
|
+
const records = candidate.filter(isRecord);
|
|
261
|
+
if (records.length > 0)
|
|
262
|
+
return records;
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
const record = candidate;
|
|
266
|
+
for (const key of directKeys) {
|
|
267
|
+
const value = record[key];
|
|
268
|
+
if (Array.isArray(value))
|
|
269
|
+
return value.filter(isRecord);
|
|
270
|
+
if (isRecord(value)) {
|
|
271
|
+
const nested = directKeys.map((nestedKey) => value[nestedKey]).find((nestedValue) => Array.isArray(nestedValue));
|
|
272
|
+
if (Array.isArray(nested))
|
|
273
|
+
return nested.filter(isRecord);
|
|
274
|
+
stack.push(value);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
stack.push(...Object.values(record).filter((value) => value && typeof value === "object"));
|
|
278
|
+
}
|
|
279
|
+
return [];
|
|
280
|
+
}
|
|
281
|
+
function firstText(item, keys) {
|
|
282
|
+
for (const key of keys) {
|
|
283
|
+
const value = item[key];
|
|
284
|
+
if (typeof value === "string" && value.trim())
|
|
285
|
+
return value.trim();
|
|
286
|
+
if (typeof value === "number")
|
|
287
|
+
return String(value);
|
|
288
|
+
}
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
function splitList(value) {
|
|
292
|
+
if (!value)
|
|
293
|
+
return [];
|
|
294
|
+
return value
|
|
295
|
+
.split(/[,;\n·ㆍ]|<br\s*\/?\s*>/i)
|
|
296
|
+
.map((entry) => entry.replace(/^[-*]\s*/, "").trim())
|
|
297
|
+
.filter(Boolean);
|
|
298
|
+
}
|
|
299
|
+
function normalizeUrl(value, fallback) {
|
|
300
|
+
const candidate = value?.startsWith("http") ? value : fallback;
|
|
301
|
+
if (!candidate)
|
|
302
|
+
return undefined;
|
|
303
|
+
try {
|
|
304
|
+
return new URL(candidate).toString();
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return fallback;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
function fallbackSourceUrl(source, id) {
|
|
311
|
+
if (source === "youth-center") {
|
|
312
|
+
return `https://www.youthcenter.go.kr/youngPlcyUnif/youngPlcyUnifDtl.do?bizId=${encodeURIComponent(id)}`;
|
|
313
|
+
}
|
|
314
|
+
if (source === "bokjiro") {
|
|
315
|
+
return `https://www.bokjiro.go.kr/ssis-tbu/twataa/wlfareInfo/moveTWAT52011M.do?wlfareInfoId=${encodeURIComponent(id)}`;
|
|
316
|
+
}
|
|
317
|
+
return `https://www.gov.kr/portal/rcvfvrSvc/dtlEx/${encodeURIComponent(id)}`;
|
|
318
|
+
}
|
|
319
|
+
function deriveRegions(item) {
|
|
320
|
+
const text = joinedText(item, [
|
|
321
|
+
"zipCd",
|
|
322
|
+
"region",
|
|
323
|
+
"rgonNm",
|
|
324
|
+
"sprvsnInstCdNm",
|
|
325
|
+
"plcyExplnCn",
|
|
326
|
+
"servDgst",
|
|
327
|
+
"svcPpo",
|
|
328
|
+
"jurMnofNm",
|
|
329
|
+
"jrsdDptNm",
|
|
330
|
+
"addr",
|
|
331
|
+
"localArea"
|
|
332
|
+
]);
|
|
333
|
+
const regions = ["서울", "부산", "대구", "인천", "광주", "대전", "울산", "세종", "경기", "강원", "충북", "충남", "전북", "전남", "경북", "경남", "제주"];
|
|
334
|
+
return regions.filter((region) => text.includes(region));
|
|
335
|
+
}
|
|
336
|
+
function deriveAgeRanges(item) {
|
|
337
|
+
const min = Number(firstText(item, ["sprtTrgtMinAge", "minAge", "ageMin", "trgterAgeBegin"]));
|
|
338
|
+
const max = Number(firstText(item, ["sprtTrgtMaxAge", "maxAge", "ageMax", "trgterAgeEnd"]));
|
|
339
|
+
const ranges = [
|
|
340
|
+
["teen", 13, 19],
|
|
341
|
+
["twenties", 20, 29],
|
|
342
|
+
["thirties", 30, 39],
|
|
343
|
+
["forties", 40, 49],
|
|
344
|
+
["fifties", 50, 59],
|
|
345
|
+
["sixties_plus", 60, 200]
|
|
346
|
+
];
|
|
347
|
+
if (Number.isFinite(min) && Number.isFinite(max)) {
|
|
348
|
+
return ranges
|
|
349
|
+
.filter(([range, start, end]) => {
|
|
350
|
+
if (range === "teen" && min >= 19)
|
|
351
|
+
return false;
|
|
352
|
+
return min <= end && max >= start;
|
|
353
|
+
})
|
|
354
|
+
.map(([range]) => range);
|
|
355
|
+
}
|
|
356
|
+
const text = joinedText(item, ["ageInfo", "sprtTrgtCn", "plcyExplnCn", "trgterIndvdl", "slctCritCn", "servDgst", "svcPpo"]);
|
|
357
|
+
const ages = new Set();
|
|
358
|
+
for (const [range, start] of ranges) {
|
|
359
|
+
if (text.includes(`${Math.floor(start / 10) * 10}대`))
|
|
360
|
+
ages.add(range);
|
|
361
|
+
}
|
|
362
|
+
for (const match of text.matchAll(/(?:만\s*)?(\d{1,3})\s*세/g)) {
|
|
363
|
+
const age = Number(match[1]);
|
|
364
|
+
const range = ranges.find(([, start, end]) => age >= start && age <= end)?.[0];
|
|
365
|
+
if (range && !(range === "teen" && age >= 19))
|
|
366
|
+
ages.add(range);
|
|
367
|
+
}
|
|
368
|
+
if (text.includes("노인") || text.includes("어르신") || text.includes("고령"))
|
|
369
|
+
ages.add("sixties_plus");
|
|
370
|
+
if (text.includes("청년")) {
|
|
371
|
+
ages.add("twenties");
|
|
372
|
+
ages.add("thirties");
|
|
373
|
+
}
|
|
374
|
+
return [...ages];
|
|
375
|
+
}
|
|
376
|
+
function deriveHouseholdTypes(item) {
|
|
377
|
+
const text = joinedText(item, ["earnEtcCn", "sprtTrgtCn", "plcyExplnCn", "trgterIndvdl", "slctCritCn", "supportTarget", "servDgst", "svcPpo"]);
|
|
378
|
+
const types = [];
|
|
379
|
+
if (text.includes("1인") || text.includes("단독"))
|
|
380
|
+
types.push("single");
|
|
381
|
+
if (text.includes("부부") || text.includes("신혼"))
|
|
382
|
+
types.push("couple");
|
|
383
|
+
if (text.includes("가족") || text.includes("가구") || text.includes("아동") || text.includes("양육"))
|
|
384
|
+
types.push("family");
|
|
385
|
+
if (text.includes("한부모"))
|
|
386
|
+
types.push("single_parent");
|
|
387
|
+
return [...new Set(types)];
|
|
388
|
+
}
|
|
389
|
+
function deriveEmploymentStatuses(item) {
|
|
390
|
+
const text = joinedText(item, ["plcyKywdNm", "sprtTrgtCn", "plcyExplnCn", "earnEtcCn", "trgterIndvdl", "slctCritCn", "supportTarget", "servDgst", "svcPpo"]);
|
|
391
|
+
const statuses = [];
|
|
392
|
+
if (text.includes("미취업") || text.includes("구직") || text.includes("실업") || text.includes("실직"))
|
|
393
|
+
statuses.push("unemployed");
|
|
394
|
+
if (text.includes("재직") || text.includes("근로") || text.includes("취업자") || text.includes("직장"))
|
|
395
|
+
statuses.push("employed");
|
|
396
|
+
if (text.includes("창업") || text.includes("자영") || text.includes("소상공"))
|
|
397
|
+
statuses.push("self_employed");
|
|
398
|
+
return [...new Set(statuses)];
|
|
399
|
+
}
|
|
400
|
+
function deriveApplicationDeadline(item) {
|
|
401
|
+
const raw = firstText(item, [
|
|
402
|
+
"aplyYmd",
|
|
403
|
+
"aplyPrd",
|
|
404
|
+
"applicationPeriod",
|
|
405
|
+
"applicationDeadline",
|
|
406
|
+
"reqstBeginEndDe",
|
|
407
|
+
"svcAvailPrd",
|
|
408
|
+
"applicationDueDate",
|
|
409
|
+
"dueDate",
|
|
410
|
+
"reqstEndDe"
|
|
411
|
+
]);
|
|
412
|
+
if (!raw)
|
|
413
|
+
return undefined;
|
|
414
|
+
const compactMatches = [...raw.matchAll(/\d{8}/g)].map((match) => match[0]);
|
|
415
|
+
const separatedMatches = [...raw.matchAll(/(\d{4})[.\-/년\s]+(\d{1,2})[.\-/월\s]+(\d{1,2})/g)].map((match) => `${match[1]}${match[2].padStart(2, "0")}${match[3].padStart(2, "0")}`);
|
|
416
|
+
const last = [...compactMatches, ...separatedMatches].at(-1);
|
|
417
|
+
if (!last)
|
|
418
|
+
return undefined;
|
|
419
|
+
const isoDate = `${last.slice(0, 4)}-${last.slice(4, 6)}-${last.slice(6, 8)}`;
|
|
420
|
+
try {
|
|
421
|
+
return kstDeadlineToUtc(isoDate);
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
function deriveCategory(item) {
|
|
428
|
+
const text = joinedText(item, ["plcyKywdNm", "plcyExplnCn", "sprtCn", "plcyNm", "servDgst", "svcPpo", "servNm", "svcNm"]);
|
|
429
|
+
if (text.includes("취업") || text.includes("일자리") || text.includes("구직"))
|
|
430
|
+
return "employment";
|
|
431
|
+
if (text.includes("주거") || text.includes("월세") || text.includes("임대"))
|
|
432
|
+
return "housing";
|
|
433
|
+
if (text.includes("교육") || text.includes("장학") || text.includes("훈련"))
|
|
434
|
+
return "education";
|
|
435
|
+
if (text.includes("건강") || text.includes("의료") || text.includes("돌봄"))
|
|
436
|
+
return "health";
|
|
437
|
+
if (text.includes("가족") || text.includes("출산") || text.includes("육아") || text.includes("양육") || text.includes("아동"))
|
|
438
|
+
return "family";
|
|
439
|
+
if (text.includes("청년"))
|
|
440
|
+
return "youth";
|
|
441
|
+
if (deriveRegions(item).length > 0)
|
|
442
|
+
return "local";
|
|
443
|
+
return "other";
|
|
444
|
+
}
|
|
445
|
+
function containsAny(item, needles) {
|
|
446
|
+
const text = joinedText(item, Object.keys(item));
|
|
447
|
+
return needles.some((needle) => text.includes(needle));
|
|
448
|
+
}
|
|
449
|
+
function joinedText(item, keys) {
|
|
450
|
+
return keys.map((key) => firstText(item, [key]) ?? "").join(" ");
|
|
451
|
+
}
|
|
452
|
+
function isRecord(value) {
|
|
453
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
454
|
+
}
|
|
455
|
+
function messageFrom(error) {
|
|
456
|
+
return error instanceof Error ? error.message : String(error);
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAC5E,OAAO,EACL,mBAAmB,EAMpB,MAAM,oBAAoB,CAAC;AAM5B,MAAM,OAAO,0BAA0B;IAElB;IACA;IAFnB,YACmB,YAAiC,EACjC,UAA6C,EAAE;QAD/C,iBAAY,GAAZ,YAAY,CAAqB;QACjC,YAAO,GAAP,OAAO,CAAwC;IAC/D,CAAC;IAEJ,KAAK,CAAC,MAAM;QACV,MAAM,OAAO,GAAG,IAAI,GAAG,EAAyB,CAAC;QACjD,KAAK,MAAM,UAAU,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC3C,IAAI,CAAC;gBACH,KAAK,MAAM,MAAM,IAAI,MAAM,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;oBAC/C,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;oBAC9B,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;wBAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EA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Ac;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mcp-gen-ui/adapters",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Live and composable BenefitRepository adapters for mcp-gen-ui.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"author": "Team KOI",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/orca-svg/mcp-gateway-genui.git",
|
|
10
|
+
"directory": "packages/adapters"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://github.com/orca-svg/mcp-gateway-genui#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/orca-svg/mcp-gateway-genui/issues"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"provenance": true
|
|
22
|
+
},
|
|
23
|
+
"sideEffects": false,
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@mcp-gen-ui/core": "0.2.0",
|
|
35
|
+
"@mcp-gen-ui/schema": "0.2.0"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prebuild": "node -e \"require('node:fs').rmSync('dist', { recursive: true, force: true })\"",
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
41
|
+
"test": "vitest run"
|
|
42
|
+
}
|
|
43
|
+
}
|