@commercetools-demo/puck-types 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/dist/index.d.mts +180 -0
- package/dist/index.d.ts +180 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +34 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Data } from '@measured/puck';
|
|
2
|
+
export { Field, Fields, ComponentConfig as PuckComponentConfig, ComponentData as PuckComponentData, Config as PuckConfig, Data as PuckData } from '@measured/puck';
|
|
3
|
+
|
|
4
|
+
interface PuckStateInfo {
|
|
5
|
+
draft?: PuckPageValue;
|
|
6
|
+
published?: PuckPageValue;
|
|
7
|
+
}
|
|
8
|
+
interface PuckPageMeta {
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The value stored in a CommerceTools custom object for a puck page.
|
|
15
|
+
* puckData is Puck's native Data format stored verbatim.
|
|
16
|
+
*/
|
|
17
|
+
interface PuckPageValue {
|
|
18
|
+
key: string;
|
|
19
|
+
businessUnitKey: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/** URL path, e.g. "/home". Used for slug-based queries. */
|
|
22
|
+
slug: string;
|
|
23
|
+
puckData: Data;
|
|
24
|
+
meta?: PuckPageMeta;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
/** A puck page as returned by the list endpoint (includes state info). */
|
|
29
|
+
interface PuckPageListItem {
|
|
30
|
+
id: string;
|
|
31
|
+
version: number;
|
|
32
|
+
container: string;
|
|
33
|
+
key: string;
|
|
34
|
+
value: PuckPageValue;
|
|
35
|
+
states: PuckStateInfo;
|
|
36
|
+
}
|
|
37
|
+
/** A single puck page with full state details. */
|
|
38
|
+
interface PuckPageWithStates {
|
|
39
|
+
id: string;
|
|
40
|
+
version: number;
|
|
41
|
+
container: string;
|
|
42
|
+
key: string;
|
|
43
|
+
value: PuckPageValue;
|
|
44
|
+
states: PuckStateInfo;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PuckPageState {
|
|
48
|
+
key: string;
|
|
49
|
+
businessUnitKey: string;
|
|
50
|
+
states: PuckStateInfo;
|
|
51
|
+
}
|
|
52
|
+
interface PuckPageVersionEntry extends PuckPageValue {
|
|
53
|
+
id: string;
|
|
54
|
+
timestamp: string;
|
|
55
|
+
}
|
|
56
|
+
interface PuckPageVersion {
|
|
57
|
+
key: string;
|
|
58
|
+
businessUnitKey: string;
|
|
59
|
+
versions: PuckPageVersionEntry[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface PuckContentMeta {
|
|
63
|
+
description?: string;
|
|
64
|
+
tags?: string[];
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
interface PuckContentValue {
|
|
68
|
+
key: string;
|
|
69
|
+
businessUnitKey: string;
|
|
70
|
+
name: string;
|
|
71
|
+
/** Free-form tag, e.g. "hero", "banner". No schema enforcement. */
|
|
72
|
+
contentType: string;
|
|
73
|
+
/** Puck native data — edited visually with the Puck editor. */
|
|
74
|
+
data: Data;
|
|
75
|
+
meta?: PuckContentMeta;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
interface PuckContentStateInfo {
|
|
80
|
+
draft?: PuckContentValue;
|
|
81
|
+
published?: PuckContentValue;
|
|
82
|
+
}
|
|
83
|
+
/** A puck content item as returned by the list endpoint (includes state info). */
|
|
84
|
+
interface PuckContentListItem {
|
|
85
|
+
id: string;
|
|
86
|
+
version: number;
|
|
87
|
+
container: string;
|
|
88
|
+
key: string;
|
|
89
|
+
value: PuckContentValue;
|
|
90
|
+
states: PuckContentStateInfo;
|
|
91
|
+
}
|
|
92
|
+
/** A single puck content item with full state details. */
|
|
93
|
+
interface PuckContentWithStates {
|
|
94
|
+
id: string;
|
|
95
|
+
version: number;
|
|
96
|
+
container: string;
|
|
97
|
+
key: string;
|
|
98
|
+
value: PuckContentValue;
|
|
99
|
+
states: PuckContentStateInfo;
|
|
100
|
+
}
|
|
101
|
+
interface PuckContentState {
|
|
102
|
+
key: string;
|
|
103
|
+
businessUnitKey: string;
|
|
104
|
+
states: PuckContentStateInfo;
|
|
105
|
+
}
|
|
106
|
+
interface PuckContentVersionEntry extends PuckContentValue {
|
|
107
|
+
id: string;
|
|
108
|
+
timestamp: string;
|
|
109
|
+
}
|
|
110
|
+
interface PuckContentVersion {
|
|
111
|
+
key: string;
|
|
112
|
+
businessUnitKey: string;
|
|
113
|
+
versions: PuckContentVersionEntry[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface MediaFile {
|
|
117
|
+
url: string;
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
isImage: boolean;
|
|
122
|
+
createdAt: Date | string;
|
|
123
|
+
size?: number;
|
|
124
|
+
}
|
|
125
|
+
interface MediaLibraryPagination {
|
|
126
|
+
totalItems: number;
|
|
127
|
+
totalPages: number;
|
|
128
|
+
currentPage: number;
|
|
129
|
+
limit: number;
|
|
130
|
+
}
|
|
131
|
+
interface MediaLibraryResult {
|
|
132
|
+
files: MediaFile[];
|
|
133
|
+
pagination: MediaLibraryPagination;
|
|
134
|
+
}
|
|
135
|
+
/** Generic wrapper representing a CommerceTools custom object. */
|
|
136
|
+
interface CtCustomObject<T> {
|
|
137
|
+
id: string;
|
|
138
|
+
version: number;
|
|
139
|
+
container: string;
|
|
140
|
+
key: string;
|
|
141
|
+
value: T;
|
|
142
|
+
createdAt: string;
|
|
143
|
+
lastModifiedAt: string;
|
|
144
|
+
}
|
|
145
|
+
interface CreatePuckPageInput {
|
|
146
|
+
name: string;
|
|
147
|
+
slug: string;
|
|
148
|
+
puckData?: Data;
|
|
149
|
+
meta?: PuckPageMeta;
|
|
150
|
+
}
|
|
151
|
+
interface UpdatePuckPageInput {
|
|
152
|
+
name?: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
puckData?: Data;
|
|
155
|
+
meta?: PuckPageMeta;
|
|
156
|
+
}
|
|
157
|
+
type PuckPageResponse = CtCustomObject<PuckPageValue>;
|
|
158
|
+
type PuckPageListResponse = PuckPageListItem[];
|
|
159
|
+
type PuckPageWithStatesResponse = PuckPageWithStates;
|
|
160
|
+
type PuckPageStateResponse = PuckPageState;
|
|
161
|
+
type PuckPageVersionResponse = PuckPageVersion;
|
|
162
|
+
interface CreatePuckContentInput {
|
|
163
|
+
name: string;
|
|
164
|
+
contentType: string;
|
|
165
|
+
data?: Data;
|
|
166
|
+
meta?: PuckContentMeta;
|
|
167
|
+
}
|
|
168
|
+
interface UpdatePuckContentInput {
|
|
169
|
+
name?: string;
|
|
170
|
+
contentType?: string;
|
|
171
|
+
data?: Data;
|
|
172
|
+
meta?: PuckContentMeta;
|
|
173
|
+
}
|
|
174
|
+
type PuckContentResponse = CtCustomObject<PuckContentValue>;
|
|
175
|
+
type PuckContentListResponse = PuckContentListItem[];
|
|
176
|
+
type PuckContentWithStatesResponse = PuckContentWithStates;
|
|
177
|
+
type PuckContentStateResponse = PuckContentState;
|
|
178
|
+
type PuckContentVersionResponse = PuckContentVersion;
|
|
179
|
+
|
|
180
|
+
export type { CreatePuckContentInput, CreatePuckPageInput, CtCustomObject, MediaFile, MediaLibraryPagination, MediaLibraryResult, PuckContentListItem, PuckContentListResponse, PuckContentMeta, PuckContentResponse, PuckContentState, PuckContentStateInfo, PuckContentStateResponse, PuckContentValue, PuckContentVersion, PuckContentVersionEntry, PuckContentVersionResponse, PuckContentWithStates, PuckContentWithStatesResponse, PuckPageListItem, PuckPageListResponse, PuckPageMeta, PuckPageResponse, PuckPageState, PuckPageStateResponse, PuckPageValue, PuckPageVersion, PuckPageVersionEntry, PuckPageVersionResponse, PuckPageWithStates, PuckPageWithStatesResponse, PuckStateInfo, UpdatePuckContentInput, UpdatePuckPageInput };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { Data } from '@measured/puck';
|
|
2
|
+
export { Field, Fields, ComponentConfig as PuckComponentConfig, ComponentData as PuckComponentData, Config as PuckConfig, Data as PuckData } from '@measured/puck';
|
|
3
|
+
|
|
4
|
+
interface PuckStateInfo {
|
|
5
|
+
draft?: PuckPageValue;
|
|
6
|
+
published?: PuckPageValue;
|
|
7
|
+
}
|
|
8
|
+
interface PuckPageMeta {
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The value stored in a CommerceTools custom object for a puck page.
|
|
15
|
+
* puckData is Puck's native Data format stored verbatim.
|
|
16
|
+
*/
|
|
17
|
+
interface PuckPageValue {
|
|
18
|
+
key: string;
|
|
19
|
+
businessUnitKey: string;
|
|
20
|
+
name: string;
|
|
21
|
+
/** URL path, e.g. "/home". Used for slug-based queries. */
|
|
22
|
+
slug: string;
|
|
23
|
+
puckData: Data;
|
|
24
|
+
meta?: PuckPageMeta;
|
|
25
|
+
createdAt: string;
|
|
26
|
+
updatedAt: string;
|
|
27
|
+
}
|
|
28
|
+
/** A puck page as returned by the list endpoint (includes state info). */
|
|
29
|
+
interface PuckPageListItem {
|
|
30
|
+
id: string;
|
|
31
|
+
version: number;
|
|
32
|
+
container: string;
|
|
33
|
+
key: string;
|
|
34
|
+
value: PuckPageValue;
|
|
35
|
+
states: PuckStateInfo;
|
|
36
|
+
}
|
|
37
|
+
/** A single puck page with full state details. */
|
|
38
|
+
interface PuckPageWithStates {
|
|
39
|
+
id: string;
|
|
40
|
+
version: number;
|
|
41
|
+
container: string;
|
|
42
|
+
key: string;
|
|
43
|
+
value: PuckPageValue;
|
|
44
|
+
states: PuckStateInfo;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PuckPageState {
|
|
48
|
+
key: string;
|
|
49
|
+
businessUnitKey: string;
|
|
50
|
+
states: PuckStateInfo;
|
|
51
|
+
}
|
|
52
|
+
interface PuckPageVersionEntry extends PuckPageValue {
|
|
53
|
+
id: string;
|
|
54
|
+
timestamp: string;
|
|
55
|
+
}
|
|
56
|
+
interface PuckPageVersion {
|
|
57
|
+
key: string;
|
|
58
|
+
businessUnitKey: string;
|
|
59
|
+
versions: PuckPageVersionEntry[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface PuckContentMeta {
|
|
63
|
+
description?: string;
|
|
64
|
+
tags?: string[];
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
interface PuckContentValue {
|
|
68
|
+
key: string;
|
|
69
|
+
businessUnitKey: string;
|
|
70
|
+
name: string;
|
|
71
|
+
/** Free-form tag, e.g. "hero", "banner". No schema enforcement. */
|
|
72
|
+
contentType: string;
|
|
73
|
+
/** Puck native data — edited visually with the Puck editor. */
|
|
74
|
+
data: Data;
|
|
75
|
+
meta?: PuckContentMeta;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
updatedAt: string;
|
|
78
|
+
}
|
|
79
|
+
interface PuckContentStateInfo {
|
|
80
|
+
draft?: PuckContentValue;
|
|
81
|
+
published?: PuckContentValue;
|
|
82
|
+
}
|
|
83
|
+
/** A puck content item as returned by the list endpoint (includes state info). */
|
|
84
|
+
interface PuckContentListItem {
|
|
85
|
+
id: string;
|
|
86
|
+
version: number;
|
|
87
|
+
container: string;
|
|
88
|
+
key: string;
|
|
89
|
+
value: PuckContentValue;
|
|
90
|
+
states: PuckContentStateInfo;
|
|
91
|
+
}
|
|
92
|
+
/** A single puck content item with full state details. */
|
|
93
|
+
interface PuckContentWithStates {
|
|
94
|
+
id: string;
|
|
95
|
+
version: number;
|
|
96
|
+
container: string;
|
|
97
|
+
key: string;
|
|
98
|
+
value: PuckContentValue;
|
|
99
|
+
states: PuckContentStateInfo;
|
|
100
|
+
}
|
|
101
|
+
interface PuckContentState {
|
|
102
|
+
key: string;
|
|
103
|
+
businessUnitKey: string;
|
|
104
|
+
states: PuckContentStateInfo;
|
|
105
|
+
}
|
|
106
|
+
interface PuckContentVersionEntry extends PuckContentValue {
|
|
107
|
+
id: string;
|
|
108
|
+
timestamp: string;
|
|
109
|
+
}
|
|
110
|
+
interface PuckContentVersion {
|
|
111
|
+
key: string;
|
|
112
|
+
businessUnitKey: string;
|
|
113
|
+
versions: PuckContentVersionEntry[];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface MediaFile {
|
|
117
|
+
url: string;
|
|
118
|
+
name: string;
|
|
119
|
+
title?: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
isImage: boolean;
|
|
122
|
+
createdAt: Date | string;
|
|
123
|
+
size?: number;
|
|
124
|
+
}
|
|
125
|
+
interface MediaLibraryPagination {
|
|
126
|
+
totalItems: number;
|
|
127
|
+
totalPages: number;
|
|
128
|
+
currentPage: number;
|
|
129
|
+
limit: number;
|
|
130
|
+
}
|
|
131
|
+
interface MediaLibraryResult {
|
|
132
|
+
files: MediaFile[];
|
|
133
|
+
pagination: MediaLibraryPagination;
|
|
134
|
+
}
|
|
135
|
+
/** Generic wrapper representing a CommerceTools custom object. */
|
|
136
|
+
interface CtCustomObject<T> {
|
|
137
|
+
id: string;
|
|
138
|
+
version: number;
|
|
139
|
+
container: string;
|
|
140
|
+
key: string;
|
|
141
|
+
value: T;
|
|
142
|
+
createdAt: string;
|
|
143
|
+
lastModifiedAt: string;
|
|
144
|
+
}
|
|
145
|
+
interface CreatePuckPageInput {
|
|
146
|
+
name: string;
|
|
147
|
+
slug: string;
|
|
148
|
+
puckData?: Data;
|
|
149
|
+
meta?: PuckPageMeta;
|
|
150
|
+
}
|
|
151
|
+
interface UpdatePuckPageInput {
|
|
152
|
+
name?: string;
|
|
153
|
+
slug?: string;
|
|
154
|
+
puckData?: Data;
|
|
155
|
+
meta?: PuckPageMeta;
|
|
156
|
+
}
|
|
157
|
+
type PuckPageResponse = CtCustomObject<PuckPageValue>;
|
|
158
|
+
type PuckPageListResponse = PuckPageListItem[];
|
|
159
|
+
type PuckPageWithStatesResponse = PuckPageWithStates;
|
|
160
|
+
type PuckPageStateResponse = PuckPageState;
|
|
161
|
+
type PuckPageVersionResponse = PuckPageVersion;
|
|
162
|
+
interface CreatePuckContentInput {
|
|
163
|
+
name: string;
|
|
164
|
+
contentType: string;
|
|
165
|
+
data?: Data;
|
|
166
|
+
meta?: PuckContentMeta;
|
|
167
|
+
}
|
|
168
|
+
interface UpdatePuckContentInput {
|
|
169
|
+
name?: string;
|
|
170
|
+
contentType?: string;
|
|
171
|
+
data?: Data;
|
|
172
|
+
meta?: PuckContentMeta;
|
|
173
|
+
}
|
|
174
|
+
type PuckContentResponse = CtCustomObject<PuckContentValue>;
|
|
175
|
+
type PuckContentListResponse = PuckContentListItem[];
|
|
176
|
+
type PuckContentWithStatesResponse = PuckContentWithStates;
|
|
177
|
+
type PuckContentStateResponse = PuckContentState;
|
|
178
|
+
type PuckContentVersionResponse = PuckContentVersion;
|
|
179
|
+
|
|
180
|
+
export type { CreatePuckContentInput, CreatePuckPageInput, CtCustomObject, MediaFile, MediaLibraryPagination, MediaLibraryResult, PuckContentListItem, PuckContentListResponse, PuckContentMeta, PuckContentResponse, PuckContentState, PuckContentStateInfo, PuckContentStateResponse, PuckContentValue, PuckContentVersion, PuckContentVersionEntry, PuckContentVersionResponse, PuckContentWithStates, PuckContentWithStatesResponse, PuckPageListItem, PuckPageListResponse, PuckPageMeta, PuckPageResponse, PuckPageState, PuckPageStateResponse, PuckPageValue, PuckPageVersion, PuckPageVersionEntry, PuckPageVersionResponse, PuckPageWithStates, PuckPageWithStatesResponse, PuckStateInfo, UpdatePuckContentInput, UpdatePuckPageInput };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/index.ts
|
|
17
|
+
var index_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(index_exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export type {\n PuckConfig,\n PuckComponentConfig,\n PuckData,\n PuckComponentData,\n Fields,\n Field,\n} from './puck-data.types';\n\nexport type {\n PuckPageMeta,\n PuckPageValue,\n PuckPageListItem,\n PuckPageWithStates,\n} from './puck-page.types';\n\nexport type {\n PuckStateInfo,\n PuckPageState,\n PuckPageVersionEntry,\n PuckPageVersion,\n} from './puck-state.types';\n\nexport type {\n PuckContentMeta,\n PuckContentValue,\n PuckContentStateInfo,\n PuckContentListItem,\n PuckContentWithStates,\n PuckContentState,\n PuckContentVersionEntry,\n PuckContentVersion,\n} from './puck-content.types';\n\nexport type {\n MediaFile,\n MediaLibraryPagination,\n MediaLibraryResult,\n CtCustomObject,\n CreatePuckPageInput,\n UpdatePuckPageInput,\n PuckPageResponse,\n PuckPageListResponse,\n PuckPageWithStatesResponse,\n PuckPageStateResponse,\n PuckPageVersionResponse,\n CreatePuckContentInput,\n UpdatePuckContentInput,\n PuckContentResponse,\n PuckContentListResponse,\n PuckContentWithStatesResponse,\n PuckContentStateResponse,\n PuckContentVersionResponse,\n} from './puck-api.types';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@commercetools-demo/puck-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript types for the Puck CMS integration",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.mjs",
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"package.json"
|
|
18
|
+
],
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsup",
|
|
24
|
+
"build:watch": "tsup --watch",
|
|
25
|
+
"typecheck": "tsc --noEmit"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@measured/puck": "^0.18.2"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"tsup": "^8.3.0",
|
|
32
|
+
"typescript": "^5.7.2"
|
|
33
|
+
}
|
|
34
|
+
}
|