@siglume/api-sdk 0.10.8 → 1.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/dist/index.cjs CHANGED
@@ -1771,18 +1771,6 @@ function parseBundleMember(data) {
1771
1771
  link_id: stringOrNull2(data.link_id)
1772
1772
  };
1773
1773
  }
1774
- function parseConnectedAccountLifecycle(data) {
1775
- return {
1776
- connected_account_id: String(data.connected_account_id ?? ""),
1777
- provider_key: String(data.provider_key ?? ""),
1778
- expires_at: stringOrNull2(data.expires_at),
1779
- scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
1780
- refreshed_at: stringOrNull2(data.refreshed_at),
1781
- connection_status: stringOrNull2(data.connection_status),
1782
- provider_revoked: typeof data.provider_revoked === "boolean" ? data.provider_revoked : null,
1783
- revoked_at: stringOrNull2(data.revoked_at)
1784
- };
1785
- }
1786
1774
  function parseBundle(data) {
1787
1775
  const membersRaw = Array.isArray(data.members) ? data.members : [];
1788
1776
  return {
@@ -1861,21 +1849,6 @@ function parseBinding(data) {
1861
1849
  raw: { ...data }
1862
1850
  };
1863
1851
  }
1864
- function parseConnectedAccount(data) {
1865
- return {
1866
- connected_account_id: String(data.connected_account_id ?? data.id ?? ""),
1867
- provider_key: String(data.provider_key ?? ""),
1868
- account_role: String(data.account_role ?? ""),
1869
- display_name: stringOrNull2(data.display_name),
1870
- environment: stringOrNull2(data.environment),
1871
- connection_status: stringOrNull2(data.connection_status),
1872
- scopes: Array.isArray(data.scopes) ? data.scopes.filter((item) => typeof item === "string") : [],
1873
- metadata: toRecord2(data.metadata),
1874
- created_at: stringOrNull2(data.created_at),
1875
- updated_at: stringOrNull2(data.updated_at),
1876
- raw: { ...data }
1877
- };
1878
- }
1879
1852
  function parseSupportCase(data) {
1880
1853
  return {
1881
1854
  support_case_id: String(data.support_case_id ?? data.id ?? ""),
@@ -2914,13 +2887,6 @@ var init_client = __esm({
2914
2887
  if (options.runtime_validation) {
2915
2888
  payload.runtime_validation = coerceMapping(options.runtime_validation, "runtime_validation");
2916
2889
  }
2917
- if (options.oauth_credentials) {
2918
- payload.oauth_credentials = Array.isArray(options.oauth_credentials) ? {
2919
- items: options.oauth_credentials.map(
2920
- (item, index) => coerceMapping(item, `oauth_credentials[${index}]`)
2921
- )
2922
- } : coerceMapping(options.oauth_credentials, "oauth_credentials");
2923
- }
2924
2890
  if (options.source_context) {
2925
2891
  payload.source_context = coerceMapping(options.source_context, "source_context");
2926
2892
  }
@@ -3050,7 +3016,6 @@ var init_client = __esm({
3050
3016
  auto_manifest: toRecord2(data.auto_manifest),
3051
3017
  confidence: toRecord2(data.confidence),
3052
3018
  validation_report: toRecord2(data.validation_report),
3053
- oauth_status: toRecord2(data.oauth_status),
3054
3019
  review_url: stringOrNull2(data.review_url),
3055
3020
  trace_id: meta.trace_id,
3056
3021
  request_id: meta.request_id
@@ -3226,66 +3191,9 @@ var init_client = __esm({
3226
3191
  return parseBundle(data);
3227
3192
  }
3228
3193
  // ----- end bundles -------------------------------------------------------
3229
- // ----- Connected accounts (v0.7 track 3) ---------------------------------
3230
- // `resolve()` is intentionally NOT wrapped: runtime-only, never over the wire.
3231
- async start_connected_account_oauth(input) {
3232
- const body = {
3233
- listing_id: input.listing_id,
3234
- redirect_uri: input.redirect_uri
3235
- };
3236
- if (input.scopes !== void 0) body.scopes = input.scopes;
3237
- if (input.account_role !== void 0) body.account_role = input.account_role;
3238
- const [data] = await this.request("POST", "/me/connected-accounts/oauth/authorize", {
3239
- json_body: body
3240
- });
3241
- return {
3242
- authorize_url: String(data.authorize_url ?? ""),
3243
- state: String(data.state ?? ""),
3244
- provider_key: String(data.provider_key ?? ""),
3245
- scopes: Array.isArray(data.scopes) ? data.scopes.filter((s) => typeof s === "string") : [],
3246
- pkce_method: stringOrNull2(data.pkce_method)
3247
- };
3248
- }
3249
- async complete_connected_account_oauth(input) {
3250
- const [data] = await this.request("POST", "/me/connected-accounts/oauth/callback", {
3251
- json_body: { state: input.state, code: input.code }
3252
- });
3253
- return { ...data };
3254
- }
3255
- async refresh_connected_account(account_id) {
3256
- const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/refresh`);
3257
- return parseConnectedAccountLifecycle(data);
3258
- }
3259
- async revoke_connected_account(account_id) {
3260
- const [data] = await this.request("POST", `/me/connected-accounts/${account_id}/revoke`);
3261
- return parseConnectedAccountLifecycle(data);
3262
- }
3263
- async set_listing_oauth_credentials(listing_id, input) {
3264
- const body = {
3265
- provider_key: input.provider_key,
3266
- client_id: input.client_id,
3267
- client_secret: input.client_secret,
3268
- authorize_url: input.authorize_url,
3269
- token_url: input.token_url
3270
- };
3271
- if (input.revoke_url !== void 0) body.revoke_url = input.revoke_url;
3272
- if (input.display_name !== void 0) body.display_name = input.display_name;
3273
- if (input.scope_separator !== void 0) body.scope_separator = input.scope_separator;
3274
- if (input.token_endpoint_auth !== void 0) body.token_endpoint_auth = input.token_endpoint_auth;
3275
- if (input.pkce_required !== void 0) body.pkce_required = input.pkce_required;
3276
- if (input.refresh_supported !== void 0) body.refresh_supported = input.refresh_supported;
3277
- if (input.available_scopes !== void 0) body.available_scopes = input.available_scopes;
3278
- if (input.required_scopes !== void 0) body.required_scopes = input.required_scopes;
3279
- const [data] = await this.request("PUT", `/market/capabilities/${listing_id}/oauth-credentials`, {
3280
- json_body: body
3281
- });
3282
- return { ...data };
3283
- }
3284
- async get_listing_oauth_credentials_status(listing_id) {
3285
- const [data] = await this.request("GET", `/market/capabilities/${listing_id}/oauth-credentials`);
3286
- return { ...data };
3287
- }
3288
- // ----- end connected accounts --------------------------------------------
3194
+ // ----- Connected accounts ------------------------------------------------
3195
+ // Architecture B: publisher APIs own external OAuth and token storage.
3196
+ // The SDK no longer exposes platform OAuth or listing credential APIs.
3289
3197
  async get_developer_portal() {
3290
3198
  const [data, meta] = await this.request("GET", "/market/developer/portal");
3291
3199
  return {
@@ -3318,7 +3226,6 @@ var init_client = __esm({
3318
3226
  dry_run_supported: Boolean(data.dry_run_supported ?? false),
3319
3227
  approval_mode: stringOrNull2(data.approval_mode),
3320
3228
  required_connected_accounts: Array.isArray(data.required_connected_accounts) ? data.required_connected_accounts : [],
3321
- connected_accounts: Array.isArray(data.connected_accounts) ? data.connected_accounts.filter((item) => isRecord2(item)).map((item) => ({ ...item })) : [],
3322
3229
  stub_providers_enabled: Boolean(data.stub_providers_enabled ?? false),
3323
3230
  simulated_receipts: Boolean(data.simulated_receipts ?? false),
3324
3231
  approval_simulator: Boolean(data.approval_simulator ?? false),
@@ -4616,25 +4523,6 @@ var init_client = __esm({
4616
4523
  raw: { ...data }
4617
4524
  };
4618
4525
  }
4619
- async list_connected_accounts(options = {}) {
4620
- const params = {
4621
- provider_key: options.provider_key,
4622
- environment: options.environment,
4623
- limit: Math.max(1, Math.min(Math.trunc(options.limit ?? 50), 100)),
4624
- cursor: options.cursor
4625
- };
4626
- const [data, meta] = await this.request("GET", "/market/connected-accounts", { params });
4627
- const items = Array.isArray(data.items) ? data.items.filter((item) => isRecord2(item)).map(parseConnectedAccount) : [];
4628
- const next_cursor = stringOrNull2(data.next_cursor);
4629
- return new CursorPageResult({
4630
- items,
4631
- next_cursor,
4632
- limit: typeof data.limit === "number" ? data.limit : params.limit,
4633
- offset: typeof data.offset === "number" ? data.offset : null,
4634
- meta,
4635
- fetchNext: next_cursor ? (cursor) => this.list_connected_accounts({ ...options, cursor }) : void 0
4636
- });
4637
- }
4638
4526
  async create_support_case(subject, body, options = {}) {
4639
4527
  const summary = subject.trim();
4640
4528
  const details = body.trim();
@@ -7473,24 +7361,12 @@ var AppTestHarness = class {
7473
7361
  this.stubs = stubs;
7474
7362
  }
7475
7363
  async executeWithKind(execution_kind, task_type = "default", options = {}) {
7476
- const connected_accounts = options.connected_accounts ?? Object.fromEntries(
7477
- Object.keys(this.stubs).map((key) => [
7478
- key,
7479
- {
7480
- provider_key: key,
7481
- session_token: `stub-token-${key}`,
7482
- environment: Environment.SANDBOX,
7483
- scopes: []
7484
- }
7485
- ])
7486
- );
7487
7364
  const ctx = {
7488
7365
  agent_id: "test-agent-001",
7489
7366
  owner_user_id: "test-owner-001",
7490
7367
  task_type,
7491
7368
  environment: Environment.SANDBOX,
7492
7369
  execution_kind,
7493
- connected_accounts,
7494
7370
  input_params: options.input_params ?? {},
7495
7371
  trace_id: options.trace_id,
7496
7372
  idempotency_key: options.idempotency_key,
@@ -7580,12 +7456,6 @@ var AppTestHarness = class {
7580
7456
  }
7581
7457
  return issues;
7582
7458
  }
7583
- async simulate_connected_account_missing(task_type = "default", options = {}) {
7584
- return this.executeWithKind("dry_run", task_type, {
7585
- ...options,
7586
- connected_accounts: {}
7587
- });
7588
- }
7589
7459
  async simulate_metering(record, options = {}) {
7590
7460
  const { normalizeUsageRecord: normalizeUsageRecord2 } = await Promise.resolve().then(() => (init_metering(), metering_exports));
7591
7461
  const manifest = await this.app.manifest();