@siglume/api-sdk 0.10.7 → 0.10.8
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 +99 -91
- package/dist/bin/siglume.cjs +306 -10
- package/dist/bin/siglume.cjs.map +1 -1
- package/dist/bin/siglume.js +306 -10
- package/dist/bin/siglume.js.map +1 -1
- package/dist/cli/index.cjs +306 -10
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +78 -0
- package/dist/cli/index.d.ts +78 -0
- package/dist/cli/index.js +306 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +168 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +92 -1
- package/dist/index.d.ts +92 -1
- package/dist/index.js +168 -1
- package/dist/index.js.map +1 -1
- package/package.json +58 -58
package/dist/index.cjs
CHANGED
|
@@ -1559,6 +1559,56 @@ var init_operations = __esm({
|
|
|
1559
1559
|
});
|
|
1560
1560
|
|
|
1561
1561
|
// src/client.ts
|
|
1562
|
+
function validateManifestPersistenceContract(payload) {
|
|
1563
|
+
const vertical = String(payload.store_vertical ?? "").trim().toLowerCase();
|
|
1564
|
+
const persistence = payload.persistence;
|
|
1565
|
+
if (persistence === void 0 || persistence === null) {
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
if (!isRecord2(persistence)) {
|
|
1569
|
+
throw new SiglumeClientError("AppManifest.persistence must be an object.");
|
|
1570
|
+
}
|
|
1571
|
+
const mode = String(persistence.mode ?? (vertical === "game" ? "platform" : "none")).trim().toLowerCase();
|
|
1572
|
+
if (!["none", "local", "platform", "developer_server"].includes(mode)) {
|
|
1573
|
+
throw new SiglumeClientError(
|
|
1574
|
+
"AppManifest.persistence.mode must be one of: none, local, platform, developer_server."
|
|
1575
|
+
);
|
|
1576
|
+
}
|
|
1577
|
+
const schema = persistence.save_data_schema;
|
|
1578
|
+
if (vertical === "game" && mode !== "none" && schema === void 0) {
|
|
1579
|
+
throw new SiglumeClientError(
|
|
1580
|
+
"AppManifest.persistence.save_data_schema is required when store_vertical='game' and persistence.mode is not 'none'."
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1583
|
+
if (schema !== void 0) {
|
|
1584
|
+
validateSaveDataSchema(schema, "AppManifest.persistence.save_data_schema");
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
function validateSaveDataSchema(schema, fieldName) {
|
|
1588
|
+
if (!isRecord2(schema)) {
|
|
1589
|
+
throw new SiglumeClientError(`${fieldName} must be a JSON Schema object.`);
|
|
1590
|
+
}
|
|
1591
|
+
const schemaSize = new TextEncoder().encode(JSON.stringify(schema)).length;
|
|
1592
|
+
if (schemaSize > 8192) {
|
|
1593
|
+
throw new SiglumeClientError(`${fieldName} must be at most 8192 bytes.`);
|
|
1594
|
+
}
|
|
1595
|
+
if (schema.type !== "object") {
|
|
1596
|
+
throw new SiglumeClientError(`${fieldName}.type must be 'object'.`);
|
|
1597
|
+
}
|
|
1598
|
+
const properties = schema.properties;
|
|
1599
|
+
if (!isRecord2(properties) || Object.keys(properties).length === 0) {
|
|
1600
|
+
throw new SiglumeClientError(`${fieldName}.properties must be a non-empty object.`);
|
|
1601
|
+
}
|
|
1602
|
+
if (schema.required !== void 0) {
|
|
1603
|
+
if (!Array.isArray(schema.required) || !schema.required.every((item) => typeof item === "string")) {
|
|
1604
|
+
throw new SiglumeClientError(`${fieldName}.required must be an array of strings when provided.`);
|
|
1605
|
+
}
|
|
1606
|
+
const missing = schema.required.filter((item) => !(item in properties));
|
|
1607
|
+
if (missing.length > 0) {
|
|
1608
|
+
throw new SiglumeClientError(`${fieldName}.required references undefined properties: ${missing.join(", ")}.`);
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1562
1612
|
function buildToolManualQualityReport(payload) {
|
|
1563
1613
|
const qualityBlock = isRecord2(payload.quality) ? payload.quality : payload;
|
|
1564
1614
|
const issues = [];
|
|
@@ -1633,6 +1683,8 @@ function buildUrl(baseUrl, path, params) {
|
|
|
1633
1683
|
return url.toString();
|
|
1634
1684
|
}
|
|
1635
1685
|
function parseListing(data) {
|
|
1686
|
+
const metadata = isRecord2(data.metadata) ? data.metadata : {};
|
|
1687
|
+
const persistence = isRecord2(data.persistence) ? data.persistence : isRecord2(metadata.persistence) ? metadata.persistence : {};
|
|
1636
1688
|
return {
|
|
1637
1689
|
listing_id: String(data.listing_id ?? data.id ?? ""),
|
|
1638
1690
|
capability_key: String(data.capability_key ?? ""),
|
|
@@ -1655,14 +1707,59 @@ function parseListing(data) {
|
|
|
1655
1707
|
seller_display_name: stringOrNull2(data.seller_display_name),
|
|
1656
1708
|
seller_homepage_url: stringOrNull2(data.seller_homepage_url),
|
|
1657
1709
|
seller_social_url: stringOrNull2(data.seller_social_url),
|
|
1710
|
+
publisher_type: stringOrNull2(data.publisher_type),
|
|
1711
|
+
publisher_company_id: stringOrNull2(data.publisher_company_id),
|
|
1712
|
+
company_id: stringOrNull2(data.company_id),
|
|
1713
|
+
company_name: stringOrNull2(data.company_name),
|
|
1714
|
+
company_publish_status: stringOrNull2(data.company_publish_status),
|
|
1715
|
+
company_terms_version: stringOrNull2(data.company_terms_version),
|
|
1658
1716
|
review_status: stringOrNull2(data.review_status),
|
|
1659
1717
|
review_note: stringOrNull2(data.review_note),
|
|
1660
1718
|
submission_blockers: Array.isArray(data.submission_blockers) ? data.submission_blockers.filter((item) => typeof item === "string") : [],
|
|
1719
|
+
persistence: { ...persistence },
|
|
1661
1720
|
created_at: stringOrNull2(data.created_at),
|
|
1662
1721
|
updated_at: stringOrNull2(data.updated_at),
|
|
1663
1722
|
raw: { ...data }
|
|
1664
1723
|
};
|
|
1665
1724
|
}
|
|
1725
|
+
function parseCompanyPublisher(data) {
|
|
1726
|
+
const wallets = Array.isArray(data.settlement_wallets) ? data.settlement_wallets.filter((item) => isRecord2(item)) : [];
|
|
1727
|
+
return {
|
|
1728
|
+
company_id: String(data.company_id ?? data.id ?? ""),
|
|
1729
|
+
name: String(data.name ?? ""),
|
|
1730
|
+
status: String(data.status ?? ""),
|
|
1731
|
+
description: stringOrNull2(data.description),
|
|
1732
|
+
is_founder: Boolean(data.is_founder ?? false),
|
|
1733
|
+
membership_role: stringOrNull2(data.membership_role),
|
|
1734
|
+
membership_status: stringOrNull2(data.membership_status),
|
|
1735
|
+
can_publish: Boolean(data.can_publish ?? true),
|
|
1736
|
+
can_approve: Boolean(data.can_approve ?? false),
|
|
1737
|
+
approval_required: Boolean(data.approval_required ?? false),
|
|
1738
|
+
paid_listing_allowed: Boolean(data.paid_listing_allowed ?? false),
|
|
1739
|
+
disabled_reasons: Array.isArray(data.disabled_reasons) ? data.disabled_reasons.filter((item) => typeof item === "string") : [],
|
|
1740
|
+
company_terms_version: stringOrNull2(data.company_terms_version),
|
|
1741
|
+
active_listing_count: Number(data.active_listing_count ?? 0),
|
|
1742
|
+
pending_approval_count: Number(data.pending_approval_count ?? 0),
|
|
1743
|
+
settlement_wallet_ready: Boolean(data.settlement_wallet_ready ?? false),
|
|
1744
|
+
settlement_wallets: wallets.map((item) => ({ ...item })),
|
|
1745
|
+
raw: { ...data }
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
function parseCapabilitySaveState(data) {
|
|
1749
|
+
return {
|
|
1750
|
+
capability_key: String(data.capability_key ?? ""),
|
|
1751
|
+
save_key: String(data.save_key ?? ""),
|
|
1752
|
+
schema_version: String(data.schema_version ?? "1"),
|
|
1753
|
+
revision: Number(data.revision ?? 0),
|
|
1754
|
+
payload: toRecord2(data.payload),
|
|
1755
|
+
metadata: toRecord2(data.metadata),
|
|
1756
|
+
checksum: stringOrNull2(data.checksum),
|
|
1757
|
+
updated_at: stringOrNull2(data.updated_at),
|
|
1758
|
+
created_at: stringOrNull2(data.created_at),
|
|
1759
|
+
exists: Boolean(data.exists ?? false),
|
|
1760
|
+
raw: { ...data }
|
|
1761
|
+
};
|
|
1762
|
+
}
|
|
1666
1763
|
function parseBundleMember(data) {
|
|
1667
1764
|
return {
|
|
1668
1765
|
capability_listing_id: String(data.capability_listing_id ?? ""),
|
|
@@ -2842,6 +2939,9 @@ var init_client = __esm({
|
|
|
2842
2939
|
"support_contact",
|
|
2843
2940
|
"seller_homepage_url",
|
|
2844
2941
|
"seller_social_url",
|
|
2942
|
+
"publisher_type",
|
|
2943
|
+
"company_id",
|
|
2944
|
+
"publisher_company_id",
|
|
2845
2945
|
"store_vertical",
|
|
2846
2946
|
"jurisdiction",
|
|
2847
2947
|
"price_model",
|
|
@@ -2854,7 +2954,8 @@ var init_client = __esm({
|
|
|
2854
2954
|
"dry_run_supported",
|
|
2855
2955
|
"required_connected_accounts",
|
|
2856
2956
|
"permission_scopes",
|
|
2857
|
-
"compatibility_tags"
|
|
2957
|
+
"compatibility_tags",
|
|
2958
|
+
"persistence"
|
|
2858
2959
|
]) {
|
|
2859
2960
|
const value = manifestPayload[fieldName];
|
|
2860
2961
|
if (value !== void 0 && value !== null) {
|
|
@@ -2894,6 +2995,26 @@ var init_client = __esm({
|
|
|
2894
2995
|
);
|
|
2895
2996
|
}
|
|
2896
2997
|
}
|
|
2998
|
+
const explicitPublisherType = payload.publisher_type !== void 0 && payload.publisher_type !== null;
|
|
2999
|
+
const companyId = String(payload.company_id ?? "").trim() || String(payload.publisher_company_id ?? "").trim();
|
|
3000
|
+
const publisherType = String(payload.publisher_type ?? "user").trim().toLowerCase();
|
|
3001
|
+
if (publisherType !== "user" && publisherType !== "company") {
|
|
3002
|
+
throw new SiglumeClientError("AppManifest.publisher_type must be 'user' or 'company'.");
|
|
3003
|
+
}
|
|
3004
|
+
if (publisherType === "company" && !companyId) {
|
|
3005
|
+
throw new SiglumeClientError("AppManifest.company_id is required when publisher_type='company'.");
|
|
3006
|
+
}
|
|
3007
|
+
if (publisherType === "user" && companyId) {
|
|
3008
|
+
throw new SiglumeClientError("AppManifest.company_id cannot be combined with publisher_type='user'.");
|
|
3009
|
+
}
|
|
3010
|
+
if (explicitPublisherType || companyId) {
|
|
3011
|
+
payload.publisher_type = publisherType;
|
|
3012
|
+
}
|
|
3013
|
+
if (companyId) {
|
|
3014
|
+
payload.company_id = companyId;
|
|
3015
|
+
payload.publisher_company_id = companyId;
|
|
3016
|
+
}
|
|
3017
|
+
validateManifestPersistenceContract(payload);
|
|
2897
3018
|
if (payload.manifest && typeof payload.manifest === "object") {
|
|
2898
3019
|
delete payload.manifest.version;
|
|
2899
3020
|
}
|
|
@@ -3001,6 +3122,45 @@ var init_client = __esm({
|
|
|
3001
3122
|
const [data] = await this.request("GET", `/market/capabilities/${listing_id}`);
|
|
3002
3123
|
return parseListing(data);
|
|
3003
3124
|
}
|
|
3125
|
+
async list_company_publishers() {
|
|
3126
|
+
const [data] = await this.request("GET", "/market/company-publishers");
|
|
3127
|
+
return Array.isArray(data.items) ? data.items.filter((item) => isRecord2(item)).map(parseCompanyPublisher) : [];
|
|
3128
|
+
}
|
|
3129
|
+
async request_company_publish_approval(listing_id, note) {
|
|
3130
|
+
const [data] = await this.request("POST", `/market/capabilities/${listing_id}/company-publish-approval`, {
|
|
3131
|
+
json_body: note ? { note } : {}
|
|
3132
|
+
});
|
|
3133
|
+
return parseListing(data);
|
|
3134
|
+
}
|
|
3135
|
+
async decide_company_publish_approval(listing_id, options) {
|
|
3136
|
+
const [data] = await this.request("POST", `/market/capabilities/${listing_id}/company-publish-approval/decision`, {
|
|
3137
|
+
json_body: {
|
|
3138
|
+
decision: options.decision,
|
|
3139
|
+
...options.reason ? { reason: options.reason } : {}
|
|
3140
|
+
}
|
|
3141
|
+
});
|
|
3142
|
+
return parseListing(data);
|
|
3143
|
+
}
|
|
3144
|
+
async get_capability_state(capability_key, save_key = "default") {
|
|
3145
|
+
const [data] = await this.request("GET", `/market/capability-state/${capability_key}/${save_key}`);
|
|
3146
|
+
return parseCapabilitySaveState(data);
|
|
3147
|
+
}
|
|
3148
|
+
async put_capability_state(capability_key, save_key = "default", payload = {}, options = {}) {
|
|
3149
|
+
const body = {
|
|
3150
|
+
payload: toRecord2(payload),
|
|
3151
|
+
schema_version: options.schema_version ?? "1",
|
|
3152
|
+
metadata: toRecord2(options.metadata)
|
|
3153
|
+
};
|
|
3154
|
+
if (options.expected_revision !== void 0 && options.expected_revision !== null) {
|
|
3155
|
+
body.expected_revision = Math.trunc(options.expected_revision);
|
|
3156
|
+
}
|
|
3157
|
+
const [data] = await this.request("PUT", `/market/capability-state/${capability_key}/${save_key}`, { json_body: body });
|
|
3158
|
+
return parseCapabilitySaveState(data);
|
|
3159
|
+
}
|
|
3160
|
+
async delete_capability_state(capability_key, save_key = "default") {
|
|
3161
|
+
const [data] = await this.request("DELETE", `/market/capability-state/${capability_key}/${save_key}`);
|
|
3162
|
+
return parseCapabilitySaveState(data);
|
|
3163
|
+
}
|
|
3004
3164
|
// ----- Capability bundles (v0.7 track 2) ---------------------------------
|
|
3005
3165
|
async list_bundles(options = {}) {
|
|
3006
3166
|
const params = {
|
|
@@ -5160,6 +5320,7 @@ __export(src_exports, {
|
|
|
5160
5320
|
MeterClient: () => MeterClient,
|
|
5161
5321
|
OpenAIProvider: () => OpenAIProvider,
|
|
5162
5322
|
PermissionClass: () => PermissionClass,
|
|
5323
|
+
PersistenceMode: () => PersistenceMode,
|
|
5163
5324
|
PriceModel: () => PriceModel,
|
|
5164
5325
|
RecordMode: () => RecordMode,
|
|
5165
5326
|
Recorder: () => Recorder,
|
|
@@ -6570,6 +6731,12 @@ var ListingCurrency = {
|
|
|
6570
6731
|
USD: "USD",
|
|
6571
6732
|
JPY: "JPY"
|
|
6572
6733
|
};
|
|
6734
|
+
var PersistenceMode = {
|
|
6735
|
+
NONE: "none",
|
|
6736
|
+
LOCAL: "local",
|
|
6737
|
+
PLATFORM: "platform",
|
|
6738
|
+
DEVELOPER_SERVER: "developer_server"
|
|
6739
|
+
};
|
|
6573
6740
|
var ToolManualPermissionClass = {
|
|
6574
6741
|
READ_ONLY: "read_only",
|
|
6575
6742
|
ACTION: "action",
|