@storyblok/management-api-client 0.2.3 → 1.0.0-alpha.1

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.
Files changed (74) hide show
  1. package/dist/client.cjs +190 -0
  2. package/dist/client.cjs.map +1 -0
  3. package/dist/client.d.cts +624 -0
  4. package/dist/client.d.mts +624 -0
  5. package/dist/client.mjs +189 -0
  6. package/dist/client.mjs.map +1 -0
  7. package/dist/error.cjs.map +1 -1
  8. package/dist/error.d.cts +12 -2
  9. package/dist/error.d.mts +12 -2
  10. package/dist/error.mjs.map +1 -1
  11. package/dist/generated/asset_folders/types.gen.d.cts +5 -31
  12. package/dist/generated/asset_folders/types.gen.d.mts +5 -31
  13. package/dist/generated/assets/types.gen.d.cts +1 -73
  14. package/dist/generated/assets/types.gen.d.mts +1 -73
  15. package/dist/generated/component_folders/types.gen.d.cts +29 -45
  16. package/dist/generated/component_folders/types.gen.d.mts +29 -45
  17. package/dist/generated/components/types.gen.d.cts +636 -465
  18. package/dist/generated/components/types.gen.d.mts +636 -465
  19. package/dist/generated/datasource_entries/types.gen.d.cts +6 -32
  20. package/dist/generated/datasource_entries/types.gen.d.mts +6 -32
  21. package/dist/generated/datasources/types.gen.d.cts +18 -39
  22. package/dist/generated/datasources/types.gen.d.mts +18 -39
  23. package/dist/generated/internal_tags/types.gen.d.cts +28 -32
  24. package/dist/generated/internal_tags/types.gen.d.mts +28 -32
  25. package/dist/generated/presets/types.gen.d.cts +53 -58
  26. package/dist/generated/presets/types.gen.d.mts +53 -58
  27. package/dist/generated/spaces/types.gen.d.cts +1 -41
  28. package/dist/generated/spaces/types.gen.d.mts +1 -41
  29. package/dist/generated/stories/types.gen.d.cts +206 -198
  30. package/dist/generated/stories/types.gen.d.mts +206 -198
  31. package/dist/generated/users/types.gen.d.cts +13 -112
  32. package/dist/generated/users/types.gen.d.mts +13 -112
  33. package/dist/index.cjs +3 -178
  34. package/dist/index.d.cts +8 -425
  35. package/dist/index.d.mts +8 -425
  36. package/dist/index.mjs +2 -176
  37. package/dist/resources/asset-folders.cjs.map +1 -1
  38. package/dist/resources/asset-folders.mjs.map +1 -1
  39. package/dist/resources/assets.cjs +11 -2
  40. package/dist/resources/assets.cjs.map +1 -1
  41. package/dist/resources/assets.d.cts +3 -2
  42. package/dist/resources/assets.d.mts +3 -2
  43. package/dist/resources/assets.mjs +11 -2
  44. package/dist/resources/assets.mjs.map +1 -1
  45. package/dist/resources/component-folders.cjs.map +1 -1
  46. package/dist/resources/component-folders.mjs.map +1 -1
  47. package/dist/resources/components.cjs.map +1 -1
  48. package/dist/resources/components.mjs.map +1 -1
  49. package/dist/resources/datasource-entries.cjs.map +1 -1
  50. package/dist/resources/datasource-entries.mjs.map +1 -1
  51. package/dist/resources/datasources.cjs.map +1 -1
  52. package/dist/resources/datasources.mjs.map +1 -1
  53. package/dist/resources/internal-tags.cjs.map +1 -1
  54. package/dist/resources/internal-tags.mjs.map +1 -1
  55. package/dist/resources/presets.cjs.map +1 -1
  56. package/dist/resources/presets.mjs.map +1 -1
  57. package/dist/resources/spaces.cjs.map +1 -1
  58. package/dist/resources/spaces.mjs.map +1 -1
  59. package/dist/resources/stories.cjs.map +1 -1
  60. package/dist/resources/stories.d.cts +105 -0
  61. package/dist/resources/stories.d.mts +105 -0
  62. package/dist/resources/stories.mjs.map +1 -1
  63. package/dist/resources/users.cjs.map +1 -1
  64. package/dist/resources/users.mjs.map +1 -1
  65. package/package.json +13 -10
  66. package/test/GUIDE.md +59 -0
  67. package/test/setup.e2e.ts +11 -0
  68. package/test/specs/mapi-round-trip.spec.e2e.ts +520 -0
  69. package/vitest.config.e2e.ts +26 -0
  70. package/vitest.config.ts +3 -0
  71. package/dist/index.cjs.map +0 -1
  72. package/dist/index.mjs.map +0 -1
  73. package/dist/types.d.cts +0 -130
  74. package/dist/types.d.mts +0 -130
@@ -1,6 +1,178 @@
1
1
  //#region src/generated/stories/types.gen.d.ts
2
- type StoryCreate = StoryCreate2;
3
- type StoryUpdate = StoryUpdate2;
2
+ /**
3
+ * Input for creating a story.
4
+ */
5
+ type StoryCreate = {
6
+ /**
7
+ * The numeric ID of the story. Can be passed in the body per the MAPI docs.
8
+ */
9
+ id?: number;
10
+ /**
11
+ * The complete name provided for the story.
12
+ */
13
+ name: string;
14
+ /**
15
+ * The slug specific for the story. Auto-generated as a UUID when omitted.
16
+ */
17
+ slug?: string;
18
+ content?: BlokContentInput;
19
+ /**
20
+ * ID of the parent folder.
21
+ */
22
+ parent_id?: number;
23
+ /**
24
+ * Value of the real path defined in the story's entry configuration (usually required for the Visual Editor).
25
+ */
26
+ path?: string | null;
27
+ /**
28
+ * true if the story is defined as root for the folder.
29
+ */
30
+ is_startpage?: boolean;
31
+ /**
32
+ * Array of tag names.
33
+ */
34
+ tag_list?: Array<string>;
35
+ /**
36
+ * Date defined in the story's entry configuration YYYY-mm-dd.
37
+ */
38
+ sort_by_date?: string | null;
39
+ /**
40
+ * Numeric representation of the story's position in the folder.
41
+ */
42
+ position?: number;
43
+ /**
44
+ * Object to store non-editable data that is exclusively maintained with the Management API.
45
+ */
46
+ meta_data?: {
47
+ [key: string]: unknown;
48
+ } | null;
49
+ /**
50
+ * Whether the entry is a folder.
51
+ */
52
+ is_folder?: boolean;
53
+ /**
54
+ * Default content type for stories in this folder.
55
+ */
56
+ default_root?: string | null;
57
+ /**
58
+ * Whether the Visual Editor is disabled.
59
+ */
60
+ disable_fe_editor?: boolean;
61
+ /**
62
+ * Translated slug entries to create, update, or delete.
63
+ */
64
+ translated_slugs_attributes?: Array<{
65
+ id?: number;
66
+ lang?: string;
67
+ slug?: string;
68
+ name?: string;
69
+ published?: boolean;
70
+ }>;
71
+ };
72
+ /**
73
+ * Input for updating a story.
74
+ */
75
+ type StoryUpdate = {
76
+ /**
77
+ * The numeric ID of the story. Can be passed in the update body per the MAPI docs.
78
+ */
79
+ id?: number;
80
+ /**
81
+ * The complete name provided for the story.
82
+ */
83
+ name?: string;
84
+ /**
85
+ * The slug specific for the story.
86
+ */
87
+ slug?: string;
88
+ content?: BlokContentInput;
89
+ /**
90
+ * ID of the parent folder.
91
+ */
92
+ parent_id?: number;
93
+ /**
94
+ * Value of the real path defined in the story's entry configuration (usually required for the Visual Editor).
95
+ */
96
+ path?: string | null;
97
+ /**
98
+ * true if the story is defined as root for the folder.
99
+ */
100
+ is_startpage?: boolean;
101
+ /**
102
+ * Array of tag names.
103
+ */
104
+ tag_list?: Array<string>;
105
+ /**
106
+ * Date defined in the story's entry configuration YYYY-mm-dd.
107
+ */
108
+ sort_by_date?: string | null;
109
+ /**
110
+ * Numeric representation of the story's position in the folder.
111
+ */
112
+ position?: number;
113
+ /**
114
+ * Object to store non-editable data that is exclusively maintained with the Management API.
115
+ */
116
+ meta_data?: {
117
+ [key: string]: unknown;
118
+ } | null;
119
+ /**
120
+ * Whether the entry is a folder.
121
+ */
122
+ is_folder?: boolean;
123
+ /**
124
+ * Default content type for stories in this folder.
125
+ */
126
+ default_root?: string | null;
127
+ /**
128
+ * Whether the Visual Editor is disabled.
129
+ */
130
+ disable_fe_editor?: boolean;
131
+ /**
132
+ * Translated slug entries to create, update, or delete.
133
+ */
134
+ translated_slugs_attributes?: Array<{
135
+ id?: number;
136
+ lang?: string;
137
+ slug?: string;
138
+ name?: string;
139
+ published?: boolean;
140
+ }>;
141
+ };
142
+ type StoryCreateRequest = {
143
+ story: StoryCreate;
144
+ /**
145
+ * Should the story be published immediately (set 1 to publish)
146
+ */
147
+ publish?: number;
148
+ /**
149
+ * ID of the current release (can be requested with the from_release API parameter)
150
+ */
151
+ release_id?: number;
152
+ };
153
+ type StoryUpdateRequest = {
154
+ story: StoryUpdate;
155
+ /**
156
+ * Group ID (UUID string), shared between stories defined as alternates
157
+ */
158
+ group_id?: string;
159
+ /**
160
+ * If this is 1, the request can overwrite a locked story. Note that a user currently editing the story (which is why it was locked) will encounter a content conflict model. Importantly, note that force_update does not work when editing is locked for the workflow stage that the story currently is in
161
+ */
162
+ force_update?: '0' | '1';
163
+ /**
164
+ * Numeric ID of release (optional)
165
+ */
166
+ release_id?: number;
167
+ /**
168
+ * Should the story be published immediately (set 1 to publish)
169
+ */
170
+ publish?: number;
171
+ /**
172
+ * Language code to publish the story individually (must be enabled in the space settings)
173
+ */
174
+ lang?: string;
175
+ };
4
176
  /**
5
177
  * Minimal story object for alternates
6
178
  */
@@ -37,7 +209,7 @@ type StoryAlternate = {
37
209
  /**
38
210
  * Asset field type - single asset (image, video, audio, or document)
39
211
  */
40
- type AssetField = {
212
+ type AssetFieldValue = {
41
213
  /**
42
214
  * Identifies this as an asset field
43
215
  */
@@ -88,7 +260,7 @@ type AssetField = {
88
260
  /**
89
261
  * Content object representing a component instance. Contains a _uid, a component technical name, and dynamic fields whose values depend on the component's schema field types (text, textarea, richtext, markdown, number, datetime, boolean, option, options, asset, multiasset, multilink, bloks, table, section, custom/plugin).
90
262
  */
91
- type StoryContent = {
263
+ type BlokContent = {
92
264
  /**
93
265
  * Unique identifier for this component instance
94
266
  */
@@ -101,12 +273,12 @@ type StoryContent = {
101
273
  * Storyblok editor markup string for inline editing (present in draft/preview mode)
102
274
  */
103
275
  _editable?: string;
104
- [key: string]: string | number | boolean | Array<string | AssetField | StoryContent> | AssetField | MultilinkField | TableField | RichtextField | PluginField | string | undefined;
276
+ [key: string]: string | number | boolean | Array<string | AssetFieldValue | BlokContent> | AssetFieldValue | MultilinkFieldValue | TableFieldValue | RichtextFieldValue | PluginFieldValue | string | undefined;
105
277
  };
106
278
  /**
107
279
  * Multilink field type - link to internal stories, external URLs, emails, etc.
108
280
  */
109
- type MultilinkField = {
281
+ type MultilinkFieldValue = {
110
282
  /**
111
283
  * Identifies this as a multilink field
112
284
  */
@@ -139,7 +311,7 @@ type MultilinkField = {
139
311
  /**
140
312
  * Table field type - structured table data
141
313
  */
142
- type TableField = {
314
+ type TableFieldValue = {
143
315
  /**
144
316
  * Table header cells
145
317
  */
@@ -173,7 +345,7 @@ type TableField = {
173
345
  /**
174
346
  * Richtext field type - structured rich text document (ProseMirror format)
175
347
  */
176
- type RichtextField = {
348
+ type RichtextFieldValue = {
177
349
  /**
178
350
  * Root node type for richtext documents
179
351
  */
@@ -188,7 +360,7 @@ type RichtextField = {
188
360
  /**
189
361
  * Plugin/Custom field type - field plugin with custom structure
190
362
  */
191
- type PluginField = {
363
+ type PluginFieldValue = {
192
364
  /**
193
365
  * Technical name of the field plugin
194
366
  */
@@ -289,7 +461,7 @@ type StoryBase = {
289
461
  * Generated UUID string
290
462
  */
291
463
  readonly uuid: string;
292
- content: StoryContent;
464
+ content: BlokContent;
293
465
  /**
294
466
  * The slug specific for the story
295
467
  */
@@ -354,11 +526,11 @@ type StoryMapi = StoryBase & {
354
526
  */
355
527
  disable_fe_editor?: boolean;
356
528
  /**
357
- * Subset of parent folder info (resolved from parent_id).
529
+ * Subset of parent folder info (resolved from parent_id). Null when the story has no parent folder.
358
530
  */
359
531
  parent?: {
360
532
  [key: string]: unknown;
361
- };
533
+ } | null;
362
534
  /**
363
535
  * Whether the story has unpublished changes.
364
536
  */
@@ -401,13 +573,9 @@ type StoryMapi = StoryBase & {
401
573
  published?: boolean;
402
574
  }>;
403
575
  /**
404
- * ID of the current release.
405
- */
406
- release_id?: number;
407
- /**
408
- * Scheduled publishing date.
576
+ * Scheduled publishing date. Null when no publishing date is scheduled.
409
577
  */
410
- scheduled_dates?: string;
578
+ scheduled_dates?: string | null;
411
579
  /**
412
580
  * User IDs who saved the story as Favorite.
413
581
  */
@@ -437,7 +605,7 @@ type StoryMapi = StoryBase & {
437
605
  */
438
606
  main_version_id?: number;
439
607
  /**
440
- * Current workflow stage details.
608
+ * Current workflow stage details. Null when the story is not assigned to a workflow stage.
441
609
  */
442
610
  stage?: {
443
611
  workflow_id?: number;
@@ -445,181 +613,25 @@ type StoryMapi = StoryBase & {
445
613
  story_id?: number;
446
614
  due_date?: string;
447
615
  created_at?: string;
448
- };
449
- };
450
- /**
451
- * Input for creating a story.
452
- */
453
- type StoryCreate2 = {
454
- /**
455
- * The numeric ID of the story. Can be passed in the body per the MAPI docs.
456
- */
457
- id?: number;
458
- /**
459
- * The complete name provided for the story.
460
- */
461
- name: string;
462
- /**
463
- * The slug specific for the story. Auto-generated as a UUID when omitted.
464
- */
465
- slug?: string;
466
- content?: StoryContent;
467
- /**
468
- * ID of the parent folder.
469
- */
470
- parent_id?: number;
471
- /**
472
- * Value of the real path defined in the story's entry configuration (usually required for the Visual Editor).
473
- */
474
- path?: string | null;
475
- /**
476
- * true if the story is defined as root for the folder.
477
- */
478
- is_startpage?: boolean;
479
- /**
480
- * Array of tag names.
481
- */
482
- tag_list?: Array<string>;
483
- /**
484
- * Date defined in the story's entry configuration YYYY-mm-dd.
485
- */
486
- sort_by_date?: string | null;
487
- /**
488
- * Numeric representation of the story's position in the folder.
489
- */
490
- position?: number;
491
- /**
492
- * Object to store non-editable data that is exclusively maintained with the Management API.
493
- */
494
- meta_data?: {
495
- [key: string]: unknown;
496
616
  } | null;
497
- /**
498
- * Whether the entry is a folder.
499
- */
500
- is_folder?: boolean;
501
- /**
502
- * Default content type for stories in this folder.
503
- */
504
- default_root?: string | null;
505
- /**
506
- * Whether the Visual Editor is disabled.
507
- */
508
- disable_fe_editor?: boolean;
509
- /**
510
- * Translated slug entries to create, update, or delete.
511
- */
512
- translated_slugs_attributes?: Array<{
513
- id?: number;
514
- lang?: string;
515
- slug?: string;
516
- name?: string;
517
- published?: boolean;
518
- }>;
519
- };
520
- type StoryCreateRequest2 = {
521
- story: StoryCreate2;
522
- /**
523
- * Should the story be published immediately (set 1 to publish)
524
- */
525
- publish?: number;
526
- /**
527
- * ID of the current release (can be requested with the from_release API parameter)
528
- */
529
- release_id?: number;
530
617
  };
531
618
  /**
532
- * Input for updating a story.
619
+ * Content object for creating or updating a component instance. Contains a component technical name and dynamic fields whose values depend on the component's schema field types. The _uid is optional — Storyblok will auto-generate one if not provided.
533
620
  */
534
- type StoryUpdate2 = {
535
- /**
536
- * The numeric ID of the story. Can be passed in the update body per the MAPI docs.
537
- */
538
- id?: number;
539
- /**
540
- * The complete name provided for the story.
541
- */
542
- name?: string;
543
- /**
544
- * The slug specific for the story.
545
- */
546
- slug?: string;
547
- content?: StoryContent;
548
- /**
549
- * ID of the parent folder.
550
- */
551
- parent_id?: number;
552
- /**
553
- * Value of the real path defined in the story's entry configuration (usually required for the Visual Editor).
554
- */
555
- path?: string | null;
621
+ type BlokContentInput = {
556
622
  /**
557
- * true if the story is defined as root for the folder.
623
+ * Unique identifier for this component instance (auto-generated when omitted)
558
624
  */
559
- is_startpage?: boolean;
560
- /**
561
- * Array of tag names.
562
- */
563
- tag_list?: Array<string>;
564
- /**
565
- * Date defined in the story's entry configuration YYYY-mm-dd.
566
- */
567
- sort_by_date?: string | null;
568
- /**
569
- * Numeric representation of the story's position in the folder.
570
- */
571
- position?: number;
572
- /**
573
- * Object to store non-editable data that is exclusively maintained with the Management API.
574
- */
575
- meta_data?: {
576
- [key: string]: unknown;
577
- } | null;
578
- /**
579
- * Whether the entry is a folder.
580
- */
581
- is_folder?: boolean;
582
- /**
583
- * Default content type for stories in this folder.
584
- */
585
- default_root?: string | null;
586
- /**
587
- * Whether the Visual Editor is disabled.
588
- */
589
- disable_fe_editor?: boolean;
590
- /**
591
- * Translated slug entries to create, update, or delete.
592
- */
593
- translated_slugs_attributes?: Array<{
594
- id?: number;
595
- lang?: string;
596
- slug?: string;
597
- name?: string;
598
- published?: boolean;
599
- }>;
600
- };
601
- type StoryUpdateRequest2 = {
602
- story: StoryUpdate2;
603
- /**
604
- * Group ID (UUID string), shared between stories defined as alternates
605
- */
606
- group_id?: string;
607
- /**
608
- * If this is 1, the request can overwrite a locked story. Note that a user currently editing the story (which is why it was locked) will encounter a content conflict model. Importantly, note that force_update does not work when editing is locked for the workflow stage that the story currently is in
609
- */
610
- force_update?: '0' | '1';
611
- /**
612
- * Numeric ID of release (optional)
613
- */
614
- release_id?: number;
625
+ _uid?: string;
615
626
  /**
616
- * Should the story be published immediately (set 1 to publish)
627
+ * Technical name of the component (content type or nestable block)
617
628
  */
618
- publish?: number;
629
+ component: string;
619
630
  /**
620
- * Language code to publish the story individually (must be enabled in the space settings)
631
+ * Storyblok editor markup string for inline editing (present in draft/preview mode)
621
632
  */
622
- lang?: string;
633
+ _editable?: string;
634
+ [key: string]: null | string | number | boolean | Array<string | AssetFieldValue | BlokContentInput> | AssetFieldValue | MultilinkFieldValue | TableFieldValue | RichtextFieldValue | PluginFieldValue | string | undefined;
623
635
  };
624
636
  /**
625
637
  * Request body for duplicating a story
@@ -675,7 +687,7 @@ type StoryBaseWritable = {
675
687
  * Latest publishing date yyyy-MM-dd'T'HH:mm:ssZ
676
688
  */
677
689
  published_at: string | null;
678
- content: StoryContent;
690
+ content: BlokContent;
679
691
  /**
680
692
  * The slug specific for the story
681
693
  */
@@ -740,11 +752,11 @@ type StoryMapiWritable = StoryBaseWritable & {
740
752
  */
741
753
  disable_fe_editor?: boolean;
742
754
  /**
743
- * Subset of parent folder info (resolved from parent_id).
755
+ * Subset of parent folder info (resolved from parent_id). Null when the story has no parent folder.
744
756
  */
745
757
  parent?: {
746
758
  [key: string]: unknown;
747
- };
759
+ } | null;
748
760
  /**
749
761
  * Whether the story has unpublished changes.
750
762
  */
@@ -787,13 +799,9 @@ type StoryMapiWritable = StoryBaseWritable & {
787
799
  published?: boolean;
788
800
  }>;
789
801
  /**
790
- * ID of the current release.
802
+ * Scheduled publishing date. Null when no publishing date is scheduled.
791
803
  */
792
- release_id?: number;
793
- /**
794
- * Scheduled publishing date.
795
- */
796
- scheduled_dates?: string;
804
+ scheduled_dates?: string | null;
797
805
  /**
798
806
  * User IDs who saved the story as Favorite.
799
807
  */
@@ -823,7 +831,7 @@ type StoryMapiWritable = StoryBaseWritable & {
823
831
  */
824
832
  main_version_id?: number;
825
833
  /**
826
- * Current workflow stage details.
834
+ * Current workflow stage details. Null when the story is not assigned to a workflow stage.
827
835
  */
828
836
  stage?: {
829
837
  workflow_id?: number;
@@ -831,7 +839,7 @@ type StoryMapiWritable = StoryBaseWritable & {
831
839
  story_id?: number;
832
840
  due_date?: string;
833
841
  created_at?: string;
834
- };
842
+ } | null;
835
843
  };
836
844
  type ListData = {
837
845
  body?: never;
@@ -998,7 +1006,7 @@ type ListResponses = {
998
1006
  };
999
1007
  };
1000
1008
  type CreateData = {
1001
- body: StoryCreateRequest2;
1009
+ body: StoryCreateRequest;
1002
1010
  path: {
1003
1011
  /**
1004
1012
  * The ID of the Storyblok space (can be integer or string)
@@ -1082,7 +1090,7 @@ type GetResponses = {
1082
1090
  };
1083
1091
  };
1084
1092
  type UpdateData = {
1085
- body: StoryUpdateRequest2;
1093
+ body: StoryUpdateRequest;
1086
1094
  path: {
1087
1095
  /**
1088
1096
  * The ID of the Storyblok space (can be integer or string)
@@ -1302,5 +1310,5 @@ type VersionsResponses = {
1302
1310
  };
1303
1311
  };
1304
1312
  //#endregion
1305
- export { AssetField, CreateData, CreateResponses, DeleteResponses, DuplicateData, DuplicateResponses, GetData, GetResponses, ListData, ListResponses, MultilinkField, PluginField, PublishData, PublishResponses, RichtextField, StoryAlternate, StoryContent, StoryCreate, StoryLocalizedPath, StoryMapi, StoryTranslatedSlug, StoryUpdate, TableField, UpdateData, UpdateResponses, VersionsData, VersionsResponses };
1313
+ export { CreateData, CreateResponses, DeleteResponses, DuplicateData, DuplicateResponses, GetData, GetResponses, ListData, ListResponses, PublishData, PublishResponses, StoryCreateRequest, StoryMapi, StoryUpdateRequest, UpdateData, UpdateResponses, VersionsData, VersionsResponses };
1306
1314
  //# sourceMappingURL=types.gen.d.mts.map