@dotcms/client 0.0.1-beta.24 → 0.0.1-beta.26

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 CHANGED
@@ -1,11 +1,14 @@
1
1
  {
2
2
  "name": "@dotcms/client",
3
- "version": "0.0.1-beta.24",
3
+ "version": "0.0.1-beta.26",
4
4
  "description": "Official JavaScript library for interacting with DotCMS REST APIs.",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/dotCMS/core.git#main"
8
8
  },
9
+ "devDependencies": {
10
+ "@dotcms/types": "next"
11
+ },
9
12
  "scripts": {
10
13
  "build": "nx run sdk-client:build:js; cd ../../../../dotCMS/src/main/webapp/html/js/editor-js; rm -rf src package.json *.esm.d.ts"
11
14
  },
@@ -29,12 +32,6 @@
29
32
  "types": "./next.esm.d.ts",
30
33
  "import": "./next.cjs.mjs",
31
34
  "default": "./next.cjs.js"
32
- },
33
- "./types": {
34
- "module": "./types.esm.js",
35
- "types": "./types.esm.d.ts",
36
- "import": "./types.cjs.mjs",
37
- "default": "./types.cjs.js"
38
35
  }
39
36
  },
40
37
  "typesVersions": {
@@ -44,9 +41,6 @@
44
41
  ],
45
42
  "next": [
46
43
  "./src/next.d.ts"
47
- ],
48
- "types": [
49
- "./src/types.d.ts"
50
44
  ]
51
45
  }
52
46
  },
@@ -1,5 +1,5 @@
1
+ import { DotCMSPageAsset, DotCMSGraphQLPageResponse } from '@dotcms/types';
1
2
  import { DotCMSClientConfig, RequestOptions } from '../client';
2
- import { DotCMSGraphQLPageResponse, DotCMSPageAsset } from '../models/types';
3
3
  /**
4
4
  * The parameters for the Page API.
5
5
  * @public
@@ -166,7 +166,7 @@ export declare class PageClient {
166
166
  * });
167
167
  *```
168
168
  */
169
- get(url: string, options?: PageRequestParams): Promise<DotCMSPageAsset>;
170
- get(url: string, options?: GraphQLPageOptions): Promise<DotCMSGraphQLPageResponse>;
169
+ get<T extends DotCMSPageAsset | DotCMSGraphQLPageResponse = DotCMSPageAsset>(url: string, options?: PageRequestParams): Promise<T>;
170
+ get<T extends DotCMSPageAsset | DotCMSGraphQLPageResponse = DotCMSGraphQLPageResponse>(url: string, options?: GraphQLPageOptions): Promise<T>;
171
171
  }
172
172
  export {};
@@ -1,14 +1,4 @@
1
- /**
2
- * Represents the response from a GraphQL query for a page.
3
- *
4
- * @interface GraphQLPageResponse
5
- * @property {Record<string, unknown>} page - The main page data.
6
- * @property {unknown} [key: string] - Additional properties that may be included in the response.
7
- */
8
- interface GraphQLPageResponse {
9
- page: Record<string, unknown>;
10
- [key: string]: unknown;
11
- }
1
+ import { DotCMSGraphQLPageResponse } from '@dotcms/types';
12
2
  /**
13
3
  * Transforms a GraphQL Page response to a Page Entity.
14
4
  *
@@ -20,5 +10,4 @@ interface GraphQLPageResponse {
20
10
  * const pageEntity = graphqlToPageEntity(graphQLPageResponse);
21
11
  * ```
22
12
  */
23
- export declare const graphqlToPageEntity: (graphQLPageResponse: GraphQLPageResponse) => any;
24
- export {};
13
+ export declare const graphqlToPageEntity: (graphQLPageResponse: DotCMSGraphQLPageResponse) => any;
package/transforms.cjs.js CHANGED
@@ -1064,6 +1064,7 @@ const ErrorMessages = {
1064
1064
  503: 'Service Unavailable. Try again later.'
1065
1065
  };
1066
1066
 
1067
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1067
1068
  /**
1068
1069
  * Transforms a GraphQL Page response to a Page Entity.
1069
1070
  *
package/transforms.esm.js CHANGED
@@ -1062,6 +1062,7 @@ const ErrorMessages = {
1062
1062
  503: 'Service Unavailable. Try again later.'
1063
1063
  };
1064
1064
 
1065
+ /* eslint-disable @typescript-eslint/no-explicit-any */
1065
1066
  /**
1066
1067
  * Transforms a GraphQL Page response to a Page Entity.
1067
1068
  *
@@ -1,576 +0,0 @@
1
- import { Contentlet } from '../content/shared/types';
2
- /**
3
- * Represents a DotCMS page asset with its associated data and configurations
4
- *
5
- * @template T - Type parameter for URL content mapping, defaults to unknown
6
- * @interface DotCMSPageAsset
7
- *
8
- * @example
9
- * // Using DotCMSPageAsset without urlContentMap type
10
- *
11
- * const basicPageAsset: DotCMSPageAsset = {
12
- * canCreateTemplate: true,
13
- * containers: {},
14
- * layout: {...},
15
- * page: {...},
16
- * site: {...},
17
- * template: {...},
18
- * ...
19
- * };
20
- *
21
- * @example
22
- * // Using DotCMSPageAsset with urlContentMap type
23
- * interface SomeContentlet {
24
- * urlContentMap: {
25
- * slug: string;
26
- * category: string;
27
- * }
28
- * }
29
- *
30
- * const pageWithUrlMap: DotCMSPageAsset<{ urlContentMap: SomeContentlet }> = {
31
- * containers: {},
32
- * layout: {...},
33
- * page: {...},
34
- * site: {...},
35
- * template: {...},
36
- * // This is the contentlet SomeContentlet type
37
- * urlContentMap: {
38
- * slug: "/blog/post-1",
39
- * category: "blog"
40
- * }
41
- * };
42
- */
43
- export interface DotCMSPageAsset<T = unknown> {
44
- /** Whether a template can be created for this page */
45
- canCreateTemplate?: boolean;
46
- /** Map of containers on the page indexed by container ID */
47
- containers: {
48
- [key: string]: DotCMSPageAssetContainer;
49
- };
50
- /** Layout configuration for the page */
51
- layout: DotCMSLayout;
52
- /** Page metadata and properties */
53
- page: DotCMSPage;
54
- /** Site information */
55
- site: DotCMSSite;
56
- /** Template configuration */
57
- template: DotCMSTemplate;
58
- /** View configuration */
59
- viewAs?: DotCMSViewAs;
60
- /** Vanity URL configuration if applicable */
61
- vanityUrl?: DotCMSVanityUrl;
62
- /** Content mapping for the page URL */
63
- urlContentMap?: T extends {
64
- urlContentMap: infer U;
65
- } ? Contentlet<U> : Contentlet<T>;
66
- /** The parameters used to fetch the page */
67
- params?: Record<string, unknown>;
68
- }
69
- export interface DotPageAssetLayoutRow {
70
- identifier: number;
71
- value?: string;
72
- id?: string;
73
- columns: DotPageAssetLayoutColumn[];
74
- styleClass?: string;
75
- }
76
- export interface DotCMSVanityUrl {
77
- pattern: string;
78
- vanityUrlId: string;
79
- url: string;
80
- siteId: string;
81
- languageId: number;
82
- forwardTo: string;
83
- response: number;
84
- order: number;
85
- temporaryRedirect: boolean;
86
- permanentRedirect: boolean;
87
- forward: boolean;
88
- }
89
- export interface DotPageAssetLayoutColumn {
90
- preview: boolean;
91
- containers: DotCMSColumnContainer[];
92
- widthPercent: number;
93
- width: number;
94
- leftOffset: number;
95
- left: number;
96
- styleClass?: string;
97
- }
98
- export interface DotCMSColumnContainer {
99
- identifier: string;
100
- uuid: string;
101
- historyUUIDs: string[];
102
- }
103
- export interface DotCMSPageAssetContainer {
104
- container: DotCMSContainer;
105
- containerStructures: DotCMSContainerStructure[];
106
- contentlets: {
107
- [key: string]: DotCMSContentlet[];
108
- };
109
- }
110
- export interface DotCMSContainer {
111
- identifier: string;
112
- uuid: string;
113
- iDate: number;
114
- type: string;
115
- owner?: string;
116
- inode: string;
117
- source: string;
118
- title: string;
119
- friendlyName: string;
120
- modDate: number;
121
- modUser: string;
122
- sortOrder: number;
123
- showOnMenu: boolean;
124
- code?: string;
125
- maxContentlets: number;
126
- useDiv: boolean;
127
- sortContentletsBy?: string;
128
- preLoop: string;
129
- postLoop: string;
130
- staticify: boolean;
131
- luceneQuery?: string;
132
- notes: string;
133
- languageId?: number;
134
- path?: string;
135
- live: boolean;
136
- locked: boolean;
137
- working: boolean;
138
- deleted: boolean;
139
- name: string;
140
- archived: boolean;
141
- permissionId: string;
142
- versionId: string;
143
- versionType: string;
144
- permissionType: string;
145
- categoryId: string;
146
- idate: number;
147
- new: boolean;
148
- acceptTypes: string;
149
- contentlets: DotCMSContentlet[];
150
- parentPermissionable: DotCMSSiteParentPermissionable;
151
- }
152
- export interface DotCMSContentlet {
153
- archived: boolean;
154
- baseType: string;
155
- deleted?: boolean;
156
- binary?: string;
157
- binaryContentAsset?: string;
158
- binaryVersion?: string;
159
- contentType: string;
160
- file?: string;
161
- folder: string;
162
- hasLiveVersion?: boolean;
163
- hasTitleImage: boolean;
164
- host: string;
165
- hostName: string;
166
- identifier: string;
167
- inode: string;
168
- image?: any;
169
- languageId: number;
170
- language?: string;
171
- live: boolean;
172
- locked: boolean;
173
- mimeType?: string;
174
- modDate: string;
175
- modUser: string;
176
- modUserName: string;
177
- owner: string;
178
- sortOrder: number;
179
- stInode: string;
180
- title: string;
181
- titleImage: string;
182
- text?: string;
183
- url: string;
184
- working: boolean;
185
- body?: string;
186
- contentTypeIcon?: string;
187
- variant?: string;
188
- __icon__?: string;
189
- [key: string]: any;
190
- }
191
- export interface DotcmsNavigationItem {
192
- code?: any;
193
- folder: string;
194
- children?: DotcmsNavigationItem[];
195
- host: string;
196
- languageId: number;
197
- href: string;
198
- title: string;
199
- type: string;
200
- hash: number;
201
- target: string;
202
- order: number;
203
- }
204
- interface DotCMSTemplate {
205
- iDate: number;
206
- type: string;
207
- owner: string;
208
- inode: string;
209
- identifier: string;
210
- source: string;
211
- title: string;
212
- friendlyName: string;
213
- modDate: number;
214
- modUser: string;
215
- sortOrder: number;
216
- showOnMenu: boolean;
217
- image: string;
218
- drawed: boolean;
219
- drawedBody: string;
220
- theme: string;
221
- anonymous: boolean;
222
- template: boolean;
223
- name: string;
224
- live: boolean;
225
- archived: boolean;
226
- locked: boolean;
227
- working: boolean;
228
- permissionId: string;
229
- versionId: string;
230
- versionType: string;
231
- deleted: boolean;
232
- permissionType: string;
233
- categoryId: string;
234
- idate: number;
235
- new: boolean;
236
- canEdit: boolean;
237
- }
238
- interface DotCMSPage {
239
- template: string;
240
- modDate: number;
241
- metadata: string;
242
- cachettl: string;
243
- pageURI: string;
244
- title: string;
245
- type: string;
246
- showOnMenu: string;
247
- httpsRequired: boolean;
248
- inode: string;
249
- disabledWYSIWYG: any[];
250
- seokeywords: string;
251
- host: string;
252
- lastReview: number;
253
- working: boolean;
254
- locked: boolean;
255
- stInode: string;
256
- friendlyName: string;
257
- live: boolean;
258
- owner: string;
259
- identifier: string;
260
- nullProperties: any[];
261
- friendlyname: string;
262
- pagemetadata: string;
263
- languageId: number;
264
- url: string;
265
- seodescription: string;
266
- modUserName: string;
267
- folder: string;
268
- deleted: boolean;
269
- sortOrder: number;
270
- modUser: string;
271
- pageUrl: string;
272
- workingInode: string;
273
- shortyWorking: string;
274
- canEdit: boolean;
275
- canRead: boolean;
276
- canLock: boolean;
277
- lockedOn: number;
278
- lockedBy: string;
279
- lockedByName: string;
280
- liveInode: string;
281
- shortyLive: string;
282
- }
283
- interface DotCMSViewAs {
284
- language: {
285
- id: number;
286
- languageCode: string;
287
- countryCode: string;
288
- language: string;
289
- country: string;
290
- };
291
- mode: string;
292
- }
293
- interface DotCMSLayout {
294
- pageWidth: string;
295
- width: string;
296
- layout: string;
297
- title: string;
298
- header: boolean;
299
- footer: boolean;
300
- body: DotPageAssetLayoutBody;
301
- sidebar: DotPageAssetLayoutSidebar;
302
- }
303
- interface DotCMSContainerStructure {
304
- id: string;
305
- structureId: string;
306
- containerInode: string;
307
- containerId: string;
308
- code: string;
309
- contentTypeVar: string;
310
- }
311
- interface DotPageAssetLayoutSidebar {
312
- preview: boolean;
313
- containers: DotCMSContainer[];
314
- location: string;
315
- widthPercent: number;
316
- width: string;
317
- }
318
- interface DotPageAssetLayoutBody {
319
- rows: DotPageAssetLayoutRow[];
320
- }
321
- interface DotCMSSite {
322
- lowIndexPriority: boolean;
323
- name: string;
324
- default: boolean;
325
- aliases: string;
326
- parent: boolean;
327
- tagStorage: string;
328
- systemHost: boolean;
329
- inode: string;
330
- versionType: string;
331
- structureInode: string;
332
- hostname: string;
333
- hostThumbnail?: any;
334
- owner: string;
335
- permissionId: string;
336
- permissionType: string;
337
- type: string;
338
- identifier: string;
339
- modDate: number;
340
- host: string;
341
- live: boolean;
342
- indexPolicy: string;
343
- categoryId: string;
344
- actionId?: any;
345
- new: boolean;
346
- archived: boolean;
347
- locked: boolean;
348
- disabledWysiwyg: any[];
349
- modUser: string;
350
- working: boolean;
351
- titleImage: {
352
- present: boolean;
353
- };
354
- folder: string;
355
- htmlpage: boolean;
356
- fileAsset: boolean;
357
- vanityUrl: boolean;
358
- keyValue: boolean;
359
- structure?: DotCMSSiteStructure;
360
- title: string;
361
- languageId: number;
362
- indexPolicyDependencies: string;
363
- contentTypeId: string;
364
- versionId: string;
365
- lastReview: number;
366
- nextReview?: any;
367
- reviewInterval?: any;
368
- sortOrder: number;
369
- contentType: DotCMSSiteContentType;
370
- }
371
- interface DotCMSSiteContentType {
372
- owner?: any;
373
- parentPermissionable: DotCMSSiteParentPermissionable;
374
- permissionId: string;
375
- permissionType: string;
376
- }
377
- export interface DotCMSSiteParentPermissionable {
378
- Inode: string;
379
- Identifier: string;
380
- permissionByIdentifier: boolean;
381
- type: string;
382
- owner?: any;
383
- identifier: string;
384
- permissionId: string;
385
- parentPermissionable?: any;
386
- permissionType: string;
387
- inode: string;
388
- childrenPermissionable?: any;
389
- variantId?: string;
390
- }
391
- interface DotCMSSiteStructure {
392
- iDate: number;
393
- type: string;
394
- owner?: any;
395
- inode: string;
396
- identifier: string;
397
- name: string;
398
- description: string;
399
- defaultStructure: boolean;
400
- reviewInterval?: any;
401
- reviewerRole?: any;
402
- pagedetail?: any;
403
- structureType: number;
404
- fixed: boolean;
405
- system: boolean;
406
- velocityVarName: string;
407
- urlMapPattern?: any;
408
- host: string;
409
- folder: string;
410
- publishDateVar?: any;
411
- expireDateVar?: any;
412
- modDate: number;
413
- fields: DotCMSSiteField[];
414
- widget: boolean;
415
- detailPage?: any;
416
- fieldsBySortOrder: DotCMSSiteField[];
417
- form: boolean;
418
- htmlpageAsset: boolean;
419
- content: boolean;
420
- fileAsset: boolean;
421
- persona: boolean;
422
- permissionId: string;
423
- permissionType: string;
424
- live: boolean;
425
- categoryId: string;
426
- idate: number;
427
- new: boolean;
428
- archived: boolean;
429
- locked: boolean;
430
- modUser: string;
431
- working: boolean;
432
- title: string;
433
- versionId: string;
434
- versionType: string;
435
- }
436
- interface DotCMSSiteField {
437
- iDate: number;
438
- type: string;
439
- owner?: any;
440
- inode: string;
441
- identifier: string;
442
- structureInode: string;
443
- fieldName: string;
444
- fieldType: string;
445
- fieldRelationType?: any;
446
- fieldContentlet: string;
447
- required: boolean;
448
- velocityVarName: string;
449
- sortOrder: number;
450
- values?: any;
451
- regexCheck?: any;
452
- hint?: any;
453
- defaultValue?: any;
454
- indexed: boolean;
455
- listed: boolean;
456
- fixed: boolean;
457
- readOnly: boolean;
458
- searchable: boolean;
459
- unique: boolean;
460
- modDate: number;
461
- dataType: string;
462
- live: boolean;
463
- categoryId: string;
464
- idate: number;
465
- new: boolean;
466
- archived: boolean;
467
- locked: boolean;
468
- modUser: string;
469
- working: boolean;
470
- permissionId: string;
471
- parentPermissionable?: any;
472
- permissionType: string;
473
- title: string;
474
- versionId: string;
475
- versionType: string;
476
- }
477
- /**
478
- * Represents a basic page structure returned from GraphQL queries
479
- */
480
- export interface DotCMSBasicGraphQLPage {
481
- publishDate: string;
482
- type: string;
483
- httpsRequired: boolean;
484
- inode: string;
485
- path: string;
486
- identifier: string;
487
- hasTitleImage: boolean;
488
- sortOrder: number;
489
- extension: string;
490
- canRead: boolean;
491
- pageURI: string;
492
- canEdit: boolean;
493
- archived: boolean;
494
- friendlyName: string;
495
- workingInode: string;
496
- url: string;
497
- hasLiveVersion: boolean;
498
- deleted: boolean;
499
- pageUrl: string;
500
- shortyWorking: string;
501
- mimeType: string;
502
- locked: boolean;
503
- stInode: string;
504
- contentType: string;
505
- creationDate: string;
506
- liveInode: string;
507
- name: string;
508
- shortyLive: string;
509
- modDate: string;
510
- title: string;
511
- baseType: string;
512
- working: boolean;
513
- canLock: boolean;
514
- live: boolean;
515
- isContentlet: boolean;
516
- statusIcons: string;
517
- conLanguage: {
518
- id: number;
519
- language: string;
520
- languageCode: string;
521
- };
522
- template: {
523
- drawed: boolean;
524
- };
525
- containers: {
526
- path?: string;
527
- identifier: string;
528
- maxContentlets?: number;
529
- containerStructures?: {
530
- contentTypeVar: string;
531
- }[];
532
- containerContentlets?: {
533
- uuid: string;
534
- contentlets: DotCMSContentlet[];
535
- }[];
536
- };
537
- layout: DotCMSLayout;
538
- viewAs: DotCMSViewAs;
539
- }
540
- export interface DotCMSPageGraphQLContainer {
541
- path: string;
542
- identifier: string;
543
- maxContentlets?: number;
544
- containerStructures: DotCMSContainerStructure[];
545
- containerContentlets: DotCMSPageContainerContentlets[];
546
- }
547
- export interface DotCMSPageContainerContentlets {
548
- uuid: string;
549
- contentlets: DotCMSContentlet[];
550
- }
551
- export interface DotCMSGraphQLError {
552
- message: string;
553
- locations: {
554
- line: number;
555
- column: number;
556
- }[];
557
- extensions: {
558
- classification: string;
559
- };
560
- }
561
- /**
562
- * Represents the complete response from a GraphQL page query
563
- *
564
- * @template TContent - The type of the content data
565
- * @template TNav - The type of the navigation data
566
- */
567
- export interface DotCMSGraphQLPageResponse<TContent = Record<string, any>> {
568
- page: DotCMSBasicGraphQLPage;
569
- content?: TContent;
570
- errors?: DotCMSGraphQLError;
571
- graphql: {
572
- query: string;
573
- variables: Record<string, unknown>;
574
- };
575
- }
576
- export {};
package/src/types.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { DotCMSPageAsset, DotCMSGraphQLPageResponse } from './lib/client/models/types';
2
- export { Contentlet } from './lib/client/content/shared/types';
package/types.cjs.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/types";
@@ -1 +0,0 @@
1
- exports._default = require('./types.cjs.js').default;
package/types.cjs.js DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
package/types.cjs.mjs DELETED
@@ -1,2 +0,0 @@
1
- export * from './types.cjs.js';
2
- export { _default as default } from './types.cjs.default.js';
package/types.esm.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./src/types";
package/types.esm.js DELETED
@@ -1 +0,0 @@
1
-