Skip to content

Commit fa9e4f2

Browse files
committed
run build and update version
1 parent 65c6996 commit fa9e4f2

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

dist/strapi.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/strapi.mjs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
const s = (t) => {
1+
const f = (t, e) => {
22
if (typeof t != "object" || t === null)
33
return t;
44
const a = {};
5-
for (const r in t)
6-
a[r] = s(t[r]);
7-
return a;
8-
}, d = (t) => {
5+
for (const n in t)
6+
a[n] = f(t[n]);
7+
return typeof a.url == "string" && a.url.startsWith("/") && (e || (e = process.env.CMS_URL), a.url = `${e}${a.url}`), a;
8+
}, d = (t, e) => {
99
const a = {};
10-
for (const r in t) {
11-
const e = t[r];
12-
if (typeof e == "object" && e !== null && "data" in e && e.data !== null && "id" in e.data && "attributes" in e.data) {
13-
const i = l(e);
14-
a[r] = { id: e.data.id, ...i };
10+
for (const n in t) {
11+
const o = t[n];
12+
if (typeof o == "object" && o !== null && "data" in o && o.data !== null && "id" in o.data && "attributes" in o.data) {
13+
const i = s(o, e);
14+
a[n] = { id: o.data.id, ...i };
1515
} else
16-
Array.isArray(e) ? a[r] = e.map((i) => d(i)) : a[r] = s(e);
16+
Array.isArray(o) ? a[n] = o.map((i) => d(i, e)) : a[n] = f(o, e);
1717
}
1818
return a;
19-
}, l = (t) => {
19+
}, s = (t, e) => {
2020
if (Array.isArray(t))
2121
return {
22-
data: t.map(l)
22+
data: t.map((n) => s(n, e))
2323
};
2424
if (t == null || typeof t == "object" && !Object.keys(t).length)
2525
return null;
2626
let a = { ...t };
2727
return t.attributes && (a = {
2828
...a,
29-
...d(t.attributes)
30-
}, delete a.attributes), t.data && (a = l(t.data)), a;
31-
}, m = (t) => {
32-
const a = t?.meta?.pagination?.total, r = t?.meta?.pagination?.limit, e = t?.meta?.pagination?.start;
33-
let i = 0, n = 1;
34-
a && r && (i = Math.ceil(a / r)), e && r && (n = Math.floor(e / r) + 1);
35-
const c = n < i, f = n >= 2;
36-
let o = l(t.data);
37-
return o.data && (o = o.data), {
29+
...d(t.attributes, e)
30+
}, delete a.attributes), t.data && (a = s(t.data, e)), a.url?.startsWith("/") && (e || (e = process.env.CMS_URL), a.url = `${e}${a.url}`), a;
31+
}, m = (t, e) => {
32+
const a = t?.meta?.pagination?.total, n = t?.meta?.pagination?.limit, o = t?.meta?.pagination?.start;
33+
let i = 0, r = 1;
34+
a && n && (i = Math.ceil(a / n)), o && n && (r = Math.floor(o / n) + 1);
35+
const u = r < i, c = r >= 2;
36+
let l = s(t.data, e);
37+
return l.data && (l = l.data), {
3838
meta: {
3939
...t?.meta,
4040
pagination: {
4141
...t?.meta?.pagination,
4242
...i && { pages: i },
43-
...n && { page: n },
44-
hasNextPage: c,
45-
hasPrevPage: f
43+
...r && { page: r },
44+
hasNextPage: u,
45+
hasPrevPage: c
4646
}
4747
},
48-
data: o
48+
data: l
4949
};
5050
};
5151
export {
5252
m as normalize,
53-
l as normalizeContent,
53+
s as normalizeContent,
5454
d as normalizeNestedAttributes
5555
};

dist/strapi/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ type NormalizedContent = {
1313
};
1414
data: unknown[] | unknown;
1515
};
16-
export declare const normalizeNestedAttributes: (attributes: Record<string, any>) => Record<string, unknown>;
17-
export declare const normalizeContent: (input: any) => any;
18-
export declare const normalize: (content: any) => NormalizedContent;
16+
export declare const normalizeNestedAttributes: (attributes: Record<string, any>, strapiUrl?: string) => Record<string, unknown>;
17+
export declare const normalizeContent: (input: any, strapiUrl?: string) => any;
18+
export declare const normalize: (content: any, strapiUrl?: string) => NormalizedContent;
1919
export {};
2020
//# sourceMappingURL=index.d.ts.map

dist/strapi/index.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teleporthq/cms-mappers",
3-
"version": "1.0.15",
3+
"version": "1.0.16",
44
"main": "dist/index.js",
55
"module": "dist/contentful.mjs",
66
"types": "dist/contentful/index.d.ts",

0 commit comments

Comments
 (0)