@hubspot/local-dev-lib 1.1.0 → 1.2.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/api/projects.js +2 -2
- package/api/sandboxSync.d.ts +3 -3
- package/api/sandboxSync.js +1 -1
- package/lang/en.json +4 -4
- package/lang/lang/en.json +4 -4
- package/lib/cms/modules.d.ts +1 -0
- package/lib/cms/modules.js +5 -2
- package/lib/cms/templates.d.ts +42 -0
- package/lib/cms/templates.js +43 -1
- package/lib/sandboxes.d.ts +3 -3
- package/lib/sandboxes.js +2 -1
- package/package.json +1 -1
- package/types/Sandbox.d.ts +30 -36
package/api/projects.js
CHANGED
|
@@ -162,13 +162,13 @@ async function cancelStagedBuild(accountId, projectName) {
|
|
|
162
162
|
exports.cancelStagedBuild = cancelStagedBuild;
|
|
163
163
|
async function fetchBuildWarnLogs(accountId, projectName, buildId) {
|
|
164
164
|
return http_1.default.get(accountId, {
|
|
165
|
-
url: `${PROJECTS_LOGS_API_PATH}/logs/projects/${projectName}/builds/${buildId}/combined/warn`,
|
|
165
|
+
url: `${PROJECTS_LOGS_API_PATH}/logs/projects/${encodeURIComponent(projectName)}/builds/${buildId}/combined/warn`,
|
|
166
166
|
});
|
|
167
167
|
}
|
|
168
168
|
exports.fetchBuildWarnLogs = fetchBuildWarnLogs;
|
|
169
169
|
async function fetchDeployWarnLogs(accountId, projectName, deployId) {
|
|
170
170
|
return http_1.default.get(accountId, {
|
|
171
|
-
url: `${PROJECTS_LOGS_API_PATH}/logs/projects/${projectName}/deploys/${deployId}/combined/warn`,
|
|
171
|
+
url: `${PROJECTS_LOGS_API_PATH}/logs/projects/${encodeURIComponent(projectName)}/deploys/${deployId}/combined/warn`,
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
174
|
exports.fetchDeployWarnLogs = fetchDeployWarnLogs;
|
package/api/sandboxSync.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitiateSyncResponse,
|
|
2
|
-
export declare function initiateSync(fromHubId: number, toHubId: number, tasks: Array<
|
|
3
|
-
export declare function fetchTaskStatus(accountId: number, taskId: number): Promise<
|
|
1
|
+
import { InitiateSyncResponse, FetchTypesResponse, TaskRequestData, SyncTaskStatusType } from '../types/Sandbox';
|
|
2
|
+
export declare function initiateSync(fromHubId: number, toHubId: number, tasks: Array<TaskRequestData>, sandboxHubId: number): Promise<InitiateSyncResponse>;
|
|
3
|
+
export declare function fetchTaskStatus(accountId: number, taskId: number): Promise<SyncTaskStatusType>;
|
|
4
4
|
export declare function fetchTypes(accountId: number, toHubId: number): Promise<FetchTypesResponse>;
|
package/api/sandboxSync.js
CHANGED
|
@@ -23,7 +23,7 @@ async function initiateSync(fromHubId, toHubId, tasks, sandboxHubId) {
|
|
|
23
23
|
exports.initiateSync = initiateSync;
|
|
24
24
|
async function fetchTaskStatus(accountId, taskId) {
|
|
25
25
|
return http_1.default.get(accountId, {
|
|
26
|
-
url: `${SANDBOXES_SYNC_API_PATH}/tasks/${taskId}`,
|
|
26
|
+
url: `${SANDBOXES_SYNC_API_PATH}/tasks/${taskId}/status`,
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
exports.fetchTaskStatus = fetchTaskStatus;
|
package/lang/en.json
CHANGED
|
@@ -223,11 +223,11 @@
|
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
225
|
"accountTypes": {
|
|
226
|
-
"developmentSandbox": "
|
|
226
|
+
"developmentSandbox": "dev sandbox",
|
|
227
227
|
"standardSandbox": "standard sandbox",
|
|
228
|
-
"developerTest": "
|
|
229
|
-
"appDeveloper": "
|
|
230
|
-
"standard": "
|
|
228
|
+
"developerTest": "test account",
|
|
229
|
+
"appDeveloper": "dev account",
|
|
230
|
+
"standard": "standard"
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
"config": {
|
package/lang/lang/en.json
CHANGED
|
@@ -223,11 +223,11 @@
|
|
|
223
223
|
}
|
|
224
224
|
},
|
|
225
225
|
"accountTypes": {
|
|
226
|
-
"developmentSandbox": "
|
|
226
|
+
"developmentSandbox": "dev sandbox",
|
|
227
227
|
"standardSandbox": "standard sandbox",
|
|
228
|
-
"developerTest": "
|
|
229
|
-
"appDeveloper": "
|
|
230
|
-
"standard": "
|
|
228
|
+
"developerTest": "test account",
|
|
229
|
+
"appDeveloper": "dev account",
|
|
230
|
+
"standard": "standard"
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
"config": {
|
package/lib/cms/modules.d.ts
CHANGED
|
@@ -21,4 +21,5 @@ export declare function createModule(moduleDefinition: ModuleDefinition, name: s
|
|
|
21
21
|
allowExistingDir: boolean;
|
|
22
22
|
}): Promise<void>;
|
|
23
23
|
export declare function retrieveDefaultModule(name: string | undefined, dest: string): Promise<import("../../types/Github").GithubRepoFile[] | undefined>;
|
|
24
|
+
export declare const isModuleHTMLFile: (filePath: string) => boolean;
|
|
24
25
|
export {};
|
package/lib/cms/modules.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.retrieveDefaultModule = exports.createModule = exports.validateSrcAndDestPaths = exports.ValidationIds = void 0;
|
|
6
|
+
exports.isModuleHTMLFile = exports.retrieveDefaultModule = exports.createModule = exports.validateSrcAndDestPaths = exports.ValidationIds = void 0;
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
9
9
|
const path_2 = require("../path");
|
|
@@ -114,7 +114,7 @@ async function createModule(moduleDefinition, name, dest, getInternalVersion, op
|
|
|
114
114
|
external_js: [],
|
|
115
115
|
global: global,
|
|
116
116
|
help_text: '',
|
|
117
|
-
|
|
117
|
+
content_types: contentTypes,
|
|
118
118
|
js_assets: [],
|
|
119
119
|
other_assets: [],
|
|
120
120
|
smart_type: 'NOT_SMART',
|
|
@@ -182,3 +182,6 @@ async function retrieveDefaultModule(name, dest) {
|
|
|
182
182
|
await (0, github_1.downloadGithubRepoContents)('HubSpot/cms-react', `default-react-modules/src/components/modules/${name}`, dest);
|
|
183
183
|
}
|
|
184
184
|
exports.retrieveDefaultModule = retrieveDefaultModule;
|
|
185
|
+
const MODULE_HTML_EXTENSION_REGEX = new RegExp(/\.module(?:\/|\\)module\.html$/);
|
|
186
|
+
const isModuleHTMLFile = (filePath) => MODULE_HTML_EXTENSION_REGEX.test(filePath);
|
|
187
|
+
exports.isModuleHTMLFile = isModuleHTMLFile;
|
package/lib/cms/templates.d.ts
CHANGED
|
@@ -20,4 +20,46 @@ declare const ASSET_PATHS: {
|
|
|
20
20
|
export declare function createTemplate(name: string, dest: string, type?: keyof typeof ASSET_PATHS, options?: {
|
|
21
21
|
allowExisting: boolean;
|
|
22
22
|
}): Promise<void>;
|
|
23
|
+
export declare const TEMPLATE_TYPES: {
|
|
24
|
+
unmapped: number;
|
|
25
|
+
email_base_template: number;
|
|
26
|
+
email: number;
|
|
27
|
+
landing_page_base_template: number;
|
|
28
|
+
landing_page: number;
|
|
29
|
+
blog_base: number;
|
|
30
|
+
blog: number;
|
|
31
|
+
blog_listing: number;
|
|
32
|
+
site_page: number;
|
|
33
|
+
blog_listing_context: number;
|
|
34
|
+
blog_post_context: number;
|
|
35
|
+
error_page: number;
|
|
36
|
+
subscription_preferences: number;
|
|
37
|
+
unsubscribe_confirmation: number;
|
|
38
|
+
unsubscribe_simple: number;
|
|
39
|
+
optin_email: number;
|
|
40
|
+
optin_followup_email: number;
|
|
41
|
+
optin_confirmation_page: number;
|
|
42
|
+
global_group: number;
|
|
43
|
+
password_prompt_page: number;
|
|
44
|
+
resubscribe_email: number;
|
|
45
|
+
unsubscribe_confirmation_email: number;
|
|
46
|
+
resubscribe_confirmation_email: number;
|
|
47
|
+
custom_module: number;
|
|
48
|
+
css: number;
|
|
49
|
+
js: number;
|
|
50
|
+
search_results: number;
|
|
51
|
+
membership_login: number;
|
|
52
|
+
membership_register: number;
|
|
53
|
+
membership_reset: number;
|
|
54
|
+
membership_reset_request: number;
|
|
55
|
+
drag_drop_email: number;
|
|
56
|
+
knowledge_article: number;
|
|
57
|
+
membership_email: number;
|
|
58
|
+
section: number;
|
|
59
|
+
global_content_partial: number;
|
|
60
|
+
simple_landing_page_template: number;
|
|
61
|
+
proposal: number;
|
|
62
|
+
blog_post: number;
|
|
63
|
+
quote: number;
|
|
64
|
+
};
|
|
23
65
|
export {};
|
package/lib/cms/templates.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createTemplate = exports.isCodedFile = exports.getAnnotationValue = exports.ANNOTATION_KEYS = void 0;
|
|
6
|
+
exports.TEMPLATE_TYPES = exports.createTemplate = exports.isCodedFile = exports.getAnnotationValue = exports.ANNOTATION_KEYS = void 0;
|
|
7
7
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const github_1 = require("../github");
|
|
@@ -64,3 +64,45 @@ async function createTemplate(name, dest, type = 'page-template', options = { al
|
|
|
64
64
|
await (0, github_1.downloadGithubRepoContents)('HubSpot/cms-sample-assets', assetPath, filePath);
|
|
65
65
|
}
|
|
66
66
|
exports.createTemplate = createTemplate;
|
|
67
|
+
exports.TEMPLATE_TYPES = {
|
|
68
|
+
unmapped: 0,
|
|
69
|
+
email_base_template: 1,
|
|
70
|
+
email: 2,
|
|
71
|
+
landing_page_base_template: 3,
|
|
72
|
+
landing_page: 4,
|
|
73
|
+
blog_base: 5,
|
|
74
|
+
blog: 6,
|
|
75
|
+
blog_listing: 42,
|
|
76
|
+
site_page: 8,
|
|
77
|
+
blog_listing_context: 9,
|
|
78
|
+
blog_post_context: 10,
|
|
79
|
+
error_page: 11,
|
|
80
|
+
subscription_preferences: 12,
|
|
81
|
+
unsubscribe_confirmation: 13,
|
|
82
|
+
unsubscribe_simple: 14,
|
|
83
|
+
optin_email: 15,
|
|
84
|
+
optin_followup_email: 16,
|
|
85
|
+
optin_confirmation_page: 17,
|
|
86
|
+
global_group: 18,
|
|
87
|
+
password_prompt_page: 19,
|
|
88
|
+
resubscribe_email: 20,
|
|
89
|
+
unsubscribe_confirmation_email: 21,
|
|
90
|
+
resubscribe_confirmation_email: 22,
|
|
91
|
+
custom_module: 23,
|
|
92
|
+
css: 24,
|
|
93
|
+
js: 25,
|
|
94
|
+
search_results: 27,
|
|
95
|
+
membership_login: 29,
|
|
96
|
+
membership_register: 30,
|
|
97
|
+
membership_reset: 31,
|
|
98
|
+
membership_reset_request: 32,
|
|
99
|
+
drag_drop_email: 34,
|
|
100
|
+
knowledge_article: 35,
|
|
101
|
+
membership_email: 36,
|
|
102
|
+
section: 37,
|
|
103
|
+
global_content_partial: 38,
|
|
104
|
+
simple_landing_page_template: 39,
|
|
105
|
+
proposal: 40,
|
|
106
|
+
blog_post: 41,
|
|
107
|
+
quote: 43,
|
|
108
|
+
};
|
package/lib/sandboxes.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InitiateSyncResponse, Sandbox, SandboxType,
|
|
1
|
+
import { InitiateSyncResponse, Sandbox, SandboxType, SyncTaskStatusType, TaskRequestData, Usage } from '../types/Sandbox';
|
|
2
2
|
export declare function createSandbox(accountId: number, name: string, type: 1 | 2): Promise<{
|
|
3
3
|
name: string;
|
|
4
4
|
sandbox: Sandbox;
|
|
@@ -9,6 +9,6 @@ export declare function deleteSandbox(parentAccountId: number, sandboxAccountId:
|
|
|
9
9
|
sandboxAccountId: number;
|
|
10
10
|
}>;
|
|
11
11
|
export declare function getSandboxUsageLimits(parentAccountId: number): Promise<Usage | void>;
|
|
12
|
-
export declare function initiateSync(fromHubId: number, toHubId: number, tasks: Array<
|
|
13
|
-
export declare function fetchTaskStatus(accountId: number, taskId: number): Promise<
|
|
12
|
+
export declare function initiateSync(fromHubId: number, toHubId: number, tasks: Array<TaskRequestData>, sandboxHubId: number): Promise<InitiateSyncResponse>;
|
|
13
|
+
export declare function fetchTaskStatus(accountId: number, taskId: number): Promise<SyncTaskStatusType>;
|
|
14
14
|
export declare function fetchTypes(accountId: number, toHubId: number): Promise<Array<SandboxType> | void>;
|
package/lib/sandboxes.js
CHANGED
|
@@ -51,7 +51,8 @@ async function initiateSync(fromHubId, toHubId, tasks, sandboxHubId) {
|
|
|
51
51
|
exports.initiateSync = initiateSync;
|
|
52
52
|
async function fetchTaskStatus(accountId, taskId) {
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
const result = await (0, sandboxSync_1.fetchTaskStatus)(accountId, taskId);
|
|
55
|
+
return result;
|
|
55
56
|
}
|
|
56
57
|
catch (err) {
|
|
57
58
|
(0, apiErrors_1.throwApiError)(err);
|
package/package.json
CHANGED
package/types/Sandbox.d.ts
CHANGED
|
@@ -47,13 +47,18 @@ type MutationError = {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
type
|
|
50
|
+
export type SyncTaskStatusType = {
|
|
51
|
+
status: string;
|
|
52
|
+
result?: string;
|
|
53
|
+
tasks: Pick<CompositeSyncTask, 'type' | 'status'>[];
|
|
54
|
+
};
|
|
55
|
+
type SyncMutationData = {
|
|
51
56
|
numRequests: number;
|
|
52
57
|
numSuccesses: number;
|
|
53
58
|
errors: Array<TaskError>;
|
|
54
59
|
mutationErrors: Array<MutationError>;
|
|
55
60
|
};
|
|
56
|
-
export type
|
|
61
|
+
export type CompositeSyncTask = {
|
|
57
62
|
id: string;
|
|
58
63
|
parentHubId: number;
|
|
59
64
|
sandboxHubId: number;
|
|
@@ -70,12 +75,29 @@ export type Task = {
|
|
|
70
75
|
startedAt: string;
|
|
71
76
|
completedAt: string;
|
|
72
77
|
error: MutationError;
|
|
73
|
-
creates:
|
|
74
|
-
updates:
|
|
75
|
-
deletes:
|
|
78
|
+
creates: SyncMutationData;
|
|
79
|
+
updates: SyncMutationData;
|
|
80
|
+
deletes: SyncMutationData;
|
|
76
81
|
diffSummary: string;
|
|
77
82
|
portableKeys: Array<string>;
|
|
78
83
|
};
|
|
84
|
+
export type SyncTask = {
|
|
85
|
+
id: string;
|
|
86
|
+
parentHubId: number;
|
|
87
|
+
sandboxHubId: number;
|
|
88
|
+
fromHubId: number;
|
|
89
|
+
toHubId: number;
|
|
90
|
+
command: string;
|
|
91
|
+
status: string;
|
|
92
|
+
result: string;
|
|
93
|
+
sandboxType: string;
|
|
94
|
+
requestedAt: string;
|
|
95
|
+
requestedByUserId: number;
|
|
96
|
+
requestedByUser: User;
|
|
97
|
+
startedAt: string;
|
|
98
|
+
completedAt: string;
|
|
99
|
+
tasks: Array<CompositeSyncTask>;
|
|
100
|
+
};
|
|
79
101
|
export type Sandbox = {
|
|
80
102
|
sandboxHubId: number;
|
|
81
103
|
parentHubId: number;
|
|
@@ -88,23 +110,7 @@ export type Sandbox = {
|
|
|
88
110
|
domain: string;
|
|
89
111
|
createdByUser: User;
|
|
90
112
|
updatedByUser?: User | null;
|
|
91
|
-
lastSync?:
|
|
92
|
-
id: string;
|
|
93
|
-
parentHubId: number;
|
|
94
|
-
sandboxHubId: number;
|
|
95
|
-
fromHubId: number;
|
|
96
|
-
toHubId: number;
|
|
97
|
-
command: string;
|
|
98
|
-
status: string;
|
|
99
|
-
result: string;
|
|
100
|
-
sandboxType: string;
|
|
101
|
-
requestedAt: string;
|
|
102
|
-
requestedByUserId: number;
|
|
103
|
-
requestedByUser: User;
|
|
104
|
-
startedAt: string;
|
|
105
|
-
completedAt: string;
|
|
106
|
-
tasks: Array<Task>;
|
|
107
|
-
};
|
|
113
|
+
lastSync?: SyncTask;
|
|
108
114
|
currentUserHasAccess?: boolean;
|
|
109
115
|
currentUserHasSuperAdminAccess?: boolean;
|
|
110
116
|
requestAccessFrom?: User | null;
|
|
@@ -129,26 +135,14 @@ export type Usage = {
|
|
|
129
135
|
export type SandboxUsageLimitsResponse = {
|
|
130
136
|
usage: Usage;
|
|
131
137
|
};
|
|
132
|
-
export type
|
|
138
|
+
export type TaskRequestData = {
|
|
133
139
|
type: string;
|
|
134
140
|
};
|
|
135
141
|
export type InitiateSyncResponse = {
|
|
136
142
|
links: {
|
|
137
143
|
status: string;
|
|
138
144
|
};
|
|
139
|
-
sync:
|
|
140
|
-
id: string;
|
|
141
|
-
parentHubId: number;
|
|
142
|
-
sandboxHubId: number;
|
|
143
|
-
fromHubId: number;
|
|
144
|
-
toHubId: number;
|
|
145
|
-
command: string;
|
|
146
|
-
status: string;
|
|
147
|
-
sandboxType: string;
|
|
148
|
-
requestedAt: string;
|
|
149
|
-
requestedByUserId: number;
|
|
150
|
-
tasks: Array<Task>;
|
|
151
|
-
};
|
|
145
|
+
sync: SyncTask;
|
|
152
146
|
id: string;
|
|
153
147
|
};
|
|
154
148
|
export type SandboxType = {
|