@01.software/cli 0.10.5 → 0.11.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/dist/index.js CHANGED
@@ -7,7 +7,8 @@ import { Command } from "commander";
7
7
  // src/lib/client.ts
8
8
  import {
9
9
  CollectionClient,
10
- ServerCommerceClient
10
+ ServerCommerceClient,
11
+ TenantIntrospectionApi
11
12
  } from "@01.software/sdk/server";
12
13
 
13
14
  // src/lib/credentials.ts
@@ -497,6 +498,7 @@ function resolveClientOrThrow(apiKeyFlag) {
497
498
  void 0
498
499
  ),
499
500
  commerce: new ServerCommerceClient(serverOptions),
501
+ tenant: new TenantIntrospectionApi(serverOptions),
500
502
  publishableKey,
501
503
  secretKey
502
504
  };
@@ -1525,9 +1527,6 @@ ${loginUrl}`));
1525
1527
 
1526
1528
  // src/commands/schema.ts
1527
1529
  import { COLLECTIONS as COLLECTIONS2 } from "@01.software/sdk";
1528
- function getApiUrl() {
1529
- return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || "https://api.01.software").replace(/\/$/, "");
1530
- }
1531
1530
  function registerSchemaCommands(program2, getClient2, getFormat2) {
1532
1531
  const schema = program2.command("schema").description("Collection schema introspection");
1533
1532
  schema.command("list").description("List available collections").action(() => {
@@ -1545,23 +1544,7 @@ function registerSchemaCommands(program2, getClient2, getFormat2) {
1545
1544
  throw new Error(`Unknown collection "${collection}". ${hint}`);
1546
1545
  }
1547
1546
  const client = getClient2();
1548
- const baseUrl = getApiUrl();
1549
- const url = `${baseUrl}/api/tenants/schema/${encodeURIComponent(collection)}`;
1550
- const response = await fetch(url, {
1551
- headers: {
1552
- "X-Publishable-Key": client.publishableKey,
1553
- Authorization: `Bearer ${client.secretKey}`
1554
- }
1555
- });
1556
- if (!response.ok) {
1557
- const body = await response.json().catch(() => ({ error: response.statusText }));
1558
- const err = new Error(
1559
- body.error || `HTTP ${response.status}`
1560
- );
1561
- Object.assign(err, { status: response.status });
1562
- throw err;
1563
- }
1564
- const result = await response.json();
1547
+ const result = await client.tenant.collectionSchema(collection);
1565
1548
  printResult(result, getFormat2());
1566
1549
  } catch (e) {
1567
1550
  exitWithError(e);
@@ -1716,9 +1699,6 @@ var collectionSchemaResponseSchema = z3.object({
1716
1699
  }).strict();
1717
1700
 
1718
1701
  // src/commands/feature.ts
1719
- function getApiUrl2() {
1720
- return (process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL || "https://api.01.software").replace(/\/$/, "");
1721
- }
1722
1702
  function flattenProgress(progress) {
1723
1703
  return progress.groups.flatMap(
1724
1704
  (group) => group.items.map((item) => ({
@@ -1743,28 +1723,8 @@ function registerFeatureCommands(program2, getClient2, getFormat2) {
1743
1723
  tenantFeatureProgressInputSchema
1744
1724
  );
1745
1725
  const client = getClient2();
1746
- const baseUrl = getApiUrl2();
1747
- const search = new URLSearchParams({ feature: input.feature });
1748
- if (input.includeEvidence) search.set("includeEvidence", "true");
1749
- const response = await fetch(
1750
- `${baseUrl}/api/tenants/feature-progress?${search.toString()}`,
1751
- {
1752
- headers: {
1753
- "X-Publishable-Key": client.publishableKey,
1754
- Authorization: `Bearer ${client.secretKey}`
1755
- }
1756
- }
1757
- );
1758
- if (!response.ok) {
1759
- const body = await response.json().catch(() => ({ error: response.statusText }));
1760
- const err = new Error(
1761
- body.error || `HTTP ${response.status}`
1762
- );
1763
- Object.assign(err, { status: response.status });
1764
- throw err;
1765
- }
1766
1726
  const result = tenantFeatureProgressResponseSchema.parse(
1767
- await response.json()
1727
+ await client.tenant.featureProgress(input)
1768
1728
  );
1769
1729
  const format = getFormat2();
1770
1730
  printResult(