Skip to content

Commit 4ea6fe8

Browse files
holkexyzaspiers
authored andcommitted
add richtext facet for descriptions of activity claim
1 parent 167d0c0 commit 4ea6fe8

File tree

7 files changed

+70
-16
lines changed

7 files changed

+70
-16
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@hypercerts-org/lexicon": minor
3+
---
4+
5+
Add rich text facet support to activity claim descriptions
6+
7+
Add `shortDescriptionFacets` and `descriptionFacets` fields to the activity lexicon to support rich text annotations (mentions, URLs, hashtags, etc.) in activity claim descriptions.

SCHEMAS.md

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@ Hypercerts-specific lexicons for tracking impact work and claims.
1515

1616
#### Properties
1717

18-
| Property | Type | Required | Description | Comments |
19-
| ------------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
20-
| `title` | `string` | yes | Title of the hypercert. | maxLength: 256 |
21-
| `shortDescription` | `string` | yes | Short blurb of the impact work done. | maxLength: 3000, maxGraphemes: 300 |
22-
| `description` | `string` | no | Optional longer description of the impact work done. | maxLength: 30000, maxGraphemes: 3000 |
23-
| `image` | `union` | no | The hypercert visual representation as a URI or image blob. | |
24-
| `workScope` | `ref` | no | A strong reference to a record defining the scope of work. The record referenced should describe the logical scope using label-based conditions. | |
25-
| `startDate` | `string` | no | When the work began | |
26-
| `endDate` | `string` | no | When the work ended | |
27-
| `contributors` | `ref` | no | An array of contributor objects, each containing contributor information, weight, and contribution details. | |
28-
| `rights` | `ref` | no | A strong reference to the rights that this hypercert has. The record referenced must conform with the lexicon org.hypercerts.claim.rights. | |
29-
| `locations` | `ref` | no | An array of strong references to the location where activity was performed. The record referenced must conform with the lexicon app.certified.location. | |
30-
| `createdAt` | `string` | yes | Client-declared timestamp when this record was originally created | |
18+
| Property | Type | Required | Description | Comments |
19+
| ------------------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ |
20+
| `title` | `string` | yes | Title of the hypercert. | maxLength: 256 |
21+
| `shortDescription` | `string` | yes | Short summary of this activity claim, suitable for previews and list views. Rich text annotations may be provided via `shortDescriptionFacets`. | maxLength: 3000, maxGraphemes: 300 |
22+
| `shortDescriptionFacets` | `ref` | no | Rich text annotations for `shortDescription` (mentions, URLs, hashtags, etc). | |
23+
| `description` | `string` | no | Optional longer description of this activity claim, including context or interpretation. Rich text annotations may be provided via `descriptionFacets`. | maxLength: 30000, maxGraphemes: 3000 |
24+
| `descriptionFacets` | `ref` | no | Rich text annotations for `description` (mentions, URLs, hashtags, etc). | |
25+
| `image` | `union` | no | The hypercert visual representation as a URI or image blob. | |
26+
| `workScope` | `ref` | no | A strong reference to a record defining the scope of work. The record referenced should describe the logical scope using label-based conditions. | |
27+
| `startDate` | `string` | no | When the work began | |
28+
| `endDate` | `string` | no | When the work ended | |
29+
| `contributors` | `ref` | no | An array of contributor objects, each containing contributor information, weight, and contribution details. | |
30+
| `rights` | `ref` | no | A strong reference to the rights that this hypercert has. The record referenced must conform with the lexicon org.hypercerts.claim.rights. | |
31+
| `locations` | `ref` | no | An array of strong references to the location where activity was performed. The record referenced must conform with the lexicon app.certified.location. | |
32+
| `createdAt` | `string` | yes | Client-declared timestamp when this record was originally created | |
3133

3234
#### Defs
3335

lexicons/org/hypercerts/claim/activity.json

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,32 @@
1717
},
1818
"shortDescription": {
1919
"type": "string",
20-
"description": "Short blurb of the impact work done.",
20+
"description": "Short summary of this activity claim, suitable for previews and list views. Rich text annotations may be provided via `shortDescriptionFacets`.",
2121
"maxLength": 3000,
2222
"maxGraphemes": 300
2323
},
24+
"shortDescriptionFacets": {
25+
"type": "array",
26+
"description": "Rich text annotations for `shortDescription` (mentions, URLs, hashtags, etc).",
27+
"items": {
28+
"type": "ref",
29+
"ref": "app.bsky.richtext.facet"
30+
}
31+
},
2432
"description": {
2533
"type": "string",
26-
"description": "Optional longer description of the impact work done.",
34+
"description": "Optional longer description of this activity claim, including context or interpretation. Rich text annotations may be provided via `descriptionFacets`.",
2735
"maxLength": 30000,
2836
"maxGraphemes": 3000
2937
},
38+
"descriptionFacets": {
39+
"type": "array",
40+
"description": "Rich text annotations for `description` (mentions, URLs, hashtags, etc).",
41+
"items": {
42+
"type": "ref",
43+
"ref": "app.bsky.richtext.facet"
44+
}
45+
},
3046
"image": {
3147
"type": "union",
3248
"refs": [

package-lock.json

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"prepare": "husky && ./scripts/setup-merge-driver.sh"
6565
},
6666
"dependencies": {
67+
"@atcute/bluesky": "^3.2.15",
6768
"@atcute/leaflet": "^1.0.15",
6869
"@atproto/lexicon": "^0.6.0",
6970
"multiformats": "^13.3.6"

scripts/create-shims.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,24 @@
33

44
# @atcute/leaflet - Leaflet document types
55
mkdir -p ./generated/types/pub/leaflet/pages
6-
cat > ./generated/types/pub/leaflet/pages/linearDocument.ts << 'EOF'
6+
cat >./generated/types/pub/leaflet/pages/linearDocument.ts <<'EOF'
77
// Type shim for @atcute/leaflet external lexicons
88
// This allows our generated code to resolve Leaflet type references
99
export * from '@atcute/leaflet/types/pages/linearDocument';
1010
EOF
1111

12+
# app.bsky.richtext.facet - ATProto richtext facet types
13+
mkdir -p ./generated/types/app/bsky/richtext
14+
cat >./generated/types/app/bsky/richtext/facet.ts <<'EOF'
15+
// Type shim for app.bsky.richtext.facet lexicon
16+
// Re-exports from @atcute/bluesky which provides ATProto standard lexicon types
17+
import type { AppBskyRichtextFacet } from '@atcute/bluesky';
18+
export type { AppBskyRichtextFacet };
19+
export type Main = AppBskyRichtextFacet.Main;
20+
export type ByteSlice = AppBskyRichtextFacet.ByteSlice;
21+
export type Link = AppBskyRichtextFacet.Link;
22+
export type Mention = AppBskyRichtextFacet.Mention;
23+
export type Tag = AppBskyRichtextFacet.Tag;
24+
EOF
25+
1226
echo "Created type shims for external lexicons"

tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"paths": {
2020
"../../../pub/leaflet/pages/*": [
2121
"./node_modules/@atcute/leaflet/lib/lexicons/types/pub/leaflet/pages/*"
22+
],
23+
"../../../app/bsky/richtext/facet": [
24+
"./generated/types/app/bsky/richtext/facet"
2225
]
2326
}
2427
},

0 commit comments

Comments
 (0)