sb-mig 2.9.3 → 3.1.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/README.md +51 -27
- package/dist/index.js +52 -0
- package/package.json +40 -57
- package/CHANGELOG.md +0 -996
- package/bin/run +0 -5
- package/bin/run.cmd +0 -3
- package/lib/api/apiConfig.d.ts +0 -2
- package/lib/api/apiConfig.js +0 -9
- package/lib/api/componentPresets.d.ts +0 -1
- package/lib/api/componentPresets.js +0 -22
- package/lib/api/components.d.ts +0 -5
- package/lib/api/components.js +0 -71
- package/lib/api/datasources.d.ts +0 -24
- package/lib/api/datasources.js +0 -193
- package/lib/api/migrate.d.ts +0 -19
- package/lib/api/migrate.js +0 -220
- package/lib/api/mutateComponents.d.ts +0 -2
- package/lib/api/mutateComponents.js +0 -50
- package/lib/api/presets.d.ts +0 -4
- package/lib/api/presets.js +0 -59
- package/lib/api/resolvePresets.d.ts +0 -2
- package/lib/api/resolvePresets.js +0 -40
- package/lib/api/roles.d.ts +0 -14
- package/lib/api/roles.js +0 -133
- package/lib/api/spaces.d.ts +0 -2
- package/lib/api/spaces.js +0 -29
- package/lib/commands/backup.d.ts +0 -22
- package/lib/commands/backup.js +0 -217
- package/lib/commands/debug.d.ts +0 -9
- package/lib/commands/debug.js +0 -21
- package/lib/commands/sync.d.ts +0 -26
- package/lib/commands/sync.js +0 -93
- package/lib/config/StoryblokComponentsConfig.d.ts +0 -68
- package/lib/config/StoryblokComponentsConfig.js +0 -220
- package/lib/config/config.d.ts +0 -37
- package/lib/config/config.js +0 -36
- package/lib/core.d.ts +0 -16
- package/lib/core.js +0 -75
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -5
- package/lib/types/storyblokTypes.d.ts +0 -171
- package/lib/types/storyblokTypes.js +0 -3
- package/lib/utils/discover.d.ts +0 -4
- package/lib/utils/discover.js +0 -96
- package/lib/utils/discover2.d.ts +0 -63
- package/lib/utils/discover2.js +0 -424
- package/lib/utils/files.d.ts +0 -6
- package/lib/utils/files.js +0 -54
- package/lib/utils/logger.d.ts +0 -11
- package/lib/utils/logger.js +0 -30
- package/lib/utils/others.d.ts +0 -1
- package/lib/utils/others.js +0 -5
- package/oclif.manifest.json +0 -1
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
declare global {
|
|
2
|
-
interface StoryblokBridgeConfig {
|
|
3
|
-
initOnlyOnce?: boolean;
|
|
4
|
-
accessToken?: string;
|
|
5
|
-
}
|
|
6
|
-
interface StoryblokEventPayload<S extends StoryblokComponent<string> = any> {
|
|
7
|
-
action: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode';
|
|
8
|
-
event?: string;
|
|
9
|
-
story?: S;
|
|
10
|
-
slug?: string;
|
|
11
|
-
storyId?: string;
|
|
12
|
-
reload?: boolean;
|
|
13
|
-
}
|
|
14
|
-
interface StoryblokBridge {
|
|
15
|
-
init: (config?: StoryblokBridgeConfig) => void;
|
|
16
|
-
pingEditor: (callback: (instance: StoryblokBridge) => void) => void;
|
|
17
|
-
isInEditor: () => boolean;
|
|
18
|
-
enterEditmode: () => void;
|
|
19
|
-
on: (event: 'customEvent' | 'published' | 'input' | 'change' | 'unpublished' | 'enterEditmode' | string[], callback: (payload?: StoryblokEventPayload) => void) => void;
|
|
20
|
-
addComments: (tree: StoryblokComponent<string>, storyId: string) => StoryblokComponent<string>;
|
|
21
|
-
}
|
|
22
|
-
interface Window {
|
|
23
|
-
storyblok: StoryblokBridge;
|
|
24
|
-
StoryblokCacheVersion: number;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
import { AxiosInstance, AxiosProxyConfig } from 'axios';
|
|
28
|
-
export interface StoryblokConfig {
|
|
29
|
-
accessToken?: string;
|
|
30
|
-
oauthToken?: string;
|
|
31
|
-
cache?: StoryblokCache;
|
|
32
|
-
timeout?: number;
|
|
33
|
-
headers?: any;
|
|
34
|
-
region?: string;
|
|
35
|
-
maxRetries?: number;
|
|
36
|
-
https?: boolean;
|
|
37
|
-
rateLimit?: number;
|
|
38
|
-
proxy?: AxiosProxyConfig;
|
|
39
|
-
componentResolver?: (component: string, data: any) => void;
|
|
40
|
-
}
|
|
41
|
-
export interface StoryblokCache {
|
|
42
|
-
type?: 'memory';
|
|
43
|
-
clear?: 'auto' | 'manual';
|
|
44
|
-
}
|
|
45
|
-
export interface StoryblokCacheProvider {
|
|
46
|
-
get: (key: string) => Promise<StoryblokResult | null> | (StoryblokResult | null);
|
|
47
|
-
set: (key: string, content: StoryblokResult) => Promise<void> | any;
|
|
48
|
-
flush: () => Promise<void> | void;
|
|
49
|
-
}
|
|
50
|
-
export interface StoryblokResult {
|
|
51
|
-
data: any;
|
|
52
|
-
perPage: number;
|
|
53
|
-
total: number;
|
|
54
|
-
headers: any;
|
|
55
|
-
}
|
|
56
|
-
export interface StoryblokManagmentApiResult {
|
|
57
|
-
data: any;
|
|
58
|
-
headers: any;
|
|
59
|
-
}
|
|
60
|
-
export interface StoryblokComponent<TComp extends string> {
|
|
61
|
-
_uid: string;
|
|
62
|
-
component: TComp;
|
|
63
|
-
_editable?: string;
|
|
64
|
-
}
|
|
65
|
-
export interface StoryData<Content = StoryblokComponent<string> & {
|
|
66
|
-
[index: string]: any;
|
|
67
|
-
}> {
|
|
68
|
-
content: Content;
|
|
69
|
-
created_at: string;
|
|
70
|
-
full_slug: string;
|
|
71
|
-
group_id: string;
|
|
72
|
-
id: number;
|
|
73
|
-
is_startpage: boolean;
|
|
74
|
-
meta_data: any;
|
|
75
|
-
name: string;
|
|
76
|
-
parent_id: number;
|
|
77
|
-
position: number;
|
|
78
|
-
published_at: string | null;
|
|
79
|
-
first_published_at: string | null;
|
|
80
|
-
slug: string;
|
|
81
|
-
sort_by_date: string | null;
|
|
82
|
-
tag_list: string[];
|
|
83
|
-
uuid: string;
|
|
84
|
-
}
|
|
85
|
-
export interface AlternateObject {
|
|
86
|
-
id: number;
|
|
87
|
-
name: string;
|
|
88
|
-
slug: string;
|
|
89
|
-
published: boolean;
|
|
90
|
-
full_slug: string;
|
|
91
|
-
is_folder: boolean;
|
|
92
|
-
parent_id: number;
|
|
93
|
-
}
|
|
94
|
-
export interface Stories {
|
|
95
|
-
data: {
|
|
96
|
-
stories: StoryData[];
|
|
97
|
-
};
|
|
98
|
-
perPage: number;
|
|
99
|
-
total: number;
|
|
100
|
-
headers: any;
|
|
101
|
-
}
|
|
102
|
-
export interface Story {
|
|
103
|
-
data: {
|
|
104
|
-
story: StoryData;
|
|
105
|
-
};
|
|
106
|
-
headers: any;
|
|
107
|
-
}
|
|
108
|
-
export interface StoriesParams {
|
|
109
|
-
token?: string;
|
|
110
|
-
with_tag?: string;
|
|
111
|
-
is_startpage?: 0 | 1;
|
|
112
|
-
starts_with?: string;
|
|
113
|
-
by_uuids?: string;
|
|
114
|
-
by_uuids_ordered?: string;
|
|
115
|
-
excluding_ids?: string;
|
|
116
|
-
excluding_fields?: string;
|
|
117
|
-
resolve_links?: 'url' | 'story' | '0' | '1';
|
|
118
|
-
version?: 'draft' | 'published';
|
|
119
|
-
resolve_relations?: string;
|
|
120
|
-
cv?: number;
|
|
121
|
-
sort_by?: string;
|
|
122
|
-
search_term?: string;
|
|
123
|
-
filter_query?: any;
|
|
124
|
-
per_page?: number;
|
|
125
|
-
page?: string;
|
|
126
|
-
from_release?: string;
|
|
127
|
-
fallback_language?: string;
|
|
128
|
-
first_published_at_gt?: string;
|
|
129
|
-
first_published_at_lt?: string;
|
|
130
|
-
published_at_gt?: string;
|
|
131
|
-
published_at_lt?: string;
|
|
132
|
-
}
|
|
133
|
-
export interface StoryParams {
|
|
134
|
-
token?: string;
|
|
135
|
-
find_by?: 'uuid';
|
|
136
|
-
version?: 'draft' | 'published';
|
|
137
|
-
resolve_links?: 'url' | 'story' | '0' | '1';
|
|
138
|
-
resolve_relations?: string;
|
|
139
|
-
cv?: number;
|
|
140
|
-
from_release?: string;
|
|
141
|
-
}
|
|
142
|
-
export interface Richtext {
|
|
143
|
-
content: Array<Object>;
|
|
144
|
-
}
|
|
145
|
-
export interface RichtextInstance {
|
|
146
|
-
render: (data: Richtext) => string;
|
|
147
|
-
}
|
|
148
|
-
declare class Storyblok {
|
|
149
|
-
throttle: any;
|
|
150
|
-
cacheVersion: number;
|
|
151
|
-
accessToken: string;
|
|
152
|
-
cache: StoryblokCache;
|
|
153
|
-
client: AxiosInstance;
|
|
154
|
-
richTextResolver: RichtextInstance;
|
|
155
|
-
constructor(config: StoryblokConfig, endpoint?: string);
|
|
156
|
-
get(slug: string, params?: any): Promise<StoryblokResult>;
|
|
157
|
-
getAll(slug: string, params?: any, entity?: string): Promise<any[]>;
|
|
158
|
-
post(slug: string, params?: any): Promise<StoryblokManagmentApiResult>;
|
|
159
|
-
put(slug: string, params?: any): Promise<StoryblokManagmentApiResult>;
|
|
160
|
-
delete(slug: string, params?: any): Promise<StoryblokManagmentApiResult>;
|
|
161
|
-
getStories(params?: StoriesParams): Promise<Stories>;
|
|
162
|
-
getStory(slug: string, params?: StoryParams): Promise<Story>;
|
|
163
|
-
setToken(token: string): void;
|
|
164
|
-
getToken(): string;
|
|
165
|
-
cacheResponse(url: string, params: any): Promise<StoryblokResult>;
|
|
166
|
-
newVersion(): number;
|
|
167
|
-
cacheProvider(): StoryblokCacheProvider;
|
|
168
|
-
flushCache(): Promise<this>;
|
|
169
|
-
setComponentResolver(renderFunction: (component: string, data: any) => void): void;
|
|
170
|
-
}
|
|
171
|
-
export default Storyblok;
|
package/lib/utils/discover.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const findComponents: (componentDirectory: string) => any[];
|
|
2
|
-
export declare const findComponentsWithExt: (ext: string | boolean) => any[];
|
|
3
|
-
export declare const findComponentsByPackageName: (ext: string | boolean, specifiedComponents: string[], local?: boolean | undefined) => any[];
|
|
4
|
-
export declare const findDatasources: () => any[];
|
package/lib/utils/discover.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// component resolution file borrowed from great storyblok-migrate
|
|
3
|
-
// https://github.com/maoberlehner/storyblok-migrate
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.findDatasources = exports.findComponentsByPackageName = exports.findComponentsWithExt = exports.findComponents = void 0;
|
|
6
|
-
const glob = require("glob");
|
|
7
|
-
const path = require("path");
|
|
8
|
-
const config_1 = require("../config/config");
|
|
9
|
-
const findComponents = (componentDirectory) => {
|
|
10
|
-
const directory = path.resolve(process.cwd(), componentDirectory);
|
|
11
|
-
return glob
|
|
12
|
-
.sync(path.join(directory, '**', '!(_*|*.datasource)*.js'))
|
|
13
|
-
.map(file => require(path.resolve(directory, file)));
|
|
14
|
-
};
|
|
15
|
-
exports.findComponents = findComponents;
|
|
16
|
-
const findComponentsWithExt = (ext) => {
|
|
17
|
-
const rootDirectory = './';
|
|
18
|
-
const directory = path.resolve(process.cwd(), rootDirectory);
|
|
19
|
-
const files = glob
|
|
20
|
-
.sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(',')}}`, '**', `[^_]*.${ext}`), {
|
|
21
|
-
follow: true,
|
|
22
|
-
})
|
|
23
|
-
.map(file => require(path.resolve(directory, file)));
|
|
24
|
-
const fileNames = files.map(file => file.name);
|
|
25
|
-
return files;
|
|
26
|
-
};
|
|
27
|
-
exports.findComponentsWithExt = findComponentsWithExt;
|
|
28
|
-
const findComponentsByPackageName = (ext, specifiedComponents, local) => {
|
|
29
|
-
const rootDirectory = './';
|
|
30
|
-
const directory = path.resolve(process.cwd(), rootDirectory);
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
if (local === true) {
|
|
33
|
-
const onlyLocalComponentsDirectories = config_1.default.componentsDirectories.filter(dir => !dir.includes('node_modules'));
|
|
34
|
-
const onlyLocalPackages = glob.sync(path.join(`${directory}/{${onlyLocalComponentsDirectories.join(',')}}`, '**', 'package.json'), {
|
|
35
|
-
follow: true,
|
|
36
|
-
});
|
|
37
|
-
return onlyLocalPackages
|
|
38
|
-
.filter(file => {
|
|
39
|
-
return specifiedComponents.includes(require(path.resolve(directory, file)).name);
|
|
40
|
-
})
|
|
41
|
-
.map(file => {
|
|
42
|
-
const fileFolderPath = file.split('/').slice(0, -1).join('/');
|
|
43
|
-
return glob
|
|
44
|
-
.sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
|
|
45
|
-
follow: true,
|
|
46
|
-
})
|
|
47
|
-
.map(file => require(path.resolve(directory, file)).name);
|
|
48
|
-
})
|
|
49
|
-
.flat();
|
|
50
|
-
}
|
|
51
|
-
if (local === false) {
|
|
52
|
-
const onlyNodeModulesPackagesComponentsDirectories = config_1.default.componentsDirectories.filter(dir => dir.includes('node_modules'));
|
|
53
|
-
const onlyNodeModulesPackages = glob.sync(path.join(`${directory}/{${onlyNodeModulesPackagesComponentsDirectories.join(',')}}`, '**', 'package.json'), {
|
|
54
|
-
follow: true,
|
|
55
|
-
});
|
|
56
|
-
return onlyNodeModulesPackages
|
|
57
|
-
.filter(file => {
|
|
58
|
-
return specifiedComponents.includes(require(path.resolve(directory, file)).name);
|
|
59
|
-
})
|
|
60
|
-
.map(file => {
|
|
61
|
-
const fileFolderPath = file.split('/').slice(0, -1).join('/');
|
|
62
|
-
return glob
|
|
63
|
-
.sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
|
|
64
|
-
follow: true,
|
|
65
|
-
})
|
|
66
|
-
.map(file => require(path.resolve(directory, file)).name);
|
|
67
|
-
})
|
|
68
|
-
.flat();
|
|
69
|
-
}
|
|
70
|
-
return glob
|
|
71
|
-
.sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(',')}}`, '**', 'package.json'), {
|
|
72
|
-
follow: true,
|
|
73
|
-
})
|
|
74
|
-
.filter(file => {
|
|
75
|
-
return specifiedComponents.includes(require(path.resolve(directory, file)).name);
|
|
76
|
-
})
|
|
77
|
-
.map(file => {
|
|
78
|
-
const fileFolderPath = file.split('/').slice(0, -1).join('/');
|
|
79
|
-
return glob
|
|
80
|
-
.sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
|
|
81
|
-
follow: true,
|
|
82
|
-
})
|
|
83
|
-
.map(file => require(path.resolve(directory, file)).name);
|
|
84
|
-
})
|
|
85
|
-
.flat();
|
|
86
|
-
};
|
|
87
|
-
exports.findComponentsByPackageName = findComponentsByPackageName;
|
|
88
|
-
const findDatasources = () => {
|
|
89
|
-
const rootDirectory = './';
|
|
90
|
-
const directory = path.resolve(process.cwd(), rootDirectory);
|
|
91
|
-
return (glob
|
|
92
|
-
.sync(path.join(`${directory}/${config_1.default.datasourcesDirectory}`, '**', '[^_]*.sb.datasource.js'))
|
|
93
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
94
|
-
.map(file => require(path.resolve(directory, file))));
|
|
95
|
-
};
|
|
96
|
-
exports.findDatasources = findDatasources;
|
package/lib/utils/discover2.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
export declare enum SCOPE {
|
|
2
|
-
local = "local",
|
|
3
|
-
external = "external",
|
|
4
|
-
lock = "lock",
|
|
5
|
-
all = "all"
|
|
6
|
-
}
|
|
7
|
-
export declare enum LOOKUP_TYPE {
|
|
8
|
-
packagName = "packageName",
|
|
9
|
-
fileName = "fileName"
|
|
10
|
-
}
|
|
11
|
-
interface DiscoverRequest {
|
|
12
|
-
scope: SCOPE;
|
|
13
|
-
type: LOOKUP_TYPE;
|
|
14
|
-
}
|
|
15
|
-
interface DiscoverOneRequest {
|
|
16
|
-
fileName: string;
|
|
17
|
-
scope: SCOPE;
|
|
18
|
-
type: LOOKUP_TYPE;
|
|
19
|
-
}
|
|
20
|
-
interface DiscoverManyRequest {
|
|
21
|
-
fileNames: string[];
|
|
22
|
-
scope: SCOPE;
|
|
23
|
-
type: LOOKUP_TYPE;
|
|
24
|
-
}
|
|
25
|
-
interface DiscoverOneByPackageNameRequest {
|
|
26
|
-
packageName: string;
|
|
27
|
-
scope: SCOPE;
|
|
28
|
-
}
|
|
29
|
-
interface DiscoverManyByPackageNameRequest {
|
|
30
|
-
packageNames: string[];
|
|
31
|
-
scope: SCOPE;
|
|
32
|
-
}
|
|
33
|
-
interface CompareRequest {
|
|
34
|
-
local: string[];
|
|
35
|
-
external: string[];
|
|
36
|
-
}
|
|
37
|
-
export interface OneComponent {
|
|
38
|
-
name: string;
|
|
39
|
-
path: string;
|
|
40
|
-
}
|
|
41
|
-
export interface CompareResult {
|
|
42
|
-
local: OneComponent[];
|
|
43
|
-
external: OneComponent[];
|
|
44
|
-
}
|
|
45
|
-
declare type DiscoverResult = string[];
|
|
46
|
-
export declare const compare: (request: CompareRequest) => CompareResult;
|
|
47
|
-
export declare const discoverManyByPackageName: (request: DiscoverManyByPackageNameRequest) => DiscoverResult;
|
|
48
|
-
export declare const discoverOneByPackageName: (request: DiscoverOneByPackageNameRequest) => DiscoverResult;
|
|
49
|
-
export declare const discoverMany: (request: DiscoverManyRequest) => DiscoverResult;
|
|
50
|
-
export declare const discoverManyDatasources: (request: DiscoverManyRequest) => DiscoverResult;
|
|
51
|
-
export declare const discoverDatasources: (request: DiscoverRequest) => DiscoverResult;
|
|
52
|
-
export declare const discoverOne: (request: DiscoverOneRequest) => DiscoverResult;
|
|
53
|
-
export declare const discover: (request: DiscoverRequest) => DiscoverResult;
|
|
54
|
-
export declare const discoverManyStyles: (request: DiscoverManyRequest) => DiscoverResult;
|
|
55
|
-
export declare const discoverRoles: (request: DiscoverRequest) => DiscoverResult;
|
|
56
|
-
export declare const discoverManyRoles: (request: DiscoverManyRequest) => DiscoverResult;
|
|
57
|
-
export declare const getFilesContent: (data: {
|
|
58
|
-
files: string[];
|
|
59
|
-
}) => any[];
|
|
60
|
-
export declare const getFileContent: (data: {
|
|
61
|
-
file: string;
|
|
62
|
-
}) => any;
|
|
63
|
-
export {};
|