samva 0.38.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -452,7 +452,7 @@ const campaign = await samva.campaigns.create({
452
452
  email: { subject: "What's new", html: "<h1>Updates</h1>" },
453
453
  },
454
454
  audience: {
455
- topicId: "unsub_1234567890abcdef",
455
+ topicId: "tpc_1234567890abcdef",
456
456
  includeTags: ["subscribers"],
457
457
  excludeTags: ["bounced"],
458
458
  },
@@ -2080,7 +2080,7 @@ export declare class Topics {
2080
2080
  /**
2081
2081
  * Set topic subscriptions
2082
2082
  *
2083
- * Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent.
2083
+ * Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent. On email, setting subscribed never overrides a contact's explicit unsubscribe: those contacts are counted in kept, and only the recipient can resubscribe them.
2084
2084
  */
2085
2085
  static setSubscriptions<ThrowOnError extends boolean = false>(parameters: {
2086
2086
  id: TopicId;
@@ -6342,7 +6342,7 @@ var Topics = class {
6342
6342
  /**
6343
6343
  * Set topic subscriptions
6344
6344
  *
6345
- * Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent.
6345
+ * Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent. On email, setting subscribed never overrides a contact's explicit unsubscribe: those contacts are counted in kept, and only the recipient can resubscribe them.
6346
6346
  */
6347
6347
  static setSubscriptions(parameters, options) {
6348
6348
  const params = buildClientParams([parameters], [{ args: [
@@ -2304,6 +2304,10 @@ export type TopicFormCreatePayload = {
2304
2304
  };
2305
2305
  export type TopicSetSubscriptionsResult = {
2306
2306
  updated: number;
2307
+ /**
2308
+ * Email contacts left unsubscribed because they explicitly unsubscribed from this topic. Only the recipient can resubscribe them, through the preference page or double opt-in.
2309
+ */
2310
+ kept: number;
2307
2311
  };
2308
2312
  export type TopicSetSubscriptionsPayload = {
2309
2313
  contacts: Array<TopicContactRef>;
@@ -211,8 +211,8 @@ const RenderTimeZone = /* @__PURE__ */ (() => Schema.String.check(Schema.isMaxCo
211
211
  identifier: "RenderTimeZone"
212
212
  })).check(Schema.isMaxLength(64).annotate({ expected: "a value with a length of at most 64" })))();
213
213
  const StoredReplyToAddresses = /* @__PURE__ */ (() => Schema.Union([Schema.Array(Schema.String), Schema.Null]).annotate({ identifier: "StoredReplyToAddresses" }))();
214
- const TopicId = /* @__PURE__ */ (() => Schema.String.check(Schema.isPattern(new globalThis.RegExp("^unsub_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
215
- expected: "a string matching the RegExp ^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
214
+ const TopicId = /* @__PURE__ */ (() => Schema.String.check(Schema.isPattern(new globalThis.RegExp("^tpc_[0-9a-hjkmnp-tv-z]{16,24}$", "u")).annotate({
215
+ expected: "a string matching the RegExp ^tpc_[0-9a-hjkmnp-tv-z]{16,24}$",
216
216
  identifier: "TopicId"
217
217
  })).pipe(Schema.brand("TopicId")))();
218
218
  const EmailTrackingOverrideV1 = /* @__PURE__ */ (() => Schema.Struct({
@@ -31,9 +31,11 @@ export declare const TopicSubscriptionCounts: Schema.Struct<{
31
31
  }>;
32
32
  export type TopicSetSubscriptionsResult = {
33
33
  readonly updated: number;
34
+ readonly kept: number;
34
35
  };
35
36
  export declare const TopicSetSubscriptionsResult: Schema.Struct<{
36
37
  readonly updated: Schema.Finite;
38
+ readonly kept: Schema.Finite;
37
39
  }>;
38
40
  export type TopicSubscription = {
39
41
  readonly contactId: ContactId;
@@ -536,6 +538,7 @@ export declare const TopicsSetSubscriptionsRequestJson: Schema.Struct<{
536
538
  export type TopicsSetSubscriptions200 = TopicSetSubscriptionsResult;
537
539
  export declare const TopicsSetSubscriptions200: Schema.Struct<{
538
540
  readonly updated: Schema.Finite;
541
+ readonly kept: Schema.Finite;
539
542
  }>;
540
543
  export type TopicsSetSubscriptions400 = MalformedRequestError;
541
544
  export declare const TopicsSetSubscriptions400: typeof MalformedRequestError;
@@ -1488,6 +1491,7 @@ declare const TopicsGroup_base: HttpApiGroup.HttpApiGroup<"Topics", HttpApiEndpo
1488
1491
  readonly source: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.Null]>>;
1489
1492
  }>>, never, Schema.toCodecJson<Schema.Struct<{
1490
1493
  readonly updated: Schema.Finite;
1494
+ readonly kept: Schema.Finite;
1491
1495
  }>>, Schema.toCodecJson<Schema.decodeTo<Schema.declareConstructor<BillingProviderError, {
1492
1496
  readonly _tag: "BillingProviderError";
1493
1497
  readonly message: string;
@@ -16,7 +16,10 @@ const TopicSubscriptionCounts = /* @__PURE__ */ (() => Schema.Struct({
16
16
  unsubscribed: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(9007199254740991).annotate({ expected: "a value less than or equal to 9007199254740991" }))
17
17
  })
18
18
  }).annotate({ identifier: "TopicSubscriptionCounts" }))();
19
- const TopicSetSubscriptionsResult = /* @__PURE__ */ (() => Schema.Struct({ updated: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(9007199254740991).annotate({ expected: "a value less than or equal to 9007199254740991" })) }).annotate({ identifier: "TopicSetSubscriptionsResult" }))();
19
+ const TopicSetSubscriptionsResult = /* @__PURE__ */ (() => Schema.Struct({
20
+ updated: Schema.Finite.check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(9007199254740991).annotate({ expected: "a value less than or equal to 9007199254740991" })),
21
+ kept: Schema.Finite.annotate({ description: "Email contacts left unsubscribed because they explicitly unsubscribed from this topic. Only the recipient can resubscribe them, through the preference page or double opt-in." }).check(Schema.isInt().annotate({ expected: "an integer" })).check(Schema.isGreaterThanOrEqualTo(0).annotate({ expected: "a value greater than or equal to 0" })).check(Schema.isLessThanOrEqualTo(9007199254740991).annotate({ expected: "a value less than or equal to 9007199254740991" }))
22
+ }).annotate({ identifier: "TopicSetSubscriptionsResult" }))();
20
23
  const TopicSubscription = /* @__PURE__ */ (() => Schema.Struct({
21
24
  contactId: ContactId,
22
25
  channel: Schema.Union([
@@ -298,7 +301,7 @@ var TopicsGroup = class extends HttpApiGroup.make("Topics").add(HttpApiEndpoint.
298
301
  TopicsSetSubscriptions502.pipe(HttpApiSchema.status(502)),
299
302
  TopicsSetSubscriptions504.pipe(HttpApiSchema.status(504))
300
303
  ]
301
- }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "topics.setSubscriptions").annotate(OpenApi.Summary, "Set topic subscriptions").annotate(OpenApi.Description, "Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent."), HttpApiEndpoint.get("topicsCheckSubscription", "/v1/topics/check", {
304
+ }).middleware(ApiKeySecurityMiddleware).annotate(OpenApi.Identifier, "topics.setSubscriptions").annotate(OpenApi.Summary, "Set topic subscriptions").annotate(OpenApi.Description, "Upserts explicit subscribed or unsubscribed status for one channel. Each contact is named by ID, email, or phone. New addresses create contacts in the topic's namespace. Repeating the same status is idempotent. On email, setting subscribed never overrides a contact's explicit unsubscribe: those contacts are counted in kept, and only the recipient can resubscribe them."), HttpApiEndpoint.get("topicsCheckSubscription", "/v1/topics/check", {
302
305
  query: TopicsCheckSubscriptionQuery,
303
306
  success: TopicsCheckSubscription200,
304
307
  error: [
package/dist/package.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.38.0";
2
+ var version = "0.40.0";
3
3
  export { version };
4
4
 
5
5
  //# sourceMappingURL=package.js.map
@@ -557,7 +557,7 @@ const payloadSchemas = {
557
557
  },
558
558
  topicId: { anyOf: [{
559
559
  type: "string",
560
- pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
560
+ pattern: "^tpc_[0-9a-hjkmnp-tv-z]{16,24}$",
561
561
  "x-samva-brand": "TopicId"
562
562
  }, { type: "null" }] }
563
563
  },
@@ -1024,7 +1024,7 @@ const payloadSchemas = {
1024
1024
  },
1025
1025
  topicId: { anyOf: [{
1026
1026
  type: "string",
1027
- pattern: "^unsub_[0-9a-hjkmnp-tv-z]{16,24}$",
1027
+ pattern: "^tpc_[0-9a-hjkmnp-tv-z]{16,24}$",
1028
1028
  "x-samva-brand": "TopicId"
1029
1029
  }, { type: "null" }] }
1030
1030
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "samva",
3
- "version": "0.38.0",
3
+ "version": "0.40.0",
4
4
  "description": "TypeScript SDK for the Samva email and WhatsApp API",
5
5
  "keywords": [
6
6
  "api-client",
@@ -237,17 +237,17 @@
237
237
  "typecheck": "effect-tsgo tsrs --noEmit && effect-tsgo tsrs --noEmit -p codegen/tsconfig.json && effect-tsgo tsrs --noEmit -p tests/tsconfig.json && effect-tsgo tsrs --noEmit --project tests/parity/tsconfig.json"
238
238
  },
239
239
  "dependencies": {
240
- "@samva/webhooks": "0.38.0"
240
+ "@samva/webhooks": "0.40.0"
241
241
  },
242
242
  "devDependencies": {
243
243
  "@effect/openapi-generator": "^4.1.2",
244
244
  "@effect/platform-node": "^4.1.2",
245
- "@effect/tsgo": "0.63.0",
245
+ "@effect/tsgo": "0.67.5",
246
246
  "@effect/vitest": "^4.1.2",
247
247
  "@samva/openapi": "0.0.0",
248
- "@types/node": "^26.6.5",
248
+ "@types/node": "^26.6.6",
249
249
  "effect": "^4.1.2",
250
- "tsdown": "0.23.1",
250
+ "tsdown": "0.23.7",
251
251
  "typescript": "^7.0.2",
252
252
  "vitest": "5.0.3"
253
253
  },