Skip to content

Commit

Permalink
Increase version
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutpasca committed Jul 29, 2024
1 parent ec49b5a commit c65c4c6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 37 deletions.
2 changes: 1 addition & 1 deletion dist/strapi.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions dist/strapi.mjs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
function l(t) {
const l = (t) => {
if (typeof t != "object" || t === null)
return t;
const a = {};
for (const i in t)
a[i] = l(t[i]);
for (const r in t)
a[r] = l(t[r]);
return a;
}
const d = (t) => {
}, s = (t) => {
const a = {};
for (const i in t) {
const e = t[i];
for (const r in t) {
const e = t[r];
if (typeof e == "object" && e !== null && "data" in e && e.data !== null && "id" in e.data && "attributes" in e.data) {
const n = o(e);
a[i] = { id: e.data.id, ...n };
const i = n(e);
a[r] = { id: e.data.id, ...i };
} else
a[i] = l(e);
Array.isArray(e) ? a[r] = e.map((i) => s(i)) : a[r] = l(e);
}
return a;
}, o = (t) => {
}, n = (t) => {
if (t == null || typeof t == "object" && !Object.keys(t).length)
return null;
if (Array.isArray(t))
Expand All @@ -27,28 +26,29 @@ const d = (t) => {
let a = { ...t };
return t.attributes && (a = {
...a,
...d(t.attributes)
}, delete a.attributes), t.data && (a = o(t.data)), a;
...s(t.attributes)
}, delete a.attributes), t.data && (a = n(t.data)), a;
}, f = (t) => {
const a = t?.meta?.pagination?.total, i = t?.meta?.pagination?.limit, e = t?.meta?.pagination?.start;
let n = 0, r = 1;
a && i && (n = Math.ceil(a / i)), e && i && (r = e / i + 1);
const s = r < n, c = r >= 2;
const a = t?.meta?.pagination?.total, r = t?.meta?.pagination?.limit, e = t?.meta?.pagination?.start;
let i = 0, o = 1;
a && r && (i = Math.ceil(a / r)), e && r && (o = Math.floor(e / r) + 1);
const d = o < i, c = o >= 2;
return {
meta: {
...t?.meta,
pagination: {
...t?.meta?.pagination,
...!!n && { pages: n },
...!!r && { page: r },
hasNextPage: s,
...i && { pages: i },
...o && { page: o },
hasNextPage: d,
hasPrevPage: c
}
},
...o(t)
data: n(t.data)
};
};
export {
f as normalize,
o as normalizeContent
n as normalizeContent,
s as normalizeNestedAttributes
};
28 changes: 16 additions & 12 deletions dist/strapi/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
export declare const normalizeContent: (input: any) => any;
export declare const normalize: (content: any) => {
type Pagination = {
total?: number;
limit?: number;
start?: number;
pages?: number;
page?: number;
hasNextPage?: boolean;
hasPrevPage?: boolean;
};
type NormalizedContent = {
meta: {
pagination?: {
total?: number;
limit?: number;
start?: number;
pages: number;
page: number;
hasNextPage: boolean;
hasPrevPage: boolean;
};
pagination?: Pagination;
};
data: Array<unknown> | unknown;
data: unknown[] | unknown;
};
export declare const normalizeNestedAttributes: (attributes: Record<string, any>) => Record<string, unknown>;
export declare const normalizeContent: (input: any) => any;
export declare const normalize: (content: any) => NormalizedContent;
export {};
//# sourceMappingURL=index.d.ts.map
2 changes: 1 addition & 1 deletion dist/strapi/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@teleporthq/cms-mappers",
"version": "1.0.10",
"version": "1.0.11",
"main": "dist/index.js",
"module": "dist/contentful.mjs",
"types": "dist/contentful/index.d.ts",
Expand Down

0 comments on commit c65c4c6

Please sign in to comment.