@janbox/contentful-marketplace-sdk 0.0.1 → 0.0.2
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/package.json +4 -1
- package/src/client/index.ts +0 -22
- package/src/entries/banner.ts +0 -23
- package/src/entries/index.ts +0 -1
- package/src/index.ts +0 -3
- package/src/types/index.ts +0 -177
- package/tsconfig.json +0 -29
- package/vite.config.ts +0 -23
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@janbox/contentful-marketplace-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*"
|
|
9
|
+
],
|
|
7
10
|
"exports": {
|
|
8
11
|
".": {
|
|
9
12
|
"import": "./dist/index.js",
|
package/src/client/index.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ContentfulClientApi,
|
|
3
|
-
createClient,
|
|
4
|
-
type CreateClientParams,
|
|
5
|
-
} from "contentful";
|
|
6
|
-
|
|
7
|
-
export class ContentfulSDK {
|
|
8
|
-
private static _client: ContentfulClientApi<undefined> | undefined;
|
|
9
|
-
|
|
10
|
-
// static getter
|
|
11
|
-
|
|
12
|
-
static get client() {
|
|
13
|
-
if (!this._client) {
|
|
14
|
-
throw new Error("Client is not initialized");
|
|
15
|
-
}
|
|
16
|
-
return this._client;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static configure(params: CreateClientParams) {
|
|
20
|
-
this._client = createClient(params);
|
|
21
|
-
}
|
|
22
|
-
}
|
package/src/entries/banner.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { ContentfulSDK } from "@/client";
|
|
2
|
-
import type { TypeBannerSkeleton } from "@/types";
|
|
3
|
-
import type { EntriesQueries } from "contentful";
|
|
4
|
-
|
|
5
|
-
export const listBannerEntries = async ({
|
|
6
|
-
query,
|
|
7
|
-
marketId,
|
|
8
|
-
language,
|
|
9
|
-
}: {
|
|
10
|
-
marketId: string;
|
|
11
|
-
language: string;
|
|
12
|
-
query?: Partial<EntriesQueries<TypeBannerSkeleton, 'WITHOUT_UNRESOLVABLE_LINKS'>>;
|
|
13
|
-
}) => {
|
|
14
|
-
return ContentfulSDK.client.withoutUnresolvableLinks.getEntries<TypeBannerSkeleton>({
|
|
15
|
-
'fields.market.sys.contentType.sys.id': 'market',
|
|
16
|
-
'fields.market.fields.marketId': marketId,
|
|
17
|
-
'fields.language.sys.contentType.sys.id': 'language',
|
|
18
|
-
'fields.language.fields.code': language,
|
|
19
|
-
...query,
|
|
20
|
-
content_type: 'banner',
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
package/src/entries/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./banner";
|
package/src/index.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ChainModifiers,
|
|
3
|
-
Entry,
|
|
4
|
-
EntryFieldTypes,
|
|
5
|
-
EntrySkeletonType,
|
|
6
|
-
LocaleCode,
|
|
7
|
-
} from "contentful";
|
|
8
|
-
|
|
9
|
-
export interface TypeAuthorFields {
|
|
10
|
-
name: EntryFieldTypes.Symbol;
|
|
11
|
-
avatar?: EntryFieldTypes.AssetLink;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type TypeAuthorSkeleton = EntrySkeletonType<TypeAuthorFields, "author">;
|
|
15
|
-
export type TypeAuthor<
|
|
16
|
-
Modifiers extends ChainModifiers,
|
|
17
|
-
Locales extends LocaleCode = LocaleCode
|
|
18
|
-
> = Entry<TypeAuthorSkeleton, Modifiers, Locales>;
|
|
19
|
-
|
|
20
|
-
export interface TypeBannerFields {
|
|
21
|
-
name: EntryFieldTypes.Symbol;
|
|
22
|
-
image: EntryFieldTypes.AssetLink;
|
|
23
|
-
redirectUrl?: EntryFieldTypes.Symbol;
|
|
24
|
-
market: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
|
|
25
|
-
language: EntryFieldTypes.EntryLink<TypeLanguageSkeleton>;
|
|
26
|
-
platform: EntryFieldTypes.Array<EntryFieldTypes.Symbol<"MOBILE" | "WEB">>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type TypeBannerSkeleton = EntrySkeletonType<TypeBannerFields, "banner">;
|
|
30
|
-
export type TypeBanner<
|
|
31
|
-
Modifiers extends ChainModifiers,
|
|
32
|
-
Locales extends LocaleCode = LocaleCode
|
|
33
|
-
> = Entry<TypeBannerSkeleton, Modifiers, Locales>;
|
|
34
|
-
|
|
35
|
-
export interface TypeBlogCategoryFields {
|
|
36
|
-
title: EntryFieldTypes.Symbol;
|
|
37
|
-
slug: EntryFieldTypes.Symbol;
|
|
38
|
-
description?: EntryFieldTypes.RichText;
|
|
39
|
-
publishedDate?: EntryFieldTypes.Date;
|
|
40
|
-
market: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
|
|
41
|
-
language: EntryFieldTypes.EntryLink<TypeLanguageSkeleton>;
|
|
42
|
-
seo?: EntryFieldTypes.EntryLink<TypeSeoSkeleton>;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export type TypeBlogCategorySkeleton = EntrySkeletonType<
|
|
46
|
-
TypeBlogCategoryFields,
|
|
47
|
-
"blogCategory"
|
|
48
|
-
>;
|
|
49
|
-
export type TypeBlogCategory<
|
|
50
|
-
Modifiers extends ChainModifiers,
|
|
51
|
-
Locales extends LocaleCode = LocaleCode
|
|
52
|
-
> = Entry<TypeBlogCategorySkeleton, Modifiers, Locales>;
|
|
53
|
-
|
|
54
|
-
export interface TypeBlogPostFields {
|
|
55
|
-
title: EntryFieldTypes.Symbol;
|
|
56
|
-
shortDescription?: EntryFieldTypes.Text;
|
|
57
|
-
slug: EntryFieldTypes.Symbol;
|
|
58
|
-
author?: EntryFieldTypes.EntryLink<TypeAuthorSkeleton>;
|
|
59
|
-
featuredImage: EntryFieldTypes.AssetLink;
|
|
60
|
-
content: EntryFieldTypes.RichText;
|
|
61
|
-
relatedBlogPosts?: EntryFieldTypes.Array<
|
|
62
|
-
EntryFieldTypes.EntryLink<TypeBlogPostSkeleton>
|
|
63
|
-
>;
|
|
64
|
-
category?: EntryFieldTypes.EntryLink<TypeBlogCategorySkeleton>;
|
|
65
|
-
market: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
|
|
66
|
-
language: EntryFieldTypes.EntryLink<TypeLanguageSkeleton>;
|
|
67
|
-
seo?: EntryFieldTypes.EntryLink<TypeSeoSkeleton>;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type TypeBlogPostSkeleton = EntrySkeletonType<
|
|
71
|
-
TypeBlogPostFields,
|
|
72
|
-
"blogPost"
|
|
73
|
-
>;
|
|
74
|
-
export type TypeBlogPost<
|
|
75
|
-
Modifiers extends ChainModifiers,
|
|
76
|
-
Locales extends LocaleCode = LocaleCode
|
|
77
|
-
> = Entry<TypeBlogPostSkeleton, Modifiers, Locales>;
|
|
78
|
-
|
|
79
|
-
export interface TypeComponentSvgFields {
|
|
80
|
-
name: EntryFieldTypes.Symbol;
|
|
81
|
-
source: EntryFieldTypes.Text;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export type TypeComponentSvgSkeleton = EntrySkeletonType<
|
|
85
|
-
TypeComponentSvgFields,
|
|
86
|
-
"componentSvg"
|
|
87
|
-
>;
|
|
88
|
-
export type TypeComponentSvg<
|
|
89
|
-
Modifiers extends ChainModifiers,
|
|
90
|
-
Locales extends LocaleCode = LocaleCode
|
|
91
|
-
> = Entry<TypeComponentSvgSkeleton, Modifiers, Locales>;
|
|
92
|
-
|
|
93
|
-
export interface TypeDocumentationArticleFields {
|
|
94
|
-
title: EntryFieldTypes.Symbol;
|
|
95
|
-
slug: EntryFieldTypes.Symbol;
|
|
96
|
-
content: EntryFieldTypes.RichText;
|
|
97
|
-
author?: EntryFieldTypes.EntryLink<TypeAuthorSkeleton>;
|
|
98
|
-
category?: EntryFieldTypes.EntryLink<TypeDocumentationCategorySkeleton>;
|
|
99
|
-
market: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
|
|
100
|
-
language: EntryFieldTypes.EntryLink<TypeLanguageSkeleton>;
|
|
101
|
-
seo?: EntryFieldTypes.EntryLink<TypeSeoSkeleton>;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export type TypeDocumentationArticleSkeleton = EntrySkeletonType<
|
|
105
|
-
TypeDocumentationArticleFields,
|
|
106
|
-
"documentationArticle"
|
|
107
|
-
>;
|
|
108
|
-
export type TypeDocumentationArticle<
|
|
109
|
-
Modifiers extends ChainModifiers,
|
|
110
|
-
Locales extends LocaleCode = LocaleCode
|
|
111
|
-
> = Entry<TypeDocumentationArticleSkeleton, Modifiers, Locales>;
|
|
112
|
-
|
|
113
|
-
export interface TypeDocumentationCategoryFields {
|
|
114
|
-
title: EntryFieldTypes.Symbol;
|
|
115
|
-
slug: EntryFieldTypes.Symbol;
|
|
116
|
-
description?: EntryFieldTypes.Symbol;
|
|
117
|
-
order?: EntryFieldTypes.Integer;
|
|
118
|
-
icon?: EntryFieldTypes.EntryLink<TypeComponentSvgSkeleton>;
|
|
119
|
-
market: EntryFieldTypes.EntryLink<TypeMarketSkeleton>;
|
|
120
|
-
language: EntryFieldTypes.EntryLink<TypeLanguageSkeleton>;
|
|
121
|
-
seo?: EntryFieldTypes.EntryLink<TypeSeoSkeleton>;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
export type TypeDocumentationCategorySkeleton = EntrySkeletonType<
|
|
125
|
-
TypeDocumentationCategoryFields,
|
|
126
|
-
"documentationCategory"
|
|
127
|
-
>;
|
|
128
|
-
export type TypeDocumentationCategory<
|
|
129
|
-
Modifiers extends ChainModifiers,
|
|
130
|
-
Locales extends LocaleCode = LocaleCode
|
|
131
|
-
> = Entry<TypeDocumentationCategorySkeleton, Modifiers, Locales>;
|
|
132
|
-
|
|
133
|
-
export interface TypeLanguageFields {
|
|
134
|
-
name: EntryFieldTypes.Symbol;
|
|
135
|
-
code: EntryFieldTypes.Symbol;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type TypeLanguageSkeleton = EntrySkeletonType<
|
|
139
|
-
TypeLanguageFields,
|
|
140
|
-
"language"
|
|
141
|
-
>;
|
|
142
|
-
export type TypeLanguage<
|
|
143
|
-
Modifiers extends ChainModifiers,
|
|
144
|
-
Locales extends LocaleCode = LocaleCode
|
|
145
|
-
> = Entry<TypeLanguageSkeleton, Modifiers, Locales>;
|
|
146
|
-
|
|
147
|
-
export interface TypeMarketFields {
|
|
148
|
-
marketId: EntryFieldTypes.Symbol;
|
|
149
|
-
marketName: EntryFieldTypes.Symbol;
|
|
150
|
-
description?: EntryFieldTypes.Text;
|
|
151
|
-
isPrimary?: EntryFieldTypes.Boolean;
|
|
152
|
-
currency?: EntryFieldTypes.Symbol;
|
|
153
|
-
status?: EntryFieldTypes.Number;
|
|
154
|
-
isDeleted?: EntryFieldTypes.Boolean;
|
|
155
|
-
createdAt?: EntryFieldTypes.Date;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type TypeMarketSkeleton = EntrySkeletonType<TypeMarketFields, "market">;
|
|
159
|
-
export type TypeMarket<
|
|
160
|
-
Modifiers extends ChainModifiers,
|
|
161
|
-
Locales extends LocaleCode = LocaleCode
|
|
162
|
-
> = Entry<TypeMarketSkeleton, Modifiers, Locales>;
|
|
163
|
-
|
|
164
|
-
export interface TypeSeoFields {
|
|
165
|
-
metaTitle: EntryFieldTypes.Symbol;
|
|
166
|
-
metaDescription?: EntryFieldTypes.Text;
|
|
167
|
-
metaKeywords?: EntryFieldTypes.Array<EntryFieldTypes.Symbol>;
|
|
168
|
-
metaRobots?: EntryFieldTypes.Array<
|
|
169
|
-
EntryFieldTypes.Symbol<"follow" | "index" | "nofollow" | "noindex">
|
|
170
|
-
>;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
export type TypeSeoSkeleton = EntrySkeletonType<TypeSeoFields, "seo">;
|
|
174
|
-
export type TypeSeo<
|
|
175
|
-
Modifiers extends ChainModifiers,
|
|
176
|
-
Locales extends LocaleCode = LocaleCode
|
|
177
|
-
> = Entry<TypeSeoSkeleton, Modifiers, Locales>;
|
package/tsconfig.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"useDefineForClassFields": true,
|
|
5
|
-
"module": "ESNext",
|
|
6
|
-
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
|
|
9
|
-
/* Bundler mode */
|
|
10
|
-
"moduleResolution": "bundler",
|
|
11
|
-
"allowImportingTsExtensions": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"moduleDetection": "force",
|
|
14
|
-
"noEmit": true,
|
|
15
|
-
|
|
16
|
-
/* Linting */
|
|
17
|
-
"strict": true,
|
|
18
|
-
"noUnusedLocals": true,
|
|
19
|
-
"noUnusedParameters": true,
|
|
20
|
-
"erasableSyntaxOnly": true,
|
|
21
|
-
"noFallthroughCasesInSwitch": true,
|
|
22
|
-
"noUncheckedSideEffectImports": true,
|
|
23
|
-
"baseUrl": ".",
|
|
24
|
-
"paths": {
|
|
25
|
-
"@/*": ["./src/*"]
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"include": ["src"]
|
|
29
|
-
}
|
package/vite.config.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vite";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
import dts from "vite-plugin-dts";
|
|
5
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
6
|
-
import { peerDependencies } from "./package.json";
|
|
7
|
-
|
|
8
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
|
-
|
|
10
|
-
// https://vitejs.dev/config/
|
|
11
|
-
export default defineConfig({
|
|
12
|
-
build: {
|
|
13
|
-
lib: {
|
|
14
|
-
formats: ["cjs", "es"],
|
|
15
|
-
entry: resolve(__dirname, "src/index.ts"),
|
|
16
|
-
fileName: "index",
|
|
17
|
-
},
|
|
18
|
-
rollupOptions: {
|
|
19
|
-
external: Object.keys(peerDependencies),
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
plugins: [dts(), tsconfigPaths()],
|
|
23
|
-
});
|