@singi-labs/sifa-sdk 0.19.86 → 0.19.87
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/format/blob-proxy-url.js +9 -0
- package/dist/format/blob-proxy-url.js.map +1 -0
- package/dist/format/index.js +2 -0
- package/dist/format/index.js.map +1 -1
- package/dist/index.cjs +31 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/stream/stream-card-vm-schema.js +2 -1
- package/dist/stream/stream-card-vm-schema.js.map +1 -1
- package/dist/stream/to-stream-card-vm.js +13 -2
- package/dist/stream/to-stream-card-vm.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// src/format/blob-proxy-url.ts
|
|
2
|
+
import { normaliseBaseUrl } from "../jsonld/url.js";
|
|
3
|
+
function blobProxyUrl(baseUrl, did, cid, variant) {
|
|
4
|
+
return `${normaliseBaseUrl(baseUrl)}/api/blob/${encodeURIComponent(did)}/${encodeURIComponent(cid)}?v=${variant}`;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
blobProxyUrl
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=blob-proxy-url.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/format/blob-proxy-url.ts"],"sourcesContent":["import { normaliseBaseUrl } from '../jsonld/url.js';\n\n/** Output variants served by the sifa-api blob proxy. */\nexport type BlobProxyVariant = 'thumb' | 'avatar';\n\n/**\n * URL of the sifa-api blob proxy (`GET /api/blob/:did/:cid?v=`) for a blob\n * owned by `did`. The proxy fetches the blob from the owner's PDS, resizes it\n * (`thumb`: 1000px JPEG, `avatar`: 256px WebP) and caches it. Use it for blobs\n * the Bluesky image CDN refuses, such as very large originals.\n */\nexport function blobProxyUrl(\n baseUrl: string,\n did: string,\n cid: string,\n variant: BlobProxyVariant,\n): string {\n return `${normaliseBaseUrl(baseUrl)}/api/blob/${encodeURIComponent(did)}/${encodeURIComponent(cid)}?v=${variant}`;\n}\n"],"mappings":";AAAA,SAAS,wBAAwB;AAW1B,SAAS,aACd,SACA,KACA,KACA,SACQ;AACR,SAAO,GAAG,iBAAiB,OAAO,CAAC,aAAa,mBAAmB,GAAG,CAAC,IAAI,mBAAmB,GAAG,CAAC,MAAM,OAAO;AACjH;","names":[]}
|
package/dist/format/index.js
CHANGED
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
} from "./sort-by-date.js";
|
|
26
26
|
import { normalizeDoi } from "./doi.js";
|
|
27
27
|
import { openAlexWorkUrl } from "./openalex.js";
|
|
28
|
+
import { blobProxyUrl } from "./blob-proxy-url.js";
|
|
28
29
|
import {
|
|
29
30
|
formatRelationship,
|
|
30
31
|
parseEndorsementComment
|
|
@@ -55,6 +56,7 @@ import {
|
|
|
55
56
|
rgbToString
|
|
56
57
|
} from "./wcag-contrast.js";
|
|
57
58
|
export {
|
|
59
|
+
blobProxyUrl,
|
|
58
60
|
buildMetaDescription,
|
|
59
61
|
buildTalkSlug,
|
|
60
62
|
certDateExtractor,
|
package/dist/format/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/format/index.ts"],"sourcesContent":["export { formatCompanyName } from './company-name.js';\nexport { normalizeLegalForm } from './normalize-legal-form.js';\nexport { normalizeCompanyKey } from './normalize-company-key.js';\nexport { formatIsoTitle, formatRelativeTime } from './format-time.js';\nexport { formatPresentationDuration } from './format-duration.js';\nexport {\n formatCredentialDateRange,\n formatDateRange,\n formatPositionDateRange,\n formatTimelineDate,\n} from './timeline.js';\nexport {\n collapseContributors,\n type CollapseContributorsOptions,\n type CollapsedContributors,\n} from './collapse-contributors.js';\nexport {\n summarizePresentationDeliveries,\n type PresentationDeliverySummary,\n} from './summarize-deliveries.js';\nexport {\n certDateExtractor,\n dateRangeExtractor,\n lexiconDateExtractor,\n singleDateExtractor,\n sortByDateDesc,\n} from './sort-by-date.js';\nexport { normalizeDoi } from './doi.js';\nexport { openAlexWorkUrl } from './openalex.js';\nexport {\n formatRelationship,\n parseEndorsementComment,\n type ParsedEndorsementComment,\n} from './endorsement-context.js';\nexport { sanitizeHandleInput } from './handle-utils.js';\nexport { countryCodeToFlag, formatLocation, parseLocationString } from './location-utils.js';\nexport { locationSegments } from './location-segments.js';\nexport type {\n LocationSegment,\n LocationSegmentKind,\n LocationSegmentsOptions,\n} from './location-segments.js';\nexport {\n detectPdsProvider,\n formatStructuredName,\n getDisplayLabel,\n getHandleStem,\n getPdsDisplayName,\n pdsProviderFromApi,\n type PdsProvider,\n} from './pds-utils.js';\nexport { resolveEmbed, youtubeVideoId, youtubeThumbnailUrl, type EmbedResult } from './embed.js';\nexport { buildTalkSlug, parseTalkRkey, slugifyTitle } from './talk-slug.js';\nexport { buildMetaDescription } from './meta-description.js';\nexport type { MetaDescriptionInput, MetaDescriptionPosition } from './meta-description.js';\nexport { limitCombiningMarks, sanitizeDisplayText } from './text-sanitize.js';\nexport { truncateGraphemes } from './text-truncate.js';\nexport { formatDisplayUrl } from './format-display-url.js';\nexport type { DisplayUrl, FormatDisplayUrlOptions, UrlPathPolicy } from './format-display-url.js';\nexport { formatDistanceToNow } from './time-utils.js';\nexport {\n contrastRatio,\n isValidRgbColor,\n meetsContrastAA,\n relativeLuminance,\n rgbToString,\n type RgbColor,\n} from './wcag-contrast.js';\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,gBAAgB,0BAA0B;AACnD,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,2BAA2B;AACpC,SAAS,mBAAmB,gBAAgB,2BAA2B;AACvE,SAAS,wBAAwB;AAMjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,cAAc,gBAAgB,2BAA6C;AACpF,SAAS,eAAe,eAAe,oBAAoB;AAC3D,SAAS,4BAA4B;AAErC,SAAS,qBAAqB,2BAA2B;AACzD,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/format/index.ts"],"sourcesContent":["export { formatCompanyName } from './company-name.js';\nexport { normalizeLegalForm } from './normalize-legal-form.js';\nexport { normalizeCompanyKey } from './normalize-company-key.js';\nexport { formatIsoTitle, formatRelativeTime } from './format-time.js';\nexport { formatPresentationDuration } from './format-duration.js';\nexport {\n formatCredentialDateRange,\n formatDateRange,\n formatPositionDateRange,\n formatTimelineDate,\n} from './timeline.js';\nexport {\n collapseContributors,\n type CollapseContributorsOptions,\n type CollapsedContributors,\n} from './collapse-contributors.js';\nexport {\n summarizePresentationDeliveries,\n type PresentationDeliverySummary,\n} from './summarize-deliveries.js';\nexport {\n certDateExtractor,\n dateRangeExtractor,\n lexiconDateExtractor,\n singleDateExtractor,\n sortByDateDesc,\n} from './sort-by-date.js';\nexport { normalizeDoi } from './doi.js';\nexport { openAlexWorkUrl } from './openalex.js';\nexport { blobProxyUrl, type BlobProxyVariant } from './blob-proxy-url.js';\nexport {\n formatRelationship,\n parseEndorsementComment,\n type ParsedEndorsementComment,\n} from './endorsement-context.js';\nexport { sanitizeHandleInput } from './handle-utils.js';\nexport { countryCodeToFlag, formatLocation, parseLocationString } from './location-utils.js';\nexport { locationSegments } from './location-segments.js';\nexport type {\n LocationSegment,\n LocationSegmentKind,\n LocationSegmentsOptions,\n} from './location-segments.js';\nexport {\n detectPdsProvider,\n formatStructuredName,\n getDisplayLabel,\n getHandleStem,\n getPdsDisplayName,\n pdsProviderFromApi,\n type PdsProvider,\n} from './pds-utils.js';\nexport { resolveEmbed, youtubeVideoId, youtubeThumbnailUrl, type EmbedResult } from './embed.js';\nexport { buildTalkSlug, parseTalkRkey, slugifyTitle } from './talk-slug.js';\nexport { buildMetaDescription } from './meta-description.js';\nexport type { MetaDescriptionInput, MetaDescriptionPosition } from './meta-description.js';\nexport { limitCombiningMarks, sanitizeDisplayText } from './text-sanitize.js';\nexport { truncateGraphemes } from './text-truncate.js';\nexport { formatDisplayUrl } from './format-display-url.js';\nexport type { DisplayUrl, FormatDisplayUrlOptions, UrlPathPolicy } from './format-display-url.js';\nexport { formatDistanceToNow } from './time-utils.js';\nexport {\n contrastRatio,\n isValidRgbColor,\n meetsContrastAA,\n relativeLuminance,\n rgbToString,\n type RgbColor,\n} from './wcag-contrast.js';\n"],"mappings":";AAAA,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,2BAA2B;AACpC,SAAS,gBAAgB,0BAA0B;AACnD,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAC7B,SAAS,uBAAuB;AAChC,SAAS,oBAA2C;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,2BAA2B;AACpC,SAAS,mBAAmB,gBAAgB,2BAA2B;AACvE,SAAS,wBAAwB;AAMjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,cAAc,gBAAgB,2BAA6C;AACpF,SAAS,eAAe,eAAe,oBAAoB;AAC3D,SAAS,4BAA4B;AAErC,SAAS,qBAAqB,2BAA2B;AACzD,SAAS,yBAAyB;AAClC,SAAS,wBAAwB;AAEjC,SAAS,2BAA2B;AACpC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -2987,6 +2987,20 @@ function openAlexWorkUrl(id) {
|
|
|
2987
2987
|
return match ? `https://openalex.org/${match[1]}` : void 0;
|
|
2988
2988
|
}
|
|
2989
2989
|
|
|
2990
|
+
// src/jsonld/url.ts
|
|
2991
|
+
var DEFAULT_BASE_URL = "https://sifa.id";
|
|
2992
|
+
function normaliseBaseUrl(baseUrl) {
|
|
2993
|
+
const value = baseUrl ?? DEFAULT_BASE_URL;
|
|
2994
|
+
let end = value.length;
|
|
2995
|
+
while (end > 0 && value.charCodeAt(end - 1) === 47) end -= 1;
|
|
2996
|
+
return value.slice(0, end);
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// src/format/blob-proxy-url.ts
|
|
3000
|
+
function blobProxyUrl(baseUrl, did, cid, variant) {
|
|
3001
|
+
return `${normaliseBaseUrl(baseUrl)}/api/blob/${encodeURIComponent(did)}/${encodeURIComponent(cid)}?v=${variant}`;
|
|
3002
|
+
}
|
|
3003
|
+
|
|
2990
3004
|
// src/format/endorsement-context.ts
|
|
2991
3005
|
var RELATIONSHIP_PREFIX = /^\[(\w+?)(?:: ([^\]]+))?\]\s*/;
|
|
2992
3006
|
function formatRelationship(type, detail) {
|
|
@@ -4869,7 +4883,8 @@ var streamMediaBlobSchema = zod.z.object({
|
|
|
4869
4883
|
cid: zod.z.string(),
|
|
4870
4884
|
alt: zod.z.string(),
|
|
4871
4885
|
aspectRatio: aspectRatioSchema.optional(),
|
|
4872
|
-
mimeType: zod.z.string().optional()
|
|
4886
|
+
mimeType: zod.z.string().optional(),
|
|
4887
|
+
size: zod.z.number().int().nonnegative().optional()
|
|
4873
4888
|
});
|
|
4874
4889
|
var streamMediaSchema = zod.z.union([
|
|
4875
4890
|
streamMediaResolvedSchema,
|
|
@@ -5137,6 +5152,9 @@ function aspectRatio(value) {
|
|
|
5137
5152
|
function asFiniteNumber(value) {
|
|
5138
5153
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
5139
5154
|
}
|
|
5155
|
+
function asByteSize(value) {
|
|
5156
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
5157
|
+
}
|
|
5140
5158
|
function looseBlobCid(value) {
|
|
5141
5159
|
const viaRef = blobCid(value);
|
|
5142
5160
|
if (viaRef) return viaRef;
|
|
@@ -5151,6 +5169,8 @@ function blobMedia(value, did, alt) {
|
|
|
5151
5169
|
if (ratio) media.aspectRatio = ratio;
|
|
5152
5170
|
const mimeType = asNonEmptyString(asRecord(value)?.mimeType);
|
|
5153
5171
|
if (mimeType) media.mimeType = mimeType;
|
|
5172
|
+
const size = asByteSize(asRecord(value)?.size);
|
|
5173
|
+
if (size !== void 0) media.size = size;
|
|
5154
5174
|
return media;
|
|
5155
5175
|
}
|
|
5156
5176
|
function hashSuffix(value) {
|
|
@@ -5312,6 +5332,8 @@ function bskyImages(embed, did) {
|
|
|
5312
5332
|
if (ratio) media.aspectRatio = ratio;
|
|
5313
5333
|
const mimeType = asNonEmptyString(asRecord(img.image)?.mimeType);
|
|
5314
5334
|
if (mimeType) media.mimeType = mimeType;
|
|
5335
|
+
const size = asByteSize(asRecord(img.image)?.size);
|
|
5336
|
+
if (size !== void 0) media.size = size;
|
|
5315
5337
|
out.push(media);
|
|
5316
5338
|
}
|
|
5317
5339
|
return out;
|
|
@@ -5700,9 +5722,13 @@ function genericMedia(record, did, alt) {
|
|
|
5700
5722
|
}
|
|
5701
5723
|
const single = blobMedia(record.image, did, alt) ?? blobMedia(record.thumbnail, did, alt) ?? blobMedia(record.thumb, did, alt) ?? blobMedia(record.photo, did, alt) ?? (embed ? blobMedia(embed.thumbnail, did, alt) : void 0);
|
|
5702
5724
|
if (single) return [single];
|
|
5703
|
-
const
|
|
5725
|
+
const galleryMeta = asRecord(record.galleryMeta);
|
|
5726
|
+
const coverCid = galleryMeta?.coverPhotoCid;
|
|
5704
5727
|
if (typeof coverCid === "string" && coverCid.length > 0) {
|
|
5705
|
-
|
|
5728
|
+
const cover = { did, cid: coverCid, alt };
|
|
5729
|
+
const size = asByteSize(galleryMeta?.coverPhotoSize);
|
|
5730
|
+
if (size !== void 0) cover.size = size;
|
|
5731
|
+
return [cover];
|
|
5706
5732
|
}
|
|
5707
5733
|
return [];
|
|
5708
5734
|
}
|
|
@@ -7628,7 +7654,7 @@ function describeSifaRecord(collection, value) {
|
|
|
7628
7654
|
}
|
|
7629
7655
|
|
|
7630
7656
|
// src/index.ts
|
|
7631
|
-
var SIFA_SDK_VERSION = "0.19.
|
|
7657
|
+
var SIFA_SDK_VERSION = "0.19.87";
|
|
7632
7658
|
|
|
7633
7659
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
7634
7660
|
exports.ACTIVITY_VERBS = ACTIVITY_VERBS;
|
|
@@ -7768,6 +7794,7 @@ exports.WORKPLACE_TYPE_OPTIONS = WORKPLACE_TYPE_OPTIONS;
|
|
|
7768
7794
|
exports.actorShowsIdentity = actorShowsIdentity;
|
|
7769
7795
|
exports.agentRefSchema = agentRefSchema;
|
|
7770
7796
|
exports.atUriSchema = atUriSchema;
|
|
7797
|
+
exports.blobProxyUrl = blobProxyUrl;
|
|
7771
7798
|
exports.buildMetaDescription = buildMetaDescription;
|
|
7772
7799
|
exports.buildProfileHighlights = buildProfileHighlights;
|
|
7773
7800
|
exports.buildTalkSlug = buildTalkSlug;
|