Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

webhook lexicon

+699 -1
+97
lexicons/webhook-v1.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "place.wisp.v2.wh", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "Webhook configuration for AT Protocol record events. Fires an HTTP POST to a URL before or after a matching record event is processed.", 8 + "key": "any", 9 + "record": { 10 + "type": "object", 11 + "required": [ 12 + "scope", 13 + "url", 14 + "phase", 15 + "events", 16 + "createdAt" 17 + ], 18 + "properties": { 19 + "scope": { 20 + "type": "union", 21 + "refs": [ 22 + "#atUri", 23 + "#nsid" 24 + ], 25 + "description": "What to watch. An AT-URI scopes to a specific DID, collection, or record. An NSID watches that collection globally across all DIDs." 26 + }, 27 + "url": { 28 + "type": "string", 29 + "format": "uri", 30 + "maxLength": 2048, 31 + "description": "HTTPS endpoint to POST the webhook payload to." 32 + }, 33 + "phase": { 34 + "type": "string", 35 + "enum": [ 36 + "pre", 37 + "post" 38 + ], 39 + "description": "Whether the webhook should fire before ('pre') or after ('post') the record event is processed." 40 + }, 41 + "events": { 42 + "type": "array", 43 + "items": { 44 + "type": "string", 45 + "enum": [ 46 + "create", 47 + "update", 48 + "delete" 49 + ] 50 + }, 51 + "description": "Which record events to trigger on. 'create' fires when a new record is created. 'update' fires when an existing record is updated. 'delete' fires when a record is deleted.", 52 + "maxLength": 3 53 + }, 54 + "secret": { 55 + "type": "string", 56 + "description": "Optional secret used to sign the webhook payload with HMAC-SHA256. The signature is included in the 'X-Webhook-Signature' header of the webhook request." 57 + }, 58 + "enabled": { 59 + "type": "boolean", 60 + "description": "Whether the webhook is active. Default to true if omitted." 61 + }, 62 + "createdAt": { 63 + "type": "string", 64 + "format": "datetime", 65 + "description": "Timestamp of when the webhook was created." 66 + } 67 + } 68 + } 69 + }, 70 + "atUri": { 71 + "type": "object", 72 + "description": "Watch by AT-URI. at://did watches all collections for a DID. at://did/collection watches all records of that collection for a DID. at://did/collection/record watches a specific record.", 73 + "required": [ 74 + "aturi" 75 + ], 76 + "properties": { 77 + "aturi": { 78 + "type": "string", 79 + "format": "at-uri" 80 + } 81 + } 82 + }, 83 + "nsid": { 84 + "type": "object", 85 + "description": "Watch all records of this collection type globally across any DID.", 86 + "required": [ 87 + "nsid" 88 + ], 89 + "properties": { 90 + "nsid": { 91 + "type": "string", 92 + "format": "nsid" 93 + } 94 + } 95 + } 96 + } 97 + }
+1 -1
packages/@wispplace/lexicons/lex.atcute.config.js
··· 1 1 import { defineLexiconConfig } from '@atcute/lex-cli'; 2 2 3 3 export default defineLexiconConfig({ 4 - files: ['../../../lexicons/*-v2.json'], 4 + files: ['../../../lexicons/*json'], 5 5 outdir: 'src/atcute/lexicons', 6 6 });
+4
packages/@wispplace/lexicons/src/atcute/lexicons/index.ts
··· 1 + export * as PlaceWispFs from "./types/place/wisp/fs.js"; 2 + export * as PlaceWispSettings from "./types/place/wisp/settings.js"; 3 + export * as PlaceWispSubfs from "./types/place/wisp/subfs.js"; 1 4 export * as PlaceWispV2DomainAddSite from "./types/place/wisp/v2/domain/addSite.js"; 2 5 export * as PlaceWispV2DomainClaim from "./types/place/wisp/v2/domain/claim.js"; 3 6 export * as PlaceWispV2DomainClaimSubdomain from "./types/place/wisp/v2/domain/claimSubdomain.js"; ··· 7 10 export * as PlaceWispV2Domains from "./types/place/wisp/v2/domains.js"; 8 11 export * as PlaceWispV2SiteDelete from "./types/place/wisp/v2/site/delete.js"; 9 12 export * as PlaceWispV2SiteGetList from "./types/place/wisp/v2/site/getList.js"; 13 + export * as PlaceWispV2Wh from "./types/place/wisp/v2/wh.js";
+120
packages/@wispplace/lexicons/src/atcute/lexicons/types/place/wisp/fs.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 _directorySchema = /*#__PURE__*/ v.object({ 6 + $type: /*#__PURE__*/ v.optional( 7 + /*#__PURE__*/ v.literal("place.wisp.fs#directory"), 8 + ), 9 + /** 10 + * @maxLength 500 11 + */ 12 + get entries() { 13 + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(entrySchema), [ 14 + /*#__PURE__*/ v.arrayLength(0, 500), 15 + ]); 16 + }, 17 + type: /*#__PURE__*/ v.literal("directory"), 18 + }); 19 + const _entrySchema = /*#__PURE__*/ v.object({ 20 + $type: /*#__PURE__*/ v.optional( 21 + /*#__PURE__*/ v.literal("place.wisp.fs#entry"), 22 + ), 23 + /** 24 + * @maxLength 255 25 + */ 26 + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 27 + /*#__PURE__*/ v.stringLength(0, 255), 28 + ]), 29 + get node() { 30 + return /*#__PURE__*/ v.variant([directorySchema, fileSchema, subfsSchema]); 31 + }, 32 + }); 33 + const _fileSchema = /*#__PURE__*/ v.object({ 34 + $type: /*#__PURE__*/ v.optional( 35 + /*#__PURE__*/ v.literal("place.wisp.fs#file"), 36 + ), 37 + /** 38 + * True if blob content is base64-encoded (used to bypass PDS content sniffing) 39 + */ 40 + base64: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), 41 + /** 42 + * Content blob ref 43 + * @accept *\/* 44 + * @maxSize 1000000000 45 + */ 46 + blob: /*#__PURE__*/ v.blob(), 47 + /** 48 + * Content encoding (e.g., gzip for compressed files) 49 + */ 50 + encoding: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.literalEnum(["gzip"])), 51 + /** 52 + * Original MIME type before compression 53 + */ 54 + mimeType: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 55 + type: /*#__PURE__*/ v.literal("file"), 56 + }); 57 + const _mainSchema = /*#__PURE__*/ v.record( 58 + /*#__PURE__*/ v.string(), 59 + /*#__PURE__*/ v.object({ 60 + $type: /*#__PURE__*/ v.literal("place.wisp.fs"), 61 + createdAt: /*#__PURE__*/ v.datetimeString(), 62 + /** 63 + * @minimum 0 64 + * @maximum 1000 65 + */ 66 + fileCount: /*#__PURE__*/ v.optional( 67 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 68 + /*#__PURE__*/ v.integerRange(0, 1000), 69 + ]), 70 + ), 71 + get root() { 72 + return directorySchema; 73 + }, 74 + site: /*#__PURE__*/ v.string(), 75 + }), 76 + ); 77 + const _subfsSchema = /*#__PURE__*/ v.object({ 78 + $type: /*#__PURE__*/ v.optional( 79 + /*#__PURE__*/ v.literal("place.wisp.fs#subfs"), 80 + ), 81 + /** 82 + * If true (default), the subfs record's root entries are merged (flattened) into the parent directory, replacing the subfs entry. If false, the subfs entries are placed in a subdirectory with the subfs entry's name. Flat merging is useful for splitting large directories across multiple records while maintaining a flat structure. 83 + */ 84 + flat: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), 85 + /** 86 + * AT-URI pointing to a place.wisp.subfs record containing this subtree. 87 + */ 88 + subject: /*#__PURE__*/ v.resourceUriString(), 89 + type: /*#__PURE__*/ v.literal("subfs"), 90 + }); 91 + 92 + type directory$schematype = typeof _directorySchema; 93 + type entry$schematype = typeof _entrySchema; 94 + type file$schematype = typeof _fileSchema; 95 + type main$schematype = typeof _mainSchema; 96 + type subfs$schematype = typeof _subfsSchema; 97 + 98 + export interface directorySchema extends directory$schematype {} 99 + export interface entrySchema extends entry$schematype {} 100 + export interface fileSchema extends file$schematype {} 101 + export interface mainSchema extends main$schematype {} 102 + export interface subfsSchema extends subfs$schematype {} 103 + 104 + export const directorySchema = _directorySchema as directorySchema; 105 + export const entrySchema = _entrySchema as entrySchema; 106 + export const fileSchema = _fileSchema as fileSchema; 107 + export const mainSchema = _mainSchema as mainSchema; 108 + export const subfsSchema = _subfsSchema as subfsSchema; 109 + 110 + export interface Directory extends v.InferInput<typeof directorySchema> {} 111 + export interface Entry extends v.InferInput<typeof entrySchema> {} 112 + export interface File extends v.InferInput<typeof fileSchema> {} 113 + export interface Main extends v.InferInput<typeof mainSchema> {} 114 + export interface Subfs extends v.InferInput<typeof subfsSchema> {} 115 + 116 + declare module "@atcute/lexicons/ambient" { 117 + interface Records { 118 + "place.wisp.fs": mainSchema; 119 + } 120 + }
+112
packages/@wispplace/lexicons/src/atcute/lexicons/types/place/wisp/settings.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 _customHeaderSchema = /*#__PURE__*/ v.object({ 6 + $type: /*#__PURE__*/ v.optional( 7 + /*#__PURE__*/ v.literal("place.wisp.settings#customHeader"), 8 + ), 9 + /** 10 + * HTTP header name (e.g., 'Cache-Control', 'X-Frame-Options') 11 + * @maxLength 100 12 + */ 13 + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 14 + /*#__PURE__*/ v.stringLength(0, 100), 15 + ]), 16 + /** 17 + * Optional glob pattern to apply this header to specific paths (e.g., '*.html', '/assets/*'). If not specified, applies to all paths. 18 + * @maxLength 500 19 + */ 20 + path: /*#__PURE__*/ v.optional( 21 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 22 + /*#__PURE__*/ v.stringLength(0, 500), 23 + ]), 24 + ), 25 + /** 26 + * HTTP header value 27 + * @maxLength 1000 28 + */ 29 + value: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 30 + /*#__PURE__*/ v.stringLength(0, 1000), 31 + ]), 32 + }); 33 + const _mainSchema = /*#__PURE__*/ v.record( 34 + /*#__PURE__*/ v.string(), 35 + /*#__PURE__*/ v.object({ 36 + $type: /*#__PURE__*/ v.literal("place.wisp.settings"), 37 + /** 38 + * Enable clean URL routing. When enabled, '/about' will attempt to serve '/about.html' or '/about/index.html' automatically. 39 + * @default false 40 + */ 41 + cleanUrls: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean(), false), 42 + /** 43 + * Custom 404 error page file path. Incompatible with directoryListing and spaMode. 44 + * @maxLength 500 45 + */ 46 + custom404: /*#__PURE__*/ v.optional( 47 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 48 + /*#__PURE__*/ v.stringLength(0, 500), 49 + ]), 50 + ), 51 + /** 52 + * Enable directory listing mode for paths that resolve to directories without an index file. Incompatible with spaMode. 53 + * @default false 54 + */ 55 + directoryListing: /*#__PURE__*/ v.optional( 56 + /*#__PURE__*/ v.boolean(), 57 + false, 58 + ), 59 + /** 60 + * Custom HTTP headers to set on responses 61 + * @maxLength 50 62 + */ 63 + get headers() { 64 + return /*#__PURE__*/ v.optional( 65 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(customHeaderSchema), [ 66 + /*#__PURE__*/ v.arrayLength(0, 50), 67 + ]), 68 + ); 69 + }, 70 + /** 71 + * Ordered list of files to try when serving a directory. Defaults to ['index.html'] if not specified. 72 + * @maxLength 10 73 + */ 74 + indexFiles: /*#__PURE__*/ v.optional( 75 + /*#__PURE__*/ v.constrain( 76 + /*#__PURE__*/ v.array( 77 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 78 + /*#__PURE__*/ v.stringLength(0, 255), 79 + ]), 80 + ), 81 + [/*#__PURE__*/ v.arrayLength(0, 10)], 82 + ), 83 + ), 84 + /** 85 + * File to serve for all routes (e.g., 'index.html'). When set, enables SPA mode where all non-file requests are routed to this file. Incompatible with directoryListing and custom404. 86 + * @maxLength 500 87 + */ 88 + spaMode: /*#__PURE__*/ v.optional( 89 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 90 + /*#__PURE__*/ v.stringLength(0, 500), 91 + ]), 92 + ), 93 + }), 94 + ); 95 + 96 + type customHeader$schematype = typeof _customHeaderSchema; 97 + type main$schematype = typeof _mainSchema; 98 + 99 + export interface customHeaderSchema extends customHeader$schematype {} 100 + export interface mainSchema extends main$schematype {} 101 + 102 + export const customHeaderSchema = _customHeaderSchema as customHeaderSchema; 103 + export const mainSchema = _mainSchema as mainSchema; 104 + 105 + export interface CustomHeader extends v.InferInput<typeof customHeaderSchema> {} 106 + export interface Main extends v.InferInput<typeof mainSchema> {} 107 + 108 + declare module "@atcute/lexicons/ambient" { 109 + interface Records { 110 + "place.wisp.settings": mainSchema; 111 + } 112 + }
+115
packages/@wispplace/lexicons/src/atcute/lexicons/types/place/wisp/subfs.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 _directorySchema = /*#__PURE__*/ v.object({ 6 + $type: /*#__PURE__*/ v.optional( 7 + /*#__PURE__*/ v.literal("place.wisp.subfs#directory"), 8 + ), 9 + /** 10 + * @maxLength 500 11 + */ 12 + get entries() { 13 + return /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.array(entrySchema), [ 14 + /*#__PURE__*/ v.arrayLength(0, 500), 15 + ]); 16 + }, 17 + type: /*#__PURE__*/ v.literal("directory"), 18 + }); 19 + const _entrySchema = /*#__PURE__*/ v.object({ 20 + $type: /*#__PURE__*/ v.optional( 21 + /*#__PURE__*/ v.literal("place.wisp.subfs#entry"), 22 + ), 23 + /** 24 + * @maxLength 255 25 + */ 26 + name: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.string(), [ 27 + /*#__PURE__*/ v.stringLength(0, 255), 28 + ]), 29 + get node() { 30 + return /*#__PURE__*/ v.variant([directorySchema, fileSchema, subfsSchema]); 31 + }, 32 + }); 33 + const _fileSchema = /*#__PURE__*/ v.object({ 34 + $type: /*#__PURE__*/ v.optional( 35 + /*#__PURE__*/ v.literal("place.wisp.subfs#file"), 36 + ), 37 + /** 38 + * True if blob content is base64-encoded (used to bypass PDS content sniffing) 39 + */ 40 + base64: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), 41 + /** 42 + * Content blob ref 43 + * @accept *\/* 44 + * @maxSize 1000000000 45 + */ 46 + blob: /*#__PURE__*/ v.blob(), 47 + /** 48 + * Content encoding (e.g., gzip for compressed files) 49 + */ 50 + encoding: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.literalEnum(["gzip"])), 51 + /** 52 + * Original MIME type before compression 53 + */ 54 + mimeType: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 55 + type: /*#__PURE__*/ v.literal("file"), 56 + }); 57 + const _mainSchema = /*#__PURE__*/ v.record( 58 + /*#__PURE__*/ v.string(), 59 + /*#__PURE__*/ v.object({ 60 + $type: /*#__PURE__*/ v.literal("place.wisp.subfs"), 61 + createdAt: /*#__PURE__*/ v.datetimeString(), 62 + /** 63 + * @minimum 0 64 + * @maximum 1000 65 + */ 66 + fileCount: /*#__PURE__*/ v.optional( 67 + /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.integer(), [ 68 + /*#__PURE__*/ v.integerRange(0, 1000), 69 + ]), 70 + ), 71 + get root() { 72 + return directorySchema; 73 + }, 74 + }), 75 + ); 76 + const _subfsSchema = /*#__PURE__*/ v.object({ 77 + $type: /*#__PURE__*/ v.optional( 78 + /*#__PURE__*/ v.literal("place.wisp.subfs#subfs"), 79 + ), 80 + /** 81 + * AT-URI pointing to another place.wisp.subfs record for nested subtrees. When expanded, the referenced record's root entries are merged (flattened) into the parent directory, allowing recursive splitting of large directory structures. 82 + */ 83 + subject: /*#__PURE__*/ v.resourceUriString(), 84 + type: /*#__PURE__*/ v.literal("subfs"), 85 + }); 86 + 87 + type directory$schematype = typeof _directorySchema; 88 + type entry$schematype = typeof _entrySchema; 89 + type file$schematype = typeof _fileSchema; 90 + type main$schematype = typeof _mainSchema; 91 + type subfs$schematype = typeof _subfsSchema; 92 + 93 + export interface directorySchema extends directory$schematype {} 94 + export interface entrySchema extends entry$schematype {} 95 + export interface fileSchema extends file$schematype {} 96 + export interface mainSchema extends main$schematype {} 97 + export interface subfsSchema extends subfs$schematype {} 98 + 99 + export const directorySchema = _directorySchema as directorySchema; 100 + export const entrySchema = _entrySchema as entrySchema; 101 + export const fileSchema = _fileSchema as fileSchema; 102 + export const mainSchema = _mainSchema as mainSchema; 103 + export const subfsSchema = _subfsSchema as subfsSchema; 104 + 105 + export interface Directory extends v.InferInput<typeof directorySchema> {} 106 + export interface Entry extends v.InferInput<typeof entrySchema> {} 107 + export interface File extends v.InferInput<typeof fileSchema> {} 108 + export interface Main extends v.InferInput<typeof mainSchema> {} 109 + export interface Subfs extends v.InferInput<typeof subfsSchema> {} 110 + 111 + declare module "@atcute/lexicons/ambient" { 112 + interface Records { 113 + "place.wisp.subfs": mainSchema; 114 + } 115 + }
+83
packages/@wispplace/lexicons/src/atcute/lexicons/types/place/wisp/v2/wh.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 _atUriSchema = /*#__PURE__*/ v.object({ 6 + $type: /*#__PURE__*/ v.optional( 7 + /*#__PURE__*/ v.literal("place.wisp.v2.wh#atUri"), 8 + ), 9 + aturi: /*#__PURE__*/ v.resourceUriString(), 10 + }); 11 + const _mainSchema = /*#__PURE__*/ v.record( 12 + /*#__PURE__*/ v.string(), 13 + /*#__PURE__*/ v.object({ 14 + $type: /*#__PURE__*/ v.literal("place.wisp.v2.wh"), 15 + /** 16 + * Timestamp of when the webhook was created. 17 + */ 18 + createdAt: /*#__PURE__*/ v.datetimeString(), 19 + /** 20 + * Whether the webhook is active. Default to true if omitted. 21 + */ 22 + enabled: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.boolean()), 23 + /** 24 + * Which record events to trigger on. 'create' fires when a new record is created. 'update' fires when an existing record is updated. 'delete' fires when a record is deleted. 25 + * @maxLength 3 26 + */ 27 + events: /*#__PURE__*/ v.constrain( 28 + /*#__PURE__*/ v.array( 29 + /*#__PURE__*/ v.literalEnum(["create", "delete", "update"]), 30 + ), 31 + [/*#__PURE__*/ v.arrayLength(0, 3)], 32 + ), 33 + /** 34 + * Whether the webhook should fire before ('pre') or after ('post') the record event is processed. 35 + */ 36 + phase: /*#__PURE__*/ v.literalEnum(["post", "pre"]), 37 + /** 38 + * What to watch. An AT-URI scopes to a specific DID, collection, or record. An NSID watches that collection globally across all DIDs. 39 + */ 40 + get scope() { 41 + return /*#__PURE__*/ v.variant([atUriSchema, nsidSchema]); 42 + }, 43 + /** 44 + * Optional secret used to sign the webhook payload with HMAC-SHA256. The signature is included in the 'X-Webhook-Signature' header of the webhook request. 45 + */ 46 + secret: /*#__PURE__*/ v.optional(/*#__PURE__*/ v.string()), 47 + /** 48 + * HTTPS endpoint to POST the webhook payload to. 49 + * @maxLength 2048 50 + */ 51 + url: /*#__PURE__*/ v.constrain(/*#__PURE__*/ v.genericUriString(), [ 52 + /*#__PURE__*/ v.stringLength(0, 2048), 53 + ]), 54 + }), 55 + ); 56 + const _nsidSchema = /*#__PURE__*/ v.object({ 57 + $type: /*#__PURE__*/ v.optional( 58 + /*#__PURE__*/ v.literal("place.wisp.v2.wh#nsid"), 59 + ), 60 + nsid: /*#__PURE__*/ v.nsidString(), 61 + }); 62 + 63 + type atUri$schematype = typeof _atUriSchema; 64 + type main$schematype = typeof _mainSchema; 65 + type nsid$schematype = typeof _nsidSchema; 66 + 67 + export interface atUriSchema extends atUri$schematype {} 68 + export interface mainSchema extends main$schematype {} 69 + export interface nsidSchema extends nsid$schematype {} 70 + 71 + export const atUriSchema = _atUriSchema as atUriSchema; 72 + export const mainSchema = _mainSchema as mainSchema; 73 + export const nsidSchema = _nsidSchema as nsidSchema; 74 + 75 + export interface AtUri extends v.InferInput<typeof atUriSchema> {} 76 + export interface Main extends v.InferInput<typeof mainSchema> {} 77 + export interface Nsid extends v.InferInput<typeof nsidSchema> {} 78 + 79 + declare module "@atcute/lexicons/ambient" { 80 + interface Records { 81 + "place.wisp.v2.wh": mainSchema; 82 + } 83 + }
+86
packages/@wispplace/lexicons/src/lexicons.ts
··· 1028 1028 }, 1029 1029 }, 1030 1030 }, 1031 + PlaceWispV2Wh: { 1032 + lexicon: 1, 1033 + id: 'place.wisp.v2.wh', 1034 + defs: { 1035 + main: { 1036 + type: 'record', 1037 + description: 1038 + 'Webhook configuration for AT Protocol record events. Fires an HTTP POST to a URL before or after a matching record event is processed.', 1039 + key: 'any', 1040 + record: { 1041 + type: 'object', 1042 + required: ['scope', 'url', 'phase', 'events', 'createdAt'], 1043 + properties: { 1044 + scope: { 1045 + type: 'union', 1046 + refs: ['lex:place.wisp.v2.wh#atUri', 'lex:place.wisp.v2.wh#nsid'], 1047 + description: 1048 + 'What to watch. An AT-URI scopes to a specific DID, collection, or record. An NSID watches that collection globally across all DIDs.', 1049 + }, 1050 + url: { 1051 + type: 'string', 1052 + format: 'uri', 1053 + maxLength: 2048, 1054 + description: 'HTTPS endpoint to POST the webhook payload to.', 1055 + }, 1056 + phase: { 1057 + type: 'string', 1058 + enum: ['pre', 'post'], 1059 + description: 1060 + "Whether the webhook should fire before ('pre') or after ('post') the record event is processed.", 1061 + }, 1062 + events: { 1063 + type: 'array', 1064 + items: { 1065 + type: 'string', 1066 + enum: ['create', 'update', 'delete'], 1067 + }, 1068 + description: 1069 + "Which record events to trigger on. 'create' fires when a new record is created. 'update' fires when an existing record is updated. 'delete' fires when a record is deleted.", 1070 + maxLength: 3, 1071 + }, 1072 + secret: { 1073 + type: 'string', 1074 + description: 1075 + "Optional secret used to sign the webhook payload with HMAC-SHA256. The signature is included in the 'X-Webhook-Signature' header of the webhook request.", 1076 + }, 1077 + enabled: { 1078 + type: 'boolean', 1079 + description: 1080 + 'Whether the webhook is active. Default to true if omitted.', 1081 + }, 1082 + createdAt: { 1083 + type: 'string', 1084 + format: 'datetime', 1085 + description: 'Timestamp of when the webhook was created.', 1086 + }, 1087 + }, 1088 + }, 1089 + }, 1090 + atUri: { 1091 + type: 'object', 1092 + description: 1093 + 'Watch by AT-URI. at://did watches all collections for a DID. at://did/collection watches all records of that collection for a DID. at://did/collection/record watches a specific record.', 1094 + required: ['aturi'], 1095 + properties: { 1096 + aturi: { 1097 + type: 'string', 1098 + format: 'at-uri', 1099 + }, 1100 + }, 1101 + }, 1102 + nsid: { 1103 + type: 'object', 1104 + description: 1105 + 'Watch all records of this collection type globally across any DID.', 1106 + required: ['nsid'], 1107 + properties: { 1108 + nsid: { 1109 + type: 'string', 1110 + format: 'nsid', 1111 + }, 1112 + }, 1113 + }, 1114 + }, 1115 + }, 1031 1116 } as const satisfies Record<string, LexiconDoc> 1032 1117 export const schemas = Object.values(schemaDict) satisfies LexiconDoc[] 1033 1118 export const lexicons: Lexicons = new Lexicons(schemas) ··· 1073 1158 PlaceWispV2SiteDelete: 'place.wisp.v2.site.delete', 1074 1159 PlaceWispV2SiteGetList: 'place.wisp.v2.site.getList', 1075 1160 PlaceWispSubfs: 'place.wisp.subfs', 1161 + PlaceWispV2Wh: 'place.wisp.v2.wh', 1076 1162 } as const
+81
packages/@wispplace/lexicons/src/types/place/wisp/v2/wh.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import { type ValidationResult, BlobRef } from '@atproto/lexicon' 5 + import { CID } from 'multiformats/cid' 6 + import { validate as _validate } from '../../../../lexicons' 7 + import { 8 + type $Typed, 9 + is$typed as _is$typed, 10 + type OmitKey, 11 + } from '../../../../util' 12 + 13 + const is$typed = _is$typed, 14 + validate = _validate 15 + const id = 'place.wisp.v2.wh' 16 + 17 + export interface Main { 18 + $type: 'place.wisp.v2.wh' 19 + scope: $Typed<AtUri> | $Typed<Nsid> | { $type: string } 20 + /** HTTPS endpoint to POST the webhook payload to. */ 21 + url: string 22 + /** Whether the webhook should fire before ('pre') or after ('post') the record event is processed. */ 23 + phase: 'pre' | 'post' 24 + /** Which record events to trigger on. 'create' fires when a new record is created. 'update' fires when an existing record is updated. 'delete' fires when a record is deleted. */ 25 + events: ('create' | 'update' | 'delete')[] 26 + /** Optional secret used to sign the webhook payload with HMAC-SHA256. The signature is included in the 'X-Webhook-Signature' header of the webhook request. */ 27 + secret?: string 28 + /** Whether the webhook is active. Default to true if omitted. */ 29 + enabled?: boolean 30 + /** Timestamp of when the webhook was created. */ 31 + createdAt: string 32 + [k: string]: unknown 33 + } 34 + 35 + const hashMain = 'main' 36 + 37 + export function isMain<V>(v: V) { 38 + return is$typed(v, id, hashMain) 39 + } 40 + 41 + export function validateMain<V>(v: V) { 42 + return validate<Main & V>(v, id, hashMain, true) 43 + } 44 + 45 + export { 46 + type Main as Record, 47 + isMain as isRecord, 48 + validateMain as validateRecord, 49 + } 50 + 51 + /** Watch by AT-URI. at://did watches all collections for a DID. at://did/collection watches all records of that collection for a DID. at://did/collection/record watches a specific record. */ 52 + export interface AtUri { 53 + $type?: 'place.wisp.v2.wh#atUri' 54 + aturi: string 55 + } 56 + 57 + const hashAtUri = 'atUri' 58 + 59 + export function isAtUri<V>(v: V) { 60 + return is$typed(v, id, hashAtUri) 61 + } 62 + 63 + export function validateAtUri<V>(v: V) { 64 + return validate<AtUri & V>(v, id, hashAtUri) 65 + } 66 + 67 + /** Watch all records of this collection type globally across any DID. */ 68 + export interface Nsid { 69 + $type?: 'place.wisp.v2.wh#nsid' 70 + nsid: string 71 + } 72 + 73 + const hashNsid = 'nsid' 74 + 75 + export function isNsid<V>(v: V) { 76 + return is$typed(v, id, hashNsid) 77 + } 78 + 79 + export function validateNsid<V>(v: V) { 80 + return validate<Nsid & V>(v, id, hashNsid) 81 + }