diff --git a/.changeset/add-post-lexicon.md b/.changeset/add-post-lexicon.md new file mode 100644 index 00000000..da2e5814 --- /dev/null +++ b/.changeset/add-post-lexicon.md @@ -0,0 +1,5 @@ +--- +"@hypercerts-org/lexicon": minor +--- + +Add org.hypercerts.claim.post lexicon for updates, reports, and comments on hypercerts records diff --git a/ERD.puml b/ERD.puml index 753bb797..dcb94a39 100644 --- a/ERD.puml +++ b/ERD.puml @@ -242,6 +242,19 @@ dataclass collection { !endif } +' org.hypercerts.claim.post +dataclass post { + !if (SHOW_FIELDS == "true") + text + replies[]? + embed? + labels? + tags[]? + attachments[]? + createdAt + !endif +} + ' org.hypercerts.context.acknowledgement dataclass acknowledgement { !if (SHOW_FIELDS == "true") @@ -384,6 +397,9 @@ fundingReceipt::to --> contributorEntity fundingReceipt::for --> activity : funds +post::replies --> activity : "replies to" +post::replies --> collection : "replies to" + badgeAward::badge --> badgeDefinition badgeResponse::badgeAward --> badgeAward badgeAward::subject --> contributorInformation diff --git a/SCHEMAS.md b/SCHEMAS.md index b433ccf1..4313f481 100644 --- a/SCHEMAS.md +++ b/SCHEMAS.md @@ -95,6 +95,36 @@ Hypercerts-specific lexicons for tracking impact work and claims. --- +### `org.hypercerts.claim.post` + +**Description:** Record containing a hypercerts post, e.g. an update, a report, a comment. + +**Key:** `tid` + +#### Properties + +| Property | Type | Required | Description | Comments | +| ------------- | ---------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| `text` | `string` | ❌ | The primary post content. May be an empty string, if there are embeds. | maxLength: 50000, maxGraphemes: 5000 | +| `facets` | `ref[]` | ❌ | Annotations of text (mentions, URLs, hashtags, etc.) | | +| `replies` | `ref[]` | ❌ | The subjects that this post is in reply to. Each entry identifies a thread root and the direct parent being replied to. | maxLength: 10 | +| `embed` | `union` | ❌ | The primary featured media for this post (images, video, external link, or quoted record). | | +| `labels` | `union` | ❌ | Self-label values for this post. Effectively content warnings. | | +| `tags` | `string[]` | ❌ | Additional hashtags, in addition to any included in post text and facets. | maxLength: 8 | +| `attachments` | `union[]` | ❌ | The files, documents, or external references attached to this post. | maxLength: 100 | +| `createdAt` | `string` | ✅ | Client-declared timestamp when this post was originally created. | | + +#### Defs + +##### `org.hypercerts.claim.post#replyRef` + +| Property | Type | Required | Description | +| -------- | ----- | -------- | ------------------------------------------------------------------------------------------ | +| `root` | `ref` | ✅ | The root record of the thread being replied to. | +| `parent` | `ref` | ✅ | The direct parent record being replied to (may be the same as root for top-level replies). | + +--- + ### `org.hypercerts.claim.rights` **Description:** Describes the rights that a contributor and/or an owner has, such as whether the hypercert can be sold, transferred, and under what conditions. diff --git a/lexicons/org/hypercerts/claim/post.json b/lexicons/org/hypercerts/claim/post.json new file mode 100644 index 00000000..b8dc654e --- /dev/null +++ b/lexicons/org/hypercerts/claim/post.json @@ -0,0 +1,90 @@ +{ + "lexicon": 1, + "id": "org.hypercerts.claim.post", + "defs": { + "main": { + "type": "record", + "description": "Record containing a hypercerts post, e.g. an update, a report, a comment.", + "key": "tid", + "record": { + "type": "object", + "required": ["createdAt"], + "properties": { + "text": { + "type": "string", + "maxLength": 50000, + "maxGraphemes": 5000, + "description": "The primary post content. May be an empty string, if there are embeds." + }, + "facets": { + "type": "array", + "description": "Annotations of text (mentions, URLs, hashtags, etc.)", + "items": { "type": "ref", "ref": "app.bsky.richtext.facet" } + }, + "replies": { + "type": "array", + "description": "The subjects that this post is in reply to. Each entry identifies a thread root and the direct parent being replied to.", + "items": { "type": "ref", "ref": "#replyRef" }, + "maxLength": 10 + }, + "embed": { + "type": "union", + "description": "The primary featured media for this post (images, video, external link, or quoted record).", + "refs": [ + "app.bsky.embed.images", + "app.bsky.embed.video", + "app.bsky.embed.external", + "app.bsky.embed.record", + "app.bsky.embed.recordWithMedia" + ] + }, + "labels": { + "type": "union", + "description": "Self-label values for this post. Effectively content warnings.", + "refs": ["com.atproto.label.defs#selfLabels"] + }, + "tags": { + "type": "array", + "description": "Additional hashtags, in addition to any included in post text and facets.", + "maxLength": 8, + "items": { "type": "string", "maxLength": 640, "maxGraphemes": 64 } + }, + "attachments": { + "type": "array", + "description": "The files, documents, or external references attached to this post.", + "items": { + "type": "union", + "refs": [ + "org.hypercerts.defs#uri", + "org.hypercerts.defs#smallBlob" + ] + }, + "maxLength": 100 + }, + "createdAt": { + "type": "string", + "format": "datetime", + "description": "Client-declared timestamp when this post was originally created." + } + } + } + }, + "replyRef": { + "type": "object", + "description": "Identifies the thread root and direct parent that this post is replying to.", + "required": ["root", "parent"], + "properties": { + "root": { + "type": "ref", + "ref": "com.atproto.repo.strongRef", + "description": "The root record of the thread being replied to." + }, + "parent": { + "type": "ref", + "ref": "com.atproto.repo.strongRef", + "description": "The direct parent record being replied to (may be the same as root for top-level replies)." + } + } + } + } +} diff --git a/scripts/create-shims.sh b/scripts/create-shims.sh index 265666d7..a2acb620 100755 --- a/scripts/create-shims.sh +++ b/scripts/create-shims.sh @@ -23,4 +23,66 @@ export type Mention = AppBskyRichtextFacet.Mention; export type Tag = AppBskyRichtextFacet.Tag; EOF +# app.bsky.embed.* - Bluesky embed types +mkdir -p ./generated/types/app/bsky/embed +cat >./generated/types/app/bsky/embed/images.ts <<'EOF' +// Type shim for app.bsky.embed.images lexicon +import type { AppBskyEmbedImages } from '@atcute/bluesky'; +export type { AppBskyEmbedImages }; +export type Main = AppBskyEmbedImages.Main; +export type Image = AppBskyEmbedImages.Image; +export type View = AppBskyEmbedImages.View; +export type ViewImage = AppBskyEmbedImages.ViewImage; +EOF + +cat >./generated/types/app/bsky/embed/video.ts <<'EOF' +// Type shim for app.bsky.embed.video lexicon +import type { AppBskyEmbedVideo } from '@atcute/bluesky'; +export type { AppBskyEmbedVideo }; +export type Main = AppBskyEmbedVideo.Main; +export type Caption = AppBskyEmbedVideo.Caption; +export type View = AppBskyEmbedVideo.View; +EOF + +cat >./generated/types/app/bsky/embed/external.ts <<'EOF' +// Type shim for app.bsky.embed.external lexicon +import type { AppBskyEmbedExternal } from '@atcute/bluesky'; +export type { AppBskyEmbedExternal }; +export type Main = AppBskyEmbedExternal.Main; +export type External = AppBskyEmbedExternal.External; +export type View = AppBskyEmbedExternal.View; +export type ViewExternal = AppBskyEmbedExternal.ViewExternal; +EOF + +cat >./generated/types/app/bsky/embed/record.ts <<'EOF' +// Type shim for app.bsky.embed.record lexicon +import type { AppBskyEmbedRecord } from '@atcute/bluesky'; +export type { AppBskyEmbedRecord }; +export type Main = AppBskyEmbedRecord.Main; +export type View = AppBskyEmbedRecord.View; +export type ViewBlocked = AppBskyEmbedRecord.ViewBlocked; +export type ViewDetached = AppBskyEmbedRecord.ViewDetached; +export type ViewNotFound = AppBskyEmbedRecord.ViewNotFound; +export type ViewRecord = AppBskyEmbedRecord.ViewRecord; +EOF + +cat >./generated/types/app/bsky/embed/recordWithMedia.ts <<'EOF' +// Type shim for app.bsky.embed.recordWithMedia lexicon +import type { AppBskyEmbedRecordWithMedia } from '@atcute/bluesky'; +export type { AppBskyEmbedRecordWithMedia }; +export type Main = AppBskyEmbedRecordWithMedia.Main; +export type View = AppBskyEmbedRecordWithMedia.View; +EOF + +# com.atproto.label.defs - ATProto label types +mkdir -p ./generated/types/com/atproto/label +cat >./generated/types/com/atproto/label/defs.ts <<'EOF' +// Type shim for com.atproto.label.defs lexicon +import type { ComAtprotoLabelDefs } from '@atcute/atproto'; +export type { ComAtprotoLabelDefs }; +export type SelfLabels = ComAtprotoLabelDefs.SelfLabels; +export type SelfLabel = ComAtprotoLabelDefs.SelfLabel; +export type Label = ComAtprotoLabelDefs.Label; +EOF + echo "Created type shims for external lexicons"