@farthershore/cli 0.3.1 → 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/dist/client.d.ts +6 -0
- package/dist/client.js +1 -0
- package/dist/commands/apply.js +15 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -93,6 +93,12 @@ export declare function createClient(opts: {
|
|
|
93
93
|
}>;
|
|
94
94
|
}>;
|
|
95
95
|
managementListProducts: () => Promise<Product[]>;
|
|
96
|
+
whoami: () => Promise<{
|
|
97
|
+
tokenId: string;
|
|
98
|
+
organizationId: string;
|
|
99
|
+
productId: string | null;
|
|
100
|
+
scopes: string[];
|
|
101
|
+
}>;
|
|
96
102
|
isMakerToken: () => boolean;
|
|
97
103
|
};
|
|
98
104
|
export type ApiClient = ReturnType<typeof createClient>;
|
package/dist/client.js
CHANGED
|
@@ -71,6 +71,7 @@ export function createClient(opts) {
|
|
|
71
71
|
// --- Management (maker token) ---
|
|
72
72
|
managementCompile: (productId) => request("POST", `/management/products/${productId}/compile`),
|
|
73
73
|
managementListProducts: () => request("GET", "/management/products"),
|
|
74
|
+
whoami: () => request("GET", "/management/whoami"),
|
|
74
75
|
isMakerToken: () => opts.token.startsWith("mk_"),
|
|
75
76
|
};
|
|
76
77
|
}
|
package/dist/commands/apply.js
CHANGED
|
@@ -55,7 +55,21 @@ export function registerApplyCommand(program, getClient) {
|
|
|
55
55
|
"Pass a product slug, or run inside a product repo to auto-detect from product.yaml.")
|
|
56
56
|
.action(async (productArg) => {
|
|
57
57
|
const client = getClient();
|
|
58
|
-
|
|
58
|
+
// For product-scoped maker tokens, get the productId directly from
|
|
59
|
+
// the token — no need to read product.yaml or resolve slugs.
|
|
60
|
+
let productId = null;
|
|
61
|
+
if (client.isMakerToken() && !productArg) {
|
|
62
|
+
try {
|
|
63
|
+
const info = await client.whoami();
|
|
64
|
+
productId = info.productId;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Fall through to slug resolution
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!productId) {
|
|
71
|
+
productId = await resolveProductId(client, productArg);
|
|
72
|
+
}
|
|
59
73
|
if (!productId) {
|
|
60
74
|
const hint = productArg
|
|
61
75
|
? `Product "${productArg}" not found. Check the name and try again.`
|