@squiz/dxp-cli-next 5.30.0-develop.3 → 5.30.0-develop.5

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.
@@ -17,6 +17,7 @@ describe('dxp', () => {
17
17
  'job-runner Job Runner Service Commands',
18
18
  'datastore Datastore Service Commands',
19
19
  'cdp Customer Data Platform Service Commands',
20
+ 'page Page Content Service Commands',
20
21
  // TODO: Migration is hidden behind feature flag.
21
22
  // 'migration AI Page Migration Service Commands',
22
23
  // TODO: Porter is hidden behind feature flag.
@@ -37,15 +38,8 @@ describe('dxp', () => {
37
38
  'cdp Customer Data Platform Service Commands',
38
39
  // TODO: Migration is hidden behind feature flag.
39
40
  // 'migration AI Page Migration Service Commands',
41
+ 'page Page Content Service Commands',
40
42
  'porter Porter Service Commands',
41
43
  ]);
42
44
  });
43
- it('should show "page" command if ENABLE_PAGE_LAYOUTS="true"', () => {
44
- var _a;
45
- process.env.ENABLE_PAGE_LAYOUTS = 'true';
46
- const { stdout } = (0, helpers_1.runCLI)(process.cwd(), ['--help']);
47
- const commandsText = (_a = stdout
48
- .match(/Commands\:(.*)/is)) === null || _a === void 0 ? void 0 : _a[1].split('\n').map(a => a.trim()).filter(a => !!a);
49
- expect(commandsText).toContain('page Page Content Service Commands');
50
- });
51
45
  });
@@ -37,6 +37,9 @@ const createActivateCommand = () => {
37
37
  write(chalk_1.default.red(str));
38
38
  },
39
39
  })
40
+ .addOption(new commander_1.Option('-r, --region <string>', 'Region for your cdp instance to be activated e.g. au')
41
+ .choices(['au', 'us', 'uk'])
42
+ .default(''))
40
43
  .action((options) => __awaiter(void 0, void 0, void 0, function* () {
41
44
  yield (0, utils_1.throwErrorIfNotLoggedIn)(activateCommand);
42
45
  console.log('');
@@ -47,10 +50,22 @@ const createActivateCommand = () => {
47
50
  return status < 400 || status === 404;
48
51
  },
49
52
  });
50
- const scvDeployBaseUrl = yield (0, utils_1.buildDXPUrl)(constants_1.SCV_DEPLOY_SERVICE_NAME);
51
- const apiUrl = `${scvDeployBaseUrl.dxpUrl}/${scvDeployBaseUrl.tenant}`;
53
+ const scvDeployBaseUrl = yield (0, utils_1.buildDXPUrl)(constants_1.SCV_DEPLOY_SERVICE_NAME, '', '', options.region);
54
+ let apiUrl = '';
55
+ const tenant = scvDeployBaseUrl.tenant;
56
+ const hasRegion = options.region !== '';
57
+ // If the region is provided, use the region specific URL
58
+ // Otherwise, we utilize service to automatically retrieve the region for us
59
+ if (hasRegion) {
60
+ apiUrl = `${scvDeployBaseUrl.dxpUrl}/${tenant}`;
61
+ }
62
+ else {
63
+ apiUrl = `${scvDeployBaseUrl.dxpUrl}`;
64
+ }
52
65
  const getDeployResponse = (yield apiService.client
53
- .get(apiUrl)
66
+ .get(apiUrl, {
67
+ headers: Object.assign({ 'Content-Type': 'application/json' }, (!hasRegion && { 'x-dxp-tenant': tenant })),
68
+ })
54
69
  .catch((err) => {
55
70
  (0, utils_1.logDebug)(`RAW ERROR: ${JSON.stringify(err)}`);
56
71
  if (err.response && err.response.status != 404) {
@@ -62,7 +77,9 @@ const createActivateCommand = () => {
62
77
  }
63
78
  (0, utils_1.logDebug)(`PUT ${apiUrl}`);
64
79
  const activateInstanceAndDeploySchemaResponse = (yield apiService.client
65
- .put(apiUrl)
80
+ .put(apiUrl, {
81
+ headers: Object.assign({ 'Content-Type': 'application/json' }, (!hasRegion && { 'x-dxp-tenant': tenant })),
82
+ })
66
83
  .catch((err) => {
67
84
  (0, utils_1.logDebug)(`RAW ERROR: ${JSON.stringify(err)}`);
68
85
  if (err.response) {
@@ -42,7 +42,7 @@ const activate = __importStar(require("./activate"));
42
42
  const utils = __importStar(require("../../utils"));
43
43
  const axios_1 = __importDefault(require("axios"));
44
44
  jest.mock('axios');
45
- const mockDomainWithPath = 'http://localhost:9999/__dxp/us/scv-deploy/myTenant';
45
+ const mockDomainWithPath = 'http://localhost:9999/__dxp/service/scv-deploy/myTenant';
46
46
  function createMockArgs() {
47
47
  return ['node', 'dxp-cli', 'cdp', 'instance', 'activate'];
48
48
  }
@@ -65,103 +65,216 @@ describe('cdpInstanceCommand', () => {
65
65
  afterEach(() => {
66
66
  jest.clearAllMocks();
67
67
  });
68
- it('should throw error when tenant exists', () => __awaiter(void 0, void 0, void 0, function* () {
69
- const mockedAxiosInstance = {
70
- get: jest.fn().mockResolvedValue({ status: 200 }),
71
- interceptors: {
72
- request: { use: jest.fn() },
73
- response: { use: jest.fn() },
74
- },
75
- };
76
- axios_1.default.create.mockReturnValue(mockedAxiosInstance);
77
- jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
78
- dxpUrl: `${mockDomain}/__dxp/us/scv-deploy`,
79
- tenant: mockTenant,
80
- });
81
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
82
- expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
83
- const program = (0, activate_1.default)();
84
- yield program.parseAsync(createMockArgs());
85
- expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining(activate_1.errorMessage));
86
- }));
87
- it('deploys a default schema and activate an instance', () => __awaiter(void 0, void 0, void 0, function* () {
88
- jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
89
- dxpUrl: `${mockDomain}/__dxp/us/scv-deploy`,
90
- tenant: mockTenant,
91
- });
92
- jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
93
- const mockedAxiosInstance = {
94
- get: jest.fn().mockResolvedValue({ status: 404 }),
95
- put: jest
96
- .fn()
97
- .mockResolvedValue({ status: 200, data: { message: 'Success' } }),
98
- interceptors: {
99
- request: { use: jest.fn() },
100
- response: { use: jest.fn() },
101
- },
102
- };
103
- axios_1.default.create.mockReturnValue(mockedAxiosInstance);
104
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
105
- expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
106
- const program = (0, activate_1.default)();
107
- yield program.parseAsync(createMockArgs());
108
- expect(mockedAxiosInstance.put).toHaveBeenCalledWith(`${mockDomain}${mockPath}`);
109
- // Note the output from the spinner doesn't seem to appear here but this still tests that it
110
- // ran without displaying an error.
111
- expect(logSpy).toHaveBeenNthCalledWith(1, '');
112
- expect(logSpy).toHaveBeenNthCalledWith(2, '');
113
- expect(logSpy).toHaveBeenNthCalledWith(3, 'Your Schema has been deployed and instance has been activated.');
114
- expect(logSpy).toHaveBeenNthCalledWith(4, '');
115
- expect(errorSpy).not.toHaveBeenCalled();
116
- }));
117
- it('should throw error when trying to activate an instance currently', () => __awaiter(void 0, void 0, void 0, function* () {
118
- jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
119
- dxpUrl: `${mockDomain}/__dxp/us/scv-deploy`,
120
- tenant: mockTenant,
121
- });
122
- jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
123
- const mockedAxios = axios_1.default;
124
- //GET request (404)
125
- mockedAxios.get.mockResolvedValueOnce({
126
- status: 404,
127
- data: { status: deploy_const_1.CDP_DEPLOY_STATUS_ERROR },
128
- });
129
- // PUT request (409)
130
- mockedAxios.put.mockResolvedValueOnce({
131
- status: 409,
132
- data: {
133
- tenantid: 'myTenant',
134
- version: 'unknown',
135
- stack: 'stackName',
136
- status: deploy_const_1.CDP_DEPLOY_STATUS_DEPLOYING,
137
- },
138
- });
139
- axios_1.default.create.mockReturnValue(mockedAxios);
140
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
141
- expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
142
- const program = (0, activate_1.default)();
143
- yield program.parseAsync(createMockArgs());
144
- expect(mockedAxios.put).toHaveBeenCalledWith(`${mockDomain}${mockPath}`);
145
- expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('Currently activating instance. Please try again later.'));
146
- }));
147
- it('should throw error when get tenant returns 403', () => __awaiter(void 0, void 0, void 0, function* () {
148
- const mockedAxiosInstance = {
149
- get: jest.fn().mockRejectedValue({
150
- response: { status: 403, data: {} },
151
- }),
152
- interceptors: {
153
- request: { use: jest.fn() },
154
- response: { use: jest.fn() },
155
- },
156
- };
157
- axios_1.default.create.mockReturnValue(mockedAxiosInstance);
158
- jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
159
- dxpUrl: `${mockDomain}/__dxp/us/scv-deploy`,
160
- tenant: mockTenant,
161
- });
162
- const handleActivateErrorSpy = jest.spyOn(activate, 'handleActivateError');
163
- const program = (0, activate_1.default)();
164
- yield program.parseAsync(createMockArgs());
165
- expect(handleActivateErrorSpy).toHaveBeenCalledWith(403, {});
166
- }));
68
+ describe('when region is provided', () => {
69
+ it.each(['au', 'us', 'uk'])('should throw error when tenant exists for %s region', (region) => __awaiter(void 0, void 0, void 0, function* () {
70
+ const mockedAxiosInstance = {
71
+ get: jest.fn().mockResolvedValue({ status: 200 }),
72
+ interceptors: {
73
+ request: { use: jest.fn() },
74
+ response: { use: jest.fn() },
75
+ },
76
+ };
77
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
78
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
79
+ dxpUrl: `${mockDomain}/__dxp/${region}/scv-deploy`,
80
+ tenant: mockTenant,
81
+ });
82
+ const program = (0, activate_1.default)();
83
+ yield program.parseAsync((0, utils_1.createMockActivateArgs)(region));
84
+ expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining(activate_1.errorMessage));
85
+ }));
86
+ it.each(['au', 'us', 'uk'])('deploys a default schema and activate an instance for %s region', (region) => __awaiter(void 0, void 0, void 0, function* () {
87
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
88
+ dxpUrl: `${mockDomain}/__dxp/${region}/scv-deploy`,
89
+ tenant: mockTenant,
90
+ });
91
+ jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
92
+ const mockedAxiosInstance = {
93
+ get: jest.fn().mockResolvedValue({ status: 404 }),
94
+ put: jest
95
+ .fn()
96
+ .mockResolvedValue({ status: 200, data: { message: 'Success' } }),
97
+ interceptors: {
98
+ request: { use: jest.fn() },
99
+ response: { use: jest.fn() },
100
+ },
101
+ };
102
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
103
+ const program = (0, activate_1.default)();
104
+ yield program.parseAsync((0, utils_1.createMockActivateArgs)(region));
105
+ expect(mockedAxiosInstance.put).toHaveBeenCalledWith(`http://localhost:9999/__dxp/${region}/scv-deploy/${mockTenant}`, {
106
+ headers: {
107
+ 'Content-Type': 'application/json',
108
+ },
109
+ });
110
+ expect(logSpy).toHaveBeenNthCalledWith(1, '');
111
+ expect(logSpy).toHaveBeenNthCalledWith(2, '');
112
+ expect(logSpy).toHaveBeenNthCalledWith(3, 'Your Schema has been deployed and instance has been activated.');
113
+ expect(logSpy).toHaveBeenNthCalledWith(4, '');
114
+ expect(errorSpy).not.toHaveBeenCalled();
115
+ }));
116
+ it.each(['au', 'us', 'uk'])('should throw error when trying to activate an instance currently for %s region', (region) => __awaiter(void 0, void 0, void 0, function* () {
117
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
118
+ dxpUrl: `${mockDomain}/__dxp/${region}/scv-deploy`,
119
+ tenant: mockTenant,
120
+ });
121
+ jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
122
+ const mockedAxios = axios_1.default;
123
+ //GET request (404)
124
+ mockedAxios.get.mockResolvedValueOnce({
125
+ status: 404,
126
+ data: { status: deploy_const_1.CDP_DEPLOY_STATUS_ERROR },
127
+ });
128
+ // PUT request (409)
129
+ mockedAxios.put.mockResolvedValueOnce({
130
+ status: 409,
131
+ data: {
132
+ tenantid: 'myTenant',
133
+ version: 'unknown',
134
+ stack: 'stackName',
135
+ status: deploy_const_1.CDP_DEPLOY_STATUS_DEPLOYING,
136
+ },
137
+ });
138
+ axios_1.default.create.mockReturnValue(mockedAxios);
139
+ const program = (0, activate_1.default)();
140
+ yield program.parseAsync((0, utils_1.createMockActivateArgs)(region));
141
+ expect(mockedAxios.put).toHaveBeenCalledWith(`http://localhost:9999/__dxp/${region}/scv-deploy/${mockTenant}`, {
142
+ headers: {
143
+ 'Content-Type': 'application/json',
144
+ },
145
+ });
146
+ expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('Currently activating instance. Please try again later.'));
147
+ }));
148
+ it.each(['au', 'us', 'uk'])('should throw error when get tenant returns 403 for %s region', (region) => __awaiter(void 0, void 0, void 0, function* () {
149
+ const mockedAxiosInstance = {
150
+ get: jest.fn().mockRejectedValue({
151
+ response: { status: 403, data: {} },
152
+ }),
153
+ interceptors: {
154
+ request: { use: jest.fn() },
155
+ response: { use: jest.fn() },
156
+ },
157
+ };
158
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
159
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
160
+ dxpUrl: `${mockDomain}/__dxp/${region}/scv-deploy`,
161
+ tenant: mockTenant,
162
+ });
163
+ const handleActivateErrorSpy = jest.spyOn(activate, 'handleActivateError');
164
+ const program = (0, activate_1.default)();
165
+ yield program.parseAsync((0, utils_1.createMockActivateArgs)(region));
166
+ expect(handleActivateErrorSpy).toHaveBeenCalledWith(403, {});
167
+ }));
168
+ });
169
+ describe('when region is not provided', () => {
170
+ it('should throw error when tenant exists', () => __awaiter(void 0, void 0, void 0, function* () {
171
+ const mockedAxiosInstance = {
172
+ get: jest.fn().mockResolvedValue({ status: 200 }),
173
+ interceptors: {
174
+ request: { use: jest.fn() },
175
+ response: { use: jest.fn() },
176
+ },
177
+ };
178
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
179
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
180
+ dxpUrl: `${mockDomain}/__dxp/service/scv-deploy`,
181
+ tenant: mockTenant,
182
+ });
183
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant);
184
+ expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
185
+ const program = (0, activate_1.default)();
186
+ yield program.parseAsync(createMockArgs());
187
+ expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining(activate_1.errorMessage));
188
+ }));
189
+ it('deploys a default schema and activate an instance', () => __awaiter(void 0, void 0, void 0, function* () {
190
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
191
+ dxpUrl: `${mockDomain}/__dxp/service/scv-deploy`,
192
+ tenant: mockTenant,
193
+ });
194
+ jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
195
+ const mockedAxiosInstance = {
196
+ get: jest.fn().mockResolvedValue({ status: 404 }),
197
+ put: jest
198
+ .fn()
199
+ .mockResolvedValue({ status: 200, data: { message: 'Success' } }),
200
+ interceptors: {
201
+ request: { use: jest.fn() },
202
+ response: { use: jest.fn() },
203
+ },
204
+ };
205
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
206
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant);
207
+ expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
208
+ const program = (0, activate_1.default)();
209
+ yield program.parseAsync(createMockArgs());
210
+ expect(mockedAxiosInstance.put).toHaveBeenCalledWith('http://localhost:9999/__dxp/service/scv-deploy', {
211
+ headers: {
212
+ 'Content-Type': 'application/json',
213
+ 'x-dxp-tenant': 'myTenant',
214
+ },
215
+ });
216
+ // Note the output from the spinner doesn't seem to appear here but this still tests that it
217
+ // ran without displaying an error.
218
+ expect(logSpy).toHaveBeenNthCalledWith(1, '');
219
+ expect(logSpy).toHaveBeenNthCalledWith(2, '');
220
+ expect(logSpy).toHaveBeenNthCalledWith(3, 'Your Schema has been deployed and instance has been activated.');
221
+ expect(logSpy).toHaveBeenNthCalledWith(4, '');
222
+ expect(errorSpy).not.toHaveBeenCalled();
223
+ }));
224
+ it('should throw error when trying to activate an instance currently', () => __awaiter(void 0, void 0, void 0, function* () {
225
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
226
+ dxpUrl: `${mockDomain}/__dxp/service/scv-deploy`,
227
+ tenant: mockTenant,
228
+ });
229
+ jest.spyOn(utils, 'pollForDeployedSchema').mockResolvedValue({});
230
+ const mockedAxios = axios_1.default;
231
+ //GET request (404)
232
+ mockedAxios.get.mockResolvedValueOnce({
233
+ status: 404,
234
+ data: { status: deploy_const_1.CDP_DEPLOY_STATUS_ERROR },
235
+ });
236
+ // PUT request (409)
237
+ mockedAxios.put.mockResolvedValueOnce({
238
+ status: 409,
239
+ data: {
240
+ tenantid: 'myTenant',
241
+ version: 'unknown',
242
+ stack: 'stackName',
243
+ status: deploy_const_1.CDP_DEPLOY_STATUS_DEPLOYING,
244
+ },
245
+ });
246
+ axios_1.default.create.mockReturnValue(mockedAxios);
247
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant);
248
+ expect(`${mockDomain}${mockPath}`).toEqual(mockDomainWithPath);
249
+ const program = (0, activate_1.default)();
250
+ yield program.parseAsync(createMockArgs());
251
+ expect(mockedAxios.put).toHaveBeenCalledWith('http://localhost:9999/__dxp/service/scv-deploy', {
252
+ headers: {
253
+ 'Content-Type': 'application/json',
254
+ 'x-dxp-tenant': 'myTenant',
255
+ },
256
+ });
257
+ expect(errorSpy).toHaveBeenCalledWith(expect.stringContaining('Currently activating instance. Please try again later.'));
258
+ }));
259
+ it('should throw error when get tenant returns 403', () => __awaiter(void 0, void 0, void 0, function* () {
260
+ const mockedAxiosInstance = {
261
+ get: jest.fn().mockRejectedValue({
262
+ response: { status: 403, data: {} },
263
+ }),
264
+ interceptors: {
265
+ request: { use: jest.fn() },
266
+ response: { use: jest.fn() },
267
+ },
268
+ };
269
+ axios_1.default.create.mockReturnValue(mockedAxiosInstance);
270
+ jest.spyOn(utils, 'buildDXPUrl').mockResolvedValue({
271
+ dxpUrl: `${mockDomain}/__dxp/service/scv-deploy`,
272
+ tenant: mockTenant,
273
+ });
274
+ const handleActivateErrorSpy = jest.spyOn(activate, 'handleActivateError');
275
+ const program = (0, activate_1.default)();
276
+ yield program.parseAsync(createMockArgs());
277
+ expect(handleActivateErrorSpy).toHaveBeenCalledWith(403, {});
278
+ }));
279
+ });
167
280
  });
@@ -60,7 +60,7 @@ describe('cdpSchemaCommand', () => {
60
60
  jest.clearAllMocks(); // Clear all spies
61
61
  });
62
62
  it('correctly handles command arguments', () => __awaiter(void 0, void 0, void 0, function* () {
63
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
63
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant, mockRegion);
64
64
  (0, nock_1.default)(mockDomain)
65
65
  .put(mockPath, require(path_1.default.resolve(process.cwd(), './src/__tests__/cdp/scv/schema.json')))
66
66
  .reply(200, {
@@ -81,7 +81,7 @@ describe('cdpSchemaCommand', () => {
81
81
  }));
82
82
  it('presents a formatted invalid schema message', () => __awaiter(void 0, void 0, void 0, function* () {
83
83
  const schemaFileContent = require(path_1.default.resolve(process.cwd(), mockFilePath));
84
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
84
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant, mockRegion);
85
85
  expect(`${mockDomain}${mockPath}`).toEqual('http://localhost:9999/__dxp/us/scv-deploy/myTenant');
86
86
  (0, nock_1.default)(mockDomain)
87
87
  .get(mockPath)
@@ -110,7 +110,7 @@ describe('cdpSchemaCommand', () => {
110
110
  }));
111
111
  it('deploys a schema', () => __awaiter(void 0, void 0, void 0, function* () {
112
112
  const schemaFileContent = require(path_1.default.resolve(process.cwd(), mockFilePath));
113
- const mockPath = (0, utils_1.createMockUrl)(mockRegion, mockTenant);
113
+ const mockPath = (0, utils_1.createMockUrl)(mockTenant, mockRegion);
114
114
  expect(`${mockDomain}${mockPath}`).toEqual('http://localhost:9999/__dxp/us/scv-deploy/myTenant');
115
115
  (0, nock_1.default)(mockDomain)
116
116
  .get(mockPath)
@@ -14,7 +14,8 @@ export declare function buildDXPUrl(serviceName: string, tenantID?: string, over
14
14
  tenant: string | undefined;
15
15
  }>;
16
16
  export declare function handleCommandError(error: Error): void;
17
- export declare function createMockUrl(region: string, path: string): string;
17
+ export declare function createMockUrl(path: string, region?: string): string;
18
+ export declare function createMockActivateArgs(region: string): Array<string>;
18
19
  /**
19
20
  * Poll the schema to be deployed.
20
21
  */
package/lib/cdp/utils.js CHANGED
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.pollForDeployedSchema = exports.createMockUrl = exports.handleCommandError = exports.buildDXPUrl = exports.throwErrorIfNotLoggedIn = exports.logDebug = void 0;
15
+ exports.pollForDeployedSchema = exports.createMockActivateArgs = exports.createMockUrl = exports.handleCommandError = exports.buildDXPUrl = exports.throwErrorIfNotLoggedIn = exports.logDebug = void 0;
16
16
  const ApplicationStore_1 = require("../ApplicationStore");
17
17
  const chalk_1 = __importDefault(require("chalk"));
18
18
  const ApplicationConfig_1 = require("../ApplicationConfig");
@@ -43,14 +43,14 @@ function buildDXPUrl(serviceName, tenantID, override, region) {
43
43
  const existingConfig = yield (0, ApplicationConfig_1.fetchApplicationConfig)(tenantID);
44
44
  logDebug(`existingConfig: ${JSON.stringify(existingConfig)}`);
45
45
  return {
46
- dxpUrl: `${existingConfig.baseUrl}/__dxp/${region || existingConfig.region}/${serviceName}`,
46
+ dxpUrl: `${existingConfig.baseUrl}/__dxp/${region || 'service'}/${serviceName}`,
47
47
  tenant: existingConfig.tenant,
48
48
  };
49
49
  }
50
50
  else {
51
51
  logDebug(`Using override URL: ${override}`);
52
52
  return {
53
- dxpUrl: `${override}/__dxp/${region || 'au'}/${serviceName}`,
53
+ dxpUrl: `${override}/__dxp/${region || 'service'}/${serviceName}`,
54
54
  tenant: tenantID,
55
55
  };
56
56
  }
@@ -82,10 +82,14 @@ function handleCommandError(error) {
82
82
  }
83
83
  }
84
84
  exports.handleCommandError = handleCommandError;
85
- function createMockUrl(region, path) {
86
- return `/__dxp/${region}/scv-deploy/${path}`;
85
+ function createMockUrl(path, region) {
86
+ return `/__dxp/${region || 'service'}/scv-deploy/${path}`;
87
87
  }
88
88
  exports.createMockUrl = createMockUrl;
89
+ function createMockActivateArgs(region) {
90
+ return ['node', 'dxp-cli', 'cdp', 'instance', 'activate', '--region', region];
91
+ }
92
+ exports.createMockActivateArgs = createMockActivateArgs;
89
93
  /**
90
94
  * Poll the schema to be deployed.
91
95
  */
package/lib/dxp.js CHANGED
@@ -30,13 +30,11 @@ program
30
30
  .addCommand(cmp_1.default)
31
31
  .addCommand(job_runner_1.default)
32
32
  .addCommand(datastore_1.default)
33
- .addCommand(cdp_1.default);
33
+ .addCommand(cdp_1.default)
34
+ .addCommand(page_1.default);
34
35
  if (process.env.ENABLE_PORTER === 'true') {
35
36
  program.addCommand(porter_1.default);
36
37
  }
37
- if (process.env.ENABLE_PAGE_LAYOUTS === 'true') {
38
- program.addCommand(page_1.default);
39
- }
40
38
  if (process.env.ENABLE_MIGRATION === 'true') {
41
39
  program.addCommand(migration_1.default);
42
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squiz/dxp-cli-next",
3
- "version": "5.30.0-develop.3",
3
+ "version": "5.30.0-develop.5",
4
4
  "repository": {
5
5
  "url": "https://gitlab.squiz.net/dxp/dxp-cli-next"
6
6
  },