@storyblok/schema 0.1.0-alpha.0 → 0.1.0-alpha.2
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/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/field-plugins/index.cjs +4 -0
- package/dist/field-plugins/index.d.cts +2 -0
- package/dist/field-plugins/index.d.mts +2 -0
- package/dist/field-plugins/index.mjs +3 -0
- package/dist/field-plugins/storyblok-color-field.cjs +32 -0
- package/dist/field-plugins/storyblok-color-field.cjs.map +1 -0
- package/dist/field-plugins/storyblok-color-field.d.cts +16 -0
- package/dist/field-plugins/storyblok-color-field.d.mts +16 -0
- package/dist/field-plugins/storyblok-color-field.mjs +32 -0
- package/dist/field-plugins/storyblok-color-field.mjs.map +1 -0
- package/dist/generated/capi/types.gen.d.cts +1 -126
- package/dist/generated/capi/types.gen.d.mts +1 -126
- package/dist/generated/mapi/_internal.gen.d.cts +1 -171
- package/dist/generated/mapi/_internal.gen.d.mts +1 -171
- package/dist/generated/overlay/zod.gen.cjs +407 -0
- package/dist/generated/overlay/zod.gen.cjs.map +1 -0
- package/dist/generated/overlay/zod.gen.mjs +402 -0
- package/dist/generated/overlay/zod.gen.mjs.map +1 -0
- package/dist/generated/types/block.d.cts +27 -14
- package/dist/generated/types/block.d.mts +27 -14
- package/dist/generated/types/field.d.cts +48 -17
- package/dist/generated/types/field.d.mts +48 -17
- package/dist/generated/types/mapi-story.d.cts +6 -10
- package/dist/generated/types/mapi-story.d.mts +6 -10
- package/dist/generated/types/story.d.cts +3 -3
- package/dist/generated/types/story.d.mts +3 -3
- package/dist/helpers/define-block.cjs +10 -28
- package/dist/helpers/define-block.cjs.map +1 -1
- package/dist/helpers/define-block.d.cts +14 -31
- package/dist/helpers/define-block.d.mts +14 -31
- package/dist/helpers/define-block.mjs +11 -27
- package/dist/helpers/define-block.mjs.map +1 -1
- package/dist/helpers/define-datasource.cjs +0 -16
- package/dist/helpers/define-datasource.cjs.map +1 -1
- package/dist/helpers/define-datasource.d.cts +14 -23
- package/dist/helpers/define-datasource.d.mts +14 -23
- package/dist/helpers/define-datasource.mjs +1 -15
- package/dist/helpers/define-datasource.mjs.map +1 -1
- package/dist/helpers/define-field-plugin.cjs +21 -0
- package/dist/helpers/define-field-plugin.cjs.map +1 -0
- package/dist/helpers/define-field-plugin.d.cts +33 -0
- package/dist/helpers/define-field-plugin.d.mts +33 -0
- package/dist/helpers/define-field-plugin.mjs +20 -0
- package/dist/helpers/define-field-plugin.mjs.map +1 -0
- package/dist/helpers/define-field.cjs +11 -11
- package/dist/helpers/define-field.cjs.map +1 -1
- package/dist/helpers/define-field.d.cts +46 -85
- package/dist/helpers/define-field.d.mts +46 -85
- package/dist/helpers/define-field.mjs +12 -11
- package/dist/helpers/define-field.mjs.map +1 -1
- package/dist/helpers/define-schema.cjs +22 -0
- package/dist/helpers/define-schema.cjs.map +1 -0
- package/dist/helpers/define-schema.d.cts +28 -0
- package/dist/helpers/define-schema.d.mts +28 -0
- package/dist/helpers/define-schema.mjs +21 -0
- package/dist/helpers/define-schema.mjs.map +1 -0
- package/dist/helpers/schema-type.d.cts +21 -17
- package/dist/helpers/schema-type.d.mts +21 -17
- package/dist/index.cjs +10 -47
- package/dist/index.d.cts +13 -20
- package/dist/index.d.mts +13 -20
- package/dist/index.mjs +8 -15
- package/dist/utils/is-record.cjs +10 -0
- package/dist/utils/is-record.cjs.map +1 -0
- package/dist/utils/is-record.mjs +9 -0
- package/dist/utils/is-record.mjs.map +1 -0
- package/dist/validators/create-story-validator.cjs +37 -0
- package/dist/validators/create-story-validator.cjs.map +1 -0
- package/dist/validators/create-story-validator.d.cts +18 -0
- package/dist/validators/create-story-validator.d.mts +18 -0
- package/dist/validators/create-story-validator.mjs +37 -0
- package/dist/validators/create-story-validator.mjs.map +1 -0
- package/dist/validators/internal-schemas.cjs +1 -0
- package/dist/validators/internal-schemas.mjs +3 -0
- package/dist/validators/shapes.cjs +12 -0
- package/dist/validators/shapes.cjs.map +1 -0
- package/dist/validators/shapes.d.cts +71 -0
- package/dist/validators/shapes.d.mts +71 -0
- package/dist/validators/shapes.mjs +12 -0
- package/dist/validators/shapes.mjs.map +1 -0
- package/dist/validators/types.d.cts +25 -0
- package/dist/validators/types.d.mts +25 -0
- package/dist/validators/validate-schema.cjs +145 -0
- package/dist/validators/validate-schema.cjs.map +1 -0
- package/dist/validators/validate-schema.d.cts +19 -0
- package/dist/validators/validate-schema.d.mts +19 -0
- package/dist/validators/validate-schema.mjs +145 -0
- package/dist/validators/validate-schema.mjs.map +1 -0
- package/dist/validators/validate-story.cjs +285 -0
- package/dist/validators/validate-story.cjs.map +1 -0
- package/dist/validators/validate-story.d.cts +17 -0
- package/dist/validators/validate-story.d.mts +17 -0
- package/dist/validators/validate-story.mjs +284 -0
- package/dist/validators/validate-story.mjs.map +1 -0
- package/package.json +17 -2
- package/dist/generated/mapi/types.gen.d.cts +0 -1272
- package/dist/generated/mapi/types.gen.d.mts +0 -1272
- package/dist/helpers/create-story-helpers.cjs +0 -42
- package/dist/helpers/create-story-helpers.cjs.map +0 -1
- package/dist/helpers/create-story-helpers.d.cts +0 -50
- package/dist/helpers/create-story-helpers.d.mts +0 -50
- package/dist/helpers/create-story-helpers.mjs +0 -42
- package/dist/helpers/create-story-helpers.mjs.map +0 -1
- package/dist/helpers/define-asset-folder.cjs +0 -46
- package/dist/helpers/define-asset-folder.cjs.map +0 -1
- package/dist/helpers/define-asset-folder.d.cts +0 -33
- package/dist/helpers/define-asset-folder.d.mts +0 -33
- package/dist/helpers/define-asset-folder.mjs +0 -43
- package/dist/helpers/define-asset-folder.mjs.map +0 -1
- package/dist/helpers/define-asset.cjs +0 -60
- package/dist/helpers/define-asset.cjs.map +0 -1
- package/dist/helpers/define-asset.d.cts +0 -32
- package/dist/helpers/define-asset.d.mts +0 -32
- package/dist/helpers/define-asset.mjs +0 -57
- package/dist/helpers/define-asset.mjs.map +0 -1
- package/dist/helpers/define-block-folder.cjs +0 -44
- package/dist/helpers/define-block-folder.cjs.map +0 -1
- package/dist/helpers/define-block-folder.d.cts +0 -34
- package/dist/helpers/define-block-folder.d.mts +0 -34
- package/dist/helpers/define-block-folder.mjs +0 -41
- package/dist/helpers/define-block-folder.mjs.map +0 -1
- package/dist/helpers/define-datasource-entry.cjs +0 -47
- package/dist/helpers/define-datasource-entry.cjs.map +0 -1
- package/dist/helpers/define-datasource-entry.d.cts +0 -49
- package/dist/helpers/define-datasource-entry.d.mts +0 -49
- package/dist/helpers/define-datasource-entry.mjs +0 -43
- package/dist/helpers/define-datasource-entry.mjs.map +0 -1
- package/dist/helpers/define-internal-tag.cjs +0 -41
- package/dist/helpers/define-internal-tag.cjs.map +0 -1
- package/dist/helpers/define-internal-tag.d.cts +0 -34
- package/dist/helpers/define-internal-tag.d.mts +0 -34
- package/dist/helpers/define-internal-tag.mjs +0 -38
- package/dist/helpers/define-internal-tag.mjs.map +0 -1
- package/dist/helpers/define-link.cjs +0 -23
- package/dist/helpers/define-link.cjs.map +0 -1
- package/dist/helpers/define-link.d.cts +0 -32
- package/dist/helpers/define-link.d.mts +0 -32
- package/dist/helpers/define-link.mjs +0 -22
- package/dist/helpers/define-link.mjs.map +0 -1
- package/dist/helpers/define-preset.cjs +0 -44
- package/dist/helpers/define-preset.cjs.map +0 -1
- package/dist/helpers/define-preset.d.cts +0 -35
- package/dist/helpers/define-preset.d.mts +0 -35
- package/dist/helpers/define-preset.mjs +0 -41
- package/dist/helpers/define-preset.mjs.map +0 -1
- package/dist/helpers/define-space.cjs +0 -47
- package/dist/helpers/define-space.cjs.map +0 -1
- package/dist/helpers/define-space.d.cts +0 -31
- package/dist/helpers/define-space.d.mts +0 -31
- package/dist/helpers/define-space.mjs +0 -44
- package/dist/helpers/define-space.mjs.map +0 -1
- package/dist/helpers/define-story.cjs +0 -122
- package/dist/helpers/define-story.cjs.map +0 -1
- package/dist/helpers/define-story.d.cts +0 -135
- package/dist/helpers/define-story.d.mts +0 -135
- package/dist/helpers/define-story.mjs +0 -118
- package/dist/helpers/define-story.mjs.map +0 -1
- package/dist/helpers/define-tag.cjs +0 -13
- package/dist/helpers/define-tag.cjs.map +0 -1
- package/dist/helpers/define-tag.d.cts +0 -23
- package/dist/helpers/define-tag.d.mts +0 -23
- package/dist/helpers/define-tag.mjs +0 -12
- package/dist/helpers/define-tag.mjs.map +0 -1
- package/dist/helpers/define-user.cjs +0 -50
- package/dist/helpers/define-user.cjs.map +0 -1
- package/dist/helpers/define-user.d.cts +0 -26
- package/dist/helpers/define-user.d.mts +0 -26
- package/dist/helpers/define-user.mjs +0 -48
- package/dist/helpers/define-user.mjs.map +0 -1
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/helpers/define-preset.ts
|
|
3
|
-
const PRESET_DEFAULTS = {
|
|
4
|
-
id: 1,
|
|
5
|
-
space_id: 1,
|
|
6
|
-
preset: null,
|
|
7
|
-
created_at: "",
|
|
8
|
-
updated_at: ""
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Defines a preset for the MAPI.
|
|
12
|
-
* API-assigned fields (`id`) are optional and filled with safe defaults.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* import { definePreset } from '@storyblok/schema';
|
|
16
|
-
* const preset = definePreset({ name: 'Hero Dark', component_id: 42 });
|
|
17
|
-
*/
|
|
18
|
-
const definePreset = (preset) => ({
|
|
19
|
-
...PRESET_DEFAULTS,
|
|
20
|
-
...preset,
|
|
21
|
-
preset: preset.preset ?? PRESET_DEFAULTS.preset
|
|
22
|
-
});
|
|
23
|
-
/**
|
|
24
|
-
* Defines a preset creation payload for the MAPI.
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* import { definePresetCreate } from '@storyblok/schema';
|
|
28
|
-
* const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });
|
|
29
|
-
*/
|
|
30
|
-
const definePresetCreate = (preset) => preset;
|
|
31
|
-
/**
|
|
32
|
-
* Defines a preset update payload for the MAPI.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* import { definePresetUpdate } from '@storyblok/schema';
|
|
36
|
-
* const payload = definePresetUpdate({ name: 'Hero Light' });
|
|
37
|
-
*/
|
|
38
|
-
const definePresetUpdate = (preset) => preset;
|
|
39
|
-
|
|
40
|
-
//#endregion
|
|
41
|
-
exports.definePreset = definePreset;
|
|
42
|
-
exports.definePresetCreate = definePresetCreate;
|
|
43
|
-
exports.definePresetUpdate = definePresetUpdate;
|
|
44
|
-
//# sourceMappingURL=define-preset.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-preset.cjs","names":[],"sources":["../../src/helpers/define-preset.ts"],"sourcesContent":["import type { Preset, PresetCreate, PresetUpdate } from '../generated/mapi/types.gen';\n\nexport type { Preset, PresetCreate, PresetUpdate };\n\nconst PRESET_DEFAULTS = {\n id: 1,\n space_id: 1,\n preset: null,\n created_at: '',\n updated_at: '',\n};\n\ntype PresetInput = { name: string; component_id: number } & Partial<Omit<Preset, 'name' | 'component_id'>>;\n\n/**\n * Defines a preset for the MAPI.\n * API-assigned fields (`id`) are optional and filled with safe defaults.\n *\n * @example\n * import { definePreset } from '@storyblok/schema';\n * const preset = definePreset({ name: 'Hero Dark', component_id: 42 });\n */\nexport const definePreset = (preset: PresetInput): Preset => ({\n ...PRESET_DEFAULTS,\n ...preset,\n preset: preset.preset ?? PRESET_DEFAULTS.preset,\n});\n\n/**\n * Defines a preset creation payload for the MAPI.\n *\n * @example\n * import { definePresetCreate } from '@storyblok/schema';\n * const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });\n */\nexport const definePresetCreate = (preset: PresetCreate): PresetCreate => preset;\n\n/**\n * Defines a preset update payload for the MAPI.\n *\n * @example\n * import { definePresetUpdate } from '@storyblok/schema';\n * const payload = definePresetUpdate({ name: 'Hero Light' });\n */\nexport const definePresetUpdate = (preset: PresetUpdate): PresetUpdate => preset;\n"],"mappings":";;AAIA,MAAM,kBAAkB;CACtB,IAAI;CACJ,UAAU;CACV,QAAQ;CACR,YAAY;CACZ,YAAY;CACb;;;;;;;;;AAYD,MAAa,gBAAgB,YAAiC;CAC5D,GAAG;CACH,GAAG;CACH,QAAQ,OAAO,UAAU,gBAAgB;CAC1C;;;;;;;;AASD,MAAa,sBAAsB,WAAuC;;;;;;;;AAS1E,MAAa,sBAAsB,WAAuC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Preset, PresetCreate, PresetUpdate } from "../generated/mapi/types.gen.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/define-preset.d.ts
|
|
4
|
-
type PresetInput = {
|
|
5
|
-
name: string;
|
|
6
|
-
component_id: number;
|
|
7
|
-
} & Partial<Omit<Preset, 'name' | 'component_id'>>;
|
|
8
|
-
/**
|
|
9
|
-
* Defines a preset for the MAPI.
|
|
10
|
-
* API-assigned fields (`id`) are optional and filled with safe defaults.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* import { definePreset } from '@storyblok/schema';
|
|
14
|
-
* const preset = definePreset({ name: 'Hero Dark', component_id: 42 });
|
|
15
|
-
*/
|
|
16
|
-
declare const definePreset: (preset: PresetInput) => Preset;
|
|
17
|
-
/**
|
|
18
|
-
* Defines a preset creation payload for the MAPI.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* import { definePresetCreate } from '@storyblok/schema';
|
|
22
|
-
* const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });
|
|
23
|
-
*/
|
|
24
|
-
declare const definePresetCreate: (preset: PresetCreate) => PresetCreate;
|
|
25
|
-
/**
|
|
26
|
-
* Defines a preset update payload for the MAPI.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* import { definePresetUpdate } from '@storyblok/schema';
|
|
30
|
-
* const payload = definePresetUpdate({ name: 'Hero Light' });
|
|
31
|
-
*/
|
|
32
|
-
declare const definePresetUpdate: (preset: PresetUpdate) => PresetUpdate;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { definePreset, definePresetCreate, definePresetUpdate };
|
|
35
|
-
//# sourceMappingURL=define-preset.d.cts.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { Preset, PresetCreate, PresetUpdate } from "../generated/mapi/types.gen.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/define-preset.d.ts
|
|
4
|
-
type PresetInput = {
|
|
5
|
-
name: string;
|
|
6
|
-
component_id: number;
|
|
7
|
-
} & Partial<Omit<Preset, 'name' | 'component_id'>>;
|
|
8
|
-
/**
|
|
9
|
-
* Defines a preset for the MAPI.
|
|
10
|
-
* API-assigned fields (`id`) are optional and filled with safe defaults.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* import { definePreset } from '@storyblok/schema';
|
|
14
|
-
* const preset = definePreset({ name: 'Hero Dark', component_id: 42 });
|
|
15
|
-
*/
|
|
16
|
-
declare const definePreset: (preset: PresetInput) => Preset;
|
|
17
|
-
/**
|
|
18
|
-
* Defines a preset creation payload for the MAPI.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* import { definePresetCreate } from '@storyblok/schema';
|
|
22
|
-
* const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });
|
|
23
|
-
*/
|
|
24
|
-
declare const definePresetCreate: (preset: PresetCreate) => PresetCreate;
|
|
25
|
-
/**
|
|
26
|
-
* Defines a preset update payload for the MAPI.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* import { definePresetUpdate } from '@storyblok/schema';
|
|
30
|
-
* const payload = definePresetUpdate({ name: 'Hero Light' });
|
|
31
|
-
*/
|
|
32
|
-
declare const definePresetUpdate: (preset: PresetUpdate) => PresetUpdate;
|
|
33
|
-
//#endregion
|
|
34
|
-
export { definePreset, definePresetCreate, definePresetUpdate };
|
|
35
|
-
//# sourceMappingURL=define-preset.d.mts.map
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//#region src/helpers/define-preset.ts
|
|
2
|
-
const PRESET_DEFAULTS = {
|
|
3
|
-
id: 1,
|
|
4
|
-
space_id: 1,
|
|
5
|
-
preset: null,
|
|
6
|
-
created_at: "",
|
|
7
|
-
updated_at: ""
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Defines a preset for the MAPI.
|
|
11
|
-
* API-assigned fields (`id`) are optional and filled with safe defaults.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* import { definePreset } from '@storyblok/schema';
|
|
15
|
-
* const preset = definePreset({ name: 'Hero Dark', component_id: 42 });
|
|
16
|
-
*/
|
|
17
|
-
const definePreset = (preset) => ({
|
|
18
|
-
...PRESET_DEFAULTS,
|
|
19
|
-
...preset,
|
|
20
|
-
preset: preset.preset ?? PRESET_DEFAULTS.preset
|
|
21
|
-
});
|
|
22
|
-
/**
|
|
23
|
-
* Defines a preset creation payload for the MAPI.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* import { definePresetCreate } from '@storyblok/schema';
|
|
27
|
-
* const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });
|
|
28
|
-
*/
|
|
29
|
-
const definePresetCreate = (preset) => preset;
|
|
30
|
-
/**
|
|
31
|
-
* Defines a preset update payload for the MAPI.
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* import { definePresetUpdate } from '@storyblok/schema';
|
|
35
|
-
* const payload = definePresetUpdate({ name: 'Hero Light' });
|
|
36
|
-
*/
|
|
37
|
-
const definePresetUpdate = (preset) => preset;
|
|
38
|
-
|
|
39
|
-
//#endregion
|
|
40
|
-
export { definePreset, definePresetCreate, definePresetUpdate };
|
|
41
|
-
//# sourceMappingURL=define-preset.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-preset.mjs","names":[],"sources":["../../src/helpers/define-preset.ts"],"sourcesContent":["import type { Preset, PresetCreate, PresetUpdate } from '../generated/mapi/types.gen';\n\nexport type { Preset, PresetCreate, PresetUpdate };\n\nconst PRESET_DEFAULTS = {\n id: 1,\n space_id: 1,\n preset: null,\n created_at: '',\n updated_at: '',\n};\n\ntype PresetInput = { name: string; component_id: number } & Partial<Omit<Preset, 'name' | 'component_id'>>;\n\n/**\n * Defines a preset for the MAPI.\n * API-assigned fields (`id`) are optional and filled with safe defaults.\n *\n * @example\n * import { definePreset } from '@storyblok/schema';\n * const preset = definePreset({ name: 'Hero Dark', component_id: 42 });\n */\nexport const definePreset = (preset: PresetInput): Preset => ({\n ...PRESET_DEFAULTS,\n ...preset,\n preset: preset.preset ?? PRESET_DEFAULTS.preset,\n});\n\n/**\n * Defines a preset creation payload for the MAPI.\n *\n * @example\n * import { definePresetCreate } from '@storyblok/schema';\n * const payload = definePresetCreate({ name: 'Hero Dark', component_id: 42 });\n */\nexport const definePresetCreate = (preset: PresetCreate): PresetCreate => preset;\n\n/**\n * Defines a preset update payload for the MAPI.\n *\n * @example\n * import { definePresetUpdate } from '@storyblok/schema';\n * const payload = definePresetUpdate({ name: 'Hero Light' });\n */\nexport const definePresetUpdate = (preset: PresetUpdate): PresetUpdate => preset;\n"],"mappings":";AAIA,MAAM,kBAAkB;CACtB,IAAI;CACJ,UAAU;CACV,QAAQ;CACR,YAAY;CACZ,YAAY;CACb;;;;;;;;;AAYD,MAAa,gBAAgB,YAAiC;CAC5D,GAAG;CACH,GAAG;CACH,QAAQ,OAAO,UAAU,gBAAgB;CAC1C;;;;;;;;AASD,MAAa,sBAAsB,WAAuC;;;;;;;;AAS1E,MAAa,sBAAsB,WAAuC"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/helpers/define-space.ts
|
|
3
|
-
const SPACE_DEFAULTS = {
|
|
4
|
-
id: 1,
|
|
5
|
-
region: "",
|
|
6
|
-
owner_id: 1,
|
|
7
|
-
updated_at: "",
|
|
8
|
-
created_at: "",
|
|
9
|
-
plan: "",
|
|
10
|
-
plan_level: 0,
|
|
11
|
-
trial: false,
|
|
12
|
-
requires_2fa: false,
|
|
13
|
-
org_requires_2fa: false,
|
|
14
|
-
development_mode: false,
|
|
15
|
-
feature_limit_exceeded_flags: {}
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Defines a space for the MAPI.
|
|
19
|
-
* `name` is required; API-assigned fields (`id`) default to safe values.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* const space = defineSpace({ name: 'My Space' });
|
|
23
|
-
*/
|
|
24
|
-
const defineSpace = (space) => ({
|
|
25
|
-
...SPACE_DEFAULTS,
|
|
26
|
-
...space
|
|
27
|
-
});
|
|
28
|
-
/**
|
|
29
|
-
* Defines a space creation payload for the MAPI.
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* const payload = defineSpaceCreate({ name: 'My New Space' });
|
|
33
|
-
*/
|
|
34
|
-
const defineSpaceCreate = (space) => space;
|
|
35
|
-
/**
|
|
36
|
-
* Defines a space update payload for the MAPI.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* const payload = defineSpaceUpdate({ name: 'Updated Space Name' });
|
|
40
|
-
*/
|
|
41
|
-
const defineSpaceUpdate = (space) => space;
|
|
42
|
-
|
|
43
|
-
//#endregion
|
|
44
|
-
exports.defineSpace = defineSpace;
|
|
45
|
-
exports.defineSpaceCreate = defineSpaceCreate;
|
|
46
|
-
exports.defineSpaceUpdate = defineSpaceUpdate;
|
|
47
|
-
//# sourceMappingURL=define-space.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-space.cjs","names":[],"sources":["../../src/helpers/define-space.ts"],"sourcesContent":["import type { Space, SpaceCreate, SpaceUpdate } from '../generated/mapi/types.gen';\n\nexport type { Space, SpaceCreate, SpaceUpdate };\n\nconst SPACE_DEFAULTS = {\n id: 1,\n region: '',\n owner_id: 1,\n updated_at: '',\n created_at: '',\n plan: '',\n plan_level: 0,\n trial: false,\n requires_2fa: false,\n org_requires_2fa: false,\n development_mode: false,\n feature_limit_exceeded_flags: {},\n};\n\ntype SpaceInput = { name: string } & Partial<Omit<Space, 'name'>>;\n\n/**\n * Defines a space for the MAPI.\n * `name` is required; API-assigned fields (`id`) default to safe values.\n *\n * @example\n * const space = defineSpace({ name: 'My Space' });\n */\nexport const defineSpace = (space: SpaceInput): Space => ({ ...SPACE_DEFAULTS, ...space });\n\n/**\n * Defines a space creation payload for the MAPI.\n *\n * @example\n * const payload = defineSpaceCreate({ name: 'My New Space' });\n */\nexport const defineSpaceCreate = (space: SpaceCreate): SpaceCreate => space;\n\n/**\n * Defines a space update payload for the MAPI.\n *\n * @example\n * const payload = defineSpaceUpdate({ name: 'Updated Space Name' });\n */\nexport const defineSpaceUpdate = (space: SpaceUpdate): SpaceUpdate => space;\n"],"mappings":";;AAIA,MAAM,iBAAiB;CACrB,IAAI;CACJ,QAAQ;CACR,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,MAAM;CACN,YAAY;CACZ,OAAO;CACP,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,8BAA8B,EAAE;CACjC;;;;;;;;AAWD,MAAa,eAAe,WAA8B;CAAE,GAAG;CAAgB,GAAG;CAAO;;;;;;;AAQzF,MAAa,qBAAqB,UAAoC;;;;;;;AAQtE,MAAa,qBAAqB,UAAoC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Space, SpaceCreate, SpaceUpdate } from "../generated/mapi/types.gen.cjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/define-space.d.ts
|
|
4
|
-
type SpaceInput = {
|
|
5
|
-
name: string;
|
|
6
|
-
} & Partial<Omit<Space, 'name'>>;
|
|
7
|
-
/**
|
|
8
|
-
* Defines a space for the MAPI.
|
|
9
|
-
* `name` is required; API-assigned fields (`id`) default to safe values.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const space = defineSpace({ name: 'My Space' });
|
|
13
|
-
*/
|
|
14
|
-
declare const defineSpace: (space: SpaceInput) => Space;
|
|
15
|
-
/**
|
|
16
|
-
* Defines a space creation payload for the MAPI.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* const payload = defineSpaceCreate({ name: 'My New Space' });
|
|
20
|
-
*/
|
|
21
|
-
declare const defineSpaceCreate: (space: SpaceCreate) => SpaceCreate;
|
|
22
|
-
/**
|
|
23
|
-
* Defines a space update payload for the MAPI.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* const payload = defineSpaceUpdate({ name: 'Updated Space Name' });
|
|
27
|
-
*/
|
|
28
|
-
declare const defineSpaceUpdate: (space: SpaceUpdate) => SpaceUpdate;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { defineSpace, defineSpaceCreate, defineSpaceUpdate };
|
|
31
|
-
//# sourceMappingURL=define-space.d.cts.map
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Space, SpaceCreate, SpaceUpdate } from "../generated/mapi/types.gen.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/helpers/define-space.d.ts
|
|
4
|
-
type SpaceInput = {
|
|
5
|
-
name: string;
|
|
6
|
-
} & Partial<Omit<Space, 'name'>>;
|
|
7
|
-
/**
|
|
8
|
-
* Defines a space for the MAPI.
|
|
9
|
-
* `name` is required; API-assigned fields (`id`) default to safe values.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* const space = defineSpace({ name: 'My Space' });
|
|
13
|
-
*/
|
|
14
|
-
declare const defineSpace: (space: SpaceInput) => Space;
|
|
15
|
-
/**
|
|
16
|
-
* Defines a space creation payload for the MAPI.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* const payload = defineSpaceCreate({ name: 'My New Space' });
|
|
20
|
-
*/
|
|
21
|
-
declare const defineSpaceCreate: (space: SpaceCreate) => SpaceCreate;
|
|
22
|
-
/**
|
|
23
|
-
* Defines a space update payload for the MAPI.
|
|
24
|
-
*
|
|
25
|
-
* @example
|
|
26
|
-
* const payload = defineSpaceUpdate({ name: 'Updated Space Name' });
|
|
27
|
-
*/
|
|
28
|
-
declare const defineSpaceUpdate: (space: SpaceUpdate) => SpaceUpdate;
|
|
29
|
-
//#endregion
|
|
30
|
-
export { defineSpace, defineSpaceCreate, defineSpaceUpdate };
|
|
31
|
-
//# sourceMappingURL=define-space.d.mts.map
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
//#region src/helpers/define-space.ts
|
|
2
|
-
const SPACE_DEFAULTS = {
|
|
3
|
-
id: 1,
|
|
4
|
-
region: "",
|
|
5
|
-
owner_id: 1,
|
|
6
|
-
updated_at: "",
|
|
7
|
-
created_at: "",
|
|
8
|
-
plan: "",
|
|
9
|
-
plan_level: 0,
|
|
10
|
-
trial: false,
|
|
11
|
-
requires_2fa: false,
|
|
12
|
-
org_requires_2fa: false,
|
|
13
|
-
development_mode: false,
|
|
14
|
-
feature_limit_exceeded_flags: {}
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Defines a space for the MAPI.
|
|
18
|
-
* `name` is required; API-assigned fields (`id`) default to safe values.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const space = defineSpace({ name: 'My Space' });
|
|
22
|
-
*/
|
|
23
|
-
const defineSpace = (space) => ({
|
|
24
|
-
...SPACE_DEFAULTS,
|
|
25
|
-
...space
|
|
26
|
-
});
|
|
27
|
-
/**
|
|
28
|
-
* Defines a space creation payload for the MAPI.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* const payload = defineSpaceCreate({ name: 'My New Space' });
|
|
32
|
-
*/
|
|
33
|
-
const defineSpaceCreate = (space) => space;
|
|
34
|
-
/**
|
|
35
|
-
* Defines a space update payload for the MAPI.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* const payload = defineSpaceUpdate({ name: 'Updated Space Name' });
|
|
39
|
-
*/
|
|
40
|
-
const defineSpaceUpdate = (space) => space;
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
export { defineSpace, defineSpaceCreate, defineSpaceUpdate };
|
|
44
|
-
//# sourceMappingURL=define-space.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-space.mjs","names":[],"sources":["../../src/helpers/define-space.ts"],"sourcesContent":["import type { Space, SpaceCreate, SpaceUpdate } from '../generated/mapi/types.gen';\n\nexport type { Space, SpaceCreate, SpaceUpdate };\n\nconst SPACE_DEFAULTS = {\n id: 1,\n region: '',\n owner_id: 1,\n updated_at: '',\n created_at: '',\n plan: '',\n plan_level: 0,\n trial: false,\n requires_2fa: false,\n org_requires_2fa: false,\n development_mode: false,\n feature_limit_exceeded_flags: {},\n};\n\ntype SpaceInput = { name: string } & Partial<Omit<Space, 'name'>>;\n\n/**\n * Defines a space for the MAPI.\n * `name` is required; API-assigned fields (`id`) default to safe values.\n *\n * @example\n * const space = defineSpace({ name: 'My Space' });\n */\nexport const defineSpace = (space: SpaceInput): Space => ({ ...SPACE_DEFAULTS, ...space });\n\n/**\n * Defines a space creation payload for the MAPI.\n *\n * @example\n * const payload = defineSpaceCreate({ name: 'My New Space' });\n */\nexport const defineSpaceCreate = (space: SpaceCreate): SpaceCreate => space;\n\n/**\n * Defines a space update payload for the MAPI.\n *\n * @example\n * const payload = defineSpaceUpdate({ name: 'Updated Space Name' });\n */\nexport const defineSpaceUpdate = (space: SpaceUpdate): SpaceUpdate => space;\n"],"mappings":";AAIA,MAAM,iBAAiB;CACrB,IAAI;CACJ,QAAQ;CACR,UAAU;CACV,YAAY;CACZ,YAAY;CACZ,MAAM;CACN,YAAY;CACZ,OAAO;CACP,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,8BAA8B,EAAE;CACjC;;;;;;;;AAWD,MAAa,eAAe,WAA8B;CAAE,GAAG;CAAgB,GAAG;CAAO;;;;;;;AAQzF,MAAa,qBAAqB,UAAoC;;;;;;;AAQtE,MAAa,qBAAqB,UAAoC"}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/helpers/define-story.ts
|
|
3
|
-
const CAPI_STORY_DEFAULTS = {
|
|
4
|
-
id: 1,
|
|
5
|
-
uuid: "",
|
|
6
|
-
created_at: "",
|
|
7
|
-
updated_at: "",
|
|
8
|
-
published_at: null,
|
|
9
|
-
first_published_at: null,
|
|
10
|
-
full_slug: "",
|
|
11
|
-
group_id: "",
|
|
12
|
-
alternates: [],
|
|
13
|
-
default_full_slug: null,
|
|
14
|
-
release_id: null,
|
|
15
|
-
lang: "default",
|
|
16
|
-
slug: "",
|
|
17
|
-
parent_id: 0,
|
|
18
|
-
path: null,
|
|
19
|
-
is_startpage: false,
|
|
20
|
-
sort_by_date: null,
|
|
21
|
-
tag_list: [],
|
|
22
|
-
meta_data: null,
|
|
23
|
-
translated_slugs: null,
|
|
24
|
-
position: 0
|
|
25
|
-
};
|
|
26
|
-
const MAPI_STORY_DEFAULTS = {
|
|
27
|
-
id: 1,
|
|
28
|
-
uuid: "",
|
|
29
|
-
created_at: "",
|
|
30
|
-
updated_at: "",
|
|
31
|
-
published_at: null,
|
|
32
|
-
first_published_at: null,
|
|
33
|
-
full_slug: "",
|
|
34
|
-
group_id: "",
|
|
35
|
-
alternates: [],
|
|
36
|
-
slug: "",
|
|
37
|
-
parent_id: null,
|
|
38
|
-
parent: null,
|
|
39
|
-
path: null,
|
|
40
|
-
is_folder: false,
|
|
41
|
-
is_startpage: false,
|
|
42
|
-
sort_by_date: null,
|
|
43
|
-
tag_list: [],
|
|
44
|
-
meta_data: null,
|
|
45
|
-
translated_slugs: [],
|
|
46
|
-
translated_stories: [],
|
|
47
|
-
localized_paths: [],
|
|
48
|
-
position: 0,
|
|
49
|
-
deleted_at: null,
|
|
50
|
-
published: null,
|
|
51
|
-
default_root: null,
|
|
52
|
-
disble_fe_editor: false,
|
|
53
|
-
disable_fe_editor: false,
|
|
54
|
-
unpublished_changes: null,
|
|
55
|
-
imported_at: null,
|
|
56
|
-
preview_token: {
|
|
57
|
-
token: "",
|
|
58
|
-
timestamp: ""
|
|
59
|
-
},
|
|
60
|
-
pinned: false,
|
|
61
|
-
breadcrumbs: [],
|
|
62
|
-
publish_at: null,
|
|
63
|
-
expire_at: null,
|
|
64
|
-
last_author: null,
|
|
65
|
-
last_author_id: null,
|
|
66
|
-
user_ids: [],
|
|
67
|
-
space_role_ids: [],
|
|
68
|
-
can_not_view: null,
|
|
69
|
-
is_scheduled: null,
|
|
70
|
-
scheduled_dates: null,
|
|
71
|
-
ideas: [],
|
|
72
|
-
favourite_for_user_ids: []
|
|
73
|
-
};
|
|
74
|
-
function defineStory(component, story) {
|
|
75
|
-
const { content, ...rest } = story;
|
|
76
|
-
return {
|
|
77
|
-
...CAPI_STORY_DEFAULTS,
|
|
78
|
-
...rest,
|
|
79
|
-
content: {
|
|
80
|
-
...content,
|
|
81
|
-
component: component.name
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
function defineMapiStory(component, story) {
|
|
86
|
-
const { content, ...rest } = story;
|
|
87
|
-
return {
|
|
88
|
-
...MAPI_STORY_DEFAULTS,
|
|
89
|
-
...rest,
|
|
90
|
-
content: {
|
|
91
|
-
...content,
|
|
92
|
-
component: component.name
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
function defineStoryCreate(component, story) {
|
|
97
|
-
const { content, ...rest } = story;
|
|
98
|
-
return {
|
|
99
|
-
...rest,
|
|
100
|
-
content: {
|
|
101
|
-
...content,
|
|
102
|
-
component: component.name
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
function defineStoryUpdate(component, story) {
|
|
107
|
-
const { content, ...rest } = story;
|
|
108
|
-
return {
|
|
109
|
-
...rest,
|
|
110
|
-
...content && { content: {
|
|
111
|
-
...content,
|
|
112
|
-
component: component.name
|
|
113
|
-
} }
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
//#endregion
|
|
118
|
-
exports.defineMapiStory = defineMapiStory;
|
|
119
|
-
exports.defineStory = defineStory;
|
|
120
|
-
exports.defineStoryCreate = defineStoryCreate;
|
|
121
|
-
exports.defineStoryUpdate = defineStoryUpdate;
|
|
122
|
-
//# sourceMappingURL=define-story.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"define-story.cjs","names":[],"sources":["../../src/helpers/define-story.ts"],"sourcesContent":["import type { StoryAlternate } from '../generated/capi/types.gen';\nimport type { StoryLocalizedPath, StoryTranslatedSlug } from '../generated/mapi/types.gen';\nimport type { MapiStory, StoryCreate, StoryUpdate } from '../generated/types/mapi-story';\nimport type { Story } from '../generated/types/story';\nimport type { Block, RootBlock } from './define-block';\nimport type { BlockContentInput } from './define-field';\nimport type { Prettify } from '../utils/prettify';\n\nconst CAPI_STORY_DEFAULTS = {\n id: 1,\n uuid: '',\n created_at: '',\n updated_at: '',\n published_at: null,\n first_published_at: null,\n full_slug: '',\n group_id: '',\n alternates: [],\n default_full_slug: null,\n release_id: null,\n lang: 'default',\n slug: '',\n parent_id: 0,\n path: null,\n is_startpage: false,\n sort_by_date: null,\n tag_list: [],\n meta_data: null,\n translated_slugs: null,\n position: 0,\n};\n\nconst MAPI_STORY_DEFAULTS = {\n id: 1,\n uuid: '',\n created_at: '',\n updated_at: '',\n published_at: null,\n first_published_at: null,\n full_slug: '',\n group_id: '',\n alternates: [],\n slug: '',\n parent_id: null,\n parent: null,\n path: null,\n is_folder: false,\n is_startpage: false,\n sort_by_date: null,\n tag_list: [],\n meta_data: null,\n translated_slugs: [],\n translated_stories: [],\n localized_paths: [],\n position: 0,\n deleted_at: null,\n published: null,\n default_root: null,\n // Legacy upstream typo field; keep it alongside `disable_fe_editor`.\n disble_fe_editor: false,\n disable_fe_editor: false,\n unpublished_changes: null,\n imported_at: null,\n preview_token: { token: '', timestamp: '' },\n pinned: false,\n breadcrumbs: [],\n publish_at: null,\n expire_at: null,\n last_author: null,\n last_author_id: null,\n user_ids: [],\n space_role_ids: [],\n can_not_view: null,\n is_scheduled: null,\n scheduled_dates: null,\n ideas: [],\n favourite_for_user_ids: [],\n};\n\nexport type { MapiStory, Story, StoryCreate, StoryUpdate };\nexport type { StoryAlternate, StoryLocalizedPath, StoryTranslatedSlug };\n\ntype CapiStoryOptional = keyof typeof CAPI_STORY_DEFAULTS;\n\ntype CapiStoryInput<\n TBlock extends RootBlock = RootBlock,\n TBlocks extends Block = never,\n> = Prettify<\n Omit<Story<TBlock, TBlocks>, CapiStoryOptional | 'content'>\n & Partial<Pick<Story<TBlock, TBlocks>, CapiStoryOptional>>\n & {\n content: Omit<BlockContentInput<TBlock, TBlocks>, 'component'>;\n }\n>;\n\n/**\n * Returns a full CDN {@link Story} with all fields populated.\n *\n * @example\n * const myStory = defineStory(pageComponent, {\n * name: 'Home',\n * content: { headline: 'Hello World!' },\n * });\n */\nexport function defineStory<\n TBlock extends RootBlock,\n TBlocks extends Block,\n>(component: TBlock, story: CapiStoryInput<TBlock, TBlocks>): Story<TBlock, TBlocks>;\n\nexport function defineStory(component: RootBlock, story: any) {\n const { content, ...rest } = story;\n return {\n ...CAPI_STORY_DEFAULTS,\n ...rest,\n content: { ...content, component: component.name },\n };\n}\n\n// ---------------------------------------------------------------------------\n// MAPI Story helpers\n// ---------------------------------------------------------------------------\n\ntype MapiStoryOptional = keyof typeof MAPI_STORY_DEFAULTS;\n\ntype MakeMapiStoryInput<\n TStory extends MapiStory | StoryCreate | StoryUpdate,\n TBlock extends RootBlock = RootBlock,\n TBlocks extends Block = never,\n> = Prettify<\n Omit<TStory, MapiStoryOptional | 'content'>\n & Partial<Pick<TStory, Extract<MapiStoryOptional, keyof TStory>>>\n & {\n content: Omit<BlockContentInput<TBlock, TBlocks>, 'component'>;\n }\n>;\n\ntype MapiStoryInput<\n TBlock extends RootBlock = RootBlock,\n TBlocks extends Block = never,\n> = MakeMapiStoryInput<MapiStory, TBlock, TBlocks>;\n\ntype StoryCreateInput<\n TBlock extends RootBlock = RootBlock,\n TBlocks extends Block = never,\n> = MakeMapiStoryInput<StoryCreate, TBlock, TBlocks>;\n\ntype StoryUpdateInput<\n TBlock extends RootBlock = RootBlock,\n TBlocks extends Block = never,\n> = Prettify<\n Omit<MakeMapiStoryInput<StoryUpdate, TBlock, TBlocks>, 'content'>\n & {\n content: Partial<Omit<BlockContentInput<TBlock, TBlocks>, 'component'>>;\n }\n>;\n\n/**\n * Returns a full MAPI {@link MapiStory} with all fields populated.\n *\n * @example\n * const myStory = defineMapiStory(pageComponent, {\n * name: 'My Page',\n * content: { headline: 'Hello World!' },\n * });\n */\nexport function defineMapiStory<\n const TBlock extends RootBlock,\n const TBlocks extends Block = never,\n>(component: TBlock, story: MapiStoryInput<TBlock, TBlocks>): MapiStory<TBlock, TBlocks>;\n\nexport function defineMapiStory(component: RootBlock, story: any) {\n const { content, ...rest } = story;\n return {\n ...MAPI_STORY_DEFAULTS,\n ...rest,\n content: { ...content, component: component.name },\n };\n}\n\n/**\n * Defines a story creation payload for the MAPI.\n *\n * @example\n * const payload = defineStoryCreate(pageComponent, {\n * name: 'My Page',\n * content: { headline: 'Hello World!' },\n * });\n */\nexport function defineStoryCreate<\n const TBlock extends RootBlock,\n const TBlocks extends Block = never,\n>(component: TBlock, story: StoryCreateInput<TBlock, TBlocks>): StoryCreate<TBlock, TBlocks>;\n\nexport function defineStoryCreate(component: RootBlock, story: any) {\n const { content, ...rest } = story;\n return {\n ...rest,\n content: { ...content, component: component.name },\n };\n}\n\n/**\n * Defines a story update payload for the MAPI.\n *\n * @example\n * const payload = defineStoryUpdate(pageComponent, {\n * content: { headline: 'Updated!' },\n * });\n */\nexport function defineStoryUpdate<\n const TBlock extends RootBlock,\n const TBlocks extends Block = never,\n>(component: TBlock, story: StoryUpdateInput<TBlock, TBlocks>): StoryUpdate<TBlock, TBlocks>;\n\nexport function defineStoryUpdate(component: RootBlock, story: any) {\n const { content, ...rest } = story;\n return {\n ...rest,\n ...(content && {\n content: { ...content, component: component.name },\n }),\n };\n}\n"],"mappings":";;AAQA,MAAM,sBAAsB;CAC1B,IAAI;CACJ,MAAM;CACN,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,oBAAoB;CACpB,WAAW;CACX,UAAU;CACV,YAAY,EAAE;CACd,mBAAmB;CACnB,YAAY;CACZ,MAAM;CACN,MAAM;CACN,WAAW;CACX,MAAM;CACN,cAAc;CACd,cAAc;CACd,UAAU,EAAE;CACZ,WAAW;CACX,kBAAkB;CAClB,UAAU;CACX;AAED,MAAM,sBAAsB;CAC1B,IAAI;CACJ,MAAM;CACN,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,oBAAoB;CACpB,WAAW;CACX,UAAU;CACV,YAAY,EAAE;CACd,MAAM;CACN,WAAW;CACX,QAAQ;CACR,MAAM;CACN,WAAW;CACX,cAAc;CACd,cAAc;CACd,UAAU,EAAE;CACZ,WAAW;CACX,kBAAkB,EAAE;CACpB,oBAAoB,EAAE;CACtB,iBAAiB,EAAE;CACnB,UAAU;CACV,YAAY;CACZ,WAAW;CACX,cAAc;CAEd,kBAAkB;CAClB,mBAAmB;CACnB,qBAAqB;CACrB,aAAa;CACb,eAAe;EAAE,OAAO;EAAI,WAAW;EAAI;CAC3C,QAAQ;CACR,aAAa,EAAE;CACf,YAAY;CACZ,WAAW;CACX,aAAa;CACb,gBAAgB;CAChB,UAAU,EAAE;CACZ,gBAAgB,EAAE;CAClB,cAAc;CACd,cAAc;CACd,iBAAiB;CACjB,OAAO,EAAE;CACT,wBAAwB,EAAE;CAC3B;AAgCD,SAAgB,YAAY,WAAsB,OAAY;CAC5D,MAAM,EAAE,SAAS,GAAG,SAAS;AAC7B,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GAAE,GAAG;GAAS,WAAW,UAAU;GAAM;EACnD;;AAuDH,SAAgB,gBAAgB,WAAsB,OAAY;CAChE,MAAM,EAAE,SAAS,GAAG,SAAS;AAC7B,QAAO;EACL,GAAG;EACH,GAAG;EACH,SAAS;GAAE,GAAG;GAAS,WAAW,UAAU;GAAM;EACnD;;AAiBH,SAAgB,kBAAkB,WAAsB,OAAY;CAClE,MAAM,EAAE,SAAS,GAAG,SAAS;AAC7B,QAAO;EACL,GAAG;EACH,SAAS;GAAE,GAAG;GAAS,WAAW,UAAU;GAAM;EACnD;;AAgBH,SAAgB,kBAAkB,WAAsB,OAAY;CAClE,MAAM,EAAE,SAAS,GAAG,SAAS;AAC7B,QAAO;EACL,GAAG;EACH,GAAI,WAAW,EACb,SAAS;GAAE,GAAG;GAAS,WAAW,UAAU;GAAM,EACnD;EACF"}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { Block, RootBlock } from "../generated/types/block.cjs";
|
|
2
|
-
import { Prettify } from "../utils/prettify.cjs";
|
|
3
|
-
import { StoryAlternate } from "../generated/capi/types.gen.cjs";
|
|
4
|
-
import { StoryLocalizedPath, StoryTranslatedSlug } from "../generated/mapi/types.gen.cjs";
|
|
5
|
-
import { MapiStory, StoryCreate, StoryUpdate } from "../generated/types/mapi-story.cjs";
|
|
6
|
-
import { Story } from "../generated/types/story.cjs";
|
|
7
|
-
import { BlockContentInput } from "./define-field.cjs";
|
|
8
|
-
|
|
9
|
-
//#region src/helpers/define-story.d.ts
|
|
10
|
-
declare const CAPI_STORY_DEFAULTS: {
|
|
11
|
-
id: number;
|
|
12
|
-
uuid: string;
|
|
13
|
-
created_at: string;
|
|
14
|
-
updated_at: string;
|
|
15
|
-
published_at: null;
|
|
16
|
-
first_published_at: null;
|
|
17
|
-
full_slug: string;
|
|
18
|
-
group_id: string;
|
|
19
|
-
alternates: never[];
|
|
20
|
-
default_full_slug: null;
|
|
21
|
-
release_id: null;
|
|
22
|
-
lang: string;
|
|
23
|
-
slug: string;
|
|
24
|
-
parent_id: number;
|
|
25
|
-
path: null;
|
|
26
|
-
is_startpage: boolean;
|
|
27
|
-
sort_by_date: null;
|
|
28
|
-
tag_list: never[];
|
|
29
|
-
meta_data: null;
|
|
30
|
-
translated_slugs: null;
|
|
31
|
-
position: number;
|
|
32
|
-
};
|
|
33
|
-
declare const MAPI_STORY_DEFAULTS: {
|
|
34
|
-
id: number;
|
|
35
|
-
uuid: string;
|
|
36
|
-
created_at: string;
|
|
37
|
-
updated_at: string;
|
|
38
|
-
published_at: null;
|
|
39
|
-
first_published_at: null;
|
|
40
|
-
full_slug: string;
|
|
41
|
-
group_id: string;
|
|
42
|
-
alternates: never[];
|
|
43
|
-
slug: string;
|
|
44
|
-
parent_id: null;
|
|
45
|
-
parent: null;
|
|
46
|
-
path: null;
|
|
47
|
-
is_folder: boolean;
|
|
48
|
-
is_startpage: boolean;
|
|
49
|
-
sort_by_date: null;
|
|
50
|
-
tag_list: never[];
|
|
51
|
-
meta_data: null;
|
|
52
|
-
translated_slugs: never[];
|
|
53
|
-
translated_stories: never[];
|
|
54
|
-
localized_paths: never[];
|
|
55
|
-
position: number;
|
|
56
|
-
deleted_at: null;
|
|
57
|
-
published: null;
|
|
58
|
-
default_root: null;
|
|
59
|
-
disble_fe_editor: boolean;
|
|
60
|
-
disable_fe_editor: boolean;
|
|
61
|
-
unpublished_changes: null;
|
|
62
|
-
imported_at: null;
|
|
63
|
-
preview_token: {
|
|
64
|
-
token: string;
|
|
65
|
-
timestamp: string;
|
|
66
|
-
};
|
|
67
|
-
pinned: boolean;
|
|
68
|
-
breadcrumbs: never[];
|
|
69
|
-
publish_at: null;
|
|
70
|
-
expire_at: null;
|
|
71
|
-
last_author: null;
|
|
72
|
-
last_author_id: null;
|
|
73
|
-
user_ids: never[];
|
|
74
|
-
space_role_ids: never[];
|
|
75
|
-
can_not_view: null;
|
|
76
|
-
is_scheduled: null;
|
|
77
|
-
scheduled_dates: null;
|
|
78
|
-
ideas: never[];
|
|
79
|
-
favourite_for_user_ids: never[];
|
|
80
|
-
};
|
|
81
|
-
type CapiStoryOptional = keyof typeof CAPI_STORY_DEFAULTS;
|
|
82
|
-
type CapiStoryInput<TBlock extends RootBlock = RootBlock, TBlocks extends Block = never> = Prettify<Omit<Story<TBlock, TBlocks>, CapiStoryOptional | 'content'> & Partial<Pick<Story<TBlock, TBlocks>, CapiStoryOptional>> & {
|
|
83
|
-
content: Omit<BlockContentInput<TBlock, TBlocks>, 'component'>;
|
|
84
|
-
}>;
|
|
85
|
-
/**
|
|
86
|
-
* Returns a full CDN {@link Story} with all fields populated.
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* const myStory = defineStory(pageComponent, {
|
|
90
|
-
* name: 'Home',
|
|
91
|
-
* content: { headline: 'Hello World!' },
|
|
92
|
-
* });
|
|
93
|
-
*/
|
|
94
|
-
declare function defineStory<TBlock extends RootBlock, TBlocks extends Block>(component: TBlock, story: CapiStoryInput<TBlock, TBlocks>): Story<TBlock, TBlocks>;
|
|
95
|
-
type MapiStoryOptional = keyof typeof MAPI_STORY_DEFAULTS;
|
|
96
|
-
type MakeMapiStoryInput<TStory extends MapiStory | StoryCreate | StoryUpdate, TBlock extends RootBlock = RootBlock, TBlocks extends Block = never> = Prettify<Omit<TStory, MapiStoryOptional | 'content'> & Partial<Pick<TStory, Extract<MapiStoryOptional, keyof TStory>>> & {
|
|
97
|
-
content: Omit<BlockContentInput<TBlock, TBlocks>, 'component'>;
|
|
98
|
-
}>;
|
|
99
|
-
type MapiStoryInput<TBlock extends RootBlock = RootBlock, TBlocks extends Block = never> = MakeMapiStoryInput<MapiStory, TBlock, TBlocks>;
|
|
100
|
-
type StoryCreateInput<TBlock extends RootBlock = RootBlock, TBlocks extends Block = never> = MakeMapiStoryInput<StoryCreate, TBlock, TBlocks>;
|
|
101
|
-
type StoryUpdateInput<TBlock extends RootBlock = RootBlock, TBlocks extends Block = never> = Prettify<Omit<MakeMapiStoryInput<StoryUpdate, TBlock, TBlocks>, 'content'> & {
|
|
102
|
-
content: Partial<Omit<BlockContentInput<TBlock, TBlocks>, 'component'>>;
|
|
103
|
-
}>;
|
|
104
|
-
/**
|
|
105
|
-
* Returns a full MAPI {@link MapiStory} with all fields populated.
|
|
106
|
-
*
|
|
107
|
-
* @example
|
|
108
|
-
* const myStory = defineMapiStory(pageComponent, {
|
|
109
|
-
* name: 'My Page',
|
|
110
|
-
* content: { headline: 'Hello World!' },
|
|
111
|
-
* });
|
|
112
|
-
*/
|
|
113
|
-
declare function defineMapiStory<const TBlock extends RootBlock, const TBlocks extends Block = never>(component: TBlock, story: MapiStoryInput<TBlock, TBlocks>): MapiStory<TBlock, TBlocks>;
|
|
114
|
-
/**
|
|
115
|
-
* Defines a story creation payload for the MAPI.
|
|
116
|
-
*
|
|
117
|
-
* @example
|
|
118
|
-
* const payload = defineStoryCreate(pageComponent, {
|
|
119
|
-
* name: 'My Page',
|
|
120
|
-
* content: { headline: 'Hello World!' },
|
|
121
|
-
* });
|
|
122
|
-
*/
|
|
123
|
-
declare function defineStoryCreate<const TBlock extends RootBlock, const TBlocks extends Block = never>(component: TBlock, story: StoryCreateInput<TBlock, TBlocks>): StoryCreate<TBlock, TBlocks>;
|
|
124
|
-
/**
|
|
125
|
-
* Defines a story update payload for the MAPI.
|
|
126
|
-
*
|
|
127
|
-
* @example
|
|
128
|
-
* const payload = defineStoryUpdate(pageComponent, {
|
|
129
|
-
* content: { headline: 'Updated!' },
|
|
130
|
-
* });
|
|
131
|
-
*/
|
|
132
|
-
declare function defineStoryUpdate<const TBlock extends RootBlock, const TBlocks extends Block = never>(component: TBlock, story: StoryUpdateInput<TBlock, TBlocks>): StoryUpdate<TBlock, TBlocks>;
|
|
133
|
-
//#endregion
|
|
134
|
-
export { defineMapiStory, defineStory, defineStoryCreate, defineStoryUpdate };
|
|
135
|
-
//# sourceMappingURL=define-story.d.cts.map
|