@htmless/sdk 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/README.md +127 -0
- package/dist/client.d.ts +86 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +117 -0
- package/dist/client.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# htmless
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for [HTMLess](https://htmless.com) headless CMS.
|
|
4
|
+
|
|
5
|
+
Zero dependencies. Works in Node.js 18+, Deno, Bun, and all modern browsers.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install htmless
|
|
11
|
+
# or
|
|
12
|
+
pnpm add htmless
|
|
13
|
+
# or
|
|
14
|
+
yarn add htmless
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { HTMLessClient } from 'htmless';
|
|
21
|
+
|
|
22
|
+
const client = new HTMLessClient({
|
|
23
|
+
baseUrl: 'https://your-cms.example.com',
|
|
24
|
+
spaceId: 'your-space-id',
|
|
25
|
+
apiToken: 'your-api-token', // optional for public content
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Fetch a list of blog posts
|
|
29
|
+
const { items, meta } = await client.getEntries('blog-post', {
|
|
30
|
+
limit: 10,
|
|
31
|
+
sort: '-createdAt',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
console.log(`Found ${meta.total} posts`);
|
|
35
|
+
for (const post of items) {
|
|
36
|
+
console.log(post.title, post.slug);
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## API Reference
|
|
41
|
+
|
|
42
|
+
### `new HTMLessClient(options)`
|
|
43
|
+
|
|
44
|
+
| Option | Type | Required | Description |
|
|
45
|
+
| ---------- | -------- | -------- | ------------------------------ |
|
|
46
|
+
| `baseUrl` | `string` | Yes | Base URL of your HTMLess API |
|
|
47
|
+
| `spaceId` | `string` | Yes | Space ID for multi-tenant auth |
|
|
48
|
+
| `apiToken` | `string` | No | API token for authenticated access |
|
|
49
|
+
|
|
50
|
+
### Content Delivery (CDA)
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
// List entries by content type
|
|
54
|
+
const result = await client.getEntries('blog-post', {
|
|
55
|
+
slug: 'hello-world', // filter by slug
|
|
56
|
+
locale: 'en', // locale
|
|
57
|
+
sort: '-createdAt', // sort field (prefix - for desc)
|
|
58
|
+
fields: ['title', 'slug'], // sparse fieldsets
|
|
59
|
+
include: ['author'], // include relations
|
|
60
|
+
page: 1, // pagination
|
|
61
|
+
limit: 25,
|
|
62
|
+
filters: { status: 'published' },
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
// Get a single entry by ID
|
|
66
|
+
const entry = await client.getEntry('blog-post', 'entry-id', {
|
|
67
|
+
fields: ['title', 'body'],
|
|
68
|
+
include: ['author', 'category'],
|
|
69
|
+
locale: 'en',
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// Get a single asset
|
|
73
|
+
const asset = await client.getAsset('asset-id');
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Schema Introspection
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
// List all content types
|
|
80
|
+
const types = await client.getTypes();
|
|
81
|
+
|
|
82
|
+
// Get a specific content type with field definitions
|
|
83
|
+
const blogType = await client.getType('blog-post');
|
|
84
|
+
console.log(blogType.fields);
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Preview
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// Fetch draft content with a preview token
|
|
91
|
+
const draft = await client.getPreview('blog-post', 'my-draft-slug', 'preview-token');
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Error Handling
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
import { HTMLessClient, HTMLessError } from 'htmless';
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
const entry = await client.getEntry('blog-post', 'missing-id');
|
|
101
|
+
} catch (err) {
|
|
102
|
+
if (err instanceof HTMLessError) {
|
|
103
|
+
console.error(`API error ${err.status}: ${err.body}`);
|
|
104
|
+
}
|
|
105
|
+
throw err;
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## TypeScript
|
|
110
|
+
|
|
111
|
+
The SDK is written in TypeScript and ships with full type declarations. Use generics for typed responses:
|
|
112
|
+
|
|
113
|
+
```typescript
|
|
114
|
+
interface BlogPost {
|
|
115
|
+
title: string;
|
|
116
|
+
slug: string;
|
|
117
|
+
body: string;
|
|
118
|
+
publishedAt: string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const { items } = await client.getEntries<BlogPost>('blog-post');
|
|
122
|
+
// items is BlogPost[]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export interface HTMLessClientOptions {
|
|
2
|
+
baseUrl: string;
|
|
3
|
+
apiToken?: string;
|
|
4
|
+
spaceId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PaginationMeta {
|
|
7
|
+
page: number;
|
|
8
|
+
limit: number;
|
|
9
|
+
total: number;
|
|
10
|
+
totalPages: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ListResponse<T> {
|
|
13
|
+
items: T[];
|
|
14
|
+
meta: PaginationMeta;
|
|
15
|
+
}
|
|
16
|
+
export interface ContentType {
|
|
17
|
+
id: string;
|
|
18
|
+
key: string;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string | null;
|
|
21
|
+
version: number;
|
|
22
|
+
fields: ContentTypeField[];
|
|
23
|
+
createdAt: string;
|
|
24
|
+
updatedAt: string;
|
|
25
|
+
}
|
|
26
|
+
export interface ContentTypeField {
|
|
27
|
+
id: string;
|
|
28
|
+
key: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
unique: boolean;
|
|
33
|
+
localized: boolean;
|
|
34
|
+
validations: unknown;
|
|
35
|
+
defaultValue: unknown;
|
|
36
|
+
enumValues: unknown;
|
|
37
|
+
referenceTarget: string | null;
|
|
38
|
+
sortOrder: number;
|
|
39
|
+
}
|
|
40
|
+
export interface Asset {
|
|
41
|
+
id: string;
|
|
42
|
+
filename: string;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
bytes: number;
|
|
45
|
+
width: number | null;
|
|
46
|
+
height: number | null;
|
|
47
|
+
alt: string | null;
|
|
48
|
+
caption: string | null;
|
|
49
|
+
storageKey: string;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
updatedAt: string;
|
|
52
|
+
}
|
|
53
|
+
export interface GetEntriesOptions {
|
|
54
|
+
slug?: string;
|
|
55
|
+
locale?: string;
|
|
56
|
+
filters?: Record<string, string>;
|
|
57
|
+
sort?: string;
|
|
58
|
+
fields?: string[];
|
|
59
|
+
include?: string[];
|
|
60
|
+
page?: number;
|
|
61
|
+
limit?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface GetEntryOptions {
|
|
64
|
+
fields?: string[];
|
|
65
|
+
include?: string[];
|
|
66
|
+
locale?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare class HTMLessClient {
|
|
69
|
+
private readonly baseUrl;
|
|
70
|
+
private readonly apiToken?;
|
|
71
|
+
private readonly spaceId;
|
|
72
|
+
constructor(options: HTMLessClientOptions);
|
|
73
|
+
getEntries<T = Record<string, unknown>>(typeKey: string, options?: GetEntriesOptions): Promise<ListResponse<T>>;
|
|
74
|
+
getEntry<T = Record<string, unknown>>(typeKey: string, id: string, options?: GetEntryOptions): Promise<T>;
|
|
75
|
+
getAsset(id: string): Promise<Asset>;
|
|
76
|
+
getTypes(): Promise<ContentType[]>;
|
|
77
|
+
getType(key: string): Promise<ContentType>;
|
|
78
|
+
getPreview<T = Record<string, unknown>>(typeKey: string, slug: string, previewToken: string): Promise<T>;
|
|
79
|
+
private request;
|
|
80
|
+
}
|
|
81
|
+
export declare class HTMLessError extends Error {
|
|
82
|
+
readonly status: number;
|
|
83
|
+
readonly body: string;
|
|
84
|
+
constructor(status: number, body: string);
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,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C,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,oBAAoB;IAQnC,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IA+BrB,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxC,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,CAAC,CAAC;IAaP,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAOpC,QAAQ,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAMlC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAO1C,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC1C,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,CAAC,CAAC;YA8BC,OAAO;CAmBtB;AAED,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,IAAI,EAAE,MAAM,CAAC;gBAEjB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAMzC"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// ─── HTMLess TypeScript SDK ─────────────────────────────────────────
|
|
2
|
+
// Zero dependencies beyond globalThis.fetch (Node 18+, all browsers).
|
|
3
|
+
export class HTMLessClient {
|
|
4
|
+
baseUrl;
|
|
5
|
+
apiToken;
|
|
6
|
+
spaceId;
|
|
7
|
+
constructor(options) {
|
|
8
|
+
this.baseUrl = options.baseUrl.replace(/\/+$/, '');
|
|
9
|
+
this.apiToken = options.apiToken;
|
|
10
|
+
this.spaceId = options.spaceId;
|
|
11
|
+
}
|
|
12
|
+
// ─── CDA Methods ───
|
|
13
|
+
async getEntries(typeKey, options) {
|
|
14
|
+
const params = new URLSearchParams();
|
|
15
|
+
if (options?.slug)
|
|
16
|
+
params.set('slug', options.slug);
|
|
17
|
+
if (options?.locale)
|
|
18
|
+
params.set('locale', options.locale);
|
|
19
|
+
if (options?.sort)
|
|
20
|
+
params.set('sort', options.sort);
|
|
21
|
+
if (options?.fields)
|
|
22
|
+
params.set('fields', options.fields.join(','));
|
|
23
|
+
if (options?.include)
|
|
24
|
+
params.set('include', options.include.join(','));
|
|
25
|
+
if (options?.page)
|
|
26
|
+
params.set('page', String(options.page));
|
|
27
|
+
if (options?.limit)
|
|
28
|
+
params.set('limit', String(options.limit));
|
|
29
|
+
if (options?.filters) {
|
|
30
|
+
for (const [key, value] of Object.entries(options.filters)) {
|
|
31
|
+
params.set(key, value);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const qs = params.toString();
|
|
35
|
+
const url = `${this.baseUrl}/api/cda/content/${typeKey}${qs ? `?${qs}` : ''}`;
|
|
36
|
+
const data = await this.request(url);
|
|
37
|
+
return {
|
|
38
|
+
items: data.items,
|
|
39
|
+
meta: data.pagination,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async getEntry(typeKey, id, options) {
|
|
43
|
+
const params = new URLSearchParams();
|
|
44
|
+
if (options?.fields)
|
|
45
|
+
params.set('fields', options.fields.join(','));
|
|
46
|
+
if (options?.include)
|
|
47
|
+
params.set('include', options.include.join(','));
|
|
48
|
+
if (options?.locale)
|
|
49
|
+
params.set('locale', options.locale);
|
|
50
|
+
const qs = params.toString();
|
|
51
|
+
const url = `${this.baseUrl}/api/cda/content/${typeKey}/${id}${qs ? `?${qs}` : ''}`;
|
|
52
|
+
return this.request(url);
|
|
53
|
+
}
|
|
54
|
+
async getAsset(id) {
|
|
55
|
+
const url = `${this.baseUrl}/api/cda/assets/${id}`;
|
|
56
|
+
return this.request(url);
|
|
57
|
+
}
|
|
58
|
+
// ─── Schema Methods ───
|
|
59
|
+
async getTypes() {
|
|
60
|
+
const url = `${this.baseUrl}/api/cda/schemas/types`;
|
|
61
|
+
const data = await this.request(url);
|
|
62
|
+
return data.items;
|
|
63
|
+
}
|
|
64
|
+
async getType(key) {
|
|
65
|
+
const url = `${this.baseUrl}/api/cda/schemas/types/${key}`;
|
|
66
|
+
return this.request(url);
|
|
67
|
+
}
|
|
68
|
+
// ─── Preview Methods ───
|
|
69
|
+
async getPreview(typeKey, slug, previewToken) {
|
|
70
|
+
const params = new URLSearchParams();
|
|
71
|
+
params.set('slug', slug);
|
|
72
|
+
const url = `${this.baseUrl}/api/preview/content/${typeKey}?${params.toString()}`;
|
|
73
|
+
const response = await fetch(url, {
|
|
74
|
+
headers: {
|
|
75
|
+
'Authorization': `Bearer ${previewToken}`,
|
|
76
|
+
'X-Space-Id': this.spaceId,
|
|
77
|
+
'Accept': 'application/json',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
if (!response.ok) {
|
|
81
|
+
const body = await response.text();
|
|
82
|
+
throw new HTMLessError(response.status, body);
|
|
83
|
+
}
|
|
84
|
+
const data = await response.json();
|
|
85
|
+
if (data.items && data.items.length > 0) {
|
|
86
|
+
return data.items[0];
|
|
87
|
+
}
|
|
88
|
+
throw new HTMLessError(404, 'Preview entry not found');
|
|
89
|
+
}
|
|
90
|
+
// ─── Internal ───
|
|
91
|
+
async request(url) {
|
|
92
|
+
const headers = {
|
|
93
|
+
'X-Space-Id': this.spaceId,
|
|
94
|
+
'Accept': 'application/json',
|
|
95
|
+
};
|
|
96
|
+
if (this.apiToken) {
|
|
97
|
+
headers['Authorization'] = `Bearer ${this.apiToken}`;
|
|
98
|
+
}
|
|
99
|
+
const response = await fetch(url, { headers });
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
const body = await response.text();
|
|
102
|
+
throw new HTMLessError(response.status, body);
|
|
103
|
+
}
|
|
104
|
+
return response.json();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export class HTMLessError extends Error {
|
|
108
|
+
status;
|
|
109
|
+
body;
|
|
110
|
+
constructor(status, body) {
|
|
111
|
+
super(`HTMLess API error ${status}: ${body}`);
|
|
112
|
+
this.name = 'HTMLessError';
|
|
113
|
+
this.status = status;
|
|
114
|
+
this.body = body;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,sEAAsE;AA6EtE,MAAM,OAAO,aAAa;IACP,OAAO,CAAS;IAChB,QAAQ,CAAU;IAClB,OAAO,CAAS;IAEjC,YAAY,OAA6B;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACnD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;IAED,sBAAsB;IAEtB,KAAK,CAAC,UAAU,CACd,OAAe,EACf,OAA2B;QAE3B,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QAErC,IAAI,OAAO,EAAE,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAAI,OAAO,EAAE,MAAM;YAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,OAAO,EAAE,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACpD,IAA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AAQ,EAAE,CAAC;QACvD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QAE/C,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,IAAI,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrB,MAAM,CAAS;IACf,IAAI,CAAS;IAE7B,YAAY,MAAc,EAAE,IAAY;QACtC,KAAK,CAAC,qBAAqB,MAAM,KAAK,IAAI,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@htmless/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for HTMLess headless CMS",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/client.js",
|
|
7
|
+
"types": "dist/client.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/client.js",
|
|
11
|
+
"types": "./dist/client.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist/",
|
|
16
|
+
"package.json",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"htmless",
|
|
28
|
+
"headless-cms",
|
|
29
|
+
"sdk",
|
|
30
|
+
"typescript",
|
|
31
|
+
"content-api"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/HTMLess-CMS/HTMLess",
|
|
36
|
+
"directory": "packages/sdk"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://htmless.com",
|
|
39
|
+
"author": "HTMLess <hello@htmless.com>",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"typescript": "^5.9.3"
|
|
43
|
+
}
|
|
44
|
+
}
|