@mattgrill/storyblok-11ty 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/data.d.ts +79 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +653 -0
- package/dist/plugin/index.d.ts +17 -0
- package/dist/plugin/liquid.d.ts +12 -0
- package/dist/plugin/nunjuks.d.ts +11 -0
- package/dist/types.d.ts +139 -0
- package/dist/utils.d.ts +11 -0
- package/package.json +86 -0
- package/readme.md +419 -0
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { StoryblokTo11tyConfig, TransformedStory, DatasourceEntry, GetStoriesParams } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* StoryblokTo11tyData is the main class that fetches the data from Storyblok
|
|
4
|
+
*/
|
|
5
|
+
export declare class StoryblokTo11tyData {
|
|
6
|
+
private api_version;
|
|
7
|
+
private storyblok_api_token?;
|
|
8
|
+
private stories_path;
|
|
9
|
+
private datasources_path;
|
|
10
|
+
private layouts_path;
|
|
11
|
+
private components_layouts_map;
|
|
12
|
+
private per_page;
|
|
13
|
+
private storyblok_client_config;
|
|
14
|
+
private client?;
|
|
15
|
+
/**
|
|
16
|
+
* Constructor
|
|
17
|
+
* @param params - The params for initialising the class
|
|
18
|
+
*/
|
|
19
|
+
constructor(params?: StoryblokTo11tyConfig);
|
|
20
|
+
/**
|
|
21
|
+
* Takes care of cleaning a path set by the user removing
|
|
22
|
+
* leading and trailing slashes and add the process cwd
|
|
23
|
+
* @param path - The path string
|
|
24
|
+
* @returns The cleaned path
|
|
25
|
+
*/
|
|
26
|
+
private cleanPath;
|
|
27
|
+
/**
|
|
28
|
+
* Get data of a single datasource retrieving a specific dimension or all of them
|
|
29
|
+
* @param slug - Name of the datasource
|
|
30
|
+
* @param dimension_name - The name of the dimension
|
|
31
|
+
* @returns An array with the datasource entries
|
|
32
|
+
*/
|
|
33
|
+
getDatasource(slug: string, dimension_name?: string): Promise<DatasourceEntry[] | Record<string, never>>;
|
|
34
|
+
/**
|
|
35
|
+
* Get data of datasources. It can be single or multiple
|
|
36
|
+
* @param slug - Name of the datasource
|
|
37
|
+
* @returns An object with the data of the datasource/s requested
|
|
38
|
+
*/
|
|
39
|
+
getDatasources(slug?: string): Promise<DatasourceEntry[] | Record<string, DatasourceEntry[] | Record<string, never>>>;
|
|
40
|
+
/**
|
|
41
|
+
* Store a datasource to a json file
|
|
42
|
+
* @param slug - Name of the datasource
|
|
43
|
+
* @returns True or false depending if the script was able to store the data
|
|
44
|
+
*/
|
|
45
|
+
storeDatasources(slug?: string): Promise<boolean>;
|
|
46
|
+
/**
|
|
47
|
+
* Transforms a story based on the params provided
|
|
48
|
+
* @param story - The story that has to be transformed
|
|
49
|
+
* @returns The transformed story
|
|
50
|
+
*/
|
|
51
|
+
private transformStories;
|
|
52
|
+
/**
|
|
53
|
+
* Get all the stories from Storyblok
|
|
54
|
+
* @param params - Filters for the stories request
|
|
55
|
+
* @returns Array of transformed stories
|
|
56
|
+
*/
|
|
57
|
+
getStories(params?: GetStoriesParams): Promise<TransformedStory[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Cache stories in a folder as json files
|
|
60
|
+
* @param params - Filters for the stories request
|
|
61
|
+
* @returns True or false depending if the script was able to store the data
|
|
62
|
+
*/
|
|
63
|
+
storeStories(params?: GetStoriesParams): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Get a page of data from Storyblok API
|
|
66
|
+
* @param endpoint - The endpoint to query
|
|
67
|
+
* @param entity_name - The name of the entity to be retrieved from the api response
|
|
68
|
+
* @param params - Parameters to add to the API request
|
|
69
|
+
* @returns The data fetched from the API
|
|
70
|
+
*/
|
|
71
|
+
private getData;
|
|
72
|
+
/**
|
|
73
|
+
* Get a page of stories from Storyblok
|
|
74
|
+
* @param endpoint - The endpoint to query
|
|
75
|
+
* @param params - Parameters to add to the API request
|
|
76
|
+
* @returns The data fetched from the API
|
|
77
|
+
*/
|
|
78
|
+
private apiRequest;
|
|
79
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StoryblokTo11tyPlugin } from './plugin/index';
|
|
2
|
+
import { StoryblokTo11tyData } from './data';
|
|
3
|
+
/**
|
|
4
|
+
* Main exports for StoryblokTo11ty
|
|
5
|
+
*/
|
|
6
|
+
export { StoryblokTo11tyData, StoryblokTo11tyPlugin };
|
|
7
|
+
export * from './types';
|
|
8
|
+
declare const _default: {
|
|
9
|
+
importer: typeof StoryblokTo11tyData;
|
|
10
|
+
plugin: typeof StoryblokTo11tyPlugin;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|