@ollie-shop/cli 0.3.0 → 0.3.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/.turbo/turbo-build.log +14 -2
- package/CHANGELOG.md +13 -0
- package/__tests__/mocks/core.ts +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +40574 -75
- package/package.json +7 -6
- package/src/actions/component.actions.ts +31 -0
- package/src/actions/function.actions.ts +34 -0
- package/src/actions/project.actions.ts +6 -2
- package/src/commands/__tests__/store-version.test.ts +1 -4
- package/tsup.config.ts +15 -0
- package/dist/__tests__/helpers/cli-test-helper.d.ts +0 -89
- package/dist/__tests__/helpers/cli-test-helper.d.ts.map +0 -1
- package/dist/__tests__/helpers/cli-test-helper.js +0 -220
- package/dist/__tests__/mocks/index.d.ts +0 -69
- package/dist/__tests__/mocks/index.d.ts.map +0 -1
- package/dist/__tests__/mocks/index.js +0 -77
- package/dist/actions/component.actions.d.ts +0 -14
- package/dist/actions/component.actions.d.ts.map +0 -1
- package/dist/actions/component.actions.js +0 -273
- package/dist/actions/function.actions.d.ts +0 -15
- package/dist/actions/function.actions.d.ts.map +0 -1
- package/dist/actions/function.actions.js +0 -254
- package/dist/actions/project.actions.d.ts +0 -17
- package/dist/actions/project.actions.d.ts.map +0 -1
- package/dist/actions/project.actions.js +0 -97
- package/dist/actions/version.actions.d.ts +0 -19
- package/dist/actions/version.actions.d.ts.map +0 -1
- package/dist/actions/version.actions.js +0 -216
- package/dist/commands/component.d.ts +0 -3
- package/dist/commands/component.d.ts.map +0 -1
- package/dist/commands/component.js +0 -192
- package/dist/commands/docs.d.ts +0 -3
- package/dist/commands/docs.d.ts.map +0 -1
- package/dist/commands/docs.js +0 -16
- package/dist/commands/function.d.ts +0 -3
- package/dist/commands/function.d.ts.map +0 -1
- package/dist/commands/function.js +0 -243
- package/dist/commands/help.d.ts +0 -3
- package/dist/commands/help.d.ts.map +0 -1
- package/dist/commands/help.js +0 -20
- package/dist/commands/index.d.ts +0 -3
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -26
- package/dist/commands/login.d.ts +0 -3
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -175
- package/dist/commands/project.d.ts +0 -3
- package/dist/commands/project.d.ts.map +0 -1
- package/dist/commands/project.js +0 -78
- package/dist/commands/store-version.d.ts +0 -3
- package/dist/commands/store-version.d.ts.map +0 -1
- package/dist/commands/store-version.js +0 -241
- package/dist/commands/version.d.ts +0 -3
- package/dist/commands/version.d.ts.map +0 -1
- package/dist/commands/version.js +0 -46
- package/dist/commands/whoami.d.ts +0 -3
- package/dist/commands/whoami.d.ts.map +0 -1
- package/dist/commands/whoami.js +0 -41
- package/dist/index.d.ts.map +0 -1
- package/dist/prompts/component.prompts.d.ts +0 -14
- package/dist/prompts/component.prompts.d.ts.map +0 -1
- package/dist/prompts/component.prompts.js +0 -75
- package/dist/prompts/function.prompts.d.ts +0 -21
- package/dist/prompts/function.prompts.d.ts.map +0 -1
- package/dist/prompts/function.prompts.js +0 -127
- package/dist/schemas/command.schema.d.ts +0 -516
- package/dist/schemas/command.schema.d.ts.map +0 -1
- package/dist/schemas/command.schema.js +0 -267
- package/dist/types/index.d.ts +0 -147
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/utils/auth.d.ts +0 -4
- package/dist/utils/auth.d.ts.map +0 -1
- package/dist/utils/auth.js +0 -26
- package/dist/utils/cli-progress-reporter.d.ts +0 -12
- package/dist/utils/cli-progress-reporter.d.ts.map +0 -1
- package/dist/utils/cli-progress-reporter.js +0 -77
- package/dist/utils/command-builder.d.ts +0 -22
- package/dist/utils/command-builder.d.ts.map +0 -1
- package/dist/utils/command-builder.js +0 -268
- package/dist/utils/command-helpers.d.ts +0 -19
- package/dist/utils/command-helpers.d.ts.map +0 -1
- package/dist/utils/command-helpers.js +0 -79
- package/dist/utils/command-parser.d.ts +0 -146
- package/dist/utils/command-parser.d.ts.map +0 -1
- package/dist/utils/command-parser.js +0 -179
- package/dist/utils/command-suggestions.d.ts +0 -35
- package/dist/utils/command-suggestions.d.ts.map +0 -1
- package/dist/utils/command-suggestions.js +0 -152
- package/dist/utils/console.d.ts +0 -44
- package/dist/utils/console.d.ts.map +0 -1
- package/dist/utils/console.js +0 -233
- package/dist/utils/constants.d.ts +0 -8
- package/dist/utils/constants.d.ts.map +0 -1
- package/dist/utils/constants.js +0 -10
- package/dist/utils/context-detector.d.ts +0 -12
- package/dist/utils/context-detector.d.ts.map +0 -1
- package/dist/utils/context-detector.js +0 -155
- package/dist/utils/enhanced-error-handler.d.ts +0 -47
- package/dist/utils/enhanced-error-handler.d.ts.map +0 -1
- package/dist/utils/enhanced-error-handler.js +0 -221
- package/dist/utils/error-handler.d.ts +0 -3
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -55
- package/dist/utils/errors.d.ts +0 -44
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -76
- package/dist/utils/interactive-builder.d.ts +0 -22
- package/dist/utils/interactive-builder.d.ts.map +0 -1
- package/dist/utils/interactive-builder.js +0 -246
- package/dist/utils/rich-progress.d.ts +0 -59
- package/dist/utils/rich-progress.d.ts.map +0 -1
- package/dist/utils/rich-progress.js +0 -234
- package/dist/utils/store.d.ts +0 -11
- package/dist/utils/store.d.ts.map +0 -1
- package/dist/utils/store.js +0 -19
- package/dist/utils/validation-error-formatter.d.ts +0 -25
- package/dist/utils/validation-error-formatter.d.ts.map +0 -1
- package/dist/utils/validation-error-formatter.js +0 -258
- package/dist/utils/validation-helpers.d.ts +0 -60
- package/dist/utils/validation-helpers.d.ts.map +0 -1
- package/dist/utils/validation-helpers.js +0 -152
- package/src/commands/__tests__/version.test.ts +0 -71
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.registerStoreVersionCommands = registerStoreVersionCommands;
|
|
37
|
-
const zod_1 = require("zod");
|
|
38
|
-
const versionActions = __importStar(require("../actions/version.actions"));
|
|
39
|
-
const command_builder_1 = require("../utils/command-builder");
|
|
40
|
-
const command_parser_1 = require("../utils/command-parser");
|
|
41
|
-
const console_1 = require("../utils/console");
|
|
42
|
-
const StoreVersionCreateOptionsSchema = zod_1.z.object({
|
|
43
|
-
store: zod_1.z.string().uuid("Invalid store ID format"),
|
|
44
|
-
name: zod_1.z.string().min(1, "Version name is required"),
|
|
45
|
-
template: zod_1.z.string().optional(),
|
|
46
|
-
active: zod_1.z.boolean().optional(),
|
|
47
|
-
});
|
|
48
|
-
const StoreVersionListOptionsSchema = zod_1.z.object({
|
|
49
|
-
store: zod_1.z.string().uuid("Invalid store ID format"),
|
|
50
|
-
});
|
|
51
|
-
function registerStoreVersionCommands(program) {
|
|
52
|
-
const cmd = (0, command_builder_1.buildCommandGroup)(program, "store-version", "Manage store versions", ["sv"]);
|
|
53
|
-
// Create version command
|
|
54
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
55
|
-
name: "create",
|
|
56
|
-
description: "Create a new version for a store",
|
|
57
|
-
options: [
|
|
58
|
-
command_parser_1.COMMON_OPTIONS.storeId,
|
|
59
|
-
command_parser_1.COMMON_OPTIONS.versionName,
|
|
60
|
-
command_parser_1.COMMON_OPTIONS.template,
|
|
61
|
-
command_parser_1.COMMON_OPTIONS.active,
|
|
62
|
-
command_parser_1.COMMON_OPTIONS.noActive,
|
|
63
|
-
],
|
|
64
|
-
schema: StoreVersionCreateOptionsSchema,
|
|
65
|
-
examples: [
|
|
66
|
-
{
|
|
67
|
-
description: "Create an active version",
|
|
68
|
-
command: "ollieshop store-version create --store 123e4567-e89b-12d3-a456-426614174000 --name v2.0.0",
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
description: "Create version with grocery template",
|
|
72
|
-
command: "ollieshop store-version create --store 123e4567-e89b-12d3-a456-426614174000 --name grocery-v1 --template grocery",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
description: "Create inactive version for testing",
|
|
76
|
-
command: "ollieshop store-version create --store 123e4567-e89b-12d3-a456-426614174000 --name test-version --no-active",
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
handler: async (options) => {
|
|
80
|
-
await versionActions.create(options);
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
// List versions command
|
|
84
|
-
(0, command_builder_1.buildCommand)(cmd, {
|
|
85
|
-
name: "list",
|
|
86
|
-
description: "List all versions for a store",
|
|
87
|
-
options: [command_parser_1.COMMON_OPTIONS.storeId],
|
|
88
|
-
schema: StoreVersionListOptionsSchema,
|
|
89
|
-
examples: [
|
|
90
|
-
{
|
|
91
|
-
description: "List all versions for a store",
|
|
92
|
-
command: "ollieshop store-version list --store 123e4567-e89b-12d3-a456-426614174000",
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
handler: async (options) => {
|
|
96
|
-
await versionActions.list(options);
|
|
97
|
-
},
|
|
98
|
-
});
|
|
99
|
-
// Get version command with argument parser
|
|
100
|
-
const _getCmd = cmd
|
|
101
|
-
.command("get <versionId>")
|
|
102
|
-
.description("Get version details")
|
|
103
|
-
.addHelpText("after", "\nExamples:")
|
|
104
|
-
.addHelpText("after", " Get version details:")
|
|
105
|
-
.addHelpText("after", " $ ollieshop store-version get 987fcdeb-51a2-43b7-9abc-123456789012")
|
|
106
|
-
.action(async (versionId) => {
|
|
107
|
-
try {
|
|
108
|
-
const validated = (0, command_parser_1.parseUUID)(versionId);
|
|
109
|
-
await versionActions.get(validated);
|
|
110
|
-
}
|
|
111
|
-
catch (error) {
|
|
112
|
-
if (error instanceof Error) {
|
|
113
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
114
|
-
if (error.message.includes("UUID")) {
|
|
115
|
-
console_1.console.info("💡 Version IDs must be in UUID format");
|
|
116
|
-
console_1.console.log(" Example: 123e4567-e89b-12d3-a456-426614174000");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
121
|
-
}
|
|
122
|
-
process.exit(1);
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
// Set default version command
|
|
126
|
-
const _setDefaultCmd = cmd
|
|
127
|
-
.command("set-default <versionId>")
|
|
128
|
-
.description("Set a version as the default for the store")
|
|
129
|
-
.addHelpText("after", "\nExamples:")
|
|
130
|
-
.addHelpText("after", " Set version as default:")
|
|
131
|
-
.addHelpText("after", " $ ollieshop store-version set-default 987fcdeb-51a2-43b7-9abc-123456789012")
|
|
132
|
-
.action(async (versionId) => {
|
|
133
|
-
try {
|
|
134
|
-
const validated = (0, command_parser_1.parseUUID)(versionId);
|
|
135
|
-
await versionActions.setDefault(validated);
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
if (error instanceof Error) {
|
|
139
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
143
|
-
}
|
|
144
|
-
process.exit(1);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
// Activate version command
|
|
148
|
-
const _activateCmd = cmd
|
|
149
|
-
.command("activate <versionId>")
|
|
150
|
-
.description("Activate a version")
|
|
151
|
-
.addHelpText("after", "\nExamples:")
|
|
152
|
-
.addHelpText("after", " Activate a version:")
|
|
153
|
-
.addHelpText("after", " $ ollieshop store-version activate 987fcdeb-51a2-43b7-9abc-123456789012")
|
|
154
|
-
.action(async (versionId) => {
|
|
155
|
-
try {
|
|
156
|
-
const validated = (0, command_parser_1.parseUUID)(versionId);
|
|
157
|
-
await versionActions.activate(validated);
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
if (error instanceof Error) {
|
|
161
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
165
|
-
}
|
|
166
|
-
process.exit(1);
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
// Deactivate version command
|
|
170
|
-
const _deactivateCmd = cmd
|
|
171
|
-
.command("deactivate <versionId>")
|
|
172
|
-
.description("Deactivate a version")
|
|
173
|
-
.addHelpText("after", "\nExamples:")
|
|
174
|
-
.addHelpText("after", " Deactivate a version:")
|
|
175
|
-
.addHelpText("after", " $ ollieshop store-version deactivate 987fcdeb-51a2-43b7-9abc-123456789012")
|
|
176
|
-
.action(async (versionId) => {
|
|
177
|
-
try {
|
|
178
|
-
const validated = (0, command_parser_1.parseUUID)(versionId);
|
|
179
|
-
await versionActions.deactivate(validated);
|
|
180
|
-
}
|
|
181
|
-
catch (error) {
|
|
182
|
-
if (error instanceof Error) {
|
|
183
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
184
|
-
}
|
|
185
|
-
else {
|
|
186
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
187
|
-
}
|
|
188
|
-
process.exit(1);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
// Clone version command
|
|
192
|
-
const _cloneCmd = cmd
|
|
193
|
-
.command("clone <versionId>")
|
|
194
|
-
.description("Clone an existing version")
|
|
195
|
-
.requiredOption("-n, --name <name>", "Name for the cloned version", command_parser_1.COMMON_OPTIONS.versionName.parser)
|
|
196
|
-
.addHelpText("after", "\nExamples:")
|
|
197
|
-
.addHelpText("after", " Clone a version:")
|
|
198
|
-
.addHelpText("after", " $ ollieshop store-version clone 987fcdeb-51a2-43b7-9abc-123456789012 --name v2.1.0")
|
|
199
|
-
.addHelpText("after", "\n Clone for A/B testing:")
|
|
200
|
-
.addHelpText("after", " $ ollieshop store-version clone 987fcdeb-51a2-43b7-9abc-123456789012 --name experiment-checkout")
|
|
201
|
-
.action(async (versionId, options) => {
|
|
202
|
-
try {
|
|
203
|
-
const validatedId = (0, command_parser_1.parseUUID)(versionId);
|
|
204
|
-
await versionActions.clone(validatedId, options.name);
|
|
205
|
-
}
|
|
206
|
-
catch (error) {
|
|
207
|
-
if (error instanceof Error) {
|
|
208
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
212
|
-
}
|
|
213
|
-
process.exit(1);
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
// Delete version command
|
|
217
|
-
const _deleteCmd = cmd
|
|
218
|
-
.command("delete <versionId>")
|
|
219
|
-
.description("Delete a version")
|
|
220
|
-
.option("-f, --force", "Skip confirmation")
|
|
221
|
-
.addHelpText("after", "\nExamples:")
|
|
222
|
-
.addHelpText("after", " Delete with confirmation:")
|
|
223
|
-
.addHelpText("after", " $ ollieshop store-version delete 987fcdeb-51a2-43b7-9abc-123456789012")
|
|
224
|
-
.addHelpText("after", "\n Delete without confirmation:")
|
|
225
|
-
.addHelpText("after", " $ ollieshop store-version delete 987fcdeb-51a2-43b7-9abc-123456789012 --force")
|
|
226
|
-
.action(async (versionId, options) => {
|
|
227
|
-
try {
|
|
228
|
-
const validated = (0, command_parser_1.parseUUID)(versionId);
|
|
229
|
-
await versionActions.deleteVersion(validated, options.force);
|
|
230
|
-
}
|
|
231
|
-
catch (error) {
|
|
232
|
-
if (error instanceof Error) {
|
|
233
|
-
console_1.console.error(`❌ ${error.message}`);
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
console_1.console.error(`Error: ${String(error)}`);
|
|
237
|
-
}
|
|
238
|
-
process.exit(1);
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAK3D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6C9D"}
|
package/dist/commands/version.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureVersionCommand = configureVersionCommand;
|
|
4
|
-
const console_1 = require("../utils/console");
|
|
5
|
-
const pkg = require("../../package.json");
|
|
6
|
-
function configureVersionCommand(program) {
|
|
7
|
-
// Simple version command
|
|
8
|
-
program
|
|
9
|
-
.command("version")
|
|
10
|
-
.alias("v")
|
|
11
|
-
.description("Display CLI version and environment information")
|
|
12
|
-
.option("-d, --detailed", "Show detailed version information", false)
|
|
13
|
-
.option("-j, --json", "Output version information as JSON", false)
|
|
14
|
-
.action(async (options) => {
|
|
15
|
-
if (options.json) {
|
|
16
|
-
const versionInfo = {
|
|
17
|
-
cli: pkg.version,
|
|
18
|
-
node: process.version,
|
|
19
|
-
platform: process.platform,
|
|
20
|
-
arch: process.arch,
|
|
21
|
-
};
|
|
22
|
-
console.log(JSON.stringify(versionInfo, null, 2));
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
console_1.console.info(`Ollie Shop CLI version: ${pkg.version}`);
|
|
26
|
-
if (options.detailed) {
|
|
27
|
-
console_1.console.log("");
|
|
28
|
-
console_1.console.log("Environment:");
|
|
29
|
-
console_1.console.log(` Node.js: ${process.version}`);
|
|
30
|
-
console_1.console.log(` Platform: ${process.platform}`);
|
|
31
|
-
console_1.console.log(` Architecture: ${process.arch}`);
|
|
32
|
-
// Check for core package version
|
|
33
|
-
try {
|
|
34
|
-
const corePkg = require("@ollie-shop/core/package.json");
|
|
35
|
-
console_1.console.log(` Core: v${corePkg.version}`);
|
|
36
|
-
}
|
|
37
|
-
catch {
|
|
38
|
-
// Core package might not be available
|
|
39
|
-
}
|
|
40
|
-
console_1.console.log("");
|
|
41
|
-
console_1.console.log("For help, run: ollieshop --help");
|
|
42
|
-
console_1.console.log("Documentation: https://docs.ollie.shop");
|
|
43
|
-
console_1.console.log("Report issues: https://github.com/ollie-shop/cli/issues");
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../src/commands/whoami.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAwB3D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,QAqBtD"}
|
package/dist/commands/whoami.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configureWhoamiCommand = configureWhoamiCommand;
|
|
4
|
-
const auth_1 = require("../utils/auth");
|
|
5
|
-
const console_1 = require("../utils/console");
|
|
6
|
-
const store_1 = require("../utils/store");
|
|
7
|
-
async function getUserInfo() {
|
|
8
|
-
try {
|
|
9
|
-
const user = await (0, auth_1.getCurrentUser)();
|
|
10
|
-
const store = await (0, store_1.getOllieConfig)();
|
|
11
|
-
if (!user || !user.email) {
|
|
12
|
-
console_1.console.error("No user authenticated");
|
|
13
|
-
return {};
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
email: user.email,
|
|
17
|
-
store: store ?? undefined,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
catch {
|
|
21
|
-
return {};
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function configureWhoamiCommand(program) {
|
|
25
|
-
program
|
|
26
|
-
.command("whoami")
|
|
27
|
-
.description("Show logged-in user and current store")
|
|
28
|
-
.action(async () => {
|
|
29
|
-
const { email, store } = await getUserInfo();
|
|
30
|
-
if (!email) {
|
|
31
|
-
console_1.console.error("You are not authenticated");
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
console_1.console.newLine();
|
|
35
|
-
console_1.console.info(`You are logged in as: ${email}`);
|
|
36
|
-
if (store) {
|
|
37
|
-
console_1.console.info(`Current store: ${store.platformStoreId ?? "unknown"}`);
|
|
38
|
-
}
|
|
39
|
-
console_1.console.newLine();
|
|
40
|
-
});
|
|
41
|
-
}
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type ComponentSlotType } from "@ollie-shop/core";
|
|
2
|
-
export interface ComponentCreationAnswers {
|
|
3
|
-
name: string;
|
|
4
|
-
slot: ComponentSlotType;
|
|
5
|
-
includeTests: boolean;
|
|
6
|
-
description?: string;
|
|
7
|
-
}
|
|
8
|
-
export interface ComponentDeploymentAnswers {
|
|
9
|
-
versionId: string;
|
|
10
|
-
confirm: boolean;
|
|
11
|
-
}
|
|
12
|
-
export declare function promptComponentCreation(name?: string, slot?: string): Promise<ComponentCreationAnswers>;
|
|
13
|
-
export declare function promptComponentDeployment(): Promise<ComponentDeploymentAnswers>;
|
|
14
|
-
//# sourceMappingURL=component.prompts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component.prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/component.prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIzE,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,iBAAiB,CAAC;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAQD,wBAAsB,uBAAuB,CAC3C,IAAI,CAAC,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,wBAAwB,CAAC,CA8CnC;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,0BAA0B,CAAC,CAoBrF"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.promptComponentCreation = promptComponentCreation;
|
|
7
|
-
exports.promptComponentDeployment = promptComponentDeployment;
|
|
8
|
-
const core_1 = require("@ollie-shop/core");
|
|
9
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
|
-
const validation_helpers_1 = require("../utils/validation-helpers");
|
|
11
|
-
// Generate component slot choices from core enum
|
|
12
|
-
const componentSlotChoices = core_1.ComponentSlot.options.map((slot) => ({
|
|
13
|
-
name: slot.charAt(0).toUpperCase() + slot.slice(1).replace(/-/g, " "),
|
|
14
|
-
value: slot,
|
|
15
|
-
}));
|
|
16
|
-
async function promptComponentCreation(name, slot) {
|
|
17
|
-
const questions = [];
|
|
18
|
-
if (!name) {
|
|
19
|
-
questions.push({
|
|
20
|
-
type: "input",
|
|
21
|
-
name: "name",
|
|
22
|
-
message: "What's the name of your component?",
|
|
23
|
-
validate: (input) => {
|
|
24
|
-
return (0, validation_helpers_1.validateComponentName)(input);
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
if (!slot) {
|
|
29
|
-
questions.push({
|
|
30
|
-
type: "list",
|
|
31
|
-
name: "slot",
|
|
32
|
-
message: "Which slot will this component occupy?",
|
|
33
|
-
choices: componentSlotChoices,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
questions.push({
|
|
37
|
-
type: "input",
|
|
38
|
-
name: "description",
|
|
39
|
-
message: "Enter a description (optional):",
|
|
40
|
-
default: "",
|
|
41
|
-
}, {
|
|
42
|
-
type: "confirm",
|
|
43
|
-
name: "includeTests",
|
|
44
|
-
message: "Include test files?",
|
|
45
|
-
default: true,
|
|
46
|
-
});
|
|
47
|
-
const answers = await inquirer_1.default.prompt(questions);
|
|
48
|
-
return {
|
|
49
|
-
name: name || answers.name,
|
|
50
|
-
slot: slot || answers.slot,
|
|
51
|
-
description: answers.description || undefined,
|
|
52
|
-
includeTests: answers.includeTests,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
async function promptComponentDeployment() {
|
|
56
|
-
const answers = await inquirer_1.default.prompt([
|
|
57
|
-
{
|
|
58
|
-
type: "input",
|
|
59
|
-
name: "versionId",
|
|
60
|
-
message: "Enter the version ID to deploy to:",
|
|
61
|
-
validate: (input) => {
|
|
62
|
-
if (!input.trim())
|
|
63
|
-
return "Version ID is required";
|
|
64
|
-
return true;
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
type: "confirm",
|
|
69
|
-
name: "confirm",
|
|
70
|
-
message: "Are you sure you want to deploy this component?",
|
|
71
|
-
default: false,
|
|
72
|
-
},
|
|
73
|
-
]);
|
|
74
|
-
return answers;
|
|
75
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type FunctionInvocationTypeType, type OnErrorBehaviorType } from "@ollie-shop/core";
|
|
2
|
-
export interface FunctionCreationAnswers {
|
|
3
|
-
name: string;
|
|
4
|
-
invocation: FunctionInvocationTypeType;
|
|
5
|
-
priority: number;
|
|
6
|
-
onError: OnErrorBehaviorType;
|
|
7
|
-
includeTests: boolean;
|
|
8
|
-
description?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface FunctionDeploymentAnswers {
|
|
11
|
-
versionId: string;
|
|
12
|
-
confirm: boolean;
|
|
13
|
-
}
|
|
14
|
-
export interface FunctionTestAnswers {
|
|
15
|
-
pattern: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function promptFunctionCreation(name?: string, invocation?: string, priority?: number, onError?: string): Promise<FunctionCreationAnswers>;
|
|
18
|
-
export declare function promptFunctionDeployment(): Promise<FunctionDeploymentAnswers>;
|
|
19
|
-
export declare function promptFunctionTest(): Promise<FunctionTestAnswers>;
|
|
20
|
-
export declare function getInvocationDescription(invocation: FunctionInvocationTypeType): string;
|
|
21
|
-
//# sourceMappingURL=function.prompts.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"function.prompts.d.ts","sourceRoot":"","sources":["../../src/prompts/function.prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAE/B,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,0BAA0B,CAAC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,mBAAmB,CAAC;IAC7B,YAAY,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAoBD,wBAAsB,sBAAsB,CAC1C,IAAI,CAAC,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,CAAC,CAuElC;AAED,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,yBAAyB,CAAC,CAoBnF;AAED,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAWvE;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,0BAA0B,GACrC,MAAM,CAOR"}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.promptFunctionCreation = promptFunctionCreation;
|
|
7
|
-
exports.promptFunctionDeployment = promptFunctionDeployment;
|
|
8
|
-
exports.promptFunctionTest = promptFunctionTest;
|
|
9
|
-
exports.getInvocationDescription = getInvocationDescription;
|
|
10
|
-
const core_1 = require("@ollie-shop/core");
|
|
11
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
-
const validation_helpers_1 = require("../utils/validation-helpers");
|
|
13
|
-
// Generate function invocation choices from core enum
|
|
14
|
-
const invocationChoices = core_1.FunctionInvocationType.options.map((type) => ({
|
|
15
|
-
name: type === "request"
|
|
16
|
-
? "Request (before forwarding to target)"
|
|
17
|
-
: "Response (after receiving from target)",
|
|
18
|
-
value: type,
|
|
19
|
-
}));
|
|
20
|
-
// Generate error behavior choices from core enum
|
|
21
|
-
const errorBehaviorChoices = core_1.OnErrorBehavior.options.map((behavior) => ({
|
|
22
|
-
name: behavior === "throw"
|
|
23
|
-
? "Throw error and stop execution"
|
|
24
|
-
: "Skip and continue with next function",
|
|
25
|
-
value: behavior,
|
|
26
|
-
}));
|
|
27
|
-
async function promptFunctionCreation(name, invocation, priority, onError) {
|
|
28
|
-
const questions = [];
|
|
29
|
-
if (!name) {
|
|
30
|
-
questions.push({
|
|
31
|
-
type: "input",
|
|
32
|
-
name: "name",
|
|
33
|
-
message: "What's the name of your function?",
|
|
34
|
-
validate: (input) => {
|
|
35
|
-
return (0, validation_helpers_1.validateFunctionName)(input);
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (!invocation) {
|
|
40
|
-
questions.push({
|
|
41
|
-
type: "list",
|
|
42
|
-
name: "invocation",
|
|
43
|
-
message: "When should this function execute?",
|
|
44
|
-
choices: invocationChoices,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (priority === undefined) {
|
|
48
|
-
questions.push({
|
|
49
|
-
type: "number",
|
|
50
|
-
name: "priority",
|
|
51
|
-
message: "Priority (0-100, higher = executes first):",
|
|
52
|
-
default: 0,
|
|
53
|
-
validate: (input) => {
|
|
54
|
-
if (input < 0 || input > 100)
|
|
55
|
-
return "Priority must be between 0 and 100";
|
|
56
|
-
return true;
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
if (!onError) {
|
|
61
|
-
questions.push({
|
|
62
|
-
type: "list",
|
|
63
|
-
name: "onError",
|
|
64
|
-
message: "What should happen if this function fails?",
|
|
65
|
-
choices: errorBehaviorChoices,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
questions.push({
|
|
69
|
-
type: "input",
|
|
70
|
-
name: "description",
|
|
71
|
-
message: "Enter a description (optional):",
|
|
72
|
-
default: "",
|
|
73
|
-
}, {
|
|
74
|
-
type: "confirm",
|
|
75
|
-
name: "includeTests",
|
|
76
|
-
message: "Include test files?",
|
|
77
|
-
default: true,
|
|
78
|
-
});
|
|
79
|
-
const answers = await inquirer_1.default.prompt(questions);
|
|
80
|
-
return {
|
|
81
|
-
name: name || answers.name,
|
|
82
|
-
invocation: invocation || answers.invocation,
|
|
83
|
-
priority: priority ?? answers.priority,
|
|
84
|
-
onError: onError || answers.onError,
|
|
85
|
-
description: answers.description || undefined,
|
|
86
|
-
includeTests: answers.includeTests,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
async function promptFunctionDeployment() {
|
|
90
|
-
const answers = await inquirer_1.default.prompt([
|
|
91
|
-
{
|
|
92
|
-
type: "input",
|
|
93
|
-
name: "versionId",
|
|
94
|
-
message: "Enter the version ID to deploy to:",
|
|
95
|
-
validate: (input) => {
|
|
96
|
-
if (!input.trim())
|
|
97
|
-
return "Version ID is required";
|
|
98
|
-
return true;
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
type: "confirm",
|
|
103
|
-
name: "confirm",
|
|
104
|
-
message: "Are you sure you want to deploy this function?",
|
|
105
|
-
default: false,
|
|
106
|
-
},
|
|
107
|
-
]);
|
|
108
|
-
return answers;
|
|
109
|
-
}
|
|
110
|
-
async function promptFunctionTest() {
|
|
111
|
-
const answers = await inquirer_1.default.prompt([
|
|
112
|
-
{
|
|
113
|
-
type: "input",
|
|
114
|
-
name: "pattern",
|
|
115
|
-
message: "Enter test file pattern:",
|
|
116
|
-
default: "**/*.test.{js,ts}",
|
|
117
|
-
},
|
|
118
|
-
]);
|
|
119
|
-
return answers;
|
|
120
|
-
}
|
|
121
|
-
function getInvocationDescription(invocation) {
|
|
122
|
-
const descriptions = {
|
|
123
|
-
request: "Executes before forwarding request to target URL",
|
|
124
|
-
response: "Executes after receiving response from target URL",
|
|
125
|
-
};
|
|
126
|
-
return descriptions[invocation] || "Custom invocation handler";
|
|
127
|
-
}
|