@singi-labs/sifa-sdk 0.10.3 → 0.10.4

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.
@@ -318,4 +318,43 @@ interface Profile {
318
318
  externalAccounts?: ExternalAccount[];
319
319
  }
320
320
 
321
- export type { ActiveApp as A, ExternalAccount as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillSuggestion as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, Endorsement as c, EndorsementData as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillRef as t };
321
+ /**
322
+ * Adult-content gating for Bluesky activity items.
323
+ *
324
+ * Bluesky's official moderation labeler attaches content labels to
325
+ * `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels
326
+ * below are the ones we hide by default on Sifa: media is replaced with an
327
+ * `<AdultContentWarning>` placeholder card in sifa-web. Authenticated
328
+ * viewers can reveal per-card; anonymous viewers cannot.
329
+ *
330
+ * The list mirrors Bluesky's own globalLabelStrings; if the official set
331
+ * grows (e.g. a new `extreme-violence` label), update this constant.
332
+ *
333
+ * Why a constant + predicate live in the SDK: the same logic needs to run
334
+ * in sifa-web today and sifa-app tomorrow, and the API only forwards the
335
+ * raw labels — the hide decision is a client concern.
336
+ */
337
+ declare const ADULT_CONTENT_LABELS: readonly ["porn", "sexual", "nudity", "graphic-media"];
338
+ type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];
339
+ /**
340
+ * A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.
341
+ * Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView
342
+ * resolves a `postView`). `neg: true` marks a retraction.
343
+ */
344
+ interface ActivityLabel {
345
+ val: string;
346
+ src: string;
347
+ uri: string;
348
+ cts?: string;
349
+ neg?: boolean;
350
+ }
351
+ /**
352
+ * Return true if the item carries at least one adult-content label that is
353
+ * not negated. Items without a `labels` field (every non-Bluesky source,
354
+ * legacy responses) are treated as safe.
355
+ */
356
+ declare function hasAdultContent(item: {
357
+ labels?: ActivityLabel[];
358
+ }): boolean;
359
+
360
+ export { type ActivityLabel as A, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type PdsProviderInfo as a, type Profile as b, ADULT_CONTENT_LABELS as c, type ActiveApp as d, type AdultContentLabel as e, type Endorsement as f, type EndorsementData as g, type ExternalAccountKeytraceClaim as h, type LanguageProficiency as i, type ProfileCertification as j, type ProfileCourse as k, type ProfileEducation as l, type ProfileHonor as m, type ProfileIndustry as n, type ProfileLanguage as o, type ProfileLocation as p, type ProfileOverrideSource as q, type ProfilePosition as r, type ProfileProject as s, type ProfilePublication as t, type ProfileVolunteering as u, type PublicationContributor as v, type SkillRef as w, hasAdultContent as x };
@@ -318,4 +318,43 @@ interface Profile {
318
318
  externalAccounts?: ExternalAccount[];
319
319
  }
320
320
 
321
- export type { ActiveApp as A, ExternalAccount as E, FeedItem as F, LocationValue as L, ProfileSkill as P, SkillSuggestion as S, TrustStat as T, VerifiedAccount as V, PdsProviderInfo as a, Profile as b, Endorsement as c, EndorsementData as d, ExternalAccountKeytraceClaim as e, LanguageProficiency as f, ProfileCertification as g, ProfileCourse as h, ProfileEducation as i, ProfileHonor as j, ProfileIndustry as k, ProfileLanguage as l, ProfileLocation as m, ProfileOverrideSource as n, ProfilePosition as o, ProfileProject as p, ProfilePublication as q, ProfileVolunteering as r, PublicationContributor as s, SkillRef as t };
321
+ /**
322
+ * Adult-content gating for Bluesky activity items.
323
+ *
324
+ * Bluesky's official moderation labeler attaches content labels to
325
+ * `app.bsky.feed.defs#postView.labels`. The four sex-and-violence labels
326
+ * below are the ones we hide by default on Sifa: media is replaced with an
327
+ * `<AdultContentWarning>` placeholder card in sifa-web. Authenticated
328
+ * viewers can reveal per-card; anonymous viewers cannot.
329
+ *
330
+ * The list mirrors Bluesky's own globalLabelStrings; if the official set
331
+ * grows (e.g. a new `extreme-violence` label), update this constant.
332
+ *
333
+ * Why a constant + predicate live in the SDK: the same logic needs to run
334
+ * in sifa-web today and sifa-app tomorrow, and the API only forwards the
335
+ * raw labels — the hide decision is a client concern.
336
+ */
337
+ declare const ADULT_CONTENT_LABELS: readonly ["porn", "sexual", "nudity", "graphic-media"];
338
+ type AdultContentLabel = (typeof ADULT_CONTENT_LABELS)[number];
339
+ /**
340
+ * A single label entry as emitted by `app.bsky.feed.defs#postView.labels`.
341
+ * Matches `com.atproto.label.defs#label` (the on-wire shape after the AppView
342
+ * resolves a `postView`). `neg: true` marks a retraction.
343
+ */
344
+ interface ActivityLabel {
345
+ val: string;
346
+ src: string;
347
+ uri: string;
348
+ cts?: string;
349
+ neg?: boolean;
350
+ }
351
+ /**
352
+ * Return true if the item carries at least one adult-content label that is
353
+ * not negated. Items without a `labels` field (every non-Bluesky source,
354
+ * legacy responses) are treated as safe.
355
+ */
356
+ declare function hasAdultContent(item: {
357
+ labels?: ActivityLabel[];
358
+ }): boolean;
359
+
360
+ export { type ActivityLabel as A, type ExternalAccount as E, type FeedItem as F, type LocationValue as L, type ProfileSkill as P, type SkillSuggestion as S, type TrustStat as T, type VerifiedAccount as V, type PdsProviderInfo as a, type Profile as b, ADULT_CONTENT_LABELS as c, type ActiveApp as d, type AdultContentLabel as e, type Endorsement as f, type EndorsementData as g, type ExternalAccountKeytraceClaim as h, type LanguageProficiency as i, type ProfileCertification as j, type ProfileCourse as k, type ProfileEducation as l, type ProfileHonor as m, type ProfileIndustry as n, type ProfileLanguage as o, type ProfileLocation as p, type ProfileOverrideSource as q, type ProfilePosition as r, type ProfileProject as s, type ProfilePublication as t, type ProfileVolunteering as u, type PublicationContributor as v, type SkillRef as w, hasAdultContent as x };
package/dist/index.cjs CHANGED
@@ -1749,6 +1749,16 @@ function isVisibleActivityItem(collection, record) {
1749
1749
  return rule(record);
1750
1750
  }
1751
1751
 
1752
+ // src/cards/adult-content.ts
1753
+ var ADULT_CONTENT_LABELS = ["porn", "sexual", "nudity", "graphic-media"];
1754
+ function hasAdultContent(item) {
1755
+ const labels = item.labels;
1756
+ if (!labels || labels.length === 0) return false;
1757
+ return labels.some(
1758
+ (label) => !label.neg && ADULT_CONTENT_LABELS.includes(label.val)
1759
+ );
1760
+ }
1761
+
1752
1762
  // src/publishers/registry.ts
1753
1763
  var STANDARD_PUBLISHER_ID = "standard";
1754
1764
  var PUBLISHERS = Object.freeze([
@@ -2148,10 +2158,11 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
2148
2158
  });
2149
2159
 
2150
2160
  // src/index.ts
2151
- var SIFA_SDK_VERSION = "0.10.3";
2161
+ var SIFA_SDK_VERSION = "0.10.4";
2152
2162
 
2153
2163
  exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
2154
2164
  exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
2165
+ exports.ADULT_CONTENT_LABELS = ADULT_CONTENT_LABELS;
2155
2166
  exports.APP_CATEGORIES = APP_CATEGORIES;
2156
2167
  exports.APP_CATEGORY_IDS = APP_CATEGORY_IDS;
2157
2168
  exports.APP_CATEGORY_MAP = APP_CATEGORY_MAP;
@@ -2243,6 +2254,7 @@ exports.getPublisherFromSiteUrl = getPublisherFromSiteUrl;
2243
2254
  exports.getTierMeta = getTierMeta;
2244
2255
  exports.getWorkplaceTypeLabel = getWorkplaceTypeLabel;
2245
2256
  exports.groupSkillsByCategory = groupSkillsByCategory;
2257
+ exports.hasAdultContent = hasAdultContent;
2246
2258
  exports.isAppCategory = isAppCategory;
2247
2259
  exports.isKnownAppId = isKnownAppId;
2248
2260
  exports.isKnownPlatform = isKnownPlatform;