@adport/provider-pinterest 0.9.0 → 0.10.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
@@ -1319,7 +1319,7 @@ function pinterestMeasurementTools(provider) {
1319
1319
 
1320
1320
  // src/catalogs.ts
1321
1321
  import { createHash as createHash5 } from "crypto";
1322
- import { AdportError as AdportError7, defineTool as defineTool6, guardedWriteTool as guardedWriteTool6 } from "@adport/core";
1322
+ import { AdportError as AdportError7, defineTool as defineTool6, guardedWriteTool as guardedWriteTool6, hostedFeedUrl } from "@adport/core";
1323
1323
  import { z as z9 } from "zod";
1324
1324
  var id3 = z9.string().regex(/^\d{1,30}$/);
1325
1325
  var hash5 = z9.string().regex(/^[a-f0-9]{64}$/);
@@ -1348,10 +1348,19 @@ var feedCreate = z9.discriminatedUnion("catalog_type", [
1348
1348
  z9.object({ ...common, catalog_type: z9.literal("HOTEL") }).strict(),
1349
1349
  z9.object({ ...common, catalog_type: z9.literal("CREATIVE_ASSETS"), default_country: z9.string().regex(/^[A-Z]{2}$/) }).strict()
1350
1350
  ]);
1351
- var feedChanges = z9.object({ name: name2.optional(), location: location.optional(), format: format.optional(), default_currency: currency.optional(), default_availability: availability.optional(), credentials: credentials.optional(), preferred_processing_schedule: schedule.optional(), status: state.optional() }).strict().refine((value) => Object.keys(value).length > 0, "Supply at least one feed setting");
1351
+ var feedChangeFields = z9.object({ name: name2.optional(), location: location.optional(), format: format.optional(), default_currency: currency.optional(), default_availability: availability.optional(), credentials: credentials.optional(), preferred_processing_schedule: schedule.optional(), status: state.optional() }).strict();
1352
+ var feedChanges = feedChangeFields.refine((value) => Object.keys(value).length > 0, "Supply at least one feed setting");
1352
1353
  var createCatalog = z9.object({ expected_context_hash: hash5, name: name2, catalog_type: type }).strict();
1353
1354
  var createFeed = z9.object({ expected_context_hash: hash5, feed: feedCreate, confirm_source_access: z9.literal(true), confirm_publication: z9.boolean().default(false) }).strict();
1354
1355
  var updateFeed = z9.object({ ...bound, changes: feedChanges, confirm_source_access: z9.boolean().default(false), confirm_publication: z9.boolean().default(false) }).strict();
1356
+ var [retailFeed, hotelFeed, creativeAssetsFeed] = feedCreate.options;
1357
+ var hostedSource = { location: hostedFeedUrl };
1358
+ var hostedCreateFeed = createFeed.extend({ feed: z9.discriminatedUnion("catalog_type", [
1359
+ retailFeed.omit({ credentials: true }).extend(hostedSource),
1360
+ hotelFeed.omit({ credentials: true }).extend(hostedSource),
1361
+ creativeAssetsFeed.omit({ credentials: true }).extend(hostedSource)
1362
+ ]) });
1363
+ var hostedUpdateFeed = updateFeed.extend({ changes: feedChangeFields.omit({ credentials: true }).extend({ location: hostedFeedUrl.optional() }) });
1355
1364
  var deleteFeed = z9.object({ ...bound, confirm_permanent_deletion: z9.literal(true) }).strict();
1356
1365
  var ingestFeed = z9.object({ ...bound, confirm_source_access: z9.literal(true), confirm_publication: z9.literal(true) }).strict();
1357
1366
  var processing = z9.looseObject({ id: id3, status: z9.enum(["COMPLETED", "FAILED", "PROCESSING"]), created_at: z9.string(), updated_at: z9.string(), ingestion_details: z9.record(z9.string(), z9.unknown()), product_counts: z9.record(z9.string(), z9.unknown()), validation_details: z9.record(z9.string(), z9.unknown()) });
@@ -1579,8 +1588,8 @@ function pinterestCatalogTools(provider) {
1579
1588
  defineTool6({ name: "pinterest_feed_processing_results", namespace: "pinterest", description: "Read feed processing status, native product counts and diagnostics with bookmarks. Verifies feed ownership; ingestion acceptance is not product readiness.", input: z9.object({ ...account2, ...reference2, ...paging }).strict(), output, presentation: "records", pagination: { cursorInput: "bookmark" }, annotations: { readOnly: true }, handler: (input) => provider.catalogs.results(input) }),
1580
1589
  defineTool6({ name: "pinterest_feed_item_issues", namespace: "pinterest", description: "Read sampled item errors/warnings after verifying processing-result membership in this feed. Up to20 affected items per code; not a complete product inventory.", input: z9.object({ ...account2, ...reference2, processing_result_id: id3, ...paging, item_numbers: z9.array(z9.number().int().nonnegative().safe()).min(1).max(1e3).optional(), item_validation_issue: z9.string().regex(/^[A-Z][A-Z0-9_]{0,127}$/).optional() }).strict().refine((value) => !value.item_numbers || !value.item_validation_issue, "Native item-number and validation-issue filters cannot be combined"), output, presentation: "records", pagination: { cursorInput: "bookmark" }, annotations: { readOnly: true }, handler: (input) => provider.catalogs.issues(input) }),
1581
1590
  guardedWriteTool6({ name: "pinterest_create_catalog", namespace: "pinterest", provider: "pinterest", kind: "create", destructive: false, payload: createCatalog, description: "Create an empty RETAIL, HOTEL or CREATIVE_ASSETS catalog with context_hash from pinterest_catalogs. No feed/products/ads; catalog programs and catalogs:write required." }),
1582
- guardedWriteTool6({ name: "pinterest_create_feed", namespace: "pinterest", provider: "pinterest", kind: "create", payload: createFeed, sensitiveInputs: ["feed.location", "feed.credentials"], description: "Create a feed in an explicitly selected owned catalog. Defaults INACTIVE; supports native formats, schedules and optional private-source credentials. Confirm source access; ACTIVE also requires publication confirmation. Source/auth values are omitted from previews/audits; the agent applies with identical arguments instead of passing secrets to a widget. Requires catalogs read/write." }),
1583
- guardedWriteTool6({ name: "pinterest_update_feed", namespace: "pinterest", provider: "pinterest", kind: "update", payload: updateFeed, sensitiveInputs: ["changes.location", "changes.credentials"], description: "Patch supplied feed settings with a current snapshot_hash, preserving omitted settings. New source/authentication or ACTIVE requires source-access confirmation; active feeds require publication confirmation. Null credentials removes authentication; source/auth changes are applied by the agent without echoing private arguments to a widget." }),
1591
+ guardedWriteTool6({ name: "pinterest_create_feed", namespace: "pinterest", provider: "pinterest", kind: "create", payload: createFeed, hosted: { payload: hostedCreateFeed, description: "Create a feed with a public HTTPS source in the selected Pinterest catalog. Defaults to INACTIVE. Confirm access to the source. ACTIVE also requires confirmation that processing can publish product Pins." }, sensitiveInputs: ["feed.location", "feed.credentials"], description: "Create a feed in an explicitly selected owned catalog. Defaults INACTIVE; supports native formats, schedules and optional private-source credentials. Confirm source access; ACTIVE also requires publication confirmation. Source/auth values are omitted from previews/audits; the agent applies with identical arguments instead of passing secrets to a widget. Requires catalogs read/write." }),
1592
+ guardedWriteTool6({ name: "pinterest_update_feed", namespace: "pinterest", provider: "pinterest", kind: "update", payload: updateFeed, hosted: { payload: hostedUpdateFeed, description: "Update selected settings on an owned Pinterest catalog feed. A replacement source must be a public HTTPS URL. Source changes require access confirmation. Active feeds require confirmation that processing can publish product Pins." }, sensitiveInputs: ["changes.location", "changes.credentials"], description: "Patch supplied feed settings with a current snapshot_hash, preserving omitted settings. New source/authentication or ACTIVE requires source-access confirmation; active feeds require publication confirmation. Null credentials removes authentication; source/auth changes are applied by the agent without echoing private arguments to a widget." }),
1584
1593
  guardedWriteTool6({ name: "pinterest_delete_feed", namespace: "pinterest", provider: "pinterest", kind: "remove", payload: deleteFeed, description: "Permanently delete an owned feed with exact snapshot and explicit deletion confirmation. No restore endpoint is exposed; review product/ad dependencies. Native deletion is reconciled before reporting success." }),
1585
1594
  guardedWriteTool6({ name: "pinterest_ingest_feed", namespace: "pinterest", provider: "pinterest", kind: "update", payload: ingestFeed, description: "Request processing for an owned feed with current snapshot and explicit source/publication confirmations. This can create/update product Pins. Partner-only endpoint; returns native job status, never retries and never activates campaigns." })
1586
1595
  ];
@@ -3117,7 +3126,7 @@ function pinterestCatalogItemTools(provider) {
3117
3126
  defineTool9({ ...read, name: "pinterest_reconcile_catalog_item_batch", description: "Independently re-read receipt-bound item IDs after native processing, verify requested fields and UPDATE preservation. Unknown/error item reads never certify deletion. Keeps native status, configuration checks and Pin/ad readiness separate; no replay.", input: batchReference, handler: (input) => provider.catalogItems.status(input, true) }),
3118
3127
  ...named,
3119
3128
  guardedWriteTool9({ ...write2, name: "pinterest_apply_catalog_items_batch", kind: "update", destructive: true, sensitiveInputs: ["operations"], payload: itemBatchApply, description: "Submit one explicit mixed CREATE/UPDATE/UPSERT/DELETE batch with fresh context_hash and effect confirmations. Native IDs/catalog/market stay fixed; private media is minted only at apply. Async partial results retain per-item states and signed receipt; no automatic retry. Batch arguments stay private; the agent applies identical arguments." }),
3120
- guardedWriteTool9({ ...write2, name: "pinterest_update_catalog_item_copy", kind: "update", destructive: false, payload: itemCopy, description: "Edit catalog item title/name or description from a current item snapshot_hash, preserving other fields. Native batch receipt and Processing pending remain separate from independent readback or publication. Uses the normal exact preview/apply gate." })
3129
+ guardedWriteTool9({ ...write2, name: "pinterest_update_catalog_item_copy", kind: "update", destructive: true, payload: itemCopy, description: "Edit catalog item title/name or description from a current item snapshot_hash, preserving other fields. Native batch receipt and Processing pending remain separate from independent readback or publication. Uses the normal exact preview/apply gate." })
3121
3130
  ];
3122
3131
  }
3123
3132