@siglume/api-sdk 2.0.5 → 3.0.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/README.md +0 -8
- package/dist/bin/siglume.cjs +9 -211
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +9 -211
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +9 -211
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +0 -35
- package/dist/cli/index.d.ts +0 -35
- package/dist/cli/index.js +9 -211
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +0 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -42
- package/dist/index.d.ts +1 -42
- package/dist/index.js +0 -70
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.cjs
CHANGED
|
@@ -1528,12 +1528,6 @@ function parseListing(data) {
|
|
|
1528
1528
|
seller_display_name: stringOrNull(data.seller_display_name),
|
|
1529
1529
|
seller_homepage_url: stringOrNull(data.seller_homepage_url),
|
|
1530
1530
|
seller_social_url: stringOrNull(data.seller_social_url),
|
|
1531
|
-
publisher_type: stringOrNull(data.publisher_type),
|
|
1532
|
-
publisher_company_id: stringOrNull(data.publisher_company_id),
|
|
1533
|
-
company_id: stringOrNull(data.company_id),
|
|
1534
|
-
company_name: stringOrNull(data.company_name),
|
|
1535
|
-
company_publish_status: stringOrNull(data.company_publish_status),
|
|
1536
|
-
company_terms_version: stringOrNull(data.company_terms_version),
|
|
1537
1531
|
review_status: stringOrNull(data.review_status),
|
|
1538
1532
|
review_note: stringOrNull(data.review_note),
|
|
1539
1533
|
submission_blockers: Array.isArray(data.submission_blockers) ? data.submission_blockers.filter((item) => typeof item === "string") : [],
|
|
@@ -1543,29 +1537,6 @@ function parseListing(data) {
|
|
|
1543
1537
|
raw: { ...data }
|
|
1544
1538
|
};
|
|
1545
1539
|
}
|
|
1546
|
-
function parseCompanyPublisher(data) {
|
|
1547
|
-
const wallets = Array.isArray(data.settlement_wallets) ? data.settlement_wallets.filter((item) => isRecord(item)) : [];
|
|
1548
|
-
return {
|
|
1549
|
-
company_id: String(data.company_id ?? data.id ?? ""),
|
|
1550
|
-
name: String(data.name ?? ""),
|
|
1551
|
-
status: String(data.status ?? ""),
|
|
1552
|
-
description: stringOrNull(data.description),
|
|
1553
|
-
is_founder: Boolean(data.is_founder ?? false),
|
|
1554
|
-
membership_role: stringOrNull(data.membership_role),
|
|
1555
|
-
membership_status: stringOrNull(data.membership_status),
|
|
1556
|
-
can_publish: Boolean(data.can_publish ?? true),
|
|
1557
|
-
can_approve: Boolean(data.can_approve ?? false),
|
|
1558
|
-
approval_required: Boolean(data.approval_required ?? false),
|
|
1559
|
-
paid_listing_allowed: Boolean(data.paid_listing_allowed ?? false),
|
|
1560
|
-
disabled_reasons: Array.isArray(data.disabled_reasons) ? data.disabled_reasons.filter((item) => typeof item === "string") : [],
|
|
1561
|
-
company_terms_version: stringOrNull(data.company_terms_version),
|
|
1562
|
-
active_listing_count: Number(data.active_listing_count ?? 0),
|
|
1563
|
-
pending_approval_count: Number(data.pending_approval_count ?? 0),
|
|
1564
|
-
settlement_wallet_ready: Boolean(data.settlement_wallet_ready ?? false),
|
|
1565
|
-
settlement_wallets: wallets.map((item) => ({ ...item })),
|
|
1566
|
-
raw: { ...data }
|
|
1567
|
-
};
|
|
1568
|
-
}
|
|
1569
1540
|
function parseCapabilitySaveState(data) {
|
|
1570
1541
|
return {
|
|
1571
1542
|
capability_key: String(data.capability_key ?? ""),
|
|
@@ -2480,9 +2451,6 @@ var init_client = __esm({
|
|
|
2480
2451
|
"support_contact",
|
|
2481
2452
|
"seller_homepage_url",
|
|
2482
2453
|
"seller_social_url",
|
|
2483
|
-
"publisher_type",
|
|
2484
|
-
"company_id",
|
|
2485
|
-
"publisher_company_id",
|
|
2486
2454
|
"store_vertical",
|
|
2487
2455
|
"jurisdiction",
|
|
2488
2456
|
"price_model",
|
|
@@ -2556,25 +2524,6 @@ var init_client = __esm({
|
|
|
2556
2524
|
);
|
|
2557
2525
|
}
|
|
2558
2526
|
}
|
|
2559
|
-
const explicitPublisherType = payload.publisher_type !== void 0 && payload.publisher_type !== null;
|
|
2560
|
-
const companyId = String(payload.company_id ?? "").trim() || String(payload.publisher_company_id ?? "").trim();
|
|
2561
|
-
const publisherType = String(payload.publisher_type ?? "user").trim().toLowerCase();
|
|
2562
|
-
if (publisherType !== "user" && publisherType !== "company") {
|
|
2563
|
-
throw new SiglumeClientError("AppManifest.publisher_type must be 'user' or 'company'.");
|
|
2564
|
-
}
|
|
2565
|
-
if (publisherType === "company" && !companyId) {
|
|
2566
|
-
throw new SiglumeClientError("AppManifest.company_id is required when publisher_type='company'.");
|
|
2567
|
-
}
|
|
2568
|
-
if (publisherType === "user" && companyId) {
|
|
2569
|
-
throw new SiglumeClientError("AppManifest.company_id cannot be combined with publisher_type='user'.");
|
|
2570
|
-
}
|
|
2571
|
-
if (explicitPublisherType || companyId) {
|
|
2572
|
-
payload.publisher_type = publisherType;
|
|
2573
|
-
}
|
|
2574
|
-
if (companyId) {
|
|
2575
|
-
payload.company_id = companyId;
|
|
2576
|
-
payload.publisher_company_id = companyId;
|
|
2577
|
-
}
|
|
2578
2527
|
validateManifestPersistenceContract(payload);
|
|
2579
2528
|
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2580
2529
|
delete payload.manifest.version;
|
|
@@ -2682,25 +2631,6 @@ var init_client = __esm({
|
|
|
2682
2631
|
const [data] = await this.request("GET", `/market/capabilities/${listing_id}`);
|
|
2683
2632
|
return parseListing(data);
|
|
2684
2633
|
}
|
|
2685
|
-
async list_company_publishers() {
|
|
2686
|
-
const [data] = await this.request("GET", "/market/company-publishers");
|
|
2687
|
-
return Array.isArray(data.items) ? data.items.filter((item) => isRecord(item)).map(parseCompanyPublisher) : [];
|
|
2688
|
-
}
|
|
2689
|
-
async request_company_publish_approval(listing_id, note) {
|
|
2690
|
-
const [data] = await this.request("POST", `/market/capabilities/${listing_id}/company-publish-approval`, {
|
|
2691
|
-
json_body: note ? { note } : {}
|
|
2692
|
-
});
|
|
2693
|
-
return parseListing(data);
|
|
2694
|
-
}
|
|
2695
|
-
async decide_company_publish_approval(listing_id, options) {
|
|
2696
|
-
const [data] = await this.request("POST", `/market/capabilities/${listing_id}/company-publish-approval/decision`, {
|
|
2697
|
-
json_body: {
|
|
2698
|
-
decision: options.decision,
|
|
2699
|
-
...options.reason ? { reason: options.reason } : {}
|
|
2700
|
-
}
|
|
2701
|
-
});
|
|
2702
|
-
return parseListing(data);
|
|
2703
|
-
}
|
|
2704
2634
|
async get_capability_state(capability_key, save_key = "default") {
|
|
2705
2635
|
const [data] = await this.request("GET", `/market/capability-state/${capability_key}/${save_key}`);
|
|
2706
2636
|
return parseCapabilitySaveState(data);
|
|
@@ -6964,12 +6894,7 @@ function ensureManifestPublisherIdentity(project) {
|
|
|
6964
6894
|
const sellerHomepageUrl = String(manifestPayload.seller_homepage_url ?? "").trim();
|
|
6965
6895
|
const sellerSocialUrl = String(manifestPayload.seller_social_url ?? "").trim();
|
|
6966
6896
|
const jurisdiction = String(manifestPayload.jurisdiction ?? "").trim();
|
|
6967
|
-
const companyId = String(manifestPayload.company_id ?? "").trim() || String(manifestPayload.publisher_company_id ?? "").trim();
|
|
6968
|
-
const publisherType = String(manifestPayload.publisher_type ?? "user").trim().toLowerCase();
|
|
6969
6897
|
const issues = [];
|
|
6970
|
-
if (companyId && publisherType !== "company") {
|
|
6971
|
-
issues.push('manifest.company_id requires manifest.publisher_type to be "company"');
|
|
6972
|
-
}
|
|
6973
6898
|
if (!docsUrl) {
|
|
6974
6899
|
issues.push("manifest.docs_url is required");
|
|
6975
6900
|
} else if (looksLikePlaceholder(docsUrl)) {
|
|
@@ -7129,108 +7054,23 @@ ${errors.map((error) => `- ${error}`).join("\n")}`
|
|
|
7129
7054
|
}
|
|
7130
7055
|
return preflight;
|
|
7131
7056
|
}
|
|
7132
|
-
function companyNameSlug(value) {
|
|
7133
|
-
return value.normalize("NFKD").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
7134
|
-
}
|
|
7135
7057
|
async function runRegistration(path = ".", options = {}, deps = {}) {
|
|
7136
7058
|
const project = await loadProject(path);
|
|
7137
|
-
let requestedCompanyId = String(options.company_id ?? "").trim();
|
|
7138
|
-
const requestedCompanySlug = String(options.company_slug ?? "").trim();
|
|
7139
|
-
let companyPublisherCandidates = null;
|
|
7140
|
-
if (requestedCompanySlug) {
|
|
7141
|
-
if (requestedCompanyId) {
|
|
7142
|
-
throw new SiglumeProjectError("--company and --company-slug cannot be combined.");
|
|
7143
|
-
}
|
|
7144
|
-
const slug = companyNameSlug(requestedCompanySlug);
|
|
7145
|
-
if (!slug && requestedCompanySlug !== requestedCompanyId) {
|
|
7146
|
-
throw new SiglumeProjectError(`Company slug ${requestedCompanySlug} is not slug-compatible; use --company <company_id> instead.`);
|
|
7147
|
-
}
|
|
7148
|
-
}
|
|
7149
|
-
if (requestedCompanyId) {
|
|
7150
|
-
project.manifest = {
|
|
7151
|
-
...project.manifest,
|
|
7152
|
-
publisher_type: "company",
|
|
7153
|
-
company_id: requestedCompanyId,
|
|
7154
|
-
publisher_company_id: requestedCompanyId
|
|
7155
|
-
};
|
|
7156
|
-
}
|
|
7157
7059
|
ensureExplicitToolManual(project);
|
|
7158
7060
|
ensureManifestPublisherIdentity(project);
|
|
7159
7061
|
ensureRuntimeValidationReady(project);
|
|
7160
7062
|
const client = await createClient(deps);
|
|
7161
|
-
if (requestedCompanySlug) {
|
|
7162
|
-
const slug = companyNameSlug(requestedCompanySlug);
|
|
7163
|
-
companyPublisherCandidates = await client.list_company_publishers();
|
|
7164
|
-
const matches = companyPublisherCandidates.filter(
|
|
7165
|
-
(item) => companyNameSlug(item.name || item.company_id) === slug || item.company_id === requestedCompanySlug
|
|
7166
|
-
);
|
|
7167
|
-
if (matches.length === 0) {
|
|
7168
|
-
throw new SiglumeProjectError(`Company slug ${requestedCompanySlug} is not available to this API key.`);
|
|
7169
|
-
}
|
|
7170
|
-
if (matches.length > 1) {
|
|
7171
|
-
throw new SiglumeProjectError(`Company slug ${requestedCompanySlug} is ambiguous; use --company <company_id> instead.`);
|
|
7172
|
-
}
|
|
7173
|
-
const match = matches[0];
|
|
7174
|
-
if (!match) {
|
|
7175
|
-
throw new SiglumeProjectError(`Company slug ${requestedCompanySlug} is not available to this API key.`);
|
|
7176
|
-
}
|
|
7177
|
-
if (match.can_publish === false) {
|
|
7178
|
-
const disabledReasons = match.disabled_reasons ?? [];
|
|
7179
|
-
const reasons = disabledReasons.length > 0 ? disabledReasons.join(", ") : "company publisher is disabled";
|
|
7180
|
-
throw new SiglumeProjectError(`Company ${match.company_id} cannot publish: ${reasons}.`);
|
|
7181
|
-
}
|
|
7182
|
-
requestedCompanyId = match.company_id;
|
|
7183
|
-
project.manifest = {
|
|
7184
|
-
...project.manifest,
|
|
7185
|
-
publisher_type: "company",
|
|
7186
|
-
company_id: requestedCompanyId,
|
|
7187
|
-
publisher_company_id: requestedCompanyId
|
|
7188
|
-
};
|
|
7189
|
-
}
|
|
7190
7063
|
const preflight = await registrationPreflight(project, client);
|
|
7191
|
-
let companyPublisherPreflight = null;
|
|
7192
|
-
const companyId = String(project.manifest.company_id ?? "").trim() || String(project.manifest.publisher_company_id ?? "").trim();
|
|
7193
|
-
const publisherType = String(project.manifest.publisher_type ?? "user").toLowerCase();
|
|
7194
|
-
if (publisherType === "company") {
|
|
7195
|
-
if (!companyId) {
|
|
7196
|
-
throw new SiglumeProjectError("Company registration requires --company <company_id> or manifest.company_id.");
|
|
7197
|
-
}
|
|
7198
|
-
const companies = companyPublisherCandidates ?? await client.list_company_publishers();
|
|
7199
|
-
companyPublisherCandidates = companies;
|
|
7200
|
-
const company = companies.find((item) => item.company_id === companyId);
|
|
7201
|
-
if (!company) {
|
|
7202
|
-
throw new SiglumeProjectError(`Company ${companyId} is not available to this API key.`);
|
|
7203
|
-
}
|
|
7204
|
-
if (company.can_publish === false) {
|
|
7205
|
-
const disabledReasons = company.disabled_reasons ?? [];
|
|
7206
|
-
const reasons = disabledReasons.length > 0 ? disabledReasons.join(", ") : "company publisher is disabled";
|
|
7207
|
-
throw new SiglumeProjectError(`Company ${companyId} cannot publish: ${reasons}.`);
|
|
7208
|
-
}
|
|
7209
|
-
companyPublisherPreflight = company;
|
|
7210
|
-
}
|
|
7211
7064
|
let developerPortalPreflight = null;
|
|
7212
7065
|
if (String(project.manifest.price_model ?? "free").toLowerCase() !== "free") {
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
|
|
7219
|
-
throw new SiglumeProjectError(
|
|
7220
|
-
`Paid company registration requires a verified company settlement wallet for ${company.name}. Open the company settings and complete settlement readiness before registering.`
|
|
7221
|
-
);
|
|
7222
|
-
}
|
|
7223
|
-
developerPortalPreflight = { company_publisher: toJsonable(company) };
|
|
7224
|
-
} else {
|
|
7225
|
-
const portal = await client.get_developer_portal();
|
|
7226
|
-
const verifiedDestination = portal.payout_readiness?.verified_destination;
|
|
7227
|
-
if (verifiedDestination !== true) {
|
|
7228
|
-
throw new SiglumeProjectError(
|
|
7229
|
-
"Paid API registration requires a verified Polygon payout destination. Open https://siglume.com/owner/credits/payout and confirm the embedded-wallet payout token, or call GET /v1/market/developer/portal until payout_readiness.verified_destination is true."
|
|
7230
|
-
);
|
|
7231
|
-
}
|
|
7232
|
-
developerPortalPreflight = toJsonable(portal);
|
|
7066
|
+
const portal = await client.get_developer_portal();
|
|
7067
|
+
const verifiedDestination = portal.payout_readiness?.verified_destination;
|
|
7068
|
+
if (verifiedDestination !== true) {
|
|
7069
|
+
throw new SiglumeProjectError(
|
|
7070
|
+
"Paid API registration requires a verified Polygon payout destination. Open https://siglume.com/owner/credits/payout and confirm the embedded-wallet payout token, or call GET /v1/market/developer/portal until payout_readiness.verified_destination is true."
|
|
7071
|
+
);
|
|
7233
7072
|
}
|
|
7073
|
+
developerPortalPreflight = toJsonable(portal);
|
|
7234
7074
|
}
|
|
7235
7075
|
const receipt = await client.auto_register(project.manifest, project.tool_manual, {
|
|
7236
7076
|
runtime_validation: project.runtime_validation
|
|
@@ -7299,14 +7139,6 @@ async function getUsageReport(options, deps = {}) {
|
|
|
7299
7139
|
count: items.length
|
|
7300
7140
|
};
|
|
7301
7141
|
}
|
|
7302
|
-
async function listCompanyPublishersReport(deps = {}) {
|
|
7303
|
-
const client = await createClient(deps);
|
|
7304
|
-
const companies = await client.list_company_publishers();
|
|
7305
|
-
return {
|
|
7306
|
-
companies: companies.map((item) => toJsonable(item)),
|
|
7307
|
-
count: companies.length
|
|
7308
|
-
};
|
|
7309
|
-
}
|
|
7310
7142
|
async function diffJsonFiles(oldPath, newPath) {
|
|
7311
7143
|
const oldPayload = await loadJsonDocument(oldPath);
|
|
7312
7144
|
const newPayload = await loadJsonDocument(newPath);
|
|
@@ -8375,24 +8207,6 @@ function renderOperationTable(operations) {
|
|
|
8375
8207
|
...rows.map((row) => row.map((cell, index) => cell.padEnd(widths[index] ?? cell.length)).join(" "))
|
|
8376
8208
|
];
|
|
8377
8209
|
}
|
|
8378
|
-
function renderCompanyTable(companies) {
|
|
8379
|
-
const rows = companies.map((item) => [
|
|
8380
|
-
String(item.company_id ?? item.id ?? ""),
|
|
8381
|
-
String(item.name ?? ""),
|
|
8382
|
-
String(item.membership_role ?? (item.is_founder ? "founder" : "")),
|
|
8383
|
-
String(item.settlement_wallet_ready === true ? "ready" : "not_ready"),
|
|
8384
|
-
String(item.pending_approval_count ?? 0)
|
|
8385
|
-
]);
|
|
8386
|
-
const headers = ["company_id", "name", "role", "settlement", "pending"];
|
|
8387
|
-
const widths = headers.map(
|
|
8388
|
-
(header, index) => Math.max(header.length, ...rows.map((row) => row[index]?.length ?? 0))
|
|
8389
|
-
);
|
|
8390
|
-
return [
|
|
8391
|
-
headers.map((header, index) => header.padEnd(widths[index] ?? header.length)).join(" "),
|
|
8392
|
-
widths.map((width) => "-".repeat(width)).join(" "),
|
|
8393
|
-
...rows.map((row) => row.map((cell, index) => cell.padEnd(widths[index] ?? cell.length)).join(" "))
|
|
8394
|
-
];
|
|
8395
|
-
}
|
|
8396
8210
|
async function runCli(argv, deps = {}) {
|
|
8397
8211
|
const stdout = deps.stdout;
|
|
8398
8212
|
const stderr = deps.stderr ?? console.error;
|
|
@@ -8548,21 +8362,7 @@ async function runCli(argv, deps = {}) {
|
|
|
8548
8362
|
}
|
|
8549
8363
|
if (report.runtime_validation_path) emit(stdout, `runtime_validation_path: ${String(report.runtime_validation_path)}`);
|
|
8550
8364
|
});
|
|
8551
|
-
program.command("
|
|
8552
|
-
const report = await listCompanyPublishersReport(deps);
|
|
8553
|
-
if (options.json) {
|
|
8554
|
-
emit(stdout, renderJson(report));
|
|
8555
|
-
return;
|
|
8556
|
-
}
|
|
8557
|
-
const companies = Array.isArray(report.companies) ? report.companies.filter((item) => Boolean(item && typeof item === "object")) : [];
|
|
8558
|
-
if (companies.length === 0) {
|
|
8559
|
-
emit(stdout, "No company publishers available for this API key.");
|
|
8560
|
-
return;
|
|
8561
|
-
}
|
|
8562
|
-
emit(stdout, "Company publishers");
|
|
8563
|
-
renderCompanyTable(companies).forEach((line) => emit(stdout, line));
|
|
8564
|
-
});
|
|
8565
|
-
program.command("register").option("--confirm", "explicitly confirm the registration; this is the default unless --draft-only is set", false).option("--draft-only", "create or refresh the draft without confirming publication", false).option("--submit-review", "legacy alias: publish immediately if your environment still routes through submit-review", false).option("--company <companyId>", "publish under a Siglume company name; revenue is split equally among active members", "").option("--company-slug <slug>", "publish under a Siglume company by matching the slugified company name", "").option("--json", "emit machine-readable JSON", false).argument("[path]", ".", "project path").action(async (path, options) => {
|
|
8365
|
+
program.command("register").option("--confirm", "explicitly confirm the registration; this is the default unless --draft-only is set", false).option("--draft-only", "create or refresh the draft without confirming publication", false).option("--submit-review", "legacy alias: publish immediately if your environment still routes through submit-review", false).option("--json", "emit machine-readable JSON", false).argument("[path]", ".", "project path").action(async (path, options) => {
|
|
8566
8366
|
const draftOnly = Boolean(options.draftOnly);
|
|
8567
8367
|
if (draftOnly && options.confirm) {
|
|
8568
8368
|
throw new SiglumeProjectError("--draft-only cannot be combined with --confirm.");
|
|
@@ -8574,9 +8374,7 @@ async function runCli(argv, deps = {}) {
|
|
|
8574
8374
|
const report = await runRegistration(path, {
|
|
8575
8375
|
confirm: shouldConfirm,
|
|
8576
8376
|
draft_only: draftOnly,
|
|
8577
|
-
submit_review: options.submitReview
|
|
8578
|
-
company_id: options.company,
|
|
8579
|
-
company_slug: options.companySlug
|
|
8377
|
+
submit_review: options.submitReview
|
|
8580
8378
|
}, deps);
|
|
8581
8379
|
if (options.json) {
|
|
8582
8380
|
emit(stdout, renderJson(report));
|