@augmenting-integrations/api 0.1.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 +21 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +52 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +34 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Augmenting Integrations LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export type Commission = {
|
|
2
|
+
id: string;
|
|
3
|
+
agent: string;
|
|
4
|
+
carrier: string;
|
|
5
|
+
policy: string;
|
|
6
|
+
amount: number;
|
|
7
|
+
period: string;
|
|
8
|
+
status: "paid" | "pending" | "review";
|
|
9
|
+
submittedAt: string;
|
|
10
|
+
};
|
|
11
|
+
export type Lead = {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
state: string;
|
|
15
|
+
type: "health" | "life" | "supplemental";
|
|
16
|
+
age: number;
|
|
17
|
+
phone: string;
|
|
18
|
+
price: number;
|
|
19
|
+
createdAt: string;
|
|
20
|
+
purchased: boolean;
|
|
21
|
+
summary: string;
|
|
22
|
+
};
|
|
23
|
+
export type Carrier = {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
lines: string[];
|
|
27
|
+
};
|
|
28
|
+
export type DateRange = "today" | "this-week" | "this-month" | "this-quarter" | "ytd";
|
|
29
|
+
export type Quote = {
|
|
30
|
+
id: string;
|
|
31
|
+
customer: {
|
|
32
|
+
name: string;
|
|
33
|
+
age: number;
|
|
34
|
+
state: string;
|
|
35
|
+
};
|
|
36
|
+
carrier: string;
|
|
37
|
+
coverage: {
|
|
38
|
+
amount: number;
|
|
39
|
+
term?: number;
|
|
40
|
+
};
|
|
41
|
+
monthlyPremium: number;
|
|
42
|
+
annualPremium: number;
|
|
43
|
+
generatedAt: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Build a typed API client rooted at a given basePath. Each app passes its
|
|
47
|
+
* own basePath (e.g. `/commissions`) so request URLs are correct under the
|
|
48
|
+
* unified CloudFront routing layer.
|
|
49
|
+
*/
|
|
50
|
+
export declare function createApiClient(basePath?: string): {
|
|
51
|
+
commissions: {
|
|
52
|
+
list: () => Promise<{
|
|
53
|
+
items: Commission[];
|
|
54
|
+
}>;
|
|
55
|
+
create: (data: Omit<Commission, "id" | "submittedAt">) => Promise<{
|
|
56
|
+
item: Commission;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
leads: {
|
|
60
|
+
list: (params?: {
|
|
61
|
+
purchased?: boolean;
|
|
62
|
+
state?: string;
|
|
63
|
+
type?: string;
|
|
64
|
+
}) => Promise<{
|
|
65
|
+
items: Lead[];
|
|
66
|
+
}>;
|
|
67
|
+
buy: (id: string) => Promise<{
|
|
68
|
+
item: Lead;
|
|
69
|
+
}>;
|
|
70
|
+
};
|
|
71
|
+
dashboard: {
|
|
72
|
+
get: <T = unknown>(range?: DateRange) => Promise<T>;
|
|
73
|
+
};
|
|
74
|
+
carriers: {
|
|
75
|
+
list: () => Promise<{
|
|
76
|
+
items: Carrier[];
|
|
77
|
+
}>;
|
|
78
|
+
};
|
|
79
|
+
quotes: {
|
|
80
|
+
create: (data: {
|
|
81
|
+
customer: {
|
|
82
|
+
name: string;
|
|
83
|
+
age: number;
|
|
84
|
+
state: string;
|
|
85
|
+
};
|
|
86
|
+
carrier: string;
|
|
87
|
+
coverage: {
|
|
88
|
+
amount: number;
|
|
89
|
+
term?: number;
|
|
90
|
+
};
|
|
91
|
+
}) => Promise<{
|
|
92
|
+
quote: Quote;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
export type ApiClient = ReturnType<typeof createApiClient>;
|
|
97
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;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CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE;mBAOpD,IAAI,EAAE;;kBAGd,MAAM;kBAEC,IAAI;;;;cAIf,CAAC,oBAAmB,SAAS;;;;mBAOuB,OAAO,EAAE;;;;uBAGpD;YACb,QAAQ,EAAE;gBAAE,IAAI,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAC;gBAAC,KAAK,EAAE,MAAM,CAAA;aAAE,CAAC;YACvD,OAAO,EAAE,MAAM,CAAC;YAChB,QAAQ,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAC;gBAAC,IAAI,CAAC,EAAE,MAAM,CAAA;aAAE,CAAC;SAC7C;mBAK8B,KAAK;;;EAGzC;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
async function json(res) {
|
|
2
|
+
if (!res.ok)
|
|
3
|
+
throw new Error(`Request failed: ${res.status}`);
|
|
4
|
+
return (await res.json());
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Build a typed API client rooted at a given basePath. Each app passes its
|
|
8
|
+
* own basePath (e.g. `/commissions`) so request URLs are correct under the
|
|
9
|
+
* unified CloudFront routing layer.
|
|
10
|
+
*/
|
|
11
|
+
export function createApiClient(basePath = "") {
|
|
12
|
+
const base = basePath.replace(/\/$/, "");
|
|
13
|
+
return {
|
|
14
|
+
commissions: {
|
|
15
|
+
list: () => fetch(`${base}/api/commissions`).then((r) => json(r)),
|
|
16
|
+
create: (data) => fetch(`${base}/api/commissions`, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
headers: { "Content-Type": "application/json" },
|
|
19
|
+
body: JSON.stringify(data),
|
|
20
|
+
}).then((r) => json(r)),
|
|
21
|
+
},
|
|
22
|
+
leads: {
|
|
23
|
+
list: (params) => {
|
|
24
|
+
const q = new URLSearchParams();
|
|
25
|
+
if (params?.purchased !== undefined)
|
|
26
|
+
q.set("purchased", String(params.purchased));
|
|
27
|
+
if (params?.state)
|
|
28
|
+
q.set("state", params.state);
|
|
29
|
+
if (params?.type)
|
|
30
|
+
q.set("type", params.type);
|
|
31
|
+
const qs = q.toString();
|
|
32
|
+
return fetch(`${base}/api/leads${qs ? `?${qs}` : ""}`).then((r) => json(r));
|
|
33
|
+
},
|
|
34
|
+
buy: (id) => fetch(`${base}/api/leads/${id}/buy`, { method: "POST" }).then((r) => json(r)),
|
|
35
|
+
},
|
|
36
|
+
dashboard: {
|
|
37
|
+
get: (range = "this-month") => fetch(`${base}/api/dashboard?range=${encodeURIComponent(range)}`).then((r) => json(r)),
|
|
38
|
+
},
|
|
39
|
+
carriers: {
|
|
40
|
+
list: () => fetch(`${base}/api/carriers`).then((r) => json(r)),
|
|
41
|
+
},
|
|
42
|
+
quotes: {
|
|
43
|
+
create: (data) => fetch(`${base}/api/quotes`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { "Content-Type": "application/json" },
|
|
46
|
+
body: JSON.stringify(data),
|
|
47
|
+
}).then((r) => json(r)),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsCA,KAAK,UAAU,IAAI,CAAI,GAAa;IAClC,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;AACjC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,QAAQ,GAAG,EAAE;IAC3C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAEzC,OAAO;QAC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,CAAC,EAAU,EAAE,EAAE,CAClB,KAAK,CAAC,GAAG,IAAI,cAAc,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAClE,IAAI,CAAiB,CAAC,CAAC,CACxB;SACJ;QACD,SAAS,EAAE;YACT,GAAG,EAAE,CAAc,QAAmB,YAAY,EAAE,EAAE,CACpD,KAAK,CAAC,GAAG,IAAI,wBAAwB,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAC3E,IAAI,CAAI,CAAC,CAAC,CACX;SACJ;QACD,QAAQ,EAAE;YACR,IAAI,EAAE,GAAG,EAAE,CACT,KAAK,CAAC,GAAG,IAAI,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAuB,CAAC,CAAC,CAAC;SAC3E;QACD,MAAM,EAAE;YACN,MAAM,EAAE,CAAC,IAIR,EAAE,EAAE,CACH,KAAK,CAAC,GAAG,IAAI,aAAa,EAAE;gBAC1B,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;gBAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;aAC3B,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAmB,CAAC,CAAC,CAAC;SAC5C;KACF,CAAC;AACJ,CAAC"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
async function json(res) {
|
|
3
|
+
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
|
|
4
|
+
return await res.json();
|
|
5
|
+
}
|
|
6
|
+
function createApiClient(basePath = "") {
|
|
7
|
+
const base = basePath.replace(/\/$/, "");
|
|
8
|
+
return {
|
|
9
|
+
commissions: {
|
|
10
|
+
list: () => fetch(`${base}/api/commissions`).then((r) => json(r)),
|
|
11
|
+
create: (data) => fetch(`${base}/api/commissions`, {
|
|
12
|
+
method: "POST",
|
|
13
|
+
headers: { "Content-Type": "application/json" },
|
|
14
|
+
body: JSON.stringify(data)
|
|
15
|
+
}).then((r) => json(r))
|
|
16
|
+
},
|
|
17
|
+
leads: {
|
|
18
|
+
list: (params) => {
|
|
19
|
+
const q = new URLSearchParams();
|
|
20
|
+
if (params?.purchased !== void 0) q.set("purchased", String(params.purchased));
|
|
21
|
+
if (params?.state) q.set("state", params.state);
|
|
22
|
+
if (params?.type) q.set("type", params.type);
|
|
23
|
+
const qs = q.toString();
|
|
24
|
+
return fetch(`${base}/api/leads${qs ? `?${qs}` : ""}`).then(
|
|
25
|
+
(r) => json(r)
|
|
26
|
+
);
|
|
27
|
+
},
|
|
28
|
+
buy: (id) => fetch(`${base}/api/leads/${id}/buy`, { method: "POST" }).then(
|
|
29
|
+
(r) => json(r)
|
|
30
|
+
)
|
|
31
|
+
},
|
|
32
|
+
dashboard: {
|
|
33
|
+
get: (range = "this-month") => fetch(`${base}/api/dashboard?range=${encodeURIComponent(range)}`).then(
|
|
34
|
+
(r) => json(r)
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
carriers: {
|
|
38
|
+
list: () => fetch(`${base}/api/carriers`).then((r) => json(r))
|
|
39
|
+
},
|
|
40
|
+
quotes: {
|
|
41
|
+
create: (data) => fetch(`${base}/api/quotes`, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
headers: { "Content-Type": "application/json" },
|
|
44
|
+
body: JSON.stringify(data)
|
|
45
|
+
}).then((r) => json(r))
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createApiClient
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type Commission = {\n id: string;\n agent: string;\n carrier: string;\n policy: string;\n amount: number;\n period: string;\n status: \"paid\" | \"pending\" | \"review\";\n submittedAt: string;\n};\n\nexport type Lead = {\n id: string;\n name: string;\n state: string;\n type: \"health\" | \"life\" | \"supplemental\";\n age: number;\n phone: string;\n price: number;\n createdAt: string;\n purchased: boolean;\n summary: string;\n};\n\nexport type Carrier = { id: string; name: string; lines: string[] };\n\nexport type DateRange = \"today\" | \"this-week\" | \"this-month\" | \"this-quarter\" | \"ytd\";\n\nexport type Quote = {\n id: string;\n customer: { name: string; age: number; state: string };\n carrier: string;\n coverage: { amount: number; term?: number };\n monthlyPremium: number;\n annualPremium: number;\n generatedAt: string;\n};\n\nasync function json<T>(res: Response): Promise<T> {\n if (!res.ok) throw new Error(`Request failed: ${res.status}`);\n return (await res.json()) as T;\n}\n\n/**\n * Build a typed API client rooted at a given basePath. Each app passes its\n * own basePath (e.g. `/commissions`) so request URLs are correct under the\n * unified CloudFront routing layer.\n */\nexport function createApiClient(basePath = \"\") {\n const base = basePath.replace(/\\/$/, \"\");\n\n return {\n commissions: {\n list: () =>\n fetch(`${base}/api/commissions`).then((r) => json<{ items: Commission[] }>(r)),\n create: (data: Omit<Commission, \"id\" | \"submittedAt\">) =>\n fetch(`${base}/api/commissions`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(data),\n }).then((r) => json<{ item: Commission }>(r)),\n },\n leads: {\n list: (params?: { purchased?: boolean; state?: string; type?: string }) => {\n const q = new URLSearchParams();\n if (params?.purchased !== undefined) q.set(\"purchased\", String(params.purchased));\n if (params?.state) q.set(\"state\", params.state);\n if (params?.type) q.set(\"type\", params.type);\n const qs = q.toString();\n return fetch(`${base}/api/leads${qs ? `?${qs}` : \"\"}`).then((r) =>\n json<{ items: Lead[] }>(r),\n );\n },\n buy: (id: string) =>\n fetch(`${base}/api/leads/${id}/buy`, { method: \"POST\" }).then((r) =>\n json<{ item: Lead }>(r),\n ),\n },\n dashboard: {\n get: <T = unknown>(range: DateRange = \"this-month\") =>\n fetch(`${base}/api/dashboard?range=${encodeURIComponent(range)}`).then((r) =>\n json<T>(r),\n ),\n },\n carriers: {\n list: () =>\n fetch(`${base}/api/carriers`).then((r) => json<{ items: Carrier[] }>(r)),\n },\n quotes: {\n create: (data: {\n customer: { name: string; age: number; state: string };\n carrier: string;\n coverage: { amount: number; term?: number };\n }) =>\n fetch(`${base}/api/quotes`, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(data),\n }).then((r) => json<{ quote: Quote }>(r)),\n },\n };\n}\n\nexport type ApiClient = ReturnType<typeof createApiClient>;\n"],"mappings":";AAsCA,eAAe,KAAQ,KAA2B;AAChD,MAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,mBAAmB,IAAI,MAAM,EAAE;AAC5D,SAAQ,MAAM,IAAI,KAAK;AACzB;AAOO,SAAS,gBAAgB,WAAW,IAAI;AAC7C,QAAM,OAAO,SAAS,QAAQ,OAAO,EAAE;AAEvC,SAAO;AAAA,IACL,aAAa;AAAA,MACX,MAAM,MACJ,MAAM,GAAG,IAAI,kBAAkB,EAAE,KAAK,CAAC,MAAM,KAA8B,CAAC,CAAC;AAAA,MAC/E,QAAQ,CAAC,SACP,MAAM,GAAG,IAAI,oBAAoB;AAAA,QAC/B,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,QAC9C,MAAM,KAAK,UAAU,IAAI;AAAA,MAC3B,CAAC,EAAE,KAAK,CAAC,MAAM,KAA2B,CAAC,CAAC;AAAA,IAChD;AAAA,IACA,OAAO;AAAA,MACL,MAAM,CAAC,WAAoE;AACzE,cAAM,IAAI,IAAI,gBAAgB;AAC9B,YAAI,QAAQ,cAAc,OAAW,GAAE,IAAI,aAAa,OAAO,OAAO,SAAS,CAAC;AAChF,YAAI,QAAQ,MAAO,GAAE,IAAI,SAAS,OAAO,KAAK;AAC9C,YAAI,QAAQ,KAAM,GAAE,IAAI,QAAQ,OAAO,IAAI;AAC3C,cAAM,KAAK,EAAE,SAAS;AACtB,eAAO,MAAM,GAAG,IAAI,aAAa,KAAK,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;AAAA,UAAK,CAAC,MAC3D,KAAwB,CAAC;AAAA,QAC3B;AAAA,MACF;AAAA,MACA,KAAK,CAAC,OACJ,MAAM,GAAG,IAAI,cAAc,EAAE,QAAQ,EAAE,QAAQ,OAAO,CAAC,EAAE;AAAA,QAAK,CAAC,MAC7D,KAAqB,CAAC;AAAA,MACxB;AAAA,IACJ;AAAA,IACA,WAAW;AAAA,MACT,KAAK,CAAc,QAAmB,iBACpC,MAAM,GAAG,IAAI,wBAAwB,mBAAmB,KAAK,CAAC,EAAE,EAAE;AAAA,QAAK,CAAC,MACtE,KAAQ,CAAC;AAAA,MACX;AAAA,IACJ;AAAA,IACA,UAAU;AAAA,MACR,MAAM,MACJ,MAAM,GAAG,IAAI,eAAe,EAAE,KAAK,CAAC,MAAM,KAA2B,CAAC,CAAC;AAAA,IAC3E;AAAA,IACA,QAAQ;AAAA,MACN,QAAQ,CAAC,SAKP,MAAM,GAAG,IAAI,eAAe;AAAA,QAC1B,QAAQ;AAAA,QACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,QAC9C,MAAM,KAAK,UAAU,IAAI;AAAA,MAC3B,CAAC,EAAE,KAAK,CAAC,MAAM,KAAuB,CAAC,CAAC;AAAA,IAC5C;AAAA,EACF;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@augmenting-integrations/api",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed fetch wrappers for app data. MSW intercepts in dev; real APIs in prod.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"sideEffects": false,
|
|
10
|
+
"main": "./dist/index.cjs",
|
|
11
|
+
"module": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js",
|
|
17
|
+
"require": "./dist/index.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"tsup": "^8.3.5",
|
|
26
|
+
"typescript": "^5.7.2",
|
|
27
|
+
"vitest": "^4.1.5"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"clean": "rm -rf dist",
|
|
32
|
+
"test": "vitest run --passWithNoTests"
|
|
33
|
+
}
|
|
34
|
+
}
|