@01.software/sdk 0.2.6 → 0.2.7
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/README.md +0 -2
- package/dist/{auth-Cj3nVn_P.d.ts → auth-D-_Ju7m5.d.ts} +1 -1
- package/dist/{auth-BICuhJxS.d.cts → auth-ZBsN9vPn.d.cts} +1 -1
- package/dist/auth.d.cts +2 -2
- package/dist/auth.d.ts +2 -2
- package/dist/components.d.cts +1 -1
- package/dist/components.d.ts +1 -1
- package/dist/index.cjs +32 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -8
- package/dist/index.d.ts +13 -8
- package/dist/index.js +32 -11
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-D0px2DCK.d.cts → payload-types-CRSz8jfP.d.cts} +0 -76
- package/dist/{payload-types-D0px2DCK.d.ts → payload-types-CRSz8jfP.d.ts} +0 -76
- package/dist/{webhook-vrlAV1K7.d.ts → webhook-C_DHB0Sw.d.ts} +1 -1
- package/dist/{webhook--_n7O-Ed.d.cts → webhook-Dn5o0LXq.d.cts} +1 -1
- package/dist/webhook.d.cts +2 -2
- package/dist/webhook.d.ts +2 -2
- package/package.json +1 -11
- package/dist/metadata.cjs +0 -71
- package/dist/metadata.cjs.map +0 -1
- package/dist/metadata.d.cts +0 -18
- package/dist/metadata.d.ts +0 -18
- package/dist/metadata.js +0 -51
- package/dist/metadata.js.map +0 -1
package/README.md
CHANGED
|
@@ -37,8 +37,6 @@ import { handleWebhook, createTypedWebhookHandler } from '@01.software/sdk/webho
|
|
|
37
37
|
// Components only - React components
|
|
38
38
|
import { RichTextContent } from '@01.software/sdk/components'
|
|
39
39
|
|
|
40
|
-
// Metadata only - SEO meta → Next.js Metadata
|
|
41
|
-
import { generateMetadata } from '@01.software/sdk/metadata'
|
|
42
40
|
```
|
|
43
41
|
|
|
44
42
|
## Getting Started
|
package/dist/auth.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-
|
|
1
|
+
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-ZBsN9vPn.cjs';
|
|
2
2
|
import 'payload';
|
|
3
|
-
import './payload-types-
|
|
3
|
+
import './payload-types-CRSz8jfP.cjs';
|
package/dist/auth.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-
|
|
1
|
+
export { J as JwtPayload, q as createApiKey, o as createServerToken, p as decodeServerToken, r as parseApiKey, v as verifyServerToken } from './auth-D-_Ju7m5.js';
|
|
2
2
|
import 'payload';
|
|
3
|
-
import './payload-types-
|
|
3
|
+
import './payload-types-CRSz8jfP.js';
|
package/dist/components.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import React, { CSSProperties } from 'react';
|
|
|
2
2
|
import { SerializedLinkNode, SerializedBlockNode } from '@payloadcms/richtext-lexical';
|
|
3
3
|
import { SerializedEditorState, SerializedLexicalNode } from '@payloadcms/richtext-lexical/lexical';
|
|
4
4
|
import { JSXConverter } from '@payloadcms/richtext-lexical/react';
|
|
5
|
-
import { F as Form } from './payload-types-
|
|
5
|
+
import { F as Form } from './payload-types-CRSz8jfP.cjs';
|
|
6
6
|
import { I as ImageData } from './image-TT8lTsk5.cjs';
|
|
7
7
|
|
|
8
8
|
type RichTextData = SerializedEditorState<SerializedLexicalNode>;
|
package/dist/components.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import React, { CSSProperties } from 'react';
|
|
|
2
2
|
import { SerializedLinkNode, SerializedBlockNode } from '@payloadcms/richtext-lexical';
|
|
3
3
|
import { SerializedEditorState, SerializedLexicalNode } from '@payloadcms/richtext-lexical/lexical';
|
|
4
4
|
import { JSXConverter } from '@payloadcms/richtext-lexical/react';
|
|
5
|
-
import { F as Form } from './payload-types-
|
|
5
|
+
import { F as Form } from './payload-types-CRSz8jfP.js';
|
|
6
6
|
import { I as ImageData } from './image-TT8lTsk5.js';
|
|
7
7
|
|
|
8
8
|
type RichTextData = SerializedEditorState<SerializedLexicalNode>;
|
package/dist/index.cjs
CHANGED
|
@@ -708,12 +708,27 @@ var resolveRelation = (ref) => {
|
|
|
708
708
|
var objectFor = resolveRelation;
|
|
709
709
|
|
|
710
710
|
// src/core/metadata/index.ts
|
|
711
|
-
|
|
711
|
+
var COLLECTION_META_FIELDS = {
|
|
712
|
+
products: { description: "subtitle", image: "thumbnail" },
|
|
713
|
+
posts: { description: "excerpt", image: "thumbnail" },
|
|
714
|
+
documents: { description: "summary", image: "" },
|
|
715
|
+
playlists: { description: "description", image: "image" }
|
|
716
|
+
};
|
|
717
|
+
var DEFAULT_META_FIELDS = { description: "description", image: "thumbnail" };
|
|
718
|
+
function extractMetaFields(collection, doc) {
|
|
719
|
+
var _a, _b, _c, _d;
|
|
720
|
+
const mapping = (_a = COLLECTION_META_FIELDS[collection]) != null ? _a : DEFAULT_META_FIELDS;
|
|
721
|
+
return {
|
|
722
|
+
title: (_b = doc.title) != null ? _b : null,
|
|
723
|
+
description: mapping.description ? (_c = doc[mapping.description]) != null ? _c : null : null,
|
|
724
|
+
image: mapping.image ? (_d = doc[mapping.image]) != null ? _d : null : null
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
function generateMetadata(input, options) {
|
|
712
728
|
var _a, _b, _c, _d;
|
|
713
|
-
const
|
|
714
|
-
const
|
|
715
|
-
const
|
|
716
|
-
const image = resolveMetaImage(meta == null ? void 0 : meta.image);
|
|
729
|
+
const title = (_b = (_a = input.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
|
|
730
|
+
const description = (_d = (_c = input.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
|
|
731
|
+
const image = resolveMetaImage(input.image);
|
|
717
732
|
return {
|
|
718
733
|
title,
|
|
719
734
|
description,
|
|
@@ -724,11 +739,17 @@ function generateMetadata(doc, options) {
|
|
|
724
739
|
};
|
|
725
740
|
}
|
|
726
741
|
function resolveMetaImage(ref) {
|
|
727
|
-
|
|
728
|
-
|
|
742
|
+
var _a;
|
|
743
|
+
const image = resolveRelation(ref);
|
|
744
|
+
if (!image) return null;
|
|
745
|
+
const sized = (_a = image.sizes) == null ? void 0 : _a["1536"];
|
|
746
|
+
const url = (sized == null ? void 0 : sized.url) || image.url;
|
|
747
|
+
if (!url) return null;
|
|
748
|
+
const width = (sized == null ? void 0 : sized.url) ? sized.width : image.width;
|
|
749
|
+
const height = (sized == null ? void 0 : sized.url) ? sized.height : image.height;
|
|
729
750
|
return __spreadValues(__spreadValues(__spreadValues({
|
|
730
|
-
url
|
|
731
|
-
},
|
|
751
|
+
url
|
|
752
|
+
}, width && { width }), height && { height }), image.alt && { alt: image.alt });
|
|
732
753
|
}
|
|
733
754
|
|
|
734
755
|
// src/core/collection/query-builder.ts
|
|
@@ -813,7 +834,7 @@ var CollectionQueryBuilder = class {
|
|
|
813
834
|
const doc = docs[0];
|
|
814
835
|
if (!doc) return null;
|
|
815
836
|
return generateMetadata(
|
|
816
|
-
doc,
|
|
837
|
+
extractMetaFields(String(this.collection), doc),
|
|
817
838
|
metadataOptions
|
|
818
839
|
);
|
|
819
840
|
});
|
|
@@ -827,7 +848,7 @@ var CollectionQueryBuilder = class {
|
|
|
827
848
|
return __async(this, null, function* () {
|
|
828
849
|
const doc = yield this.findById(id, { depth: 1 });
|
|
829
850
|
return generateMetadata(
|
|
830
|
-
doc,
|
|
851
|
+
extractMetaFields(String(this.collection), doc),
|
|
831
852
|
metadataOptions
|
|
832
853
|
);
|
|
833
854
|
});
|