a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm

feat(tangled): iniitial commit

mary.my.id e17c37fa 351a6522

verified
+1
README.md
··· 50 50 | [`bluesky`](./packages/definitions/bluesky): `app.bsky.*` and `chat.bsky.*` schema definitions | 51 51 | [`frontpage`](./packages/definitions/frontpage): `fyi.unravel.frontpage.*` schema definitions | 52 52 | [`ozone`](./packages/definitions/ozone): `tools.ozone.*` schema definitions | 53 + | [`tangled`]('./packages/definitions/tangled): `sh.tangled.*` schema definitions | 53 54 | [`whitewind`](./packages/definitions/whitewind): `com.whtwnd.*` schema definitions | 54 55 | **Utility packages** | 55 56 | [`car`](./packages/utilities/car): DASL CAR and atproto repository decoder |
+1
lexicons-tangled/README.md
··· 1 + https://github.com/mary-ext/tangled.sh-mirror/tree/86daf8e3a3304bed263606faa6aa7b9941fbad72/lexicons
+70
lexicons-tangled/actor/profile.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.actor.profile", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A declaration of a Tangled account profile.", 8 + "key": "literal:self", 9 + "record": { 10 + "type": "object", 11 + "required": ["bluesky"], 12 + "properties": { 13 + "description": { 14 + "type": "string", 15 + "description": "Free-form profile description text.", 16 + "maxGraphemes": 256, 17 + "maxLength": 2560 18 + }, 19 + "links": { 20 + "type": "array", 21 + "minLength": 0, 22 + "maxLength": 5, 23 + "items": { 24 + "type": "string", 25 + "description": "Any URI, intended for social profiles or websites, can be used to link DIDs/AT-URIs too.", 26 + "format": "uri" 27 + } 28 + }, 29 + "stats": { 30 + "type": "array", 31 + "minLength": 0, 32 + "maxLength": 2, 33 + "items": { 34 + "type": "string", 35 + "description": "Vanity stats.", 36 + "enum": [ 37 + "merged-pull-request-count", 38 + "closed-pull-request-count", 39 + "open-pull-request-count", 40 + "open-issue-count", 41 + "closed-issue-count", 42 + "repository-count" 43 + ] 44 + } 45 + }, 46 + "bluesky": { 47 + "type": "boolean", 48 + "description": "Include link to this account on Bluesky." 49 + }, 50 + "location": { 51 + "type": "string", 52 + "description": "Free-form location text.", 53 + "maxGraphemes": 40, 54 + "maxLength": 400 55 + }, 56 + "pinnedRepositories": { 57 + "type": "array", 58 + "description": "Any ATURI, it is up to appviews to validate these fields.", 59 + "minLength": 0, 60 + "maxLength": 6, 61 + "items": { 62 + "type": "string", 63 + "format": "at-uri" 64 + } 65 + } 66 + } 67 + } 68 + } 69 + } 70 + }
+44
lexicons-tangled/artifact.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.artifact", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["name", "repo", "tag", "createdAt", "artifact"], 13 + "properties": { 14 + "name": { 15 + "type": "string", 16 + "description": "name of the artifact" 17 + }, 18 + "repo": { 19 + "type": "string", 20 + "format": "at-uri", 21 + "description": "repo that this artifact is being uploaded to" 22 + }, 23 + "tag": { 24 + "type": "bytes", 25 + "description": "hash of the tag object that this artifact is attached to (only annotated tags are supported)", 26 + "minLength": 20, 27 + "maxLength": 20 28 + }, 29 + "createdAt": { 30 + "type": "string", 31 + "format": "datetime", 32 + "description": "time of creation of this artifact" 33 + }, 34 + "artifact": { 35 + "type": "blob", 36 + "description": "the artifact", 37 + "accept": ["*/*"], 38 + "maxSize": 52428800 39 + } 40 + } 41 + } 42 + } 43 + } 44 + }
+26
lexicons-tangled/feed/star.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.feed.star", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["subject", "createdAt"], 13 + "properties": { 14 + "subject": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "createdAt": { 19 + "type": "string", 20 + "format": "datetime" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+26
lexicons-tangled/graph/follow.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.graph.follow", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["subject", "createdAt"], 13 + "properties": { 14 + "subject": { 15 + "type": "string", 16 + "format": "did" 17 + }, 18 + "createdAt": { 19 + "type": "string", 20 + "format": "datetime" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+12
lexicons-tangled/issue/closed.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.issue.state.closed", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "token", 9 + "description": "closed issue" 10 + } 11 + } 12 + }
+40
lexicons-tangled/issue/comment.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.issue.comment", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["issue", "body", "createdAt"], 13 + "properties": { 14 + "issue": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "repo": { 19 + "type": "string", 20 + "format": "at-uri" 21 + }, 22 + "commentId": { 23 + "type": "integer" 24 + }, 25 + "owner": { 26 + "type": "string", 27 + "format": "did" 28 + }, 29 + "body": { 30 + "type": "string" 31 + }, 32 + "createdAt": { 33 + "type": "string", 34 + "format": "datetime" 35 + } 36 + } 37 + } 38 + } 39 + } 40 + }
+39
lexicons-tangled/issue/issue.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.issue", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["repo", "issueId", "owner", "title", "createdAt"], 13 + "properties": { 14 + "repo": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "issueId": { 19 + "type": "integer" 20 + }, 21 + "owner": { 22 + "type": "string", 23 + "format": "did" 24 + }, 25 + "title": { 26 + "type": "string" 27 + }, 28 + "body": { 29 + "type": "string" 30 + }, 31 + "createdAt": { 32 + "type": "string", 33 + "format": "datetime" 34 + } 35 + } 36 + } 37 + } 38 + } 39 + }
+12
lexicons-tangled/issue/open.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.issue.state.open", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "token", 9 + "description": "open issue" 10 + } 11 + } 12 + }
+28
lexicons-tangled/issue/state.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.issue.state", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["issue", "state"], 13 + "properties": { 14 + "issue": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "state": { 19 + "type": "string", 20 + "description": "state of the issue", 21 + "knownValues": ["sh.tangled.repo.issue.state.open", "sh.tangled.repo.issue.state.closed"], 22 + "default": "sh.tangled.repo.issue.state.open" 23 + } 24 + } 25 + } 26 + } 27 + } 28 + }
+30
lexicons-tangled/knot/member.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.knot.member", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["subject", "domain", "createdAt"], 13 + "properties": { 14 + "subject": { 15 + "type": "string", 16 + "format": "did" 17 + }, 18 + "domain": { 19 + "type": "string", 20 + "description": "domain that this member now belongs to" 21 + }, 22 + "createdAt": { 23 + "type": "string", 24 + "format": "datetime" 25 + } 26 + } 27 + } 28 + } 29 + } 30 + }
+32
lexicons-tangled/publicKey.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.publicKey", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["key", "name", "createdAt"], 13 + "properties": { 14 + "key": { 15 + "type": "string", 16 + "maxLength": 4096, 17 + "description": "public key contents" 18 + }, 19 + "name": { 20 + "type": "string", 21 + "description": "human-readable name for this key" 22 + }, 23 + "createdAt": { 24 + "type": "string", 25 + "format": "datetime", 26 + "description": "key upload timestamp" 27 + } 28 + } 29 + } 30 + } 31 + } 32 + }
+12
lexicons-tangled/pulls/closed.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull.status.closed", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "token", 9 + "description": "closed pull request" 10 + } 11 + } 12 + }
+40
lexicons-tangled/pulls/comment.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull.comment", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["pull", "body", "createdAt"], 13 + "properties": { 14 + "pull": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "repo": { 19 + "type": "string", 20 + "format": "at-uri" 21 + }, 22 + "commentId": { 23 + "type": "integer" 24 + }, 25 + "owner": { 26 + "type": "string", 27 + "format": "did" 28 + }, 29 + "body": { 30 + "type": "string" 31 + }, 32 + "createdAt": { 33 + "type": "string", 34 + "format": "datetime" 35 + } 36 + } 37 + } 38 + } 39 + } 40 + }
+12
lexicons-tangled/pulls/merged.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull.status.merged", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "token", 9 + "description": "merged pull request" 10 + } 11 + } 12 + }
+12
lexicons-tangled/pulls/open.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull.status.open", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "token", 9 + "description": "open pull request" 10 + } 11 + } 12 + }
+58
lexicons-tangled/pulls/pull.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["targetRepo", "targetBranch", "pullId", "title", "patch", "createdAt"], 13 + "properties": { 14 + "targetRepo": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "targetBranch": { 19 + "type": "string" 20 + }, 21 + "pullId": { 22 + "type": "integer" 23 + }, 24 + "title": { 25 + "type": "string" 26 + }, 27 + "body": { 28 + "type": "string" 29 + }, 30 + "patch": { 31 + "type": "string" 32 + }, 33 + "source": { 34 + "type": "ref", 35 + "ref": "#source" 36 + }, 37 + "createdAt": { 38 + "type": "string", 39 + "format": "datetime" 40 + } 41 + } 42 + } 43 + }, 44 + "source": { 45 + "type": "object", 46 + "required": ["branch"], 47 + "properties": { 48 + "branch": { 49 + "type": "string" 50 + }, 51 + "repo": { 52 + "type": "string", 53 + "format": "at-uri" 54 + } 55 + } 56 + } 57 + } 58 + }
+32
lexicons-tangled/pulls/state.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo.pull.status", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["pull", "status"], 13 + "properties": { 14 + "pull": { 15 + "type": "string", 16 + "format": "at-uri" 17 + }, 18 + "status": { 19 + "type": "string", 20 + "description": "status of the pull request", 21 + "knownValues": [ 22 + "sh.tangled.repo.pull.status.open", 23 + "sh.tangled.repo.pull.status.closed", 24 + "sh.tangled.repo.pull.status.merged" 25 + ], 26 + "default": "sh.tangled.repo.pull.status.open" 27 + } 28 + } 29 + } 30 + } 31 + } 32 + }
+45
lexicons-tangled/repo.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "sh.tangled.repo", 4 + "needsCbor": true, 5 + "needsType": true, 6 + "defs": { 7 + "main": { 8 + "type": "record", 9 + "key": "tid", 10 + "record": { 11 + "type": "object", 12 + "required": ["name", "knot", "owner", "createdAt"], 13 + "properties": { 14 + "name": { 15 + "type": "string", 16 + "description": "name of the repo" 17 + }, 18 + "owner": { 19 + "type": "string", 20 + "format": "did" 21 + }, 22 + "knot": { 23 + "type": "string", 24 + "description": "knot where the repo was created" 25 + }, 26 + "description": { 27 + "type": "string", 28 + "format": "datetime", 29 + "minGraphemes": 1, 30 + "maxGraphemes": 140 31 + }, 32 + "source": { 33 + "type": "string", 34 + "format": "uri", 35 + "description": "source of the repo" 36 + }, 37 + "createdAt": { 38 + "type": "string", 39 + "format": "datetime" 40 + } 41 + } 42 + } 43 + } 44 + } 45 + }
+1
package.json
··· 5 5 "pull": "node ./scripts/pull-lexicons.js", 6 6 "pull:bluemoji": "node ./scripts/pull-bluemoji-lexicons.js", 7 7 "pull:frontpage": "node ./scripts/pull-frontpage-lexicons.js", 8 + "pull:tangled": "node ./scripts/pull-tangled-lexicons.js", 8 9 "pull:whtwnd": "node ./scripts/pull-whtwnd-lexicons.js", 9 10 "fmt": "prettier --cache --write ." 10 11 },
+47
packages/definitions/tangled/README.md
··· 1 + # @atcute/tangled 2 + 3 + [Tangled](https://tangled.sh/) (sh.tangled.\*) schema definitions 4 + 5 + ## usage 6 + 7 + ```ts 8 + import { ShTangledRepoPullComment } from '@atcute/tangled'; 9 + import { is } from '@atcute/lexicons'; 10 + 11 + const comment: ShTangledRepoPullComment.Main = { 12 + $type: 'sh.tangled.repo.pull.comment', 13 + repo: 'at://did:plc:wshs7t2adsemcrrd4snkeqli/sh.tangled.repo/3liuighjy2h22', 14 + pull: 'at://did:plc:ia76kvnndjutgedggx2ibrem/sh.tangled.repo.pull/3lp3tg57oyv22', 15 + owner: 'did:plc:ia76kvnndjutgedggx2ibrem', 16 + createdAt: '2025-05-14T01:29:08Z', 17 + body: 'not sure what went wrong with that first round (probably pasted the diffs wrong) but I think this should work', 18 + }; 19 + 20 + is(ShTangledRepoPullComment.mainSchema, comment); 21 + // -> true 22 + ``` 23 + 24 + ### with `@atcute/client` 25 + 26 + pick either one of these 3 options to register the ambient declarations 27 + 28 + ```jsonc 29 + // tsconfig.json 30 + { 31 + "compilerOptions": { 32 + "types": ["@atcute/tangled"], 33 + }, 34 + } 35 + ``` 36 + 37 + ```ts 38 + // env.d.ts 39 + /// <reference types="@atcute/tangled" /> 40 + ``` 41 + 42 + ```ts 43 + // index.ts 44 + import type {} from '@atcute/tangled'; 45 + ``` 46 + 47 + now all the XRPC operations should be visible in the client
+15
packages/definitions/tangled/lex.config.js
··· 1 + import { defineLexiconConfig } from '@atcute/lex-cli'; 2 + 3 + export default defineLexiconConfig({ 4 + files: ['../../../lexicons-tangled/**/*.json'], 5 + outdir: 'lib/lexicons/', 6 + mappings: [ 7 + // { 8 + // nsid: ['com.atproto.*'], 9 + // imports: (nsid) => { 10 + // const specifier = nsid.slice('com.atproto.'.length).replaceAll('.', '/'); 11 + // return { type: 'namespace', from: `@atcute/atproto/types/${specifier}` }; 12 + // }, 13 + // }, 14 + ], 15 + });
+1
packages/definitions/tangled/lib/index.ts
··· 1 + export * from './lexicons/index.js';
+18
packages/definitions/tangled/lib/lexicons/index.ts
··· 1 + export * as ShTangledActorProfile from './types/sh/tangled/actor/profile.js'; 2 + export * as ShTangledFeedStar from './types/sh/tangled/feed/star.js'; 3 + export * as ShTangledGraphFollow from './types/sh/tangled/graph/follow.js'; 4 + export * as ShTangledKnotMember from './types/sh/tangled/knot/member.js'; 5 + export * as ShTangledPublicKey from './types/sh/tangled/publicKey.js'; 6 + export * as ShTangledRepo from './types/sh/tangled/repo.js'; 7 + export * as ShTangledRepoArtifact from './types/sh/tangled/repo/artifact.js'; 8 + export * as ShTangledRepoIssue from './types/sh/tangled/repo/issue.js'; 9 + export * as ShTangledRepoIssueComment from './types/sh/tangled/repo/issue/comment.js'; 10 + export * as ShTangledRepoIssueState from './types/sh/tangled/repo/issue/state.js'; 11 + export * as ShTangledRepoIssueStateClosed from './types/sh/tangled/repo/issue/state/closed.js'; 12 + export * as ShTangledRepoIssueStateOpen from './types/sh/tangled/repo/issue/state/open.js'; 13 + export * as ShTangledRepoPull from './types/sh/tangled/repo/pull.js'; 14 + export * as ShTangledRepoPullComment from './types/sh/tangled/repo/pull/comment.js'; 15 + export * as ShTangledRepoPullStatus from './types/sh/tangled/repo/pull/status.js'; 16 + export * as ShTangledRepoPullStatusClosed from './types/sh/tangled/repo/pull/status/closed.js'; 17 + export * as ShTangledRepoPullStatusMerged from './types/sh/tangled/repo/pull/status/merged.js'; 18 + export * as ShTangledRepoPullStatusOpen from './types/sh/tangled/repo/pull/status/open.js';
+62
packages/definitions/tangled/lib/lexicons/types/sh/tangled/actor/profile.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.literal('self'), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.actor.profile'), 9 + description: /*#__PURE__*/ v.optional( 10 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 11 + /*#__PURE__*/ v.stringLength(0, 2560), 12 + /*#__PURE__*/ v.stringGraphemes(0, 256), 13 + ]), 14 + ), 15 + links: /*#__PURE__*/ v.optional( 16 + /*#__PURE__*/ v.constrain(v.array(/*#__PURE__*/ v.genericUriString()), [ 17 + /*#__PURE__*/ v.arrayLength(0, 5), 18 + ]), 19 + ), 20 + stats: /*#__PURE__*/ v.optional( 21 + /*#__PURE__*/ v.constrain( 22 + v.array( 23 + /*#__PURE__*/ v.literalEnum([ 24 + 'merged-pull-request-count', 25 + 'closed-pull-request-count', 26 + 'open-pull-request-count', 27 + 'open-issue-count', 28 + 'closed-issue-count', 29 + 'repository-count', 30 + ]), 31 + ), 32 + [/*#__PURE__*/ v.arrayLength(0, 2)], 33 + ), 34 + ), 35 + bluesky: /*#__PURE__*/ v.boolean(), 36 + location: /*#__PURE__*/ v.optional( 37 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 38 + /*#__PURE__*/ v.stringLength(0, 400), 39 + /*#__PURE__*/ v.stringGraphemes(0, 40), 40 + ]), 41 + ), 42 + pinnedRepositories: /*#__PURE__*/ v.optional( 43 + /*#__PURE__*/ v.constrain(v.array(/*#__PURE__*/ v.resourceUriString()), [ 44 + /*#__PURE__*/ v.arrayLength(0, 6), 45 + ]), 46 + ), 47 + }), 48 + ); 49 + 50 + type main$schematype = typeof _mainSchema; 51 + 52 + export interface mainSchema extends main$schematype {} 53 + 54 + export const mainSchema = _mainSchema as mainSchema; 55 + 56 + export interface Main extends v.InferInput<typeof mainSchema> {} 57 + 58 + declare module '@atcute/lexicons/ambient' { 59 + interface Records { 60 + 'sh.tangled.actor.profile': mainSchema; 61 + } 62 + }
+26
packages/definitions/tangled/lib/lexicons/types/sh/tangled/feed/star.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.feed.star'), 9 + subject: /*#__PURE__*/ v.resourceUriString(), 10 + createdAt: /*#__PURE__*/ v.datetimeString(), 11 + }), 12 + ); 13 + 14 + type main$schematype = typeof _mainSchema; 15 + 16 + export interface mainSchema extends main$schematype {} 17 + 18 + export const mainSchema = _mainSchema as mainSchema; 19 + 20 + export interface Main extends v.InferInput<typeof mainSchema> {} 21 + 22 + declare module '@atcute/lexicons/ambient' { 23 + interface Records { 24 + 'sh.tangled.feed.star': mainSchema; 25 + } 26 + }
+26
packages/definitions/tangled/lib/lexicons/types/sh/tangled/graph/follow.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.graph.follow'), 9 + subject: /*#__PURE__*/ v.didString(), 10 + createdAt: /*#__PURE__*/ v.datetimeString(), 11 + }), 12 + ); 13 + 14 + type main$schematype = typeof _mainSchema; 15 + 16 + export interface mainSchema extends main$schematype {} 17 + 18 + export const mainSchema = _mainSchema as mainSchema; 19 + 20 + export interface Main extends v.InferInput<typeof mainSchema> {} 21 + 22 + declare module '@atcute/lexicons/ambient' { 23 + interface Records { 24 + 'sh.tangled.graph.follow': mainSchema; 25 + } 26 + }
+27
packages/definitions/tangled/lib/lexicons/types/sh/tangled/knot/member.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.knot.member'), 9 + subject: /*#__PURE__*/ v.didString(), 10 + domain: /*#__PURE__*/ v.string(), 11 + createdAt: /*#__PURE__*/ v.datetimeString(), 12 + }), 13 + ); 14 + 15 + type main$schematype = typeof _mainSchema; 16 + 17 + export interface mainSchema extends main$schematype {} 18 + 19 + export const mainSchema = _mainSchema as mainSchema; 20 + 21 + export interface Main extends v.InferInput<typeof mainSchema> {} 22 + 23 + declare module '@atcute/lexicons/ambient' { 24 + interface Records { 25 + 'sh.tangled.knot.member': mainSchema; 26 + } 27 + }
+27
packages/definitions/tangled/lib/lexicons/types/sh/tangled/publicKey.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.publicKey'), 9 + key: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [/*#__PURE__*/ v.stringLength(0, 4096)]), 10 + name: /*#__PURE__*/ v.string(), 11 + createdAt: /*#__PURE__*/ v.datetimeString(), 12 + }), 13 + ); 14 + 15 + type main$schematype = typeof _mainSchema; 16 + 17 + export interface mainSchema extends main$schematype {} 18 + 19 + export const mainSchema = _mainSchema as mainSchema; 20 + 21 + export interface Main extends v.InferInput<typeof mainSchema> {} 22 + 23 + declare module '@atcute/lexicons/ambient' { 24 + interface Records { 25 + 'sh.tangled.publicKey': mainSchema; 26 + } 27 + }
+32
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo'), 9 + name: /*#__PURE__*/ v.string(), 10 + owner: /*#__PURE__*/ v.didString(), 11 + knot: /*#__PURE__*/ v.string(), 12 + description: /*#__PURE__*/ v.optional( 13 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.datetimeString(), [/*#__PURE__*/ v.stringGraphemes(1, 140)]), 14 + ), 15 + source: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.genericUriString()), 16 + createdAt: /*#__PURE__*/ v.datetimeString(), 17 + }), 18 + ); 19 + 20 + type main$schematype = typeof _mainSchema; 21 + 22 + export interface mainSchema extends main$schematype {} 23 + 24 + export const mainSchema = _mainSchema as mainSchema; 25 + 26 + export interface Main extends v.InferInput<typeof mainSchema> {} 27 + 28 + declare module '@atcute/lexicons/ambient' { 29 + interface Records { 30 + 'sh.tangled.repo': mainSchema; 31 + } 32 + }
+29
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/artifact.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.artifact'), 9 + name: /*#__PURE__*/ v.string(), 10 + repo: /*#__PURE__*/ v.resourceUriString(), 11 + tag: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.bytes(), [/*#__PURE__*/ v.bytesSize(20, 20)]), 12 + createdAt: /*#__PURE__*/ v.datetimeString(), 13 + artifact: /*#__PURE__*/ v.blob(), 14 + }), 15 + ); 16 + 17 + type main$schematype = typeof _mainSchema; 18 + 19 + export interface mainSchema extends main$schematype {} 20 + 21 + export const mainSchema = _mainSchema as mainSchema; 22 + 23 + export interface Main extends v.InferInput<typeof mainSchema> {} 24 + 25 + declare module '@atcute/lexicons/ambient' { 26 + interface Records { 27 + 'sh.tangled.repo.artifact': mainSchema; 28 + } 29 + }
+30
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/issue.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.issue'), 9 + repo: /*#__PURE__*/ v.resourceUriString(), 10 + issueId: /*#__PURE__*/ v.integer(), 11 + owner: /*#__PURE__*/ v.didString(), 12 + title: /*#__PURE__*/ v.string(), 13 + body: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 14 + createdAt: /*#__PURE__*/ v.datetimeString(), 15 + }), 16 + ); 17 + 18 + type main$schematype = typeof _mainSchema; 19 + 20 + export interface mainSchema extends main$schematype {} 21 + 22 + export const mainSchema = _mainSchema as mainSchema; 23 + 24 + export interface Main extends v.InferInput<typeof mainSchema> {} 25 + 26 + declare module '@atcute/lexicons/ambient' { 27 + interface Records { 28 + 'sh.tangled.repo.issue': mainSchema; 29 + } 30 + }
+30
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/issue/comment.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.issue.comment'), 9 + issue: /*#__PURE__*/ v.resourceUriString(), 10 + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), 11 + commentId: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), 12 + owner: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), 13 + body: /*#__PURE__*/ v.string(), 14 + createdAt: /*#__PURE__*/ v.datetimeString(), 15 + }), 16 + ); 17 + 18 + type main$schematype = typeof _mainSchema; 19 + 20 + export interface mainSchema extends main$schematype {} 21 + 22 + export const mainSchema = _mainSchema as mainSchema; 23 + 24 + export interface Main extends v.InferInput<typeof mainSchema> {} 25 + 26 + declare module '@atcute/lexicons/ambient' { 27 + interface Records { 28 + 'sh.tangled.repo.issue.comment': mainSchema; 29 + } 30 + }
+31
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/issue/state.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.issue.state'), 9 + issue: /*#__PURE__*/ v.resourceUriString(), 10 + state: /*#__PURE__*/ v.optional( 11 + /*#__PURE__*/ v.string< 12 + 'sh.tangled.repo.issue.state.open' | 'sh.tangled.repo.issue.state.closed' | (string & {}) 13 + >(), 14 + 'sh.tangled.repo.issue.state.open', 15 + ), 16 + }), 17 + ); 18 + 19 + type main$schematype = typeof _mainSchema; 20 + 21 + export interface mainSchema extends main$schematype {} 22 + 23 + export const mainSchema = _mainSchema as mainSchema; 24 + 25 + export interface Main extends v.InferInput<typeof mainSchema> {} 26 + 27 + declare module '@atcute/lexicons/ambient' { 28 + interface Records { 29 + 'sh.tangled.repo.issue.state': mainSchema; 30 + } 31 + }
+12
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/issue/state/closed.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.literal('sh.tangled.repo.issue.state.closed'); 5 + 6 + type main$schematype = typeof _mainSchema; 7 + 8 + export interface mainSchema extends main$schematype {} 9 + 10 + export const mainSchema = _mainSchema as mainSchema; 11 + 12 + export type Main = v.InferInput<typeof mainSchema>;
+12
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/issue/state/open.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.literal('sh.tangled.repo.issue.state.open'); 5 + 6 + type main$schematype = typeof _mainSchema; 7 + 8 + export interface mainSchema extends main$schematype {} 9 + 10 + export const mainSchema = _mainSchema as mainSchema; 11 + 12 + export type Main = v.InferInput<typeof mainSchema>;
+43
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.pull'), 9 + targetRepo: /*#__PURE__*/ v.resourceUriString(), 10 + targetBranch: /*#__PURE__*/ v.string(), 11 + pullId: /*#__PURE__*/ v.integer(), 12 + title: /*#__PURE__*/ v.string(), 13 + body: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 14 + patch: /*#__PURE__*/ v.string(), 15 + get source() { 16 + return /*#__PURE__*/ v.optional(sourceSchema); 17 + }, 18 + createdAt: /*#__PURE__*/ v.datetimeString(), 19 + }), 20 + ); 21 + const _sourceSchema = /*#__PURE__*/ v.object({ 22 + $type: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.literal('sh.tangled.repo.pull#source')), 23 + branch: /*#__PURE__*/ v.string(), 24 + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), 25 + }); 26 + 27 + type main$schematype = typeof _mainSchema; 28 + type source$schematype = typeof _sourceSchema; 29 + 30 + export interface mainSchema extends main$schematype {} 31 + export interface sourceSchema extends source$schematype {} 32 + 33 + export const mainSchema = _mainSchema as mainSchema; 34 + export const sourceSchema = _sourceSchema as sourceSchema; 35 + 36 + export interface Main extends v.InferInput<typeof mainSchema> {} 37 + export interface Source extends v.InferInput<typeof sourceSchema> {} 38 + 39 + declare module '@atcute/lexicons/ambient' { 40 + interface Records { 41 + 'sh.tangled.repo.pull': mainSchema; 42 + } 43 + }
+30
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull/comment.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.pull.comment'), 9 + pull: /*#__PURE__*/ v.resourceUriString(), 10 + repo: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.resourceUriString()), 11 + commentId: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.integer()), 12 + owner: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.didString()), 13 + body: /*#__PURE__*/ v.string(), 14 + createdAt: /*#__PURE__*/ v.datetimeString(), 15 + }), 16 + ); 17 + 18 + type main$schematype = typeof _mainSchema; 19 + 20 + export interface mainSchema extends main$schematype {} 21 + 22 + export const mainSchema = _mainSchema as mainSchema; 23 + 24 + export interface Main extends v.InferInput<typeof mainSchema> {} 25 + 26 + declare module '@atcute/lexicons/ambient' { 27 + interface Records { 28 + 'sh.tangled.repo.pull.comment': mainSchema; 29 + } 30 + }
+34
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull/status.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + import type {} from '@atcute/lexicons/ambient'; 4 + 5 + const _mainSchema = /*#__PURE__*/ v.record( 6 + /*#__PURE__*/ v.tidString(), 7 + /*#__PURE__*/ v.object({ 8 + $type: /*#__PURE__*/ v.literal('sh.tangled.repo.pull.status'), 9 + pull: /*#__PURE__*/ v.resourceUriString(), 10 + status: /*#__PURE__*/ v.optional( 11 + /*#__PURE__*/ v.string< 12 + | 'sh.tangled.repo.pull.status.open' 13 + | 'sh.tangled.repo.pull.status.closed' 14 + | 'sh.tangled.repo.pull.status.merged' 15 + | (string & {}) 16 + >(), 17 + 'sh.tangled.repo.pull.status.open', 18 + ), 19 + }), 20 + ); 21 + 22 + type main$schematype = typeof _mainSchema; 23 + 24 + export interface mainSchema extends main$schematype {} 25 + 26 + export const mainSchema = _mainSchema as mainSchema; 27 + 28 + export interface Main extends v.InferInput<typeof mainSchema> {} 29 + 30 + declare module '@atcute/lexicons/ambient' { 31 + interface Records { 32 + 'sh.tangled.repo.pull.status': mainSchema; 33 + } 34 + }
+12
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull/status/closed.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.literal('sh.tangled.repo.pull.status.closed'); 5 + 6 + type main$schematype = typeof _mainSchema; 7 + 8 + export interface mainSchema extends main$schematype {} 9 + 10 + export const mainSchema = _mainSchema as mainSchema; 11 + 12 + export type Main = v.InferInput<typeof mainSchema>;
+12
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull/status/merged.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.literal('sh.tangled.repo.pull.status.merged'); 5 + 6 + type main$schematype = typeof _mainSchema; 7 + 8 + export interface mainSchema extends main$schematype {} 9 + 10 + export const mainSchema = _mainSchema as mainSchema; 11 + 12 + export type Main = v.InferInput<typeof mainSchema>;
+12
packages/definitions/tangled/lib/lexicons/types/sh/tangled/repo/pull/status/open.ts
··· 1 + import type {} from '@atcute/lexicons'; 2 + import * as v from '@atcute/lexicons/validations'; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.literal('sh.tangled.repo.pull.status.open'); 5 + 6 + type main$schematype = typeof _mainSchema; 7 + 8 + export interface mainSchema extends main$schematype {} 9 + 10 + export const mainSchema = _mainSchema as mainSchema; 11 + 12 + export type Main = v.InferInput<typeof mainSchema>;
+41
packages/definitions/tangled/package.json
··· 1 + { 2 + "type": "module", 3 + "name": "@atcute/tangled", 4 + "version": "1.0.0", 5 + "description": "Tangled (sh.tangled.*) schema definitions", 6 + "keywords": [ 7 + "atcute", 8 + "atproto", 9 + "tangled" 10 + ], 11 + "license": "MIT", 12 + "repository": { 13 + "url": "https://github.com/mary-ext/atcute", 14 + "directory": "packages/definitions/tangled" 15 + }, 16 + "files": [ 17 + "dist/", 18 + "lib/", 19 + "!lib/**/*.bench.ts", 20 + "!lib/**/*.test.ts" 21 + ], 22 + "exports": { 23 + ".": "./dist/index.js", 24 + "./types/*": "./dist/lexicons/types/sh/tangled/*.js" 25 + }, 26 + "scripts": { 27 + "build": "tsc", 28 + "test": "vitest", 29 + "generate": "rm -r ./lib/lexicons/; lex-cli generate -c ./lex.config.js", 30 + "prepublish": "rm -rf dist; pnpm run build" 31 + }, 32 + "dependencies": { 33 + "@atcute/atproto": "workspace:^", 34 + "@atcute/lexicons": "workspace:^" 35 + }, 36 + "devDependencies": { 37 + "@atcute/tangled": "file:", 38 + "@atcute/lex-cli": "workspace:^", 39 + "vitest": "^3.1.3" 40 + } 41 + }
+22
packages/definitions/tangled/tsconfig.json
··· 1 + { 2 + "compilerOptions": { 3 + "outDir": "dist/", 4 + "esModuleInterop": true, 5 + "skipLibCheck": true, 6 + "target": "ESNext", 7 + "allowJs": true, 8 + "resolveJsonModule": true, 9 + "moduleDetection": "force", 10 + "isolatedModules": true, 11 + "verbatimModuleSyntax": true, 12 + "strict": true, 13 + "noImplicitOverride": true, 14 + "noUnusedLocals": true, 15 + "noUnusedParameters": true, 16 + "noFallthroughCasesInSwitch": true, 17 + "module": "NodeNext", 18 + "sourceMap": true, 19 + "declaration": true, 20 + }, 21 + "include": ["lib"], 22 + }
+27
pnpm-lock.yaml
··· 297 297 specifier: 'file:' 298 298 version: file:packages/definitions/ozone 299 299 300 + packages/definitions/tangled: 301 + dependencies: 302 + '@atcute/atproto': 303 + specifier: workspace:^ 304 + version: link:../atproto 305 + '@atcute/lexicons': 306 + specifier: workspace:^ 307 + version: link:../../core/lexicons 308 + devDependencies: 309 + '@atcute/lex-cli': 310 + specifier: workspace:^ 311 + version: link:../../core/lex-cli 312 + '@atcute/tangled': 313 + specifier: 'file:' 314 + version: file:packages/definitions/tangled 315 + vitest: 316 + specifier: ^3.1.3 317 + version: 3.1.3(@types/node@22.15.17) 318 + 300 319 packages/definitions/whitewind: 301 320 dependencies: 302 321 '@atcute/lexicons': ··· 585 604 586 605 '@atcute/ozone@file:packages/definitions/ozone': 587 606 resolution: {directory: packages/definitions/ozone, type: directory} 607 + 608 + '@atcute/tangled@file:packages/definitions/tangled': 609 + resolution: {directory: packages/definitions/tangled, type: directory} 588 610 589 611 '@atcute/whitewind@file:packages/definitions/whitewind': 590 612 resolution: {directory: packages/definitions/whitewind, type: directory} ··· 3316 3338 dependencies: 3317 3339 '@atcute/atproto': link:packages/definitions/atproto 3318 3340 '@atcute/bluesky': link:packages/definitions/bluesky 3341 + '@atcute/lexicons': link:packages/core/lexicons 3342 + 3343 + '@atcute/tangled@file:packages/definitions/tangled': 3344 + dependencies: 3345 + '@atcute/atproto': link:packages/definitions/atproto 3319 3346 '@atcute/lexicons': link:packages/core/lexicons 3320 3347 3321 3348 '@atcute/whitewind@file:packages/definitions/whitewind':
+93
scripts/pull-tangled-lexicons.js
··· 1 + import * as path from 'node:path'; 2 + import * as fs from 'node:fs/promises'; 3 + 4 + import { untar } from '@mary/tar'; 5 + import prettier from 'prettier'; 6 + 7 + const repo = `mary-ext/tangled.sh-mirror`; 8 + 9 + async function main() { 10 + const config = await prettier.resolveConfig(process.cwd() + '/foo', { editorconfig: true }); 11 + 12 + let sha; 13 + { 14 + console.log(`retrieving latest commit`); 15 + const response = await fetch(`https://api.github.com/repos/${repo}/commits?path=lexicons/`); 16 + 17 + if (!response.ok) { 18 + console.log(` response error ${response.status}`); 19 + return; 20 + } 21 + 22 + const json = await response.json(); 23 + const latest = json[0]; 24 + 25 + if (!latest) { 26 + console.log(` latest commit missing?`); 27 + return; 28 + } 29 + 30 + sha = latest.sha; 31 + console.log(` got ${sha}`); 32 + } 33 + 34 + const tmpdir = `lexicons-tmp/`; 35 + 36 + { 37 + console.log(`retrieving zip file`); 38 + const response = await fetch(`https://github.com/${repo}/archive/${sha}.tar.gz`); 39 + 40 + if (!response.ok) { 41 + console.log(` response error ${response.status}`); 42 + return; 43 + } 44 + 45 + const basename = `tangled.sh-mirror-${sha}/lexicons/`; 46 + 47 + const ds = new DecompressionStream('gzip'); 48 + const stream = response.body.pipeThrough(ds); 49 + 50 + const promises = []; 51 + 52 + console.log(` reading`); 53 + for await (const entry of untar(stream)) { 54 + if (entry.type === 'file' && entry.name.startsWith(basename) && entry.name.endsWith('.json')) { 55 + const name = entry.name.slice(basename.length); 56 + const basedir = tmpdir + path.dirname(name); 57 + 58 + const code = await entry.text(); 59 + 60 + const promise = (async () => { 61 + const formatted = await prettier.format(code, { ...config, parser: 'json' }); 62 + 63 + await fs.mkdir(basedir, { recursive: true }); 64 + await fs.writeFile(tmpdir + name, formatted); 65 + })(); 66 + 67 + promises.push(promise); 68 + } 69 + } 70 + 71 + console.log(` flushing writes`); 72 + await Promise.all(promises); 73 + } 74 + 75 + { 76 + const source = `https://github.com/${repo}/tree/${sha}/lexicons\n`; 77 + 78 + console.log(`writing readme file`); 79 + 80 + await fs.writeFile(tmpdir + `README.md`, source); 81 + } 82 + 83 + { 84 + const dest = `lexicons-tangled/`; 85 + 86 + console.log(`moving folder`); 87 + 88 + await fs.rm(dest, { recursive: true, force: true }); 89 + await fs.rename(tmpdir, dest); 90 + } 91 + } 92 + 93 + await main();