@crvouga/mockingbird-service-customerio 3.14.0 → 3.16.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.
@@ -4212,7 +4212,7 @@ var stateAdminRoutes = (routes) => {
4212
4212
  };
4213
4213
 
4214
4214
  // ../core/dist/version.js
4215
- var PACKAGE_VERSION = true ? "3.14.0" : UNRELEASED_VERSION;
4215
+ var PACKAGE_VERSION = true ? "3.16.0" : UNRELEASED_VERSION;
4216
4216
 
4217
4217
  // ../core/dist/webhooks.js
4218
4218
  var signers = {
@@ -4255,7 +4255,7 @@ var matchesEndpoint = (endpoint, message) => {
4255
4255
  return true;
4256
4256
  };
4257
4257
  var createWebhookHub = (options) => {
4258
- const delays = options.retryDelaysMs ?? DEFAULT_DELAYS;
4258
+ const delays = options.retryDelaysMs === void 0 ? DEFAULT_DELAYS : options.retryDelaysMs.length > 0 ? options.retryDelaysMs : [0];
4259
4259
  const timeoutMs = options.timeoutMs ?? 15e3;
4260
4260
  const delivered = options.delivered ?? ((status) => status >= 200 && status < 300);
4261
4261
  const send = options.fetch ?? ((request) => fetch(request));
@@ -5911,9 +5911,9 @@ var credentialRoutes = (registry) => ({
5911
5911
  });
5912
5912
 
5913
5913
  // src/generated/openapi.ts
5914
- var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Customer.io CDP + App API (Mockingbird subset)","description":"Stateful emulator subset of Customer.io: the Segment-compatible CDP ingestion endpoints\\n(\`identify\`, \`track\`, \`batch\`, as \`@customerio/cdp-analytics-node\` posts them), the App API\\ntransactional sends (email, SMS, push, inbox message), transactional-message catalog, profile\\nattribute reads (with the device list the CDP device events build), delivery-status reads, and the link-tracking click endpoint. One process\\nserves all three hosts (\`cdp.customer.io\`, \`api.customer.io\`, the tracking domain); their\\npaths do not collide.\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from Customer.io's CDP (Segment spec) and App API reference, trimmed to what our consumer sends: customer-io.client.service.ts / notification-adapter.ts / transactional-email-adapter.ts (backend), transactional-client.ts (notification-processor), customerio-trigger-name-validator.ts (notification-service) and mobile-links-click-reporter.service.ts."}},"servers":[{"url":"https://api.customer.io"},{"url":"https://cdp.customer.io"}],"paths":{"/v1/identify":{"post":{"operationId":"CdpIdentify","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentifyEvent"}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/track":{"post":{"operationId":"CdpTrack","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackEvent"}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/batch":{"post":{"operationId":"CdpBatch","description":"What \`@customerio/cdp-analytics-node\` posts: \`{batch: [...]}\`.","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["batch"],"properties":{"batch":{"type":"array","maxItems":5,"items":{"anyOf":[{"$ref":"#/components/schemas/IdentifyEvent"},{"$ref":"#/components/schemas/TrackEvent"}]}},"sentAt":{"type":"string"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed batch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/send/email":{"post":{"operationId":"SendEmail","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/sms":{"post":{"operationId":"SendSms","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSmsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/push":{"post":{"operationId":"SendPush","description":"Transactional push (https://docs.customer.io/messaging/send/transactional/push/,\\nApp API \`sendPush\`). \`to\` is \`all\` (default), \`last_used\`, or one device token from the\\nperson's device list. Behaviour for a token not on the profile, a person with no\\nprofile, and non-string \`custom_data\` values is a best guess (see README).\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendPushRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/inbox_message":{"post":{"operationId":"SendInboxMessage","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendInboxRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/transactional":{"get":{"operationId":"ListTransactionalMessages","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every transactional message in the workspace (no pagination)","content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/TransactionalMessage"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/transactional/{transactional_id}":{"parameters":[{"name":"transactional_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transactional_message","missing":"999999"}}}],"get":{"operationId":"GetTransactionalMessage","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"One transactional message","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"$ref":"#/components/schemas/TransactionalMessage"}}}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/customers/{customer_id}/attributes":{"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":150}},{"name":"id_type","in":"query","required":false,"schema":{"type":"string","enum":["id","email","cio_id"]}}],"get":{"operationId":"GetCustomerAttributes","description":"App API profile read. \`id_type\` selects which identifier \`customer_id\` is\\n(\`id\` by default, or \`email\`, or \`cio_id\`).\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The customer's identifiers and attributes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerAttributes"}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/optouts":{"get":{"operationId":"ListOptOuts","description":"Sender-specific SMS and WhatsApp opt-outs, paginated by an opaque start cursor.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}},{"name":"start","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of opted-out customers","content":{"application/json":{"schema":{"type":"object","required":["optouts"],"properties":{"next":{"type":"string"},"optouts":{"type":"array","items":{"type":"object","required":["customer_id","cio_id","optouts"],"properties":{"customer_id":{"type":"string"},"cio_id":{"type":"string"},"optouts":{"type":"array","items":{"$ref":"#/components/schemas/SenderOptOut"}}}}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/customers/{customer_id}/optouts":{"get":{"operationId":"GetCustomerOptOuts","description":"Sender opt-outs for an existing person; marketing preferences are separate.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"id_type","in":"query","schema":{"type":"string","enum":["id","email","cio_id"],"default":"id"}}],"responses":{"200":{"description":"The customer's sender opt-outs","content":{"application/json":{"schema":{"type":"object","required":["optouts"],"properties":{"optouts":{"type":"array","items":{"$ref":"#/components/schemas/SenderOptOut"}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/messages/{message_id}":{"parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":80,"x-mockingbird-resource-ref":{"type":"delivery","missing":"missingdelivery00000000000000"}}}],"get":{"operationId":"GetMessage","description":"Delivery status for one transactional send. Missing ids, and ids still inside the\\nemulator's visibility delay, are 404. The body never includes \`message_data\`.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Delivery status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryMessage"}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/click/{linkId}":{"parameters":[{"name":"linkId","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_~-][A-Za-z0-9._~-]{0,63}$"}}],"post":{"operationId":"ReportClick","description":"Link-tracking click report on the tracking domain (our backend posts it when a smart\\nlink opens the app directly). Unauthenticated.\\n","security":[],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"200":{"description":"Click recorded (no body)"},"404":{"description":"Unknown link","content":{"text/plain":{"schema":{"type":"string"}}}}}},"get":{"operationId":"FollowClick","description":"A browser following a tracked link; redirects to the original URL.","security":[],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"302":{"description":"Redirect to the original URL"},"404":{"description":"Unknown link","content":{"text/plain":{"schema":{"type":"string"}}}}}}}},"components":{"securitySchemes":{"cdpWriteKey":{"type":"http","scheme":"basic","description":"\`Basic base64(<write key>:)\` (the CDP source write key as the username)."},"appApiKey":{"type":"http","scheme":"bearer","description":"\`Bearer <App API key>\`."}},"responses":{"Queued":{"description":"Queued for delivery","content":{"application/json":{"schema":{"type":"object","required":["delivery_id","queued_at"],"properties":{"delivery_id":{"type":"string","x-mockingbird-resource":{"type":"delivery","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"queued_at":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}}}}}}},"AppError":{"description":"An App API error","content":{"application/json":{"schema":{"type":"object","required":["meta"],"properties":{"meta":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"schemas":{"SenderOptOut":{"type":"object","required":["channel","from"],"properties":{"channel":{"type":"string","enum":["sms","whatsapp"]},"from":{"type":"string"}}},"CdpSuccess":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"CdpError":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"IdentifyEvent":{"type":"object","properties":{"type":{"type":"string","enum":["identify"]},"userId":{"type":"string","minLength":1,"maxLength":64},"anonymousId":{"type":"string","minLength":1,"maxLength":64},"traits":{"type":"object","additionalProperties":true},"context":{"type":"object"},"integrations":{"type":"object"},"timestamp":{"type":"string"},"messageId":{"type":"string","maxLength":128},"_metadata":{"type":"object"}}},"TrackEvent":{"type":"object","required":["event"],"properties":{"type":{"type":"string","enum":["track"]},"userId":{"type":"string","minLength":1,"maxLength":64},"anonymousId":{"type":"string","minLength":1,"maxLength":64},"event":{"type":"string","minLength":1,"maxLength":150},"properties":{"type":"object","additionalProperties":true},"context":{"type":"object"},"integrations":{"type":"object"},"timestamp":{"type":"string"},"messageId":{"type":"string","maxLength":128},"_metadata":{"type":"object"}}},"Identifiers":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string","format":"email","maxLength":120},"cio_id":{"type":"string","maxLength":64}}},"TransactionalMessageId":{"oneOf":[{"type":"string","minLength":1,"maxLength":150},{"type":"integer","minimum":1}]},"SendEmailRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","maxLength":200},"from":{"type":"string","maxLength":200},"subject":{"type":"string","maxLength":300},"body":{"type":"string"},"message_data":{"type":"object","additionalProperties":true},"send_to_unsubscribed":{"type":"boolean"},"tracked":{"type":"boolean"},"disable_message_retention":{"type":"boolean"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"attachments":{"description":"Customer.io documents a \`{filename: base64}\` map; our backend sends an array of \`{filename, content, content_type}\`. Both are accepted.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"array","items":{"type":"object","required":["filename","content"],"properties":{"filename":{"type":"string"},"content":{"type":"string"},"content_type":{"type":"string"}}}}]}}},"SendSmsRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","maxLength":20},"message_data":{"type":"object","additionalProperties":true},"send_to_unsubscribed":{"type":"boolean"},"tracked":{"type":"boolean"},"disable_message_retention":{"type":"boolean"}}},"SendPushRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","minLength":1,"maxLength":4096},"platform":{"type":"string","enum":["all","ios","android","web","all_and_web"]},"title":{"type":"string"},"message":{"type":"string"},"image_url":{"type":"string"},"link":{"type":"string"},"sound":{"type":"string","enum":["default","none"]},"language":{"type":"string"},"message_data":{"type":"object","additionalProperties":true},"custom_data":{"description":"Firebase only supports string values (vendor docs); the emulator answers 400 for any other value type (best guess).","type":"object","additionalProperties":true},"custom_payload":{"type":"object","additionalProperties":true,"properties":{"ios":{"type":"object","additionalProperties":true},"android":{"type":"object","additionalProperties":true}}},"custom_device":{"type":"object","required":["token"],"properties":{"token":{"type":"string","minLength":1,"maxLength":4096},"platform":{"type":"string"},"last_used":{"type":"integer"},"attributes":{"type":"object","additionalProperties":true}}},"send_to_unsubscribed":{"type":"boolean"},"disable_message_retention":{"type":"boolean"},"queue_draft":{"type":"boolean"}}},"SendInboxRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"message_data":{"type":"object","additionalProperties":true}}},"TransactionalMessage":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"trigger_name":{"type":"string","x-mockingbird-resource":{"type":"transactional_message","identity":true}},"description":{"type":"string"},"send_to_unsubscribed":{"type":"boolean"},"link_tracking":{"type":"boolean"},"open_tracking":{"type":"boolean"},"hide_message_body":{"type":"boolean"},"queue_drafts":{"type":"boolean"},"created_at":{"type":"integer"},"updated_at":{"type":"integer"}}},"CustomerAttributes":{"type":"object","required":["customer"],"properties":{"customer":{"type":"object","required":["identifiers","attributes"],"properties":{"identifiers":{"type":"object","required":["id"],"additionalProperties":true,"properties":{"id":{"type":"string"},"email":{"type":"string"},"cio_id":{"type":"string"}}},"attributes":{"type":"object","additionalProperties":true},"devices":{"type":"array","items":{"type":"object","required":["id","platform","last_used"],"additionalProperties":true,"properties":{"id":{"type":"string","description":"The device token."},"platform":{"type":"string"},"last_used":{"type":"integer"},"attributes":{"type":"object","additionalProperties":true}}}}}}}},"DeliveryMessage":{"type":"object","required":["message"],"properties":{"message":{"type":"object","required":["id","state","status","metrics","created"],"additionalProperties":true,"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"delivery","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"type":{"type":"string"},"recipient":{"type":["string","null"]},"customer_id":{"type":["string","null"]},"created":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}},"state":{"type":"string"},"status":{"type":"string"},"metrics":{"type":"object","additionalProperties":{"type":"integer"}},"failure_message":{"type":["string","null"]},"rejection_reason":{"type":["string","null"]},"error":{"type":["string","null"]}}}}}}}}`);
5915
- var operationIds = ["CdpIdentify", "CdpTrack", "CdpBatch", "SendEmail", "SendSms", "SendPush", "SendInboxMessage", "ListTransactionalMessages", "GetTransactionalMessage", "GetCustomerAttributes", "ListOptOuts", "GetCustomerOptOuts", "GetMessage", "FollowClick", "ReportClick"];
5916
- var supportedOperationIds = ["CdpIdentify", "CdpTrack", "CdpBatch", "SendEmail", "SendSms", "SendPush", "SendInboxMessage", "ListTransactionalMessages", "GetTransactionalMessage", "GetCustomerAttributes", "ListOptOuts", "GetCustomerOptOuts", "GetMessage", "FollowClick", "ReportClick"];
5914
+ var document = JSON.parse(`{"openapi":"3.1.0","info":{"title":"Customer.io CDP + App API (Mockingbird subset)","description":"Stateful emulator subset of Customer.io: the Segment-compatible CDP ingestion endpoints\\n(\`identify\`, \`track\`, \`batch\`, as \`@customerio/cdp-analytics-node\` posts them), the App API\\ntransactional sends (email, SMS, push, inbox message), transactional-message catalog, profile\\nattribute reads (with the device list the CDP device events build), delivery-status reads, and the link-tracking click endpoint. One process\\nserves all three hosts (\`cdp.customer.io\`, \`api.customer.io\`, the tracking domain); their\\npaths do not collide.\\n","version":"1","x-mockingbird-upstream":{"note":"Hand-authored from Customer.io's CDP (Segment spec) and App API reference, trimmed to what our consumer sends: customer-io.client.service.ts / notification-adapter.ts / transactional-email-adapter.ts (backend), transactional-client.ts (notification-processor), customerio-trigger-name-validator.ts (notification-service) and mobile-links-click-reporter.service.ts."}},"servers":[{"url":"https://api.customer.io"},{"url":"https://cdp.customer.io"}],"paths":{"/v1/identify":{"post":{"operationId":"CdpIdentify","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentifyEvent"}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/track":{"post":{"operationId":"CdpTrack","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackEvent"}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed event","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/batch":{"post":{"operationId":"CdpBatch","description":"What \`@customerio/cdp-analytics-node\` posts: \`{batch: [...]}\`.","security":[{"cdpWriteKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["batch"],"properties":{"batch":{"type":"array","maxItems":5,"items":{"anyOf":[{"$ref":"#/components/schemas/IdentifyEvent"},{"$ref":"#/components/schemas/TrackEvent"}]}},"sentAt":{"type":"string"},"context":{"type":"object"}}}}}},"responses":{"200":{"description":"Accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpSuccess"}}}},"400":{"description":"Malformed batch","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}},"401":{"description":"Missing or unknown write key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CdpError"}}}}}}},"/v1/send/email":{"post":{"operationId":"SendEmail","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendEmailRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/sms":{"post":{"operationId":"SendSms","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendSmsRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/push":{"post":{"operationId":"SendPush","description":"Transactional push (https://docs.customer.io/messaging/send/transactional/push/,\\nApp API \`sendPush\`). \`to\` is \`all\` (default), \`last_used\`, or one device token from the\\nperson's device list. Behaviour for a token not on the profile, a person with no\\nprofile, and non-string \`custom_data\` values is a best guess (see README).\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendPushRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/send/inbox_message":{"post":{"operationId":"SendInboxMessage","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendInboxRequest"}}}},"responses":{"200":{"$ref":"#/components/responses/Queued"},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/transactional":{"get":{"operationId":"ListTransactionalMessages","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every transactional message in the workspace (no pagination)","content":{"application/json":{"schema":{"type":"object","required":["messages"],"properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/TransactionalMessage"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/transactional/{transactional_id}":{"parameters":[{"name":"transactional_id","in":"path","required":true,"schema":{"type":"string","x-mockingbird-resource-ref":{"type":"transactional_message","missing":"999999"}}}],"get":{"operationId":"GetTransactionalMessage","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"One transactional message","content":{"application/json":{"schema":{"type":"object","required":["message"],"properties":{"message":{"$ref":"#/components/schemas/TransactionalMessage"}}}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/customers/{customer_id}/attributes":{"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":150}},{"name":"id_type","in":"query","required":false,"schema":{"type":"string","enum":["id","email","cio_id"]}}],"get":{"operationId":"GetCustomerAttributes","description":"App API profile read. \`id_type\` selects which identifier \`customer_id\` is\\n(\`id\` by default, or \`email\`, or \`cio_id\`).\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The customer's identifiers and attributes","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerAttributes"}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/optouts":{"get":{"operationId":"ListOptOuts","description":"Sender-specific SMS and WhatsApp opt-outs, paginated by an opaque start cursor.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":1000,"default":100}},{"name":"start","in":"query","schema":{"type":"string"}},{"name":"from","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"A page of opted-out customers","content":{"application/json":{"schema":{"type":"object","required":["optouts"],"properties":{"next":{"type":"string"},"optouts":{"type":"array","items":{"type":"object","required":["customer_id","cio_id","optouts"],"properties":{"customer_id":{"type":"string"},"cio_id":{"type":"string"},"optouts":{"type":"array","items":{"$ref":"#/components/schemas/SenderOptOut"}}}}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/customers/{customer_id}/optouts":{"get":{"operationId":"GetCustomerOptOuts","description":"Sender opt-outs for an existing person; marketing preferences are separate.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","minLength":1}},{"name":"id_type","in":"query","schema":{"type":"string","enum":["id","email","cio_id"],"default":"id"}}],"responses":{"200":{"description":"The customer's sender opt-outs","content":{"application/json":{"schema":{"type":"object","required":["optouts"],"properties":{"optouts":{"type":"array","items":{"$ref":"#/components/schemas/SenderOptOut"}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/messages/{message_id}":{"parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":80,"x-mockingbird-resource-ref":{"type":"delivery","missing":"missingdelivery00000000000000"}}}],"get":{"operationId":"GetMessage","description":"Delivery status for one transactional send. Missing ids, and ids still inside the\\nemulator's visibility delay, are 404. The body never includes \`message_data\`.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Delivery status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeliveryMessage"}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/reporting_webhooks":{"get":{"operationId":"ListReportingWebhooks","description":"The workspace's reporting webhooks (App API \`listWebhooks\`). Seeded through\\n\`PUT /__admin/content\`; empty by default. Best guess from vendor docs, not oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every reporting webhook","content":{"application/json":{"schema":{"type":"object","required":["reporting_webhooks"],"properties":{"reporting_webhooks":{"type":"array","items":{"$ref":"#/components/schemas/ReportingWebhook"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/subscription_topics":{"get":{"operationId":"ListSubscriptionTopics","description":"The workspace's subscription-center topics (App API \`getTopics\`); an empty array when\\nthere are none. Best guess from vendor docs, not oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every subscription topic","content":{"application/json":{"schema":{"type":"object","required":["topics"],"properties":{"topics":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionTopic"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/exports/customers":{"post":{"operationId":"ExportCustomers","description":"Export the people matching \`filters\` (App API \`exportPeopleData\`). The emulator evaluates\\n\`and\` / \`or\` / \`not\` / \`attribute\` (\`eq\`, \`exists\`, \`inverse\`) filters against its\\nprofiles and finishes the export at once (\`status: done\`). \`segment\` filters answer 400\\n(no segments are modelled). Best guess from vendor docs, not oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":false}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["filters"],"properties":{"filters":{"description":"One filter node: \`{and: [...]}\`, \`{or: [...]}\`, \`{not: {...}}\`, \`{segment: {id}}\` or \`{attribute: {field, operator: eq|exists, value?, inverse?}}\`.","type":"object","additionalProperties":true},"attributes":{"description":"Attribute names added as CSV columns after \`id\`, \`cio_id\` and \`email\`.","type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"The export","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportEnvelope"}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/exports/{export_id}":{"parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"get":{"operationId":"GetExport","description":"One export (App API \`getExport\`). Best guess from vendor docs, not oracle-verified.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The export","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportEnvelope"}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/exports/{export_id}/download":{"parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"integer","minimum":1}}],"get":{"operationId":"DownloadExport","description":"A link to the export file (App API \`downloadExport\`; the vendor signs a link that expires\\nafter 15 minutes). The emulator's link is its own CSV route under the admin prefix and\\ncounts a download. Best guess from vendor docs, not oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"The download link","content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri","x-mockingbird-volatile":{"kind":"url"}}}}}}},"401":{"$ref":"#/components/responses/AppError"},"404":{"$ref":"#/components/responses/AppError"}}}},"/v1/snippets":{"get":{"operationId":"ListSnippets","description":"The workspace's snippets (App API \`listSnippets\`). Best guess from vendor docs, not oracle-verified.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every snippet","content":{"application/json":{"schema":{"type":"object","required":["snippets"],"properties":{"snippets":{"type":"array","items":{"$ref":"#/components/schemas/Snippet"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/campaigns":{"get":{"operationId":"ListCampaigns","description":"The workspace's automations (App API \`listCampaigns\`), read-only. Best guess from vendor docs, not oracle-verified.","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"responses":{"200":{"description":"Every automation","content":{"application/json":{"schema":{"type":"object","required":["campaigns"],"properties":{"campaigns":{"type":"array","items":{"$ref":"#/components/schemas/Campaign"}}}}}}},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/newsletters":{"get":{"operationId":"ListNewsletters","description":"The workspace's one-time sends (App API \`listNewsletters\`), paginated by \`limit\` and an\\nopaque \`start\` cursor (\`next\`), \`sort\` asc (default) or desc. Best guess from vendor docs,\\nnot oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/PageLimit"},{"$ref":"#/components/parameters/PageSort"},{"$ref":"#/components/parameters/PageStart"}],"responses":{"200":{"description":"A page of one-time sends","content":{"application/json":{"schema":{"type":"object","required":["newsletters"],"properties":{"next":{"type":"string"},"newsletters":{"type":"array","items":{"$ref":"#/components/schemas/Newsletter"}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"}}}},"/v1/sender_identities":{"get":{"operationId":"ListSenderIdentities","description":"The workspace's senders (App API \`listSenders\`), paginated like newsletters. Hidden senders\\nare listed only with \`hidden=true\`. Best guess from vendor docs, not oracle-verified.\\n","security":[{"appApiKey":[]}],"x-mockingbird":{"supported":true,"reason":"Best guess from vendor docs, not oracle-verified.","parity":{"enabled":true,"safe":true}},"parameters":[{"$ref":"#/components/parameters/PageLimit"},{"$ref":"#/components/parameters/PageSort"},{"$ref":"#/components/parameters/PageStart"},{"name":"hidden","in":"query","schema":{"type":"boolean"}}],"responses":{"200":{"description":"A page of senders","content":{"application/json":{"schema":{"type":"object","required":["sender_identities"],"properties":{"next":{"type":"string"},"sender_identities":{"type":"array","items":{"$ref":"#/components/schemas/SenderIdentity"}}}}}}},"400":{"$ref":"#/components/responses/AppError"},"401":{"$ref":"#/components/responses/AppError"}}}},"/click/{linkId}":{"parameters":[{"name":"linkId","in":"path","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_~-][A-Za-z0-9._~-]{0,63}$"}}],"post":{"operationId":"ReportClick","description":"Link-tracking click report on the tracking domain (our backend posts it when a smart\\nlink opens the app directly). Unauthenticated.\\n","security":[],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"200":{"description":"Click recorded (no body)"},"404":{"description":"Unknown link","content":{"text/plain":{"schema":{"type":"string"}}}}}},"get":{"operationId":"FollowClick","description":"A browser following a tracked link; redirects to the original URL.","security":[],"x-mockingbird":{"supported":true,"parity":{"enabled":true,"safe":false}},"responses":{"302":{"description":"Redirect to the original URL"},"404":{"description":"Unknown link","content":{"text/plain":{"schema":{"type":"string"}}}}}}}},"components":{"securitySchemes":{"cdpWriteKey":{"type":"http","scheme":"basic","description":"\`Basic base64(<write key>:)\` (the CDP source write key as the username)."},"appApiKey":{"type":"http","scheme":"bearer","description":"\`Bearer <App API key>\`."}},"parameters":{"PageLimit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1}},"PageSort":{"name":"sort","in":"query","schema":{"type":"string","enum":["asc","desc"]}},"PageStart":{"name":"start","in":"query","schema":{"type":"string"}}},"responses":{"Queued":{"description":"Queued for delivery","content":{"application/json":{"schema":{"type":"object","required":["delivery_id","queued_at"],"properties":{"delivery_id":{"type":"string","x-mockingbird-resource":{"type":"delivery","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"queued_at":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}}}}}}},"AppError":{"description":"An App API error","content":{"application/json":{"schema":{"type":"object","required":["meta"],"properties":{"meta":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}}}}}}}},"schemas":{"ReportingWebhook":{"type":"object","required":["name","endpoint","events"],"additionalProperties":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"},"endpoint":{"type":"string"},"events":{"type":"array","items":{"type":"string"}},"type":{"type":"string","enum":["webhook","js"]},"disabled":{"type":"boolean"},"full_resolution":{"type":"boolean"},"with_content":{"type":"boolean"}}},"SubscriptionTopic":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"integer"},"identifier":{"type":"string"},"name":{"type":"string"},"description":{"type":"string"},"subscribed_by_default":{"type":"boolean"}}},"Snippet":{"type":"object","required":["name","value"],"additionalProperties":true,"properties":{"name":{"type":"string"},"value":{"type":"string"},"updated_at":{"type":"integer"}}},"Campaign":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string"},"state":{"type":"string"},"active":{"type":"boolean"},"created":{"type":"integer"},"updated":{"type":"integer"},"tags":{"type":"array","items":{"type":"string"}}}},"Newsletter":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"},"type":{"type":"string"},"send_state":{"type":"string"},"created":{"type":"integer"},"updated":{"type":"integer"},"tags":{"type":"array","items":{"type":"string"}}}},"SenderIdentity":{"type":"object","additionalProperties":true,"properties":{"id":{"type":"integer"},"name":{"type":"string"},"email":{"type":"string"},"address":{"type":"string"},"phone":{"type":"string"},"template_type":{"type":"string"},"hidden":{"type":"boolean"},"auto_generated":{"type":"boolean"},"deduplicate_id":{"type":"string"}}},"ExportEnvelope":{"type":"object","required":["export"],"properties":{"export":{"type":"object","required":["id","type","status","failed","total","downloads","created_at","updated_at","deduplicate_id"],"properties":{"id":{"type":"integer"},"type":{"type":"string","enum":["customers","deliveries"]},"status":{"type":"string","enum":["done","pending","failed"]},"failed":{"type":"boolean"},"total":{"type":"integer"},"downloads":{"type":"integer"},"created_at":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}},"updated_at":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}},"deduplicate_id":{"type":"string","x-mockingbird-volatile":{"kind":"id"}}}}}},"SenderOptOut":{"type":"object","required":["channel","from"],"properties":{"channel":{"type":"string","enum":["sms","whatsapp"]},"from":{"type":"string"}}},"CdpSuccess":{"type":"object","required":["success"],"properties":{"success":{"type":"boolean"}}},"CdpError":{"type":"object","required":["error"],"properties":{"error":{"type":"string"}}},"IdentifyEvent":{"type":"object","properties":{"type":{"type":"string","enum":["identify"]},"userId":{"type":"string","minLength":1,"maxLength":64},"anonymousId":{"type":"string","minLength":1,"maxLength":64},"traits":{"type":"object","additionalProperties":true},"context":{"type":"object"},"integrations":{"type":"object"},"timestamp":{"type":"string"},"messageId":{"type":"string","maxLength":128},"_metadata":{"type":"object"}}},"TrackEvent":{"type":"object","required":["event"],"properties":{"type":{"type":"string","enum":["track"]},"userId":{"type":"string","minLength":1,"maxLength":64},"anonymousId":{"type":"string","minLength":1,"maxLength":64},"event":{"type":"string","minLength":1,"maxLength":150},"properties":{"type":"object","additionalProperties":true},"context":{"type":"object"},"integrations":{"type":"object"},"timestamp":{"type":"string"},"messageId":{"type":"string","maxLength":128},"_metadata":{"type":"object"}}},"Identifiers":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":64},"email":{"type":"string","format":"email","maxLength":120},"cio_id":{"type":"string","maxLength":64}}},"TransactionalMessageId":{"oneOf":[{"type":"string","minLength":1,"maxLength":150},{"type":"integer","minimum":1}]},"SendEmailRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","maxLength":200},"from":{"type":"string","maxLength":200},"subject":{"type":"string","maxLength":300},"body":{"type":"string"},"message_data":{"type":"object","additionalProperties":true},"send_to_unsubscribed":{"type":"boolean"},"tracked":{"type":"boolean"},"disable_message_retention":{"type":"boolean"},"headers":{"type":"object","additionalProperties":{"type":"string"}},"attachments":{"description":"Customer.io documents a \`{filename: base64}\` map; our backend sends an array of \`{filename, content, content_type}\`. Both are accepted.","oneOf":[{"type":"object","additionalProperties":{"type":"string"}},{"type":"array","items":{"type":"object","required":["filename","content"],"properties":{"filename":{"type":"string"},"content":{"type":"string"},"content_type":{"type":"string"}}}}]}}},"SendSmsRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","maxLength":20},"message_data":{"type":"object","additionalProperties":true},"send_to_unsubscribed":{"type":"boolean"},"tracked":{"type":"boolean"},"disable_message_retention":{"type":"boolean"}}},"SendPushRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"to":{"type":"string","minLength":1,"maxLength":4096},"platform":{"type":"string","enum":["all","ios","android","web","all_and_web"]},"title":{"type":"string"},"message":{"type":"string"},"image_url":{"type":"string"},"link":{"type":"string"},"sound":{"type":"string","enum":["default","none"]},"language":{"type":"string"},"message_data":{"type":"object","additionalProperties":true},"custom_data":{"description":"Firebase only supports string values (vendor docs); the emulator answers 400 for any other value type (best guess).","type":"object","additionalProperties":true},"custom_payload":{"type":"object","additionalProperties":true,"properties":{"ios":{"type":"object","additionalProperties":true},"android":{"type":"object","additionalProperties":true}}},"custom_device":{"type":"object","required":["token"],"properties":{"token":{"type":"string","minLength":1,"maxLength":4096},"platform":{"type":"string"},"last_used":{"type":"integer"},"attributes":{"type":"object","additionalProperties":true}}},"send_to_unsubscribed":{"type":"boolean"},"disable_message_retention":{"type":"boolean"},"queue_draft":{"type":"boolean"}}},"SendInboxRequest":{"type":"object","required":["transactional_message_id","identifiers"],"properties":{"transactional_message_id":{"$ref":"#/components/schemas/TransactionalMessageId"},"identifiers":{"$ref":"#/components/schemas/Identifiers"},"message_data":{"type":"object","additionalProperties":true}}},"TransactionalMessage":{"type":"object","required":["id","name"],"properties":{"id":{"type":"integer"},"name":{"type":"string"},"trigger_name":{"type":"string","x-mockingbird-resource":{"type":"transactional_message","identity":true}},"description":{"type":"string"},"send_to_unsubscribed":{"type":"boolean"},"link_tracking":{"type":"boolean"},"open_tracking":{"type":"boolean"},"hide_message_body":{"type":"boolean"},"queue_drafts":{"type":"boolean"},"created_at":{"type":"integer"},"updated_at":{"type":"integer"}}},"CustomerAttributes":{"type":"object","required":["customer"],"properties":{"customer":{"type":"object","required":["identifiers","attributes"],"properties":{"identifiers":{"type":"object","required":["id"],"additionalProperties":true,"properties":{"id":{"type":"string"},"email":{"type":"string"},"cio_id":{"type":"string"}}},"attributes":{"type":"object","additionalProperties":true},"devices":{"type":"array","items":{"type":"object","required":["id","platform","last_used"],"additionalProperties":true,"properties":{"id":{"type":"string","description":"The device token."},"platform":{"type":"string"},"last_used":{"type":"integer"},"attributes":{"type":"object","additionalProperties":true}}}}}}}},"DeliveryMessage":{"type":"object","required":["message"],"properties":{"message":{"type":"object","required":["id","state","status","metrics","created"],"additionalProperties":true,"properties":{"id":{"type":"string","x-mockingbird-resource":{"type":"delivery","identity":true},"x-mockingbird-volatile":{"kind":"id"}},"type":{"type":"string"},"recipient":{"type":["string","null"]},"customer_id":{"type":["string","null"]},"created":{"type":"integer","x-mockingbird-volatile":{"kind":"timestamp"}},"state":{"type":"string"},"status":{"type":"string"},"metrics":{"type":"object","additionalProperties":{"type":"integer"}},"failure_message":{"type":["string","null"]},"rejection_reason":{"type":["string","null"]},"error":{"type":["string","null"]}}}}}}}}`);
5915
+ var operationIds = ["CdpIdentify", "CdpTrack", "CdpBatch", "SendEmail", "SendSms", "SendPush", "SendInboxMessage", "ListTransactionalMessages", "GetTransactionalMessage", "GetCustomerAttributes", "ListOptOuts", "GetCustomerOptOuts", "GetMessage", "ListReportingWebhooks", "ListSubscriptionTopics", "ExportCustomers", "GetExport", "DownloadExport", "ListSnippets", "ListCampaigns", "ListNewsletters", "ListSenderIdentities", "FollowClick", "ReportClick"];
5916
+ var supportedOperationIds = ["CdpIdentify", "CdpTrack", "CdpBatch", "SendEmail", "SendSms", "SendPush", "SendInboxMessage", "ListTransactionalMessages", "GetTransactionalMessage", "GetCustomerAttributes", "ListOptOuts", "GetCustomerOptOuts", "GetMessage", "ListReportingWebhooks", "ListSubscriptionTopics", "ExportCustomers", "GetExport", "DownloadExport", "ListSnippets", "ListCampaigns", "ListNewsletters", "ListSenderIdentities", "FollowClick", "ReportClick"];
5917
5917
 
5918
5918
  // src/state.ts
5919
5919
  var DELIVERY_STATES = [
@@ -5936,6 +5936,14 @@ var FAILURE_STATES = /* @__PURE__ */ new Set([
5936
5936
  "suppressed"
5937
5937
  ]);
5938
5938
  var MAX_DEVICES_PER_PERSON = 25;
5939
+ var CONTENT_LISTS = [
5940
+ "reporting_webhooks",
5941
+ "topics",
5942
+ "snippets",
5943
+ "campaigns",
5944
+ "newsletters",
5945
+ "sender_identities"
5946
+ ];
5939
5947
  var DEFAULT_SETTINGS = {
5940
5948
  strictMessages: false,
5941
5949
  trackingBase: "https://links.customer.io",
@@ -5997,6 +6005,8 @@ var CustomerIoState = class {
5997
6005
  this.links = new Collection(sqlite, namespace, "links");
5998
6006
  this.devices = new Collection(sqlite, namespace, "devices");
5999
6007
  this.settings = new Collection(sqlite, namespace, "settings");
6008
+ this.content = new Collection(sqlite, namespace, "content");
6009
+ this.exports = new Collection(sqlite, namespace, "exports");
6000
6010
  this.ids = new IdSequence(sqlite, namespace, "customerio");
6001
6011
  this.ensureSeeded();
6002
6012
  }
@@ -6009,6 +6019,8 @@ var CustomerIoState = class {
6009
6019
  links;
6010
6020
  devices;
6011
6021
  settings;
6022
+ content;
6023
+ exports;
6012
6024
  ids;
6013
6025
  ensureSeeded() {
6014
6026
  if (this.messages.count() === 0) {
@@ -6026,6 +6038,14 @@ var CustomerIoState = class {
6026
6038
  this.settings.insert("settings", next);
6027
6039
  return next;
6028
6040
  }
6041
+ /** One workspace content list, in stored order (empty when never seeded). */
6042
+ contentOf(list) {
6043
+ return this.content.get(list)?.items ?? [];
6044
+ }
6045
+ setContent(list, items) {
6046
+ if (this.content.has(list)) this.content.update(list, { list, items });
6047
+ else this.content.insert(list, { list, items });
6048
+ }
6029
6049
  catalog() {
6030
6050
  return this.messages.list({ order: "oldest" }).map((row) => row.value);
6031
6051
  }
@@ -6136,6 +6156,17 @@ var CustomerIoState = class {
6136
6156
  // src/runtime.ts
6137
6157
  var REPORTING_WEBHOOK_PATH = "/v1/customer-io/reporting-webhook";
6138
6158
  var signReporting = (secret, timestampSeconds, body) => hmac("SHA-256", secret, `v0:${timestampSeconds}:${body}`, "hex");
6159
+ var WORKSPACE_READS = [
6160
+ "ListReportingWebhooks",
6161
+ "ListSubscriptionTopics",
6162
+ "ExportCustomers",
6163
+ "GetExport",
6164
+ "DownloadExport",
6165
+ "ListSnippets",
6166
+ "ListCampaigns",
6167
+ "ListNewsletters",
6168
+ "ListSenderIdentities"
6169
+ ];
6139
6170
  var SENDS = ["SendEmail", "SendSms", "SendPush", "SendInboxMessage"];
6140
6171
  var CDP = ["CdpIdentify", "CdpTrack", "CdpBatch"];
6141
6172
  var onSends = (rule) => SENDS.map((operationId) => ({ operationId, ...rule }));
@@ -6190,7 +6221,12 @@ var CUSTOMERIO_PRESETS = {
6190
6221
  operationId: "GetMessage",
6191
6222
  status: 401,
6192
6223
  body: { meta: { error: "Unauthorized request" } }
6193
- }
6224
+ },
6225
+ ...WORKSPACE_READS.map((operationId) => ({
6226
+ operationId,
6227
+ status: 401,
6228
+ body: { meta: { error: "Unauthorized request" } }
6229
+ }))
6194
6230
  ]
6195
6231
  },
6196
6232
  send_drop: {
@@ -6371,6 +6407,18 @@ var adminRoutes = (runtime) => ({
6371
6407
  const event = runtime.instance(namespace).report(input);
6372
6408
  return typeof event === "string" ? adminError4(404, event) : json6(201, event);
6373
6409
  },
6410
+ "GET /content": ({ namespace }) => json6(200, runtime.instance(namespace).content()),
6411
+ "PUT /content": ({ body, namespace }) => {
6412
+ if (!isRecord5(body)) {
6413
+ return adminError4(
6414
+ 400,
6415
+ "expected {reporting_webhooks?, topics?, snippets?, campaigns?, newsletters?, sender_identities?: [...]}"
6416
+ );
6417
+ }
6418
+ const result = runtime.instance(namespace).setContent(body);
6419
+ return typeof result === "string" ? adminError4(400, result) : json6(200, result);
6420
+ },
6421
+ "GET /exports/:id/file": ({ params, namespace }) => runtime.instance(namespace).exportFile(params.id) ?? adminError4(404, `no export ${params.id}`),
6374
6422
  "GET /transactional": ({ namespace }) => json6(200, { messages: runtime.instance(namespace).state.catalog() }),
6375
6423
  "PUT /transactional": ({ body, namespace }) => {
6376
6424
  const list = Array.isArray(body) ? body : isRecord5(body) ? body.messages : void 0;
@@ -6453,9 +6501,11 @@ var createRuntime2 = (options = {}) => {
6453
6501
  credential: customerIoCredential,
6454
6502
  presets: CUSTOMERIO_PRESETS,
6455
6503
  webhooks: hub,
6456
- create: ({ sqlite, namespace, publicNamespace, clock }) => new CustomerIoAPI({
6504
+ create: ({ sqlite, namespace, publicNamespace, adminPrefix, clock }) => new CustomerIoAPI({
6457
6505
  sqlite,
6458
6506
  namespace,
6507
+ publicNamespace,
6508
+ adminPrefix,
6459
6509
  now: clock.now,
6460
6510
  ...options.wallClock ? { wallClock: options.wallClock } : {},
6461
6511
  ...options.messages ? { messages: options.messages } : {},
@@ -6487,7 +6537,16 @@ var APP_OPERATIONS = /* @__PURE__ */ new Set([
6487
6537
  "GetCustomerAttributes",
6488
6538
  "ListOptOuts",
6489
6539
  "GetCustomerOptOuts",
6490
- "GetMessage"
6540
+ "GetMessage",
6541
+ "ListReportingWebhooks",
6542
+ "ListSubscriptionTopics",
6543
+ "ExportCustomers",
6544
+ "GetExport",
6545
+ "DownloadExport",
6546
+ "ListSnippets",
6547
+ "ListCampaigns",
6548
+ "ListNewsletters",
6549
+ "ListSenderIdentities"
6491
6550
  ]);
6492
6551
  var DEVICE_UPSERT_EVENT = "Device Created or Updated";
6493
6552
  var DEVICE_DELETE_EVENT = "Device Deleted";
@@ -6543,6 +6602,64 @@ var mergePreferences = (current, incoming) => ({
6543
6602
  channels: mergeBoolMap(current?.channels ?? {}, incoming.channels),
6544
6603
  topics: mergeBoolMap(current?.topics ?? {}, incoming.topics)
6545
6604
  });
6605
+ var profileAttributes = (profile) => ({
6606
+ ...profile.traits,
6607
+ id: profile.id,
6608
+ cio_id: profile.cioId,
6609
+ ...profile.email ? { email: profile.email } : {},
6610
+ unsubscribed: profile.unsubscribed
6611
+ });
6612
+ var FILTER_KEYS = ["and", "or", "not", "segment", "attribute"];
6613
+ var parseFilter = (node, path) => {
6614
+ if (!isRecord6(node)) return `${path}: expected an object`;
6615
+ const keys = Object.keys(node);
6616
+ const key = keys[0];
6617
+ if (keys.length !== 1 || key === void 0 || !FILTER_KEYS.includes(key)) {
6618
+ return `${path}: expected exactly one of ${FILTER_KEYS.join(", ")}`;
6619
+ }
6620
+ const value = node[key];
6621
+ if (key === "segment") return `${path}: segment filters are not supported by the emulator`;
6622
+ if (key === "and" || key === "or") {
6623
+ if (!Array.isArray(value) || value.length === 0)
6624
+ return `${path}.${key}: expected a non-empty array`;
6625
+ const parts = [];
6626
+ for (const [index, child] of value.entries()) {
6627
+ const part = parseFilter(child, `${path}.${key}[${index}]`);
6628
+ if (typeof part === "string") return part;
6629
+ parts.push(part);
6630
+ }
6631
+ return key === "and" ? (attributes) => parts.every((part) => part(attributes)) : (attributes) => parts.some((part) => part(attributes));
6632
+ }
6633
+ if (key === "not") {
6634
+ const inner = parseFilter(value, `${path}.not`);
6635
+ return typeof inner === "string" ? inner : (attributes) => !inner(attributes);
6636
+ }
6637
+ if (!isRecord6(value) || typeof value.field !== "string" || !value.field) {
6638
+ return `${path}.attribute.field: is required`;
6639
+ }
6640
+ const { field: field2, operator, inverse } = value;
6641
+ if (operator !== "eq" && operator !== "exists") {
6642
+ return `${path}.attribute.operator: must be eq or exists`;
6643
+ }
6644
+ if (inverse !== void 0 && typeof inverse !== "boolean") {
6645
+ return `${path}.attribute.inverse: must be a boolean`;
6646
+ }
6647
+ if (operator === "eq" && !["string", "number", "boolean"].includes(typeof value.value)) {
6648
+ return `${path}.attribute.value: is required for eq`;
6649
+ }
6650
+ const expected = String(value.value);
6651
+ return (attributes) => {
6652
+ const actual = attributes[field2];
6653
+ const present = actual !== void 0 && actual !== null;
6654
+ const match = operator === "exists" ? present : present && String(actual) === expected;
6655
+ return inverse === true ? !match : match;
6656
+ };
6657
+ };
6658
+ var csvCell = (value) => {
6659
+ const text = value === void 0 || value === null ? "" : typeof value === "object" ? JSON.stringify(value) : String(value);
6660
+ return /[",\r\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
6661
+ };
6662
+ var publicExport = ({ csv: _csv, ...record }) => record;
6546
6663
  var urlsIn = (value, out = []) => {
6547
6664
  if (typeof value === "string") {
6548
6665
  for (const url of [...extractLinks(value), ...value.match(URL_PATTERN) ?? []]) {
@@ -6565,6 +6682,8 @@ var CustomerIoAPI = class {
6565
6682
  now;
6566
6683
  wallClock;
6567
6684
  onReport;
6685
+ adminPrefix;
6686
+ publicNamespace;
6568
6687
  /** Serializes handlers so concurrent identifies merge instead of dropping traits. */
6569
6688
  tail = Promise.resolve();
6570
6689
  constructor(options = {}) {
@@ -6573,6 +6692,8 @@ var CustomerIoAPI = class {
6573
6692
  this.baseNow = options.now ?? (() => Date.now());
6574
6693
  this.wallClock = options.wallClock ?? Date.now;
6575
6694
  this.onReport = options.onReport;
6695
+ this.adminPrefix = options.adminPrefix ?? "/__admin";
6696
+ this.publicNamespace = options.publicNamespace ?? "default";
6576
6697
  this.state = new CustomerIoState(sqlite, namespace, {
6577
6698
  messages: options.messages ?? DEFAULT_TRANSACTIONAL_MESSAGES,
6578
6699
  settings: options.settings ?? {}
@@ -6592,6 +6713,15 @@ var CustomerIoAPI = class {
6592
6713
  GetCustomerOptOuts: (context) => this.enqueue(() => this.customerOptOuts(context)),
6593
6714
  GetCustomerAttributes: (context) => this.enqueue(() => this.attributes(context)),
6594
6715
  GetMessage: (context) => this.enqueue(() => this.deliveryMessage(context)),
6716
+ ListReportingWebhooks: () => this.listContent("reporting_webhooks"),
6717
+ ListSubscriptionTopics: () => this.listContent("topics"),
6718
+ ListSnippets: () => this.listContent("snippets"),
6719
+ ListCampaigns: () => this.listContent("campaigns"),
6720
+ ListNewsletters: (context) => this.pageContent(context, "newsletters"),
6721
+ ListSenderIdentities: (context) => this.pageContent(context, "sender_identities"),
6722
+ ExportCustomers: (context) => this.enqueue(() => this.exportCustomers(context)),
6723
+ GetExport: (context) => this.enqueue(() => this.getExport(context)),
6724
+ DownloadExport: (context) => this.enqueue(() => this.downloadExport(context)),
6595
6725
  ReportClick: (context) => this.enqueue(() => this.click(context, "post")),
6596
6726
  FollowClick: (context) => this.enqueue(() => this.click(context, "get"))
6597
6727
  });
@@ -7031,13 +7161,7 @@ var CustomerIoAPI = class {
7031
7161
  const customerId = context.params.customer_id ?? "";
7032
7162
  const profile = idType === "email" ? this.state.profileByEmail(customerId) : idType === "cio_id" ? this.state.profileByCioId(customerId) : this.state.profile(customerId);
7033
7163
  if (!profile) return appError(404, "not found");
7034
- const attributes = {
7035
- ...profile.traits,
7036
- id: profile.id,
7037
- cio_id: profile.cioId,
7038
- ...profile.email ? { email: profile.email } : {},
7039
- unsubscribed: profile.unsubscribed
7040
- };
7164
+ const attributes = profileAttributes(profile);
7041
7165
  return annotateResponse(
7042
7166
  jsonRes(200, {
7043
7167
  customer: {
@@ -7079,6 +7203,151 @@ var CustomerIoAPI = class {
7079
7203
  { ids: { deliveryId: delivery.id } }
7080
7204
  );
7081
7205
  }
7206
+ // ---------------------------------------------------------------- workspace content
7207
+ listContent(list) {
7208
+ return jsonRes(200, { [list]: this.state.contentOf(list) });
7209
+ }
7210
+ /** `limit` / `sort` / opaque `start` paging (newsletters, sender identities). */
7211
+ pageContent(context, list) {
7212
+ const { limit: rawLimit, sort = "asc", start, hidden } = context.query;
7213
+ const limit = rawLimit === void 0 ? Number.POSITIVE_INFINITY : Number(rawLimit);
7214
+ if (rawLimit !== void 0 && (!Number.isInteger(limit) || limit < 1)) {
7215
+ return appError(400, "limit must be a positive integer");
7216
+ }
7217
+ if (sort !== "asc" && sort !== "desc") return appError(400, "sort must be asc or desc");
7218
+ let offset = 0;
7219
+ if (start !== void 0) {
7220
+ let decoded = "";
7221
+ try {
7222
+ decoded = atob(String(start));
7223
+ } catch {
7224
+ return appError(400, "invalid start cursor");
7225
+ }
7226
+ const match = new RegExp(`^${list}:(\\d+)$`).exec(decoded);
7227
+ if (!match) return appError(400, "invalid start cursor");
7228
+ offset = Number(match[1]);
7229
+ }
7230
+ let items = this.state.contentOf(list);
7231
+ if (list === "sender_identities" && String(hidden) !== "true") {
7232
+ items = items.filter((item) => item.hidden !== true);
7233
+ }
7234
+ if (sort === "desc") items = [...items].reverse();
7235
+ const page = items.slice(offset, offset + limit);
7236
+ const next = offset + page.length < items.length ? btoa(`${list}:${offset + page.length}`) : null;
7237
+ return jsonRes(200, { ...next ? { next } : {}, [list]: page });
7238
+ }
7239
+ /**
7240
+ * Replace workspace content lists (admin). Each key of `body` that names a list replaces it;
7241
+ * items get the vendor defaults (`id` from 1, …). Everything is validated before any write.
7242
+ */
7243
+ setContent(body) {
7244
+ const next = /* @__PURE__ */ new Map();
7245
+ const at = Math.floor(this.now() / 1e3);
7246
+ for (const [key, raw] of Object.entries(body)) {
7247
+ if (!CONTENT_LISTS.includes(key)) {
7248
+ return `unknown list ${key}; expected ${CONTENT_LISTS.join(", ")}`;
7249
+ }
7250
+ const list = key;
7251
+ if (!Array.isArray(raw)) return `${list}: expected an array of objects`;
7252
+ const items = [];
7253
+ for (const [index, item] of raw.entries()) {
7254
+ if (!isRecord6(item)) return `${list}[${index}]: expected an object`;
7255
+ const id = typeof item.id === "number" ? item.id : index + 1;
7256
+ if (list === "reporting_webhooks") {
7257
+ if (typeof item.name !== "string" || typeof item.endpoint !== "string" || !Array.isArray(item.events) || !item.events.every((event) => typeof event === "string")) {
7258
+ return `${list}[${index}]: name, endpoint and events (strings) are required`;
7259
+ }
7260
+ items.push({
7261
+ type: "webhook",
7262
+ disabled: false,
7263
+ full_resolution: true,
7264
+ with_content: false,
7265
+ ...item,
7266
+ id
7267
+ });
7268
+ } else if (list === "snippets") {
7269
+ if (typeof item.name !== "string" || typeof item.value !== "string") {
7270
+ return `${list}[${index}]: name and value (strings) are required`;
7271
+ }
7272
+ items.push({ updated_at: at, ...item });
7273
+ } else if (list === "topics") {
7274
+ items.push({ identifier: `topic_${id}`, ...item, id });
7275
+ } else {
7276
+ items.push({ ...item, id });
7277
+ }
7278
+ }
7279
+ next.set(list, items);
7280
+ }
7281
+ for (const [list, items] of next) this.state.setContent(list, items);
7282
+ return this.content();
7283
+ }
7284
+ content() {
7285
+ return Object.fromEntries(
7286
+ CONTENT_LISTS.map((list) => [list, this.state.contentOf(list)])
7287
+ );
7288
+ }
7289
+ // ---------------------------------------------------------------- customer exports
7290
+ exportCustomers(context) {
7291
+ if (context.body.kind !== "json" || !isRecord6(context.body.value)) {
7292
+ return appError(400, "invalid JSON body");
7293
+ }
7294
+ const issue = bodyIssues(context)[0];
7295
+ if (issue) return appError(400, `${issue.path || "body"}: ${issue.message}`);
7296
+ const body = context.body.value;
7297
+ const filter = parseFilter(body.filters, "filters");
7298
+ if (typeof filter === "string") return appError(400, filter);
7299
+ const extra = Array.isArray(body.attributes) ? body.attributes.map(String) : [];
7300
+ const columns = [.../* @__PURE__ */ new Set(["id", "cio_id", "email", ...extra])];
7301
+ const rows = this.profiles().map((profile) => profileAttributes(profile)).filter((attributes) => filter(attributes));
7302
+ const csv = `${[columns, ...rows.map((row) => columns.map((column) => row[column]))].map((cells) => cells.map(csvCell).join(",")).join("\n")}
7303
+ `;
7304
+ const id = this.state.exports.count() + 1;
7305
+ const at = Math.floor(this.now() / 1e3);
7306
+ const record = {
7307
+ id,
7308
+ type: "customers",
7309
+ status: "done",
7310
+ failed: false,
7311
+ total: rows.length,
7312
+ downloads: 0,
7313
+ created_at: at,
7314
+ updated_at: at,
7315
+ deduplicate_id: `${id}:${at}`,
7316
+ csv
7317
+ };
7318
+ this.state.exports.insert(String(id), record);
7319
+ return jsonRes(200, { export: publicExport(record) });
7320
+ }
7321
+ exportOf(context) {
7322
+ const raw = String(context.params.export_id ?? "");
7323
+ return /^\d+$/.test(raw) ? this.state.exports.get(String(Number(raw))) : void 0;
7324
+ }
7325
+ getExport(context) {
7326
+ const record = this.exportOf(context);
7327
+ return record ? jsonRes(200, { export: publicExport(record) }) : appError(404, "not found");
7328
+ }
7329
+ /** A link to the CSV the runtime serves under the admin prefix; each link counts a download. */
7330
+ downloadExport(context) {
7331
+ const record = this.exportOf(context);
7332
+ if (!record) return appError(404, "not found");
7333
+ this.state.exports.update(String(record.id), { ...record, downloads: record.downloads + 1 });
7334
+ const prefix = this.publicNamespace === "default" ? "" : `${this.adminPrefix}/ns/${encodeURIComponent(this.publicNamespace)}`;
7335
+ return jsonRes(200, {
7336
+ url: `${context.url.origin}${prefix}${this.adminPrefix}/exports/${record.id}/file`
7337
+ });
7338
+ }
7339
+ /** The export's CSV file (the admin route the download link points at). */
7340
+ exportFile(id) {
7341
+ const record = this.state.exports.get(id);
7342
+ if (!record) return void 0;
7343
+ return new Response(record.csv, {
7344
+ status: 200,
7345
+ headers: {
7346
+ "content-type": "text/csv; charset=utf-8",
7347
+ "content-disposition": `attachment; filename="export-${record.id}.csv"`
7348
+ }
7349
+ });
7350
+ }
7082
7351
  // ---------------------------------------------------------------- link tracking
7083
7352
  click(context, mode) {
7084
7353
  const link = this.state.links.get(context.params.linkId ?? "");
@@ -7248,6 +7517,7 @@ export {
7248
7517
  DELIVERY_STATES,
7249
7518
  FAILURE_STATES,
7250
7519
  MAX_DEVICES_PER_PERSON,
7520
+ CONTENT_LISTS,
7251
7521
  DEFAULT_SETTINGS,
7252
7522
  TRANSACTIONAL_EMAIL_KEYS,
7253
7523
  DEFAULT_TRANSACTIONAL_MESSAGES,
@@ -7261,4 +7531,4 @@ export {
7261
7531
  DEVICE_DELETE_EVENT,
7262
7532
  CustomerIoAPI
7263
7533
  };
7264
- //# sourceMappingURL=chunk-MMOXP3DX.js.map
7534
+ //# sourceMappingURL=chunk-AECCAFDC.js.map