@storyblok/management-api-client 1.0.0-alpha.2 → 1.0.0-alpha.4

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 (54) hide show
  1. package/dist/client.cjs +6 -0
  2. package/dist/client.cjs.map +1 -1
  3. package/dist/client.d.cts +133 -7
  4. package/dist/client.d.mts +133 -7
  5. package/dist/client.mjs +6 -0
  6. package/dist/client.mjs.map +1 -1
  7. package/dist/generated/mapi/_internal.gen.d.cts +1 -171
  8. package/dist/generated/mapi/_internal.gen.d.mts +1 -171
  9. package/dist/generated/mapi/types-aliased.gen.d.cts +171 -1
  10. package/dist/generated/mapi/types-aliased.gen.d.mts +171 -1
  11. package/dist/generated/types/block.d.cts +27 -8
  12. package/dist/generated/types/block.d.mts +27 -8
  13. package/dist/generated/types/field.d.cts +45 -17
  14. package/dist/generated/types/field.d.mts +45 -17
  15. package/dist/generated/types/mapi-story.d.cts +6 -6
  16. package/dist/generated/types/mapi-story.d.mts +6 -6
  17. package/dist/index.d.cts +6 -4
  18. package/dist/index.d.mts +6 -4
  19. package/dist/resources/assets.cjs +1 -0
  20. package/dist/resources/assets.cjs.map +1 -1
  21. package/dist/resources/assets.mjs +1 -1
  22. package/dist/resources/assets.mjs.map +1 -1
  23. package/dist/resources/components.cjs.map +1 -1
  24. package/dist/resources/components.d.cts +17 -17
  25. package/dist/resources/components.d.mts +17 -17
  26. package/dist/resources/components.mjs.map +1 -1
  27. package/dist/resources/shared-asset-folders.cjs +81 -0
  28. package/dist/resources/shared-asset-folders.cjs.map +1 -0
  29. package/dist/resources/shared-asset-folders.d.cts +41 -0
  30. package/dist/resources/shared-asset-folders.d.mts +41 -0
  31. package/dist/resources/shared-asset-folders.mjs +81 -0
  32. package/dist/resources/shared-asset-folders.mjs.map +1 -0
  33. package/dist/resources/shared-assets.cjs +197 -0
  34. package/dist/resources/shared-assets.cjs.map +1 -0
  35. package/dist/resources/shared-assets.d.cts +29 -0
  36. package/dist/resources/shared-assets.d.mts +28 -0
  37. package/dist/resources/shared-assets.mjs +197 -0
  38. package/dist/resources/shared-assets.mjs.map +1 -0
  39. package/dist/resources/shared-internal-tags.cjs +73 -0
  40. package/dist/resources/shared-internal-tags.cjs.map +1 -0
  41. package/dist/resources/shared-internal-tags.d.cts +32 -0
  42. package/dist/resources/shared-internal-tags.d.mts +32 -0
  43. package/dist/resources/shared-internal-tags.mjs +73 -0
  44. package/dist/resources/shared-internal-tags.mjs.map +1 -0
  45. package/dist/resources/stories.cjs.map +1 -1
  46. package/dist/resources/stories.d.cts +26 -26
  47. package/dist/resources/stories.d.mts +26 -26
  48. package/dist/resources/stories.mjs.map +1 -1
  49. package/package.json +3 -3
  50. package/playground/integration-tests/test/specs/mapi-round-trip.spec.e2e.ts +30 -40
  51. package/playground/integration-tests/test/types/components.test-d.ts +7 -46
  52. package/playground/integration-tests/test/types/resources.test-d.ts +0 -152
  53. package/playground/integration-tests/test/types/stories.test-d.ts +47 -43
  54. package/test/GUIDE.md +2 -2
@@ -141,6 +141,176 @@ type Component = {
141
141
  [key: string]: unknown;
142
142
  } | null;
143
143
  };
144
+ type ComponentCreate = {
145
+ /**
146
+ * Name of the component
147
+ */
148
+ name: string;
149
+ /**
150
+ * Human-readable display name
151
+ */
152
+ display_name?: string;
153
+ /**
154
+ * Component description
155
+ */
156
+ description?: string;
157
+ /**
158
+ * Preview template HTML
159
+ */
160
+ preview_tmpl?: string;
161
+ /**
162
+ * Component image URL
163
+ */
164
+ image?: string;
165
+ /**
166
+ * Field used for preview
167
+ */
168
+ preview_field?: string;
169
+ /**
170
+ * Whether this component can be used as a root component
171
+ */
172
+ is_root?: boolean;
173
+ /**
174
+ * Whether this component can be nested inside other components
175
+ */
176
+ is_nestable?: boolean;
177
+ /**
178
+ * Default preset ID
179
+ */
180
+ preset_id?: number;
181
+ /**
182
+ * UUID
183
+ */
184
+ component_group_uuid?: string;
185
+ /**
186
+ * Component color for UI display
187
+ */
188
+ color?: string;
189
+ /**
190
+ * Component icon name
191
+ */
192
+ icon?: string;
193
+ /**
194
+ * Asset preview URL for content type
195
+ */
196
+ content_type_asset_preview?: string;
197
+ /**
198
+ * List of internal tag IDs
199
+ */
200
+ internal_tag_ids?: Array<number>;
201
+ /**
202
+ * Component field schema definition
203
+ */
204
+ schema?: {
205
+ [key: string]: {
206
+ type?: 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group';
207
+ /**
208
+ * Human-readable field name
209
+ */
210
+ display_name?: string;
211
+ /**
212
+ * Whether this field is required
213
+ */
214
+ required?: boolean;
215
+ /**
216
+ * Whether this field is translatable
217
+ */
218
+ translatable?: boolean;
219
+ [key: string]: unknown | 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group' | string | boolean | undefined;
220
+ };
221
+ };
222
+ /**
223
+ * Component metadata
224
+ */
225
+ metadata?: {
226
+ [key: string]: unknown;
227
+ };
228
+ };
229
+ type ComponentUpdate = {
230
+ /**
231
+ * Name of the component
232
+ */
233
+ name?: string;
234
+ /**
235
+ * Human-readable display name
236
+ */
237
+ display_name?: string;
238
+ /**
239
+ * Component description
240
+ */
241
+ description?: string;
242
+ /**
243
+ * Preview template HTML
244
+ */
245
+ preview_tmpl?: string;
246
+ /**
247
+ * Component image URL
248
+ */
249
+ image?: string;
250
+ /**
251
+ * Field used for preview
252
+ */
253
+ preview_field?: string;
254
+ /**
255
+ * Whether this component can be used as a root component
256
+ */
257
+ is_root?: boolean;
258
+ /**
259
+ * Whether this component can be nested inside other components
260
+ */
261
+ is_nestable?: boolean;
262
+ /**
263
+ * Default preset ID
264
+ */
265
+ preset_id?: number;
266
+ /**
267
+ * UUID
268
+ */
269
+ component_group_uuid?: string;
270
+ /**
271
+ * Component color for UI display
272
+ */
273
+ color?: string;
274
+ /**
275
+ * Component icon name
276
+ */
277
+ icon?: string;
278
+ /**
279
+ * Asset preview URL for content type
280
+ */
281
+ content_type_asset_preview?: string;
282
+ /**
283
+ * List of internal tag IDs
284
+ */
285
+ internal_tag_ids?: Array<number>;
286
+ /**
287
+ * Component field schema definition
288
+ */
289
+ schema?: {
290
+ [key: string]: {
291
+ type?: 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group';
292
+ /**
293
+ * Human-readable field name
294
+ */
295
+ display_name?: string;
296
+ /**
297
+ * Whether this field is required
298
+ */
299
+ required?: boolean;
300
+ /**
301
+ * Whether this field is translatable
302
+ */
303
+ translatable?: boolean;
304
+ [key: string]: unknown | 'bloks' | 'text' | 'textarea' | 'richtext' | 'markdown' | 'number' | 'datetime' | 'boolean' | 'options' | 'option' | 'asset' | 'multiasset' | 'multilink' | 'table' | 'section' | 'commerce' | 'custom' | 'image' | 'file' | 'tab' | 'link' | 'group' | string | boolean | undefined;
305
+ };
306
+ };
307
+ /**
308
+ * Component metadata
309
+ */
310
+ metadata?: {
311
+ [key: string]: unknown;
312
+ };
313
+ };
144
314
  type Asset = {
145
315
  /**
146
316
  * Id of the asset.
@@ -1424,5 +1594,5 @@ type SpaceRole = {
1424
1594
  blocked_asset_folder_ids: Array<number>;
1425
1595
  };
1426
1596
  //#endregion
1427
- export { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, Component, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate };
1597
+ export { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, Component, ComponentCreate, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, ComponentUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate };
1428
1598
  //# sourceMappingURL=types-aliased.gen.d.mts.map
@@ -1,20 +1,39 @@
1
1
  import { Component } from "../mapi/types-aliased.gen.cjs";
2
- import { ComponentCreate, ComponentUpdate } from "../mapi/_internal.gen.cjs";
3
2
  import { Field } from "../overlay/_internal.gen.cjs";
4
3
  import { Override } from "./_utils.cjs";
5
4
 
6
5
  //#region src/generated/types/block.d.ts
7
- /** Wire form: the MAPI object map keyed by field name. This is what `defineBlock` returns. */
8
- type BlockSchema = Record<string, Field & {
6
+ /**
7
+ * Ordered array of named fields — the content-shape DSL form `defineBlock`
8
+ * accepts and returns. A field's position in the array sets the order it appears
9
+ * in the editor (mapped to the wire `pos` on push).
10
+ */
11
+ type BlockFields = ReadonlyArray<Field & {
12
+ name: string;
13
+ pos?: number;
9
14
  required?: boolean;
10
15
  }>;
11
- /** A Storyblok block. */
12
- type Block<TName extends string = string, TBlockSchema extends BlockSchema = BlockSchema, TIsRoot extends boolean = boolean, TIsNestable extends boolean = boolean, TComponentGroupUuid extends string | null = string | null> = Override<Component, {
16
+ /**
17
+ * A Storyblok block: a named, ordered set of content fields. Uses the
18
+ * content-shape DSL `fields` array rather than the MAPI wire `schema` record.
19
+ */
20
+ type Block<TName extends string = string, TFields extends BlockFields = BlockFields, TIsRoot extends boolean = boolean, TIsNestable extends boolean = boolean> = Override<Omit<Component, 'schema' | 'component_group_uuid'>, {
13
21
  name: TName;
14
- schema: TBlockSchema;
22
+ fields: TFields;
15
23
  is_root?: TIsRoot;
16
24
  is_nestable?: TIsNestable;
17
- component_group_uuid?: TComponentGroupUuid;
25
+ /**
26
+ * Escape hatch for pinning this block to a Storyblok UI-managed component
27
+ * group by UUID. Component groups are normally maintained in code via the
28
+ * schema directory layout; set this only if you intentionally manage groups
29
+ * in the Storyblok UI, and fill in the group UUID yourself. When set,
30
+ * `schema push` diffs it and sends it to the Management API; when omitted,
31
+ * the block's remote group is left untouched.
32
+ *
33
+ * @deprecated Prefer maintaining component groups in code through the
34
+ * directory layout.
35
+ */
36
+ component_group_uuid?: string | null;
18
37
  }>;
19
38
  /**
20
39
  * A root {@link Block} (`is_root: true`). Given a union of blocks, narrows to
@@ -26,5 +45,5 @@ type RootBlock<T extends Block = Block & {
26
45
  is_root: true;
27
46
  }>;
28
47
  //#endregion
29
- export { Block, RootBlock };
48
+ export { Block, BlockFields, RootBlock };
30
49
  //# sourceMappingURL=block.d.cts.map
@@ -1,20 +1,39 @@
1
1
  import { Component } from "../mapi/types-aliased.gen.mjs";
2
- import { ComponentCreate, ComponentUpdate } from "../mapi/_internal.gen.mjs";
3
2
  import { Field } from "../overlay/_internal.gen.mjs";
4
3
  import { Override } from "./_utils.mjs";
5
4
 
6
5
  //#region src/generated/types/block.d.ts
7
- /** Wire form: the MAPI object map keyed by field name. This is what `defineBlock` returns. */
8
- type BlockSchema = Record<string, Field & {
6
+ /**
7
+ * Ordered array of named fields — the content-shape DSL form `defineBlock`
8
+ * accepts and returns. A field's position in the array sets the order it appears
9
+ * in the editor (mapped to the wire `pos` on push).
10
+ */
11
+ type BlockFields = ReadonlyArray<Field & {
12
+ name: string;
13
+ pos?: number;
9
14
  required?: boolean;
10
15
  }>;
11
- /** A Storyblok block. */
12
- type Block<TName extends string = string, TBlockSchema extends BlockSchema = BlockSchema, TIsRoot extends boolean = boolean, TIsNestable extends boolean = boolean, TComponentGroupUuid extends string | null = string | null> = Override<Component, {
16
+ /**
17
+ * A Storyblok block: a named, ordered set of content fields. Uses the
18
+ * content-shape DSL `fields` array rather than the MAPI wire `schema` record.
19
+ */
20
+ type Block<TName extends string = string, TFields extends BlockFields = BlockFields, TIsRoot extends boolean = boolean, TIsNestable extends boolean = boolean> = Override<Omit<Component, 'schema' | 'component_group_uuid'>, {
13
21
  name: TName;
14
- schema: TBlockSchema;
22
+ fields: TFields;
15
23
  is_root?: TIsRoot;
16
24
  is_nestable?: TIsNestable;
17
- component_group_uuid?: TComponentGroupUuid;
25
+ /**
26
+ * Escape hatch for pinning this block to a Storyblok UI-managed component
27
+ * group by UUID. Component groups are normally maintained in code via the
28
+ * schema directory layout; set this only if you intentionally manage groups
29
+ * in the Storyblok UI, and fill in the group UUID yourself. When set,
30
+ * `schema push` diffs it and sends it to the Management API; when omitted,
31
+ * the block's remote group is left untouched.
32
+ *
33
+ * @deprecated Prefer maintaining component groups in code through the
34
+ * directory layout.
35
+ */
36
+ component_group_uuid?: string | null;
18
37
  }>;
19
38
  /**
20
39
  * A root {@link Block} (`is_root: true`). Given a union of blocks, narrows to
@@ -26,5 +45,5 @@ type RootBlock<T extends Block = Block & {
26
45
  is_root: true;
27
46
  }>;
28
47
  //#endregion
29
- export { Block, RootBlock };
48
+ export { Block, BlockFields, RootBlock };
30
49
  //# sourceMappingURL=block.d.mts.map
@@ -1,6 +1,6 @@
1
1
  import { AssetFieldValue, BlockContentBase, BlockContentInputBase, Field, MultilinkFieldValue, PluginFieldValue, RichtextFieldValue, TableFieldValue } from "../overlay/_internal.gen.cjs";
2
2
  import { Prettify } from "./_utils.cjs";
3
- import { Block } from "./block.cjs";
3
+ import { Block, BlockFields } from "./block.cjs";
4
4
 
5
5
  //#region src/generated/types/field.d.ts
6
6
  /**
@@ -11,28 +11,40 @@ import { Block } from "./block.cjs";
11
11
  type NoBlocks = false;
12
12
  /** True when `T` is the un-narrowed base `Block` (i.e. no specific block was supplied). */
13
13
  type IsBaseBlock<T> = [Block] extends [T] ? true : false;
14
- type RequiredFieldKeys<T> = { [K in keyof T]: T[K] extends {
14
+ /**
15
+ * Maps a block's ordered `fields` array to its read content object, splitting
16
+ * required (`required: true`) from optional fields. Each `F` is a member of the
17
+ * field union, so it provably satisfies `FieldValue`'s `Field` constraint.
18
+ */
19
+ type ContentFields<TFields extends BlockFields, TBlocks, TFieldPlugins = Record<never, never>> = Prettify<{ [F in TFields[number] as F extends {
20
+ required: true;
21
+ } ? F['name'] : never]: FieldValue<F, TBlocks, TFieldPlugins> } & { [F in TFields[number] as F extends {
22
+ required: true;
23
+ } ? never : F['name']]?: FieldValue<F, TBlocks, TFieldPlugins> | null }>;
24
+ /** Input (write) variant of {@link ContentFields}, resolving each field via {@link FieldValueInput}. */
25
+ type ContentFieldsInput<TFields extends BlockFields, TBlocks, TFieldPlugins = Record<never, never>> = Prettify<{ [F in TFields[number] as F extends {
15
26
  required: true;
16
- } ? K : never }[keyof T];
17
- type OptionalFieldKeys<T> = Exclude<keyof T, RequiredFieldKeys<T>>;
27
+ } ? F['name'] : never]: FieldValueInput<F, TBlocks, TFieldPlugins> } & { [F in TFields[number] as F extends {
28
+ required: true;
29
+ } ? never : F['name']]?: FieldValueInput<F, TBlocks, TFieldPlugins> | null }>;
18
30
  /**
19
31
  * Content object for a single block instance as returned by the Storyblok
20
32
  * Content Delivery API. Without a `TBlock` argument, this is the loose
21
33
  * runtime shape (any block, `_editable` optional). With a schema-typed
22
- * `TBlock`, fields are narrowed per the block's schema.
34
+ * `TBlock`, fields are narrowed per the block's `fields`.
23
35
  */
24
- type BlockContent<TBlock extends Block = Block, TBlocks = NoBlocks> = IsBaseBlock<TBlock> extends true ? BlockContentBase : TBlock extends any ? Prettify<{
36
+ type BlockContent<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = IsBaseBlock<TBlock> extends true ? BlockContentBase : TBlock extends any ? Prettify<{
25
37
  _uid: string;
26
38
  component: TBlock['name'];
27
39
  _editable?: string;
28
- } & { [K in RequiredFieldKeys<TBlock['schema']>]: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> } & { [K in OptionalFieldKeys<TBlock['schema']>]?: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> | null }> : never;
40
+ } & ContentFields<TBlock['fields'], TBlocks, TFieldPlugins>> : never;
29
41
  /** Input variant of {@link BlockContent} for write operations (creating/updating stories via the MAPI). `_uid` is optional. */
30
- type BlockContentInput<TBlock extends Block = Block, TBlocks = NoBlocks> = IsBaseBlock<TBlock> extends true ? BlockContentInputBase : TBlock extends any ? Prettify<{
42
+ type BlockContentInput<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = IsBaseBlock<TBlock> extends true ? BlockContentInputBase : TBlock extends any ? Prettify<{
31
43
  _uid?: string;
32
44
  component: TBlock['name'];
33
45
  _editable?: string;
34
- } & { [K in RequiredFieldKeys<TBlock['schema']>]: FieldValueInput<NonNullable<TBlock['schema'][K]>, TBlocks> } & { [K in OptionalFieldKeys<TBlock['schema']>]?: FieldValueInput<NonNullable<TBlock['schema'][K]>, TBlocks> | null }> : never;
35
- type BlocksFieldValue<TBlock extends Block = Block, TBlocks = NoBlocks> = BlockContent<TBlock, TBlocks>[];
46
+ } & ContentFieldsInput<TBlock['fields'], TBlocks, TFieldPlugins>> : never;
47
+ type BlocksFieldValue<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = BlockContent<TBlock, TBlocks, TFieldPlugins>[];
36
48
  interface FieldTypeValueMap {
37
49
  text: string;
38
50
  textarea: string;
@@ -57,19 +69,35 @@ type IsNestable<T> = T extends {
57
69
  } ? false : T extends {
58
70
  is_nestable: true;
59
71
  } ? true : true;
60
- type ApplyWhitelist<TField, TBlocks> = TField extends {
61
- component_whitelist: ReadonlyArray<infer TWhitelisted extends string>;
72
+ type ApplyAllow<TField, TBlocks> = TField extends {
73
+ allow: ReadonlyArray<infer TAllowed extends string>;
62
74
  } ? Extract<TBlocks, {
63
- name: TWhitelisted;
75
+ name: TAllowed;
64
76
  }> : TBlocks extends any ? IsNestable<TBlocks> extends true ? TBlocks : never : never;
77
+ /**
78
+ * Resolves a `custom` field to its registered plugin value. When the field's
79
+ * `field_type` is a key of `TFieldPlugins`, the validator output is merged with
80
+ * the plugin envelope (`plugin`, optional `_uid`); otherwise it falls back to
81
+ * the untyped {@link PluginFieldValue}. Same shape for read and write.
82
+ */
83
+ type ResolveCustom<TField, TFieldPlugins> = TField extends {
84
+ field_type: infer F extends string;
85
+ } ? F extends keyof TFieldPlugins ? Prettify<TFieldPlugins[F] & {
86
+ plugin: string;
87
+ _uid?: string;
88
+ }> : PluginFieldValue : PluginFieldValue;
65
89
  /** Resolves a field definition to its runtime content value type (read). */
66
- type FieldValue<TField extends Field = Field, TBlocks = NoBlocks> = Prettify<TField extends {
90
+ type FieldValue<TField extends Field = Field, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = Prettify<TField extends {
67
91
  type: 'bloks';
68
- } ? [TBlocks] extends [never] ? BlockContentBase[] : [TBlocks] extends [Block] ? BlockContent<ApplyWhitelist<TField, TBlocks>, TBlocks>[] : BlockContentBase[] : FieldTypeValueMap[TField['type']]>;
92
+ } ? [TBlocks] extends [never] ? BlockContentBase[] : [TBlocks] extends [Block] ? BlockContent<ApplyAllow<TField, TBlocks>, TBlocks, TFieldPlugins>[] : BlockContentBase[] : TField extends {
93
+ type: 'custom';
94
+ } ? ResolveCustom<TField, TFieldPlugins> : FieldTypeValueMap[TField['type']]>;
69
95
  /** Resolves a field definition to its input value type (write). */
70
- type FieldValueInput<TField extends Field = Field, TBlocks = NoBlocks> = Prettify<TField extends {
96
+ type FieldValueInput<TField extends Field = Field, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = Prettify<TField extends {
71
97
  type: 'bloks';
72
- } ? [TBlocks] extends [never] ? BlockContentInputBase[] : [TBlocks] extends [Block] ? BlockContentInput<ApplyWhitelist<TField, TBlocks>, TBlocks>[] : BlockContentInputBase[] : FieldTypeValueMap[TField['type']]>;
98
+ } ? [TBlocks] extends [never] ? BlockContentInputBase[] : [TBlocks] extends [Block] ? BlockContentInput<ApplyAllow<TField, TBlocks>, TBlocks, TFieldPlugins>[] : BlockContentInputBase[] : TField extends {
99
+ type: 'custom';
100
+ } ? ResolveCustom<TField, TFieldPlugins> : FieldTypeValueMap[TField['type']]>;
73
101
  //#endregion
74
102
  export { BlockContent, BlockContentInput, BlocksFieldValue };
75
103
  //# sourceMappingURL=field.d.cts.map
@@ -1,6 +1,6 @@
1
1
  import { AssetFieldValue, BlockContentBase, BlockContentInputBase, Field, MultilinkFieldValue, PluginFieldValue, RichtextFieldValue, TableFieldValue } from "../overlay/_internal.gen.mjs";
2
2
  import { Prettify } from "./_utils.mjs";
3
- import { Block } from "./block.mjs";
3
+ import { Block, BlockFields } from "./block.mjs";
4
4
 
5
5
  //#region src/generated/types/field.d.ts
6
6
  /**
@@ -11,28 +11,40 @@ import { Block } from "./block.mjs";
11
11
  type NoBlocks = false;
12
12
  /** True when `T` is the un-narrowed base `Block` (i.e. no specific block was supplied). */
13
13
  type IsBaseBlock<T> = [Block] extends [T] ? true : false;
14
- type RequiredFieldKeys<T> = { [K in keyof T]: T[K] extends {
14
+ /**
15
+ * Maps a block's ordered `fields` array to its read content object, splitting
16
+ * required (`required: true`) from optional fields. Each `F` is a member of the
17
+ * field union, so it provably satisfies `FieldValue`'s `Field` constraint.
18
+ */
19
+ type ContentFields<TFields extends BlockFields, TBlocks, TFieldPlugins = Record<never, never>> = Prettify<{ [F in TFields[number] as F extends {
20
+ required: true;
21
+ } ? F['name'] : never]: FieldValue<F, TBlocks, TFieldPlugins> } & { [F in TFields[number] as F extends {
22
+ required: true;
23
+ } ? never : F['name']]?: FieldValue<F, TBlocks, TFieldPlugins> | null }>;
24
+ /** Input (write) variant of {@link ContentFields}, resolving each field via {@link FieldValueInput}. */
25
+ type ContentFieldsInput<TFields extends BlockFields, TBlocks, TFieldPlugins = Record<never, never>> = Prettify<{ [F in TFields[number] as F extends {
15
26
  required: true;
16
- } ? K : never }[keyof T];
17
- type OptionalFieldKeys<T> = Exclude<keyof T, RequiredFieldKeys<T>>;
27
+ } ? F['name'] : never]: FieldValueInput<F, TBlocks, TFieldPlugins> } & { [F in TFields[number] as F extends {
28
+ required: true;
29
+ } ? never : F['name']]?: FieldValueInput<F, TBlocks, TFieldPlugins> | null }>;
18
30
  /**
19
31
  * Content object for a single block instance as returned by the Storyblok
20
32
  * Content Delivery API. Without a `TBlock` argument, this is the loose
21
33
  * runtime shape (any block, `_editable` optional). With a schema-typed
22
- * `TBlock`, fields are narrowed per the block's schema.
34
+ * `TBlock`, fields are narrowed per the block's `fields`.
23
35
  */
24
- type BlockContent<TBlock extends Block = Block, TBlocks = NoBlocks> = IsBaseBlock<TBlock> extends true ? BlockContentBase : TBlock extends any ? Prettify<{
36
+ type BlockContent<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = IsBaseBlock<TBlock> extends true ? BlockContentBase : TBlock extends any ? Prettify<{
25
37
  _uid: string;
26
38
  component: TBlock['name'];
27
39
  _editable?: string;
28
- } & { [K in RequiredFieldKeys<TBlock['schema']>]: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> } & { [K in OptionalFieldKeys<TBlock['schema']>]?: FieldValue<NonNullable<TBlock['schema'][K]>, TBlocks> | null }> : never;
40
+ } & ContentFields<TBlock['fields'], TBlocks, TFieldPlugins>> : never;
29
41
  /** Input variant of {@link BlockContent} for write operations (creating/updating stories via the MAPI). `_uid` is optional. */
30
- type BlockContentInput<TBlock extends Block = Block, TBlocks = NoBlocks> = IsBaseBlock<TBlock> extends true ? BlockContentInputBase : TBlock extends any ? Prettify<{
42
+ type BlockContentInput<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = IsBaseBlock<TBlock> extends true ? BlockContentInputBase : TBlock extends any ? Prettify<{
31
43
  _uid?: string;
32
44
  component: TBlock['name'];
33
45
  _editable?: string;
34
- } & { [K in RequiredFieldKeys<TBlock['schema']>]: FieldValueInput<NonNullable<TBlock['schema'][K]>, TBlocks> } & { [K in OptionalFieldKeys<TBlock['schema']>]?: FieldValueInput<NonNullable<TBlock['schema'][K]>, TBlocks> | null }> : never;
35
- type BlocksFieldValue<TBlock extends Block = Block, TBlocks = NoBlocks> = BlockContent<TBlock, TBlocks>[];
46
+ } & ContentFieldsInput<TBlock['fields'], TBlocks, TFieldPlugins>> : never;
47
+ type BlocksFieldValue<TBlock extends Block = Block, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = BlockContent<TBlock, TBlocks, TFieldPlugins>[];
36
48
  interface FieldTypeValueMap {
37
49
  text: string;
38
50
  textarea: string;
@@ -57,19 +69,35 @@ type IsNestable<T> = T extends {
57
69
  } ? false : T extends {
58
70
  is_nestable: true;
59
71
  } ? true : true;
60
- type ApplyWhitelist<TField, TBlocks> = TField extends {
61
- component_whitelist: ReadonlyArray<infer TWhitelisted extends string>;
72
+ type ApplyAllow<TField, TBlocks> = TField extends {
73
+ allow: ReadonlyArray<infer TAllowed extends string>;
62
74
  } ? Extract<TBlocks, {
63
- name: TWhitelisted;
75
+ name: TAllowed;
64
76
  }> : TBlocks extends any ? IsNestable<TBlocks> extends true ? TBlocks : never : never;
77
+ /**
78
+ * Resolves a `custom` field to its registered plugin value. When the field's
79
+ * `field_type` is a key of `TFieldPlugins`, the validator output is merged with
80
+ * the plugin envelope (`plugin`, optional `_uid`); otherwise it falls back to
81
+ * the untyped {@link PluginFieldValue}. Same shape for read and write.
82
+ */
83
+ type ResolveCustom<TField, TFieldPlugins> = TField extends {
84
+ field_type: infer F extends string;
85
+ } ? F extends keyof TFieldPlugins ? Prettify<TFieldPlugins[F] & {
86
+ plugin: string;
87
+ _uid?: string;
88
+ }> : PluginFieldValue : PluginFieldValue;
65
89
  /** Resolves a field definition to its runtime content value type (read). */
66
- type FieldValue<TField extends Field = Field, TBlocks = NoBlocks> = Prettify<TField extends {
90
+ type FieldValue<TField extends Field = Field, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = Prettify<TField extends {
67
91
  type: 'bloks';
68
- } ? [TBlocks] extends [never] ? BlockContentBase[] : [TBlocks] extends [Block] ? BlockContent<ApplyWhitelist<TField, TBlocks>, TBlocks>[] : BlockContentBase[] : FieldTypeValueMap[TField['type']]>;
92
+ } ? [TBlocks] extends [never] ? BlockContentBase[] : [TBlocks] extends [Block] ? BlockContent<ApplyAllow<TField, TBlocks>, TBlocks, TFieldPlugins>[] : BlockContentBase[] : TField extends {
93
+ type: 'custom';
94
+ } ? ResolveCustom<TField, TFieldPlugins> : FieldTypeValueMap[TField['type']]>;
69
95
  /** Resolves a field definition to its input value type (write). */
70
- type FieldValueInput<TField extends Field = Field, TBlocks = NoBlocks> = Prettify<TField extends {
96
+ type FieldValueInput<TField extends Field = Field, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = Prettify<TField extends {
71
97
  type: 'bloks';
72
- } ? [TBlocks] extends [never] ? BlockContentInputBase[] : [TBlocks] extends [Block] ? BlockContentInput<ApplyWhitelist<TField, TBlocks>, TBlocks>[] : BlockContentInputBase[] : FieldTypeValueMap[TField['type']]>;
98
+ } ? [TBlocks] extends [never] ? BlockContentInputBase[] : [TBlocks] extends [Block] ? BlockContentInput<ApplyAllow<TField, TBlocks>, TBlocks, TFieldPlugins>[] : BlockContentInputBase[] : TField extends {
99
+ type: 'custom';
100
+ } ? ResolveCustom<TField, TFieldPlugins> : FieldTypeValueMap[TField['type']]>;
73
101
  //#endregion
74
102
  export { BlockContent, BlockContentInput, BlocksFieldValue };
75
103
  //# sourceMappingURL=field.d.mts.map
@@ -14,16 +14,16 @@ type NoBlocks = false;
14
14
  * Base (un-narrowed) `RootBlock` means no schema was supplied, so the generated
15
15
  * story passes through unchanged.
16
16
  */
17
- type MapiStoryWithSchemaContent<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlock extends RootBlock = RootBlock, TBlocks = NoBlocks> = RootBlock extends TBlock ? TStory : Override<TStory, {
18
- content: TStory extends StoryCreate$1 | StoryUpdate$1 ? BlockContentInput<TBlock, TBlocks> : BlockContent<TBlock, TBlocks>;
17
+ type MapiStoryWithSchemaContent<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlock extends RootBlock = RootBlock, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = RootBlock extends TBlock ? TStory : Override<TStory, {
18
+ content: TStory extends StoryCreate$1 | StoryUpdate$1 ? BlockContentInput<TBlock, TBlocks, TFieldPlugins> : BlockContent<TBlock, TBlocks, TFieldPlugins>;
19
19
  }>;
20
- type MakeMapiStory<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = Prettify<[TBlockOrBlocks] extends [RootBlock] ? MapiStoryWithSchemaContent<TStory, TBlockOrBlocks, TBlocks> : TBlocks extends NoBlocks ? MapiStoryWithSchemaContent<TStory, Extract<TBlockOrBlocks, RootBlock>, TBlockOrBlocks> : never>;
20
+ type MakeMapiStory<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = Prettify<[TBlockOrBlocks] extends [RootBlock] ? MapiStoryWithSchemaContent<TStory, TBlockOrBlocks, TBlocks, TFieldPlugins> : TBlocks extends NoBlocks ? MapiStoryWithSchemaContent<TStory, Extract<TBlockOrBlocks, RootBlock>, TBlockOrBlocks, TFieldPlugins> : never>;
21
21
  /** A Storyblok MAPI story. */
22
- type MapiStory<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<MapiStory$1, TBlockOrBlocks, TBlocks>;
22
+ type MapiStory<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<MapiStory$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
23
23
  /** Payload for creating a story via the MAPI. */
24
- type StoryCreate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<StoryCreate$1, TBlockOrBlocks, TBlocks>;
24
+ type StoryCreate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<StoryCreate$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
25
25
  /** Payload for updating a story via the MAPI. */
26
- type StoryUpdate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<StoryUpdate$1, TBlockOrBlocks, TBlocks>;
26
+ type StoryUpdate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<StoryUpdate$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
27
27
  //#endregion
28
28
  export { MapiStory, StoryCreate, StoryUpdate };
29
29
  //# sourceMappingURL=mapi-story.d.cts.map
@@ -14,16 +14,16 @@ type NoBlocks = false;
14
14
  * Base (un-narrowed) `RootBlock` means no schema was supplied, so the generated
15
15
  * story passes through unchanged.
16
16
  */
17
- type MapiStoryWithSchemaContent<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlock extends RootBlock = RootBlock, TBlocks = NoBlocks> = RootBlock extends TBlock ? TStory : Override<TStory, {
18
- content: TStory extends StoryCreate$1 | StoryUpdate$1 ? BlockContentInput<TBlock, TBlocks> : BlockContent<TBlock, TBlocks>;
17
+ type MapiStoryWithSchemaContent<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlock extends RootBlock = RootBlock, TBlocks = NoBlocks, TFieldPlugins = Record<never, never>> = RootBlock extends TBlock ? TStory : Override<TStory, {
18
+ content: TStory extends StoryCreate$1 | StoryUpdate$1 ? BlockContentInput<TBlock, TBlocks, TFieldPlugins> : BlockContent<TBlock, TBlocks, TFieldPlugins>;
19
19
  }>;
20
- type MakeMapiStory<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = Prettify<[TBlockOrBlocks] extends [RootBlock] ? MapiStoryWithSchemaContent<TStory, TBlockOrBlocks, TBlocks> : TBlocks extends NoBlocks ? MapiStoryWithSchemaContent<TStory, Extract<TBlockOrBlocks, RootBlock>, TBlockOrBlocks> : never>;
20
+ type MakeMapiStory<TStory extends MapiStory$1 | StoryCreate$1 | StoryUpdate$1, TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = Prettify<[TBlockOrBlocks] extends [RootBlock] ? MapiStoryWithSchemaContent<TStory, TBlockOrBlocks, TBlocks, TFieldPlugins> : TBlocks extends NoBlocks ? MapiStoryWithSchemaContent<TStory, Extract<TBlockOrBlocks, RootBlock>, TBlockOrBlocks, TFieldPlugins> : never>;
21
21
  /** A Storyblok MAPI story. */
22
- type MapiStory<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<MapiStory$1, TBlockOrBlocks, TBlocks>;
22
+ type MapiStory<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<MapiStory$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
23
23
  /** Payload for creating a story via the MAPI. */
24
- type StoryCreate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<StoryCreate$1, TBlockOrBlocks, TBlocks>;
24
+ type StoryCreate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<StoryCreate$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
25
25
  /** Payload for updating a story via the MAPI. */
26
- type StoryUpdate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TBlocks = NoBlocks> = MakeMapiStory<StoryUpdate$1, TBlockOrBlocks, TBlocks>;
26
+ type StoryUpdate<TBlockOrBlocks extends RootBlock | Block = RootBlock, TFieldPlugins = Record<never, never>, TBlocks = NoBlocks> = MakeMapiStory<StoryUpdate$1, TBlockOrBlocks, TFieldPlugins, TBlocks>;
27
27
  //#endregion
28
28
  export { MapiStory, StoryCreate, StoryUpdate };
29
29
  //# sourceMappingURL=mapi-story.d.mts.map
package/dist/index.d.cts CHANGED
@@ -1,15 +1,17 @@
1
1
  import { AssetUpdateRequest, CreateAsset, SpaceDetail } from "./generated/mapi/types.gen.cjs";
2
- import { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate } from "./generated/mapi/types-aliased.gen.cjs";
2
+ import { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, Component, ComponentCreate, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, ComponentUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate } from "./generated/mapi/types-aliased.gen.cjs";
3
3
  import { AssetCreate as AssetCreate$1, AssetListQuery } from "./resources/assets.cjs";
4
- import { ComponentCreate, ComponentUpdate } from "./generated/mapi/_internal.gen.cjs";
5
4
  import { AssetFieldValue, Field, MultilinkFieldValue, PluginFieldValue, RichtextFieldValue, TableFieldValue } from "./generated/overlay/_internal.gen.cjs";
6
- import { Block, RootBlock } from "./generated/types/block.cjs";
5
+ import { RootBlock } from "./generated/types/block.cjs";
7
6
  import { ApiErrorBody, ClientError } from "./error.cjs";
8
7
  import { RateLimitConfig } from "./utils/rate-limit.cjs";
9
8
  import { BlockContent, BlockContentInput, BlocksFieldValue } from "./generated/types/field.cjs";
10
9
  import { MapiStory, StoryCreate, StoryUpdate } from "./generated/types/mapi-story.cjs";
11
10
  import { StoryListQuery } from "./resources/stories.cjs";
12
11
  import { ApiResponse, FetchOptions, HttpRequestOptions, ManagementApiClient, ManagementApiClientConfig, MapiResourceDeps, RequestConfigOverrides, createManagementApiClient } from "./client.cjs";
12
+ import { AccessLevel, AssetFolderAccess, SharedAssetFolder, SharedAssetFolderCreate, SharedAssetFolderGetResponse, SharedAssetFolderListResponse, SharedAssetFolderUpdate } from "./resources/shared-asset-folders.cjs";
13
+ import { SharedAssetCreate, SharedAssetListQuery, SharedAssetListResponse, SharedAssetUploadRequest } from "./resources/shared-assets.cjs";
14
+ import { SharedInternalTag, SharedInternalTagCreate, SharedInternalTagListQuery, SharedInternalTagListResponse, SharedInternalTagMutateResponse, SharedInternalTagObjectType } from "./resources/shared-internal-tags.cjs";
13
15
  import { SpaceCreateQuery } from "./resources/spaces.cjs";
14
16
  import { normalizeAssetUrl } from "./utils/normalize-asset-url.cjs";
15
- export { type ApiErrorBody, type ApiResponse, type Asset, type AssetCreate, type AssetFieldValue, type AssetFolder, type AssetFolderCreate, type AssetFolderUpdate, type AssetListQuery, type AssetUpdate, type AssetUpdateRequest, type AssetCreate$1 as AssetUploadRequest, type BlockContent as BlokContent, type BlockContentInput as BlokContentInput, type BlocksFieldValue as BloksFieldValue, ClientError, type Block as Component, type ComponentCreate, type ComponentFolder, type ComponentFolderCreate, type ComponentFolderUpdate, type ComponentUpdate, type MapiDatasource as Datasource, type DatasourceCreate, type MapiDatasourceEntry as DatasourceEntry, type DatasourceUpdate, type FetchOptions, type Field, type HttpRequestOptions, type InternalTag, type InternalTagCreate, type InternalTagUpdate, type ManagementApiClient, type ManagementApiClientConfig, type MapiResourceDeps, type MultilinkFieldValue, type PluginFieldValue, type Preset, type PresetCreate, type PresetUpdate, type RateLimitConfig, type RequestConfigOverrides, type RichtextFieldValue, type RootBlock as RootComponents, type CreateAsset as SignedResponseObject, type Space, type SpaceCreate, type SpaceCreateQuery, type SpaceDetail, type SpaceUpdate, type MapiStory as Story, type StoryCreate, type StoryListQuery, type StoryLocalizedPath, type StoryTranslatedSlug, type StoryUpdate, type TableFieldValue, type User, type UserUpdate, createManagementApiClient, normalizeAssetUrl };
17
+ export { type AccessLevel, type ApiErrorBody, type ApiResponse, type Asset, type AssetCreate, type AssetFieldValue, type AssetFolder, type AssetFolderAccess, type AssetFolderCreate, type AssetFolderUpdate, type AssetListQuery, type AssetUpdate, type AssetUpdateRequest, type AssetCreate$1 as AssetUploadRequest, type BlockContent as BlokContent, type BlockContentInput as BlokContentInput, type BlocksFieldValue as BloksFieldValue, ClientError, type Component, type ComponentCreate, type ComponentFolder, type ComponentFolderCreate, type ComponentFolderUpdate, type ComponentUpdate, type MapiDatasource as Datasource, type DatasourceCreate, type MapiDatasourceEntry as DatasourceEntry, type DatasourceUpdate, type FetchOptions, type Field, type HttpRequestOptions, type InternalTag, type InternalTagCreate, type InternalTagUpdate, type ManagementApiClient, type ManagementApiClientConfig, type MapiResourceDeps, type MultilinkFieldValue, type PluginFieldValue, type Preset, type PresetCreate, type PresetUpdate, type RateLimitConfig, type RequestConfigOverrides, type RichtextFieldValue, type RootBlock as RootComponents, type SharedAssetCreate, type SharedAssetFolder, type SharedAssetFolderCreate, type SharedAssetFolderGetResponse, type SharedAssetFolderListResponse, type SharedAssetFolderUpdate, type SharedAssetListQuery, type SharedAssetListResponse, type SharedAssetUploadRequest, type SharedInternalTag, type SharedInternalTagCreate, type SharedInternalTagListQuery, type SharedInternalTagListResponse, type SharedInternalTagMutateResponse, type SharedInternalTagObjectType, type CreateAsset as SignedResponseObject, type Space, type SpaceCreate, type SpaceCreateQuery, type SpaceDetail, type SpaceUpdate, type MapiStory as Story, type StoryCreate, type StoryListQuery, type StoryLocalizedPath, type StoryTranslatedSlug, type StoryUpdate, type TableFieldValue, type User, type UserUpdate, createManagementApiClient, normalizeAssetUrl };
package/dist/index.d.mts CHANGED
@@ -1,15 +1,17 @@
1
1
  import { AssetUpdateRequest, CreateAsset, SpaceDetail } from "./generated/mapi/types.gen.mjs";
2
- import { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate } from "./generated/mapi/types-aliased.gen.mjs";
2
+ import { Asset, AssetCreate, AssetFolder, AssetFolderCreate, AssetFolderUpdate, AssetUpdate, Component, ComponentCreate, ComponentFolder, ComponentFolderCreate, ComponentFolderUpdate, ComponentUpdate, DatasourceCreate, DatasourceUpdate, InternalTag, InternalTagCreate, InternalTagUpdate, MapiDatasource, MapiDatasourceEntry, Preset, PresetCreate, PresetUpdate, Space, SpaceCreate, SpaceUpdate, StoryLocalizedPath, StoryTranslatedSlug, User, UserUpdate } from "./generated/mapi/types-aliased.gen.mjs";
3
3
  import { AssetCreate as AssetCreate$1, AssetListQuery } from "./resources/assets.mjs";
4
- import { ComponentCreate, ComponentUpdate } from "./generated/mapi/_internal.gen.mjs";
5
4
  import { AssetFieldValue, Field, MultilinkFieldValue, PluginFieldValue, RichtextFieldValue, TableFieldValue } from "./generated/overlay/_internal.gen.mjs";
6
- import { Block, RootBlock } from "./generated/types/block.mjs";
5
+ import { RootBlock } from "./generated/types/block.mjs";
7
6
  import { ApiErrorBody, ClientError } from "./error.mjs";
8
7
  import { RateLimitConfig } from "./utils/rate-limit.mjs";
9
8
  import { BlockContent, BlockContentInput, BlocksFieldValue } from "./generated/types/field.mjs";
10
9
  import { MapiStory, StoryCreate, StoryUpdate } from "./generated/types/mapi-story.mjs";
11
10
  import { StoryListQuery } from "./resources/stories.mjs";
12
11
  import { ApiResponse, FetchOptions, HttpRequestOptions, ManagementApiClient, ManagementApiClientConfig, MapiResourceDeps, RequestConfigOverrides, createManagementApiClient } from "./client.mjs";
12
+ import { AccessLevel, AssetFolderAccess, SharedAssetFolder, SharedAssetFolderCreate, SharedAssetFolderGetResponse, SharedAssetFolderListResponse, SharedAssetFolderUpdate } from "./resources/shared-asset-folders.mjs";
13
+ import { SharedAssetCreate, SharedAssetListQuery, SharedAssetListResponse, SharedAssetUploadRequest } from "./resources/shared-assets.mjs";
14
+ import { SharedInternalTag, SharedInternalTagCreate, SharedInternalTagListQuery, SharedInternalTagListResponse, SharedInternalTagMutateResponse, SharedInternalTagObjectType } from "./resources/shared-internal-tags.mjs";
13
15
  import { SpaceCreateQuery } from "./resources/spaces.mjs";
14
16
  import { normalizeAssetUrl } from "./utils/normalize-asset-url.mjs";
15
- export { type ApiErrorBody, type ApiResponse, type Asset, type AssetCreate, type AssetFieldValue, type AssetFolder, type AssetFolderCreate, type AssetFolderUpdate, type AssetListQuery, type AssetUpdate, type AssetUpdateRequest, type AssetCreate$1 as AssetUploadRequest, type BlockContent as BlokContent, type BlockContentInput as BlokContentInput, type BlocksFieldValue as BloksFieldValue, ClientError, type Block as Component, type ComponentCreate, type ComponentFolder, type ComponentFolderCreate, type ComponentFolderUpdate, type ComponentUpdate, type MapiDatasource as Datasource, type DatasourceCreate, type MapiDatasourceEntry as DatasourceEntry, type DatasourceUpdate, type FetchOptions, type Field, type HttpRequestOptions, type InternalTag, type InternalTagCreate, type InternalTagUpdate, type ManagementApiClient, type ManagementApiClientConfig, type MapiResourceDeps, type MultilinkFieldValue, type PluginFieldValue, type Preset, type PresetCreate, type PresetUpdate, type RateLimitConfig, type RequestConfigOverrides, type RichtextFieldValue, type RootBlock as RootComponents, type CreateAsset as SignedResponseObject, type Space, type SpaceCreate, type SpaceCreateQuery, type SpaceDetail, type SpaceUpdate, type MapiStory as Story, type StoryCreate, type StoryListQuery, type StoryLocalizedPath, type StoryTranslatedSlug, type StoryUpdate, type TableFieldValue, type User, type UserUpdate, createManagementApiClient, normalizeAssetUrl };
17
+ export { type AccessLevel, type ApiErrorBody, type ApiResponse, type Asset, type AssetCreate, type AssetFieldValue, type AssetFolder, type AssetFolderAccess, type AssetFolderCreate, type AssetFolderUpdate, type AssetListQuery, type AssetUpdate, type AssetUpdateRequest, type AssetCreate$1 as AssetUploadRequest, type BlockContent as BlokContent, type BlockContentInput as BlokContentInput, type BlocksFieldValue as BloksFieldValue, ClientError, type Component, type ComponentCreate, type ComponentFolder, type ComponentFolderCreate, type ComponentFolderUpdate, type ComponentUpdate, type MapiDatasource as Datasource, type DatasourceCreate, type MapiDatasourceEntry as DatasourceEntry, type DatasourceUpdate, type FetchOptions, type Field, type HttpRequestOptions, type InternalTag, type InternalTagCreate, type InternalTagUpdate, type ManagementApiClient, type ManagementApiClientConfig, type MapiResourceDeps, type MultilinkFieldValue, type PluginFieldValue, type Preset, type PresetCreate, type PresetUpdate, type RateLimitConfig, type RequestConfigOverrides, type RichtextFieldValue, type RootBlock as RootComponents, type SharedAssetCreate, type SharedAssetFolder, type SharedAssetFolderCreate, type SharedAssetFolderGetResponse, type SharedAssetFolderListResponse, type SharedAssetFolderUpdate, type SharedAssetListQuery, type SharedAssetListResponse, type SharedAssetUploadRequest, type SharedInternalTag, type SharedInternalTagCreate, type SharedInternalTagListQuery, type SharedInternalTagListResponse, type SharedInternalTagMutateResponse, type SharedInternalTagObjectType, type CreateAsset as SignedResponseObject, type Space, type SpaceCreate, type SpaceCreateQuery, type SpaceDetail, type SpaceUpdate, type MapiStory as Story, type StoryCreate, type StoryListQuery, type StoryLocalizedPath, type StoryTranslatedSlug, type StoryUpdate, type TableFieldValue, type User, type UserUpdate, createManagementApiClient, normalizeAssetUrl };
@@ -320,4 +320,5 @@ function createAssetsResource(deps) {
320
320
 
321
321
  //#endregion
322
322
  exports.createAssetsResource = createAssetsResource;
323
+ exports.uploadToS3 = uploadToS3;
323
324
  //# sourceMappingURL=assets.cjs.map