@upstart.gg/sdk 0.0.51
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/LICENSE +633 -0
- package/README.md +11 -0
- package/custom-attrs.d.ts +63 -0
- package/dist/node/cli/api.js +3 -0
- package/dist/node/cli/commands/build/cmd-build.js +3 -0
- package/dist/node/cli/commands/login/cmd-login.js +10 -0
- package/dist/node/cli/commands/logout/cmd-logout.js +3 -0
- package/dist/node/cli/commands/publish/cmd-publish.js +36 -0
- package/dist/node/cli/commands/publish/parse-gitignore.js +14 -0
- package/dist/node/cli/commands/publish/uploader.js +17 -0
- package/dist/node/cli/constants.js +2 -0
- package/dist/node/cli/program.js +48 -0
- package/dist/node/cli/store.js +3 -0
- package/dist/node/cli/types.js +1 -0
- package/dist/node/cli/utils.js +2 -0
- package/dist/node/metafile-esm.json +1 -0
- package/dist/node/shared/config.js +12 -0
- package/dist/node/shared/logger.js +3 -0
- package/dist/shared/ajv.d.ts +6 -0
- package/dist/shared/ajv.js +2 -0
- package/dist/shared/attributes.d.ts +102 -0
- package/dist/shared/attributes.js +2 -0
- package/dist/shared/bricks.d.ts +140 -0
- package/dist/shared/bricks.js +2 -0
- package/dist/shared/datasources/external/facebook/posts/fetcher.d.ts +16 -0
- package/dist/shared/datasources/external/facebook/posts/fetcher.js +2 -0
- package/dist/shared/datasources/external/facebook/posts/schema.d.ts +31 -0
- package/dist/shared/datasources/external/facebook/posts/schema.js +2 -0
- package/dist/shared/datasources/external/instagram/feed/fetcher.d.ts +16 -0
- package/dist/shared/datasources/external/instagram/feed/fetcher.js +2 -0
- package/dist/shared/datasources/external/instagram/feed/schema.d.ts +23 -0
- package/dist/shared/datasources/external/instagram/feed/schema.js +2 -0
- package/dist/shared/datasources/external/json/fetcher.d.ts +17 -0
- package/dist/shared/datasources/external/json/fetcher.js +2 -0
- package/dist/shared/datasources/external/json/options.d.ts +11 -0
- package/dist/shared/datasources/external/json/options.js +2 -0
- package/dist/shared/datasources/external/mastodon/account/fetcher.d.ts +15 -0
- package/dist/shared/datasources/external/mastodon/account/fetcher.js +2 -0
- package/dist/shared/datasources/external/mastodon/account/schema.d.ts +43 -0
- package/dist/shared/datasources/external/mastodon/account/schema.js +2 -0
- package/dist/shared/datasources/external/mastodon/options.d.ts +10 -0
- package/dist/shared/datasources/external/mastodon/options.js +2 -0
- package/dist/shared/datasources/external/mastodon/status/fetcher.d.ts +15 -0
- package/dist/shared/datasources/external/mastodon/status/fetcher.js +2 -0
- package/dist/shared/datasources/external/mastodon/status/sample.array.d.ts +53 -0
- package/dist/shared/datasources/external/mastodon/status/sample.array.js +2 -0
- package/dist/shared/datasources/external/mastodon/status/sample.single.d.ts +53 -0
- package/dist/shared/datasources/external/mastodon/status/sample.single.js +2 -0
- package/dist/shared/datasources/external/mastodon/status/schema.d.ts +261 -0
- package/dist/shared/datasources/external/mastodon/status/schema.js +2 -0
- package/dist/shared/datasources/external/meta/oauth/config.d.ts +21 -0
- package/dist/shared/datasources/external/meta/oauth/config.js +1 -0
- package/dist/shared/datasources/external/meta/options.d.ts +10 -0
- package/dist/shared/datasources/external/meta/options.js +2 -0
- package/dist/shared/datasources/external/rss/fetcher.d.ts +15 -0
- package/dist/shared/datasources/external/rss/fetcher.js +2 -0
- package/dist/shared/datasources/external/rss/options.d.ts +10 -0
- package/dist/shared/datasources/external/rss/options.js +2 -0
- package/dist/shared/datasources/external/rss/schema.d.ts +19 -0
- package/dist/shared/datasources/external/rss/schema.js +2 -0
- package/dist/shared/datasources/external/threads/media/fetcher.d.ts +19 -0
- package/dist/shared/datasources/external/threads/media/fetcher.js +2 -0
- package/dist/shared/datasources/external/threads/media/schema.d.ts +30 -0
- package/dist/shared/datasources/external/threads/media/schema.js +2 -0
- package/dist/shared/datasources/external/tiktok/oauth/config.d.ts +22 -0
- package/dist/shared/datasources/external/tiktok/oauth/config.js +1 -0
- package/dist/shared/datasources/external/tiktok/video/fetcher.d.ts +16 -0
- package/dist/shared/datasources/external/tiktok/video/fetcher.js +2 -0
- package/dist/shared/datasources/external/tiktok/video/options.d.ts +10 -0
- package/dist/shared/datasources/external/tiktok/video/options.js +2 -0
- package/dist/shared/datasources/external/tiktok/video/schema.d.ts +25 -0
- package/dist/shared/datasources/external/tiktok/video/schema.js +2 -0
- package/dist/shared/datasources/external/youtube/list/fetcher.d.ts +16 -0
- package/dist/shared/datasources/external/youtube/list/fetcher.js +2 -0
- package/dist/shared/datasources/external/youtube/list/options.d.ts +14 -0
- package/dist/shared/datasources/external/youtube/list/options.js +2 -0
- package/dist/shared/datasources/external/youtube/list/schema.d.ts +43 -0
- package/dist/shared/datasources/external/youtube/list/schema.js +2 -0
- package/dist/shared/datasources/external/youtube/oauth/config.d.ts +22 -0
- package/dist/shared/datasources/external/youtube/oauth/config.js +1 -0
- package/dist/shared/datasources/internal/contact-info/schema.d.ts +17 -0
- package/dist/shared/datasources/internal/contact-info/schema.js +2 -0
- package/dist/shared/datasources/internal/faq/schema.d.ts +12 -0
- package/dist/shared/datasources/internal/faq/schema.js +2 -0
- package/dist/shared/datasources/internal/links/schema.d.ts +12 -0
- package/dist/shared/datasources/internal/links/schema.js +2 -0
- package/dist/shared/datasources/samples.d.ts +13 -0
- package/dist/shared/datasources/samples.js +2 -0
- package/dist/shared/datasources/types.d.ts +9 -0
- package/dist/shared/datasources/types.js +2 -0
- package/dist/shared/datasources/utils.d.ts +3 -0
- package/dist/shared/datasources/utils.js +2 -0
- package/dist/shared/datasources-DAysbbXK.d.ts +201 -0
- package/dist/shared/datasources.d.ts +9 -0
- package/dist/shared/datasources.js +2 -0
- package/dist/shared/env.d.ts +27 -0
- package/dist/shared/env.js +1 -0
- package/dist/shared/errors.d.ts +1 -0
- package/dist/shared/errors.js +2 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +2 -0
- package/dist/shared/layout-constants.d.ts +20 -0
- package/dist/shared/layout-constants.js +2 -0
- package/dist/shared/manifest.d.ts +34 -0
- package/dist/shared/manifest.js +2 -0
- package/dist/shared/metafile-esm.json +1 -0
- package/dist/shared/page.d.ts +9 -0
- package/dist/shared/page.js +2 -0
- package/dist/shared/responsive.d.ts +6 -0
- package/dist/shared/responsive.js +2 -0
- package/dist/shared/social-icons.d.ts +6 -0
- package/dist/shared/social-icons.js +2 -0
- package/dist/shared/template-config.d.ts +9 -0
- package/dist/shared/template-config.js +1 -0
- package/dist/shared/theme.d.ts +37 -0
- package/dist/shared/theme.js +2 -0
- package/dist/shared/themes/all-themes.d.ts +6 -0
- package/dist/shared/themes/all-themes.js +2 -0
- package/dist/shared/themes/color-system.d.ts +323 -0
- package/dist/shared/themes/color-system.js +2 -0
- package/dist/shared/utils/invariant.d.ts +8 -0
- package/dist/shared/utils/invariant.js +2 -0
- package/dist/shared/utils/layout-utils.d.ts +24 -0
- package/dist/shared/utils/layout-utils.js +2 -0
- package/env.d.ts +24 -0
- package/package.json +162 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { TProperties, StringOptions, NumberOptions, SchemaOptions, ObjectOptions } from '@sinclair/typebox';
|
|
3
|
+
import { ElementColor } from './themes/color-system.js';
|
|
4
|
+
import './theme.js';
|
|
5
|
+
import 'chroma-js';
|
|
6
|
+
|
|
7
|
+
type EnumOption = {
|
|
8
|
+
title?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
value: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
};
|
|
13
|
+
type AttributeOptions<T extends Record<string, unknown>> = {
|
|
14
|
+
"ui:group"?: string;
|
|
15
|
+
"ui:group:title"?: string;
|
|
16
|
+
"ui:group:order"?: number;
|
|
17
|
+
advanced?: boolean;
|
|
18
|
+
"ui:hidden"?: boolean | "if-empty";
|
|
19
|
+
} & T;
|
|
20
|
+
type GeoPoint = {
|
|
21
|
+
lat: number;
|
|
22
|
+
lng: number;
|
|
23
|
+
name?: string;
|
|
24
|
+
};
|
|
25
|
+
declare function defineAttributes(attrs: TProperties): _sinclair_typebox.TObject<{
|
|
26
|
+
$pageLanguage: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<string>[]>;
|
|
27
|
+
$pagePath: _sinclair_typebox.TString;
|
|
28
|
+
$pageTitle: _sinclair_typebox.TString;
|
|
29
|
+
$pageDescription: _sinclair_typebox.TString;
|
|
30
|
+
$pageKeywords: _sinclair_typebox.TString;
|
|
31
|
+
$pageLastUpdated: _sinclair_typebox.TString;
|
|
32
|
+
$pageWidth: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<string>[]>;
|
|
33
|
+
$pagePaddingVertical: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<string>[]>;
|
|
34
|
+
$pagePaddingHorizontal: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<string>[]>;
|
|
35
|
+
$backgroundColor: _sinclair_typebox.TString;
|
|
36
|
+
$textColor: _sinclair_typebox.TString;
|
|
37
|
+
}>;
|
|
38
|
+
declare const attr: {
|
|
39
|
+
/**
|
|
40
|
+
* Define a text
|
|
41
|
+
*/
|
|
42
|
+
string(name: string, defaultValue?: string, opts?: AttributeOptions<Omit<StringOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
43
|
+
/**
|
|
44
|
+
* Define a number attribute
|
|
45
|
+
*/
|
|
46
|
+
number(name: string, defaultValue?: number, opts?: AttributeOptions<Omit<NumberOptions, "title" | "default">>): _sinclair_typebox.TNumber;
|
|
47
|
+
/**
|
|
48
|
+
* Define a boolean
|
|
49
|
+
*/
|
|
50
|
+
boolean(name: string, defaultValue?: boolean, opts?: AttributeOptions<Omit<SchemaOptions, "title" | "default">>): _sinclair_typebox.TBoolean;
|
|
51
|
+
/**
|
|
52
|
+
* Define an enum
|
|
53
|
+
*/
|
|
54
|
+
enum(name: string, defaultValue: string, opts: AttributeOptions<Omit<SchemaOptions, "title" | "default"> & {
|
|
55
|
+
options: EnumOption[] | string[];
|
|
56
|
+
displayAs?: "radio" | "select" | "button-group" | "icon-group";
|
|
57
|
+
}>): _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<string>[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Define a file that can be uploaded by the user
|
|
60
|
+
*/
|
|
61
|
+
file(name: string, defaultValue?: string, opts?: AttributeOptions<Omit<SchemaOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
62
|
+
/**
|
|
63
|
+
* Define a URL
|
|
64
|
+
*/
|
|
65
|
+
url(name: string, defaultValue?: string, opts?: AttributeOptions<Omit<SchemaOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
66
|
+
/**
|
|
67
|
+
* Define a color attribute
|
|
68
|
+
*/
|
|
69
|
+
color(name: string, defaultValue?: ElementColor, opts?: AttributeOptions<Omit<StringOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
70
|
+
/**
|
|
71
|
+
* Define a date
|
|
72
|
+
*/
|
|
73
|
+
date(name: string, defaultValue?: Date, opts?: AttributeOptions<Omit<SchemaOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
74
|
+
/**
|
|
75
|
+
* Define a date and time
|
|
76
|
+
*/
|
|
77
|
+
datetime(name: string, defaultValue?: Date, opts?: AttributeOptions<Omit<SchemaOptions, "title" | "default">>): _sinclair_typebox.TString;
|
|
78
|
+
/**
|
|
79
|
+
* Define a geolocation
|
|
80
|
+
*/
|
|
81
|
+
geolocation(name: string, defaultValue: GeoPoint, opts?: AttributeOptions<Omit<ObjectOptions, "title" | "default">>): _sinclair_typebox.TObject<{
|
|
82
|
+
lat: _sinclair_typebox.TNumber;
|
|
83
|
+
lng: _sinclair_typebox.TNumber;
|
|
84
|
+
name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
87
|
+
declare function resolveAttributes(attributes: ReturnType<typeof defineAttributes>): {
|
|
88
|
+
$pageLanguage: string;
|
|
89
|
+
$pagePath: string;
|
|
90
|
+
$pageTitle: string;
|
|
91
|
+
$pageDescription: string;
|
|
92
|
+
$pageKeywords: string;
|
|
93
|
+
$pageLastUpdated: string;
|
|
94
|
+
$pageWidth: string;
|
|
95
|
+
$pagePaddingVertical: string;
|
|
96
|
+
$pagePaddingHorizontal: string;
|
|
97
|
+
$backgroundColor: string;
|
|
98
|
+
$textColor: string;
|
|
99
|
+
};
|
|
100
|
+
type AttributesResolved = ReturnType<typeof resolveAttributes>;
|
|
101
|
+
|
|
102
|
+
export { type AttributesResolved, attr, defineAttributes, resolveAttributes };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as r}from"@sinclair/typebox";import{Value as s}from"@sinclair/typebox/value";function c(t){for(let e in t)if(e.startsWith("$"))throw new Error(`Attribute names starting with '$' (like "${e}") are reserved for internal use. Please rename it.`);return r.Object({...p,...t},{$id:"attributes"})}var n={string(t,e="",i){return r.String({title:t,default:e,...i})},number(t,e=0,i){return r.Number({title:t,default:e,...i})},boolean(t,e=!1,i){let o={"ui:field":"switch"};return r.Boolean({title:t,default:e,...o,...i})},enum(t,e,i){let o={"ui:field":"enum","ui:display":i.displayAs||"select"},{options:u,displayAs:g,...l}=i;return r.Union(u.map(a=>r.Literal(typeof a=="string"?a:a.value,{title:typeof a=="string"?a:a.title,"ui:icon":typeof a=="string"?void 0:a.icon})),{title:t,default:e,...o,...l})},file(t,e="",i={}){return r.String({title:t,default:e,...i,format:"data-url"})},url(t,e="",i={}){return r.String({title:t,default:e,...i,format:"uri"})},color(t,e="",i){let o={"ui:field":"color"};return r.String({title:t,default:e,...o,...i})},date(t,e=new Date,i={}){return r.String({title:t,default:e.toISOString(),...i,format:"date"})},datetime(t,e=new Date,i={}){return r.String({title:t,default:e.toISOString(),...i,format:"date-time"})},geolocation(t,e,i={}){return r.Object({lat:r.Number({minimum:-90,maximum:90}),lng:r.Number({minimum:-180,maximum:180}),name:r.Optional(r.String({title:"Name"}))},{title:t,default:e,...i})}},p={$pageLanguage:n.enum("Page language","en",{options:[{value:"ar",title:"Arabic"},{value:"zh",title:"Chinese"},{value:"cs",title:"Czech"},{value:"nl",title:"Dutch"},{value:"en",title:"English"},{value:"fr",title:"French"},{value:"de",title:"German"},{value:"he",title:"Hebrew"},{value:"hi",title:"Hindi"},{value:"it",title:"Italian"},{value:"ja",title:"Japanese"},{value:"ko",title:"Korean"},{value:"fa",title:"Persian"},{value:"pl",title:"Polish"},{value:"pt",title:"Portuguese"},{value:"ru",title:"Russian"},{value:"es",title:"Spanish"},{value:"tr",title:"Turkish"},{value:"vi",title:"Vietnamese"}],"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pagePath:n.string("Page path","/",{description:"The URL path of the page","ui:group":"location","ui:group:title":"Location","ui:group:order":1,"ui:field":"path"}),$pageTitle:n.string("Page title","Untitled",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageDescription:n.string("Page description","",{"ui:widget":"textarea","ui:options":{rows:3,widget:"textarea"},"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageKeywords:n.string("Page keywords","",{"ui:group":"meta","ui:group:title":"Meta tags / SEO"}),$pageLastUpdated:n.datetime("Last updated",void 0,{"ui:hidden":!0}),$pageWidth:n.enum("Page width","max-w-screen-2xl",{options:[{value:"max-w-screen-lg",title:"M",description:"Common for text-heavy content/blog posts"},{value:"max-w-screen-xl",title:"L",description:"Usefull or some landing pages"},{value:"max-w-screen-2xl",title:"XL",description:"Common width"},{value:"max-w-full",title:"Full",description:"Takes the entire space"}],description:"The maximum width of the page. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingVertical:n.enum("Page vertical spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Vertical spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$pagePaddingHorizontal:n.enum("Page horizontal spacing","20",{options:[{value:"0",title:"None"},{value:"10",title:"S"},{value:"20",title:"M"},{value:"30",title:"L"},{value:"50",title:"XL"}],description:"Horizontal spacing. Desktop only.",displayAs:"button-group","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$backgroundColor:n.color("Page background color","#ffffff",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design"}),$textColor:n.color("Default text color","#222222",{"ui:field":"color","ui:group":"layout","ui:group:title":"Page Layout & Design","ui:color-type":"page-text"})};function f(t){return s.Create(t)}export{n as attr,c as defineAttributes,f as resolveAttributes};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { TProperties, TObject, Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Generates a unique identifier for bricks.
|
|
6
|
+
*/
|
|
7
|
+
declare const generateId: (size?: number) => string;
|
|
8
|
+
type BrickPosition = {
|
|
9
|
+
/**
|
|
10
|
+
* Col start (0-based) in grid units, not pixels.
|
|
11
|
+
*/
|
|
12
|
+
x: number;
|
|
13
|
+
/**
|
|
14
|
+
* Row start (0-based) in grid units, not pixels.
|
|
15
|
+
*/
|
|
16
|
+
y: number;
|
|
17
|
+
/**
|
|
18
|
+
* Width in columns in grid units, not pixels.
|
|
19
|
+
*/
|
|
20
|
+
w: number;
|
|
21
|
+
/**
|
|
22
|
+
* Height in rows in grid units, not pixels.
|
|
23
|
+
*/
|
|
24
|
+
h: number;
|
|
25
|
+
manualHeight?: number;
|
|
26
|
+
/**
|
|
27
|
+
* If true, the brick won't be displayed.
|
|
28
|
+
*/
|
|
29
|
+
hidden?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type DefinedBrickPosition = {
|
|
32
|
+
w: number | "full" | "half" | "third" | "twoThird" | "quarter" | "threeQuarter";
|
|
33
|
+
h: number;
|
|
34
|
+
x: number | "half" | "third" | "twoThird" | "quarter" | "threeQuarter";
|
|
35
|
+
y: number;
|
|
36
|
+
hidden?: boolean;
|
|
37
|
+
};
|
|
38
|
+
type Brick<T extends string = string> = {
|
|
39
|
+
type: T;
|
|
40
|
+
id: string;
|
|
41
|
+
props: Record<string, unknown>;
|
|
42
|
+
position: {
|
|
43
|
+
mobile: BrickPosition;
|
|
44
|
+
desktop: BrickPosition;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type BricksLayout = Brick[];
|
|
48
|
+
type ResponsivePosition = Brick["position"];
|
|
49
|
+
type DefinedBrick = Omit<Brick, "id" | "position" | "manifest"> & {
|
|
50
|
+
position: {
|
|
51
|
+
mobile: DefinedBrickPosition;
|
|
52
|
+
desktop: DefinedBrickPosition;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type LayoutCols = {
|
|
56
|
+
mobile: number;
|
|
57
|
+
desktop: number;
|
|
58
|
+
};
|
|
59
|
+
declare function defineBricks<B extends DefinedBrick[]>(bricks: B): Brick[];
|
|
60
|
+
/**
|
|
61
|
+
* This specific type is used to define a row of bricks.
|
|
62
|
+
* The `y` property of the position is automatically set to the current row.
|
|
63
|
+
*/
|
|
64
|
+
type DefinedRowBrick = Omit<Brick, "id" | "manifest" | "position"> & {
|
|
65
|
+
position: {
|
|
66
|
+
mobile?: Omit<DefinedBrickPosition, "y">;
|
|
67
|
+
tablet?: Omit<DefinedBrickPosition, "y">;
|
|
68
|
+
desktop: Omit<DefinedBrickPosition, "y">;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* Creates a new row of bricks, automatically setting the `y` property to the current row.
|
|
73
|
+
*/
|
|
74
|
+
declare function createRow<B extends DefinedRowBrick[]>(bricks: B): DefinedBrick[];
|
|
75
|
+
declare function defineBrickManifest<BType extends string, BTitle extends string, BIcon extends string, BFile extends string, BDesc extends string, BProps extends TProperties>({ type, kind, title, description, preferredWidth, preferredHeight, minWidth, minHeight, maxWidth, icon, file, props, datasource, datarecord, }: {
|
|
76
|
+
type: BType;
|
|
77
|
+
kind: string;
|
|
78
|
+
title: BTitle;
|
|
79
|
+
icon: BIcon;
|
|
80
|
+
file: BFile;
|
|
81
|
+
description: BDesc;
|
|
82
|
+
minWidth?: {
|
|
83
|
+
mobile: number;
|
|
84
|
+
desktop: number;
|
|
85
|
+
};
|
|
86
|
+
minHeight?: {
|
|
87
|
+
mobile: number;
|
|
88
|
+
desktop: number;
|
|
89
|
+
};
|
|
90
|
+
maxWidth?: {
|
|
91
|
+
mobile: number;
|
|
92
|
+
desktop: number;
|
|
93
|
+
};
|
|
94
|
+
preferredWidth?: {
|
|
95
|
+
mobile: number;
|
|
96
|
+
desktop: number;
|
|
97
|
+
};
|
|
98
|
+
preferredHeight?: {
|
|
99
|
+
mobile: number;
|
|
100
|
+
desktop: number;
|
|
101
|
+
};
|
|
102
|
+
props: TObject<BProps>;
|
|
103
|
+
datasource?: TObject;
|
|
104
|
+
datarecord?: TObject;
|
|
105
|
+
}): TObject<{
|
|
106
|
+
props: TObject<BProps>;
|
|
107
|
+
datarecord?: TObject<TProperties> | undefined;
|
|
108
|
+
datasource?: TObject<TProperties> | undefined;
|
|
109
|
+
type: _sinclair_typebox.TLiteral<BType>;
|
|
110
|
+
kind: _sinclair_typebox.TLiteral<string>;
|
|
111
|
+
title: _sinclair_typebox.TLiteral<BTitle>;
|
|
112
|
+
description: _sinclair_typebox.TLiteral<BDesc>;
|
|
113
|
+
icon: _sinclair_typebox.TLiteral<BIcon>;
|
|
114
|
+
file: _sinclair_typebox.TLiteral<BFile>;
|
|
115
|
+
preferredWidth: TObject<{
|
|
116
|
+
mobile: _sinclair_typebox.TNumber;
|
|
117
|
+
desktop: _sinclair_typebox.TNumber;
|
|
118
|
+
}>;
|
|
119
|
+
preferredHeight: TObject<{
|
|
120
|
+
mobile: _sinclair_typebox.TNumber;
|
|
121
|
+
desktop: _sinclair_typebox.TNumber;
|
|
122
|
+
}>;
|
|
123
|
+
minWidth: TObject<{
|
|
124
|
+
mobile: _sinclair_typebox.TNumber;
|
|
125
|
+
desktop: _sinclair_typebox.TNumber;
|
|
126
|
+
}>;
|
|
127
|
+
maxWidth: TObject<{
|
|
128
|
+
mobile: _sinclair_typebox.TNumber;
|
|
129
|
+
desktop: _sinclair_typebox.TNumber;
|
|
130
|
+
}>;
|
|
131
|
+
minHeight: TObject<{
|
|
132
|
+
mobile: _sinclair_typebox.TNumber;
|
|
133
|
+
desktop: _sinclair_typebox.TNumber;
|
|
134
|
+
}>;
|
|
135
|
+
}>;
|
|
136
|
+
type BrickManifest = ReturnType<typeof defineBrickManifest>;
|
|
137
|
+
type ResolvedBrickManifest = Static<BrickManifest>;
|
|
138
|
+
type BrickConstraints = Pick<ResolvedBrickManifest, "preferredWidth" | "preferredHeight" | "minWidth" | "minHeight" | "maxWidth">;
|
|
139
|
+
|
|
140
|
+
export { type Brick, type BrickConstraints, type BrickManifest, type BrickPosition, type BricksLayout, type DefinedBrick, type DefinedBrickPosition, type LayoutCols, type ResolvedBrickManifest, type ResponsivePosition, createRow, defineBrickManifest, defineBricks, generateId };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";import{customAlphabet as x}from"nanoid";var p={desktop:36,mobile:18};var k=x("1234567890azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN",7);function u(e,i,r=p){return{x:e.x==="quarter"?r[i]/4:e.x==="threeQuarter"?r[i]*.75:e.x==="half"?r[i]/2:e.x==="third"?r[i]/3:e.x==="twoThird"?r[i]*2/3:e.x,y:e.y,w:e.w==="full"?r[i]:e.w==="half"?r[i]/2:e.w==="third"?r[i]/3:e.w==="quarter"?r[i]/4:e.w==="twoThird"?r[i]*2/3:e.w==="threeQuarter"?r[i]*3/4:e.w,h:e.h,hidden:e.hidden}}function w(e){return e.map(i=>({...i,id:`brick-${k()}`,position:{mobile:u(i.position.mobile,"mobile"),desktop:u(i.position.desktop,"desktop")}}))}var d={mobile:0,tablet:0,desktop:0};function P(e){let i=Math.max(...e.map(o=>Math.max(o.position.desktop?.h??0,o.position.tablet?.h??0,o.position.mobile?.h??0))),r=Math.max(...e.map(o=>Math.max(o.position.mobile?.h??0,o.position.tablet?.h??0,o.position.desktop?.h??0))),s=e.map((o,m)=>{let n={...o,id:`brick-${k()}`,position:{desktop:{...o.position.desktop,y:d.desktop},...o.position.mobile?{mobile:{...o.position.mobile,y:d.mobile}}:null}};return n.position.mobile?.w===p.mobile&&m!==e.length-1&&(d.mobile+=n.position.mobile.h),n});return d.desktop+=i,d.mobile+=r,s}function D({type:e,kind:i,title:r,description:s,preferredWidth:o,preferredHeight:m,minWidth:n,minHeight:b,maxWidth:h,icon:c,file:f,props:B,datasource:a,datarecord:l}){return t.Object({type:t.Literal(e),kind:t.Literal(i),title:t.Literal(r),description:t.Literal(s),icon:t.Literal(c),file:t.Literal(f),preferredWidth:t.Object({mobile:t.Number(),desktop:t.Number()},{default:o??n}),preferredHeight:t.Object({mobile:t.Number(),desktop:t.Number()},{default:m??b}),minWidth:t.Object({mobile:t.Number(),desktop:t.Number()},{default:n??{mobile:1,desktop:1}}),maxWidth:t.Object({mobile:t.Number(),desktop:t.Number()},{default:h??{mobile:p.mobile,desktop:p.desktop}}),minHeight:t.Object({mobile:t.Number(),desktop:t.Number()},{default:b??{mobile:1,desktop:1}}),...a&&{datasource:a},...l&&{datarecord:l},props:B})}export{P as createRow,D as defineBrickManifest,w as defineBricks,k as generateId};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FacebookPostSchema } from './schema.js';
|
|
2
|
+
import { MetaOAuthConfig } from '../../meta/oauth/config.js';
|
|
3
|
+
import { a as DatasourceFetcher } from '../../../../datasources-DAysbbXK.js';
|
|
4
|
+
import { MetaOptions } from '../../meta/options.js';
|
|
5
|
+
import '@sinclair/typebox';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../../../../attributes.js';
|
|
8
|
+
import '../../../../themes/color-system.js';
|
|
9
|
+
import '../../../../theme.js';
|
|
10
|
+
import 'chroma-js';
|
|
11
|
+
import '../../../../bricks.js';
|
|
12
|
+
import '../../../../manifest.js';
|
|
13
|
+
|
|
14
|
+
declare const fetchFacebookPostDatasource: DatasourceFetcher<FacebookPostSchema, MetaOAuthConfig, MetaOptions>;
|
|
15
|
+
|
|
16
|
+
export { fetchFacebookPostDatasource as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";var c=t.Object({data:t.Array(t.Object({from:t.Object({name:t.String(),id:t.String()}),id:t.String(),permalink_url:t.String(),is_hidden:t.Boolean(),message:t.Optional(t.String()),object_id:t.String(),link:t.String(),is_published:t.Boolean(),status_type:t.String(),type:t.String(),actions:t.Array(t.Object({name:t.String(),link:t.String()}))})),paging:t.Object({previous:t.Optional(t.String()),next:t.Optional(t.String())})});import{UnauthorizedError as p}from"http-errors-enhanced";function m(e){return Object.fromEntries(Object.entries(e).map(([r,a])=>[r,a.toString()]))}import h from"ajv";import b from"ajv-formats";var s=new h({useDefaults:!0});b(s,["date-time","time","date","email","hostname","ipv4","ipv6","uri","uri-reference","uuid","uri-template","json-pointer","relative-json-pointer","regex"]);s.addFormat("date-object",{validate:e=>e instanceof Date&&!Number.isNaN(e.getTime()),async:!1});function u(e){return!e||e.length===0?"Unknown validation error":e.map(r=>{let{instancePath:a,message:o,params:i}=r,n=a||"root",f=Object.entries(i||{}).map(([d,l])=>`${d}: ${l}`).join(", ");return`${n} ${o} (${f})`}).join("; ")}var g=async({options:e,oauth:r})=>{let a=new URLSearchParams({...m(e),fields:["from","permalink_url","name","description","caption","id","is_hidden","message","application","object_id","link","is_published","properties","status_type","story","type","actions","call_to_action","child_attachments"].join(","),access_token:r.config.accessToken}),o=await fetch(`https://graph.facebook.com/me/posts?${a}`);if(!o.ok)throw o.status===401?new p("fetchFacebookPostDatasource Error: Unauthorized."):new Error(`fetchFacebookPostDatasource Error: Response status: ${o.status}`);let i=await o.json(),n=s.compile(c);if(!n(i))throw new Error(`fetchFacebookPostDatasource Error: Invalid JSON object: ${u(n.errors)}`);return i},D=g;export{D as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const facebookPostSchema: _sinclair_typebox.TObject<{
|
|
5
|
+
data: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
6
|
+
from: _sinclair_typebox.TObject<{
|
|
7
|
+
name: _sinclair_typebox.TString;
|
|
8
|
+
id: _sinclair_typebox.TString;
|
|
9
|
+
}>;
|
|
10
|
+
id: _sinclair_typebox.TString;
|
|
11
|
+
permalink_url: _sinclair_typebox.TString;
|
|
12
|
+
is_hidden: _sinclair_typebox.TBoolean;
|
|
13
|
+
message: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
14
|
+
object_id: _sinclair_typebox.TString;
|
|
15
|
+
link: _sinclair_typebox.TString;
|
|
16
|
+
is_published: _sinclair_typebox.TBoolean;
|
|
17
|
+
status_type: _sinclair_typebox.TString;
|
|
18
|
+
type: _sinclair_typebox.TString;
|
|
19
|
+
actions: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
20
|
+
name: _sinclair_typebox.TString;
|
|
21
|
+
link: _sinclair_typebox.TString;
|
|
22
|
+
}>>;
|
|
23
|
+
}>>;
|
|
24
|
+
paging: _sinclair_typebox.TObject<{
|
|
25
|
+
previous: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
26
|
+
next: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
27
|
+
}>;
|
|
28
|
+
}>;
|
|
29
|
+
type FacebookPostSchema = Static<typeof facebookPostSchema>;
|
|
30
|
+
|
|
31
|
+
export { type FacebookPostSchema, facebookPostSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";var e=t.Object({data:t.Array(t.Object({from:t.Object({name:t.String(),id:t.String()}),id:t.String(),permalink_url:t.String(),is_hidden:t.Boolean(),message:t.Optional(t.String()),object_id:t.String(),link:t.String(),is_published:t.Boolean(),status_type:t.String(),type:t.String(),actions:t.Array(t.Object({name:t.String(),link:t.String()}))})),paging:t.Object({previous:t.Optional(t.String()),next:t.Optional(t.String())})});export{e as facebookPostSchema};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { InstagramFeedSchema } from './schema.js';
|
|
2
|
+
import { MetaOAuthConfig } from '../../meta/oauth/config.js';
|
|
3
|
+
import { a as DatasourceFetcher } from '../../../../datasources-DAysbbXK.js';
|
|
4
|
+
import { MetaOptions } from '../../meta/options.js';
|
|
5
|
+
import '@sinclair/typebox';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '../../../../attributes.js';
|
|
8
|
+
import '../../../../themes/color-system.js';
|
|
9
|
+
import '../../../../theme.js';
|
|
10
|
+
import 'chroma-js';
|
|
11
|
+
import '../../../../bricks.js';
|
|
12
|
+
import '../../../../manifest.js';
|
|
13
|
+
|
|
14
|
+
declare const fetchInstagramFeedDatasource: DatasourceFetcher<InstagramFeedSchema, MetaOAuthConfig, MetaOptions>;
|
|
15
|
+
|
|
16
|
+
export { fetchInstagramFeedDatasource as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as e}from"@sinclair/typebox";var c=e.Object({data:e.Array(e.Object({id:e.String(),caption:e.String(),timestamp:e.String(),media_url:e.String(),permalink:e.String(),media_type:e.Union([e.Literal("IMAGE"),e.Literal("VIDEO"),e.Literal("CAROUSEL_ALBUM")])})),paging:e.Object({cursors:e.Object({before:e.Optional(e.String()),after:e.Optional(e.String())}),next:e.Optional(e.String())})});import{UnauthorizedError as p}from"http-errors-enhanced";function d(t){return Object.fromEntries(Object.entries(t).map(([a,o])=>[a,o.toString()]))}import l from"ajv";import h from"ajv-formats";var s=new l({useDefaults:!0});h(s,["date-time","time","date","email","hostname","ipv4","ipv6","uri","uri-reference","uuid","uri-template","json-pointer","relative-json-pointer","regex"]);s.addFormat("date-object",{validate:t=>t instanceof Date&&!Number.isNaN(t.getTime()),async:!1});function u(t){return!t||t.length===0?"Unknown validation error":t.map(a=>{let{instancePath:o,message:r,params:n}=a,i=o||"root",m=Object.entries(n||{}).map(([g,f])=>`${g}: ${f}`).join(", ");return`${i} ${r} (${m})`}).join("; ")}var j=async({options:t,oauth:a})=>{let o=new URLSearchParams({...d(t),access_token:a.config.accessToken,fields:["id","caption","timestamp","thumbnail_url","media_url","permalink","media_type"].join(",")}),r=await fetch(`https://graph.instagram.com/me/media?${o.toString()}`);if(!r.ok)throw r.status===401?new p("fetchInstagramFeedDatasource Error: Unauthorized."):new Error(`fetchInstagramFeedDatasource Error: Response status: ${r.status}`);let n=await r.json(),i=s.compile(c);if(!i(n))throw new Error(`fetchInstagramFeedDatasource Error: Invalid Instagram response data: ${u(i.errors)}`);return n},U=j;export{U as default};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const instagramFeedSchema: _sinclair_typebox.TObject<{
|
|
5
|
+
data: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
6
|
+
id: _sinclair_typebox.TString;
|
|
7
|
+
caption: _sinclair_typebox.TString;
|
|
8
|
+
timestamp: _sinclair_typebox.TString;
|
|
9
|
+
media_url: _sinclair_typebox.TString;
|
|
10
|
+
permalink: _sinclair_typebox.TString;
|
|
11
|
+
media_type: _sinclair_typebox.TUnion<[_sinclair_typebox.TLiteral<"IMAGE">, _sinclair_typebox.TLiteral<"VIDEO">, _sinclair_typebox.TLiteral<"CAROUSEL_ALBUM">]>;
|
|
12
|
+
}>>;
|
|
13
|
+
paging: _sinclair_typebox.TObject<{
|
|
14
|
+
cursors: _sinclair_typebox.TObject<{
|
|
15
|
+
before: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
16
|
+
after: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
17
|
+
}>;
|
|
18
|
+
next: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
19
|
+
}>;
|
|
20
|
+
}>;
|
|
21
|
+
type InstagramFeedSchema = Static<typeof instagramFeedSchema>;
|
|
22
|
+
|
|
23
|
+
export { type InstagramFeedSchema, instagramFeedSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";var a=t.Object({data:t.Array(t.Object({id:t.String(),caption:t.String(),timestamp:t.String(),media_url:t.String(),permalink:t.String(),media_type:t.Union([t.Literal("IMAGE"),t.Literal("VIDEO"),t.Literal("CAROUSEL_ALBUM")])})),paging:t.Object({cursors:t.Object({before:t.Optional(t.String()),after:t.Optional(t.String())}),next:t.Optional(t.String())})});export{a as instagramFeedSchema};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HttpJsonOptions } from './options.js';
|
|
2
|
+
import { a as DatasourceFetcher } from '../../../datasources-DAysbbXK.js';
|
|
3
|
+
import '@sinclair/typebox';
|
|
4
|
+
import 'zod';
|
|
5
|
+
import '../../../attributes.js';
|
|
6
|
+
import '../../../themes/color-system.js';
|
|
7
|
+
import '../../../theme.js';
|
|
8
|
+
import 'chroma-js';
|
|
9
|
+
import '../../../bricks.js';
|
|
10
|
+
import '../../../manifest.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* For this fetcher, validation is done outside of the fetcher.
|
|
14
|
+
*/
|
|
15
|
+
declare const fetchHttpJSON: DatasourceFetcher<unknown, null, HttpJsonOptions>;
|
|
16
|
+
|
|
17
|
+
export { fetchHttpJSON as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{get as i}from"lodash-es";var l=async({options:e,pageConfig:s})=>{let r=/{{(.+?)}}/g,t=u(s),n=e.url.replace(r,t),c={};if(e.headers)for(let[a,p]of Object.entries(e.headers??{}))c[a]=p.replace(r,t);let o=await fetch(n,{headers:c});if(!o.ok)throw new Error(`fetchHttpJSON Error: Response status: ${o.status}`);return o.json()},h=l;function u(e){return function(r,t){let n=t.trim();return String(i(e,n))??""}}export{h as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const httpJsonOptions: _sinclair_typebox.TObject<{
|
|
5
|
+
nextRefreshDelay: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
6
|
+
url: _sinclair_typebox.TString;
|
|
7
|
+
headers: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TString>>;
|
|
8
|
+
}>;
|
|
9
|
+
type HttpJsonOptions = Static<typeof httpJsonOptions>;
|
|
10
|
+
|
|
11
|
+
export { type HttpJsonOptions, httpJsonOptions };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";import{Type as e}from"@sinclair/typebox";import r from"zod";var o=e.Object({nextRefreshDelay:e.Optional(e.Number())}),p=["facebook-posts","instagram-feed","mastodon-status","rss","threads-media","tiktok-video","youtube-list","json"],i=r.enum(p);var c=t.Composite([o,t.Object({url:t.String(),headers:t.Optional(t.Record(t.String(),t.String()))})]);export{c as httpJsonOptions};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MastodonAccountSchema } from './schema.js';
|
|
2
|
+
import { a as DatasourceFetcher } from '../../../../datasources-DAysbbXK.js';
|
|
3
|
+
import { MastodonCommonOptions } from '../options.js';
|
|
4
|
+
import '@sinclair/typebox';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import '../../../../attributes.js';
|
|
7
|
+
import '../../../../themes/color-system.js';
|
|
8
|
+
import '../../../../theme.js';
|
|
9
|
+
import 'chroma-js';
|
|
10
|
+
import '../../../../bricks.js';
|
|
11
|
+
import '../../../../manifest.js';
|
|
12
|
+
|
|
13
|
+
declare const fetchMastodonAccount: DatasourceFetcher<MastodonAccountSchema, null, MastodonCommonOptions>;
|
|
14
|
+
|
|
15
|
+
export { fetchMastodonAccount as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";var l=t.Object({id:t.String(),username:t.String(),acct:t.String(),url:t.String(),display_name:t.Optional(t.String()),note:t.String(),avatar:t.String(),avatar_static:t.String(),header:t.String(),header_static:t.String(),locked:t.Boolean(),fields:t.Array(t.Object({name:t.String(),value:t.String(),verified_at:t.Optional(t.String())})),emojis:t.Array(t.Object({shortcode:t.String(),url:t.String(),static_url:t.String(),visible_in_picker:t.Boolean(),category:t.Optional(t.String())})),bot:t.Boolean(),group:t.Boolean(),discoverable:t.Union([t.Boolean(),t.Null()]),noindex:t.Optional(t.Boolean()),moved:t.Optional(t.String()),suspended:t.Optional(t.Boolean()),limited:t.Optional(t.Boolean()),created_at:t.String(),last_status_at:t.Optional(t.String()),statuses_count:t.Number(),followers_count:t.Number(),following_count:t.Number()});import d from"ajv";import S from"ajv-formats";var r=new d({useDefaults:!0});S(r,["date-time","time","date","email","hostname","ipv4","ipv6","uri","uri-reference","uuid","uri-template","json-pointer","relative-json-pointer","regex"]);r.addFormat("date-object",{validate:o=>o instanceof Date&&!Number.isNaN(o.getTime()),async:!1});function m(o){return!o||o.length===0?"Unknown validation error":o.map(s=>{let{instancePath:i,message:e,params:a}=s,n=i||"root",c=Object.entries(a||{}).map(([u,p])=>`${u}: ${p}`).join(", ");return`${n} ${e} (${c})`}).join("; ")}var g=async({options:o})=>{let i=`https://mastodon.social/api/v1/accounts/lookup?${new URLSearchParams({acct:o.username}).toString()}`,e=await fetch(i);if(!e.ok)throw new Error(`fetchMastodonAccount Error: Response status: ${e.status}`);let a=await e.json(),n=r.compile(l);if(!n(a))throw new Error(`fetchMastodonAccount Error: Invalid Mastodon account response data: ${m(n.errors)}`);return a},b=g;export{b as default};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const mastodonAccountSchema: _sinclair_typebox.TObject<{
|
|
5
|
+
id: _sinclair_typebox.TString;
|
|
6
|
+
username: _sinclair_typebox.TString;
|
|
7
|
+
acct: _sinclair_typebox.TString;
|
|
8
|
+
url: _sinclair_typebox.TString;
|
|
9
|
+
display_name: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
10
|
+
note: _sinclair_typebox.TString;
|
|
11
|
+
avatar: _sinclair_typebox.TString;
|
|
12
|
+
avatar_static: _sinclair_typebox.TString;
|
|
13
|
+
header: _sinclair_typebox.TString;
|
|
14
|
+
header_static: _sinclair_typebox.TString;
|
|
15
|
+
locked: _sinclair_typebox.TBoolean;
|
|
16
|
+
fields: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
17
|
+
name: _sinclair_typebox.TString;
|
|
18
|
+
value: _sinclair_typebox.TString;
|
|
19
|
+
verified_at: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
20
|
+
}>>;
|
|
21
|
+
emojis: _sinclair_typebox.TArray<_sinclair_typebox.TObject<{
|
|
22
|
+
shortcode: _sinclair_typebox.TString;
|
|
23
|
+
url: _sinclair_typebox.TString;
|
|
24
|
+
static_url: _sinclair_typebox.TString;
|
|
25
|
+
visible_in_picker: _sinclair_typebox.TBoolean;
|
|
26
|
+
category: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
27
|
+
}>>;
|
|
28
|
+
bot: _sinclair_typebox.TBoolean;
|
|
29
|
+
group: _sinclair_typebox.TBoolean;
|
|
30
|
+
discoverable: _sinclair_typebox.TUnion<[_sinclair_typebox.TBoolean, _sinclair_typebox.TNull]>;
|
|
31
|
+
noindex: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
32
|
+
moved: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
33
|
+
suspended: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
34
|
+
limited: _sinclair_typebox.TOptional<_sinclair_typebox.TBoolean>;
|
|
35
|
+
created_at: _sinclair_typebox.TString;
|
|
36
|
+
last_status_at: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
37
|
+
statuses_count: _sinclair_typebox.TNumber;
|
|
38
|
+
followers_count: _sinclair_typebox.TNumber;
|
|
39
|
+
following_count: _sinclair_typebox.TNumber;
|
|
40
|
+
}>;
|
|
41
|
+
type MastodonAccountSchema = Static<typeof mastodonAccountSchema>;
|
|
42
|
+
|
|
43
|
+
export { type MastodonAccountSchema, mastodonAccountSchema };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";var n=t.Object({id:t.String(),username:t.String(),acct:t.String(),url:t.String(),display_name:t.Optional(t.String()),note:t.String(),avatar:t.String(),avatar_static:t.String(),header:t.String(),header_static:t.String(),locked:t.Boolean(),fields:t.Array(t.Object({name:t.String(),value:t.String(),verified_at:t.Optional(t.String())})),emojis:t.Array(t.Object({shortcode:t.String(),url:t.String(),static_url:t.String(),visible_in_picker:t.Boolean(),category:t.Optional(t.String())})),bot:t.Boolean(),group:t.Boolean(),discoverable:t.Union([t.Boolean(),t.Null()]),noindex:t.Optional(t.Boolean()),moved:t.Optional(t.String()),suspended:t.Optional(t.Boolean()),limited:t.Optional(t.Boolean()),created_at:t.String(),last_status_at:t.Optional(t.String()),statuses_count:t.Number(),followers_count:t.Number(),following_count:t.Number()});export{n as mastodonAccountSchema};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const mastodonCommonOptions: _sinclair_typebox.TObject<{
|
|
5
|
+
nextRefreshDelay: _sinclair_typebox.TOptional<_sinclair_typebox.TNumber>;
|
|
6
|
+
username: _sinclair_typebox.TString;
|
|
7
|
+
}>;
|
|
8
|
+
type MastodonCommonOptions = Static<typeof mastodonCommonOptions>;
|
|
9
|
+
|
|
10
|
+
export { type MastodonCommonOptions, mastodonCommonOptions };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as o}from"@sinclair/typebox";import{Type as t}from"@sinclair/typebox";import r from"zod";var e=t.Object({nextRefreshDelay:t.Optional(t.Number())}),s=["facebook-posts","instagram-feed","mastodon-status","rss","threads-media","tiktok-video","youtube-list","json"],i=r.enum(s);var O=o.Composite([e,o.Object({username:o.String()})]);export{O as mastodonCommonOptions};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MastodonStatusArraySchema } from './schema.js';
|
|
2
|
+
import { a as DatasourceFetcher } from '../../../../datasources-DAysbbXK.js';
|
|
3
|
+
import { MastodonCommonOptions } from '../options.js';
|
|
4
|
+
import '@sinclair/typebox';
|
|
5
|
+
import 'zod';
|
|
6
|
+
import '../../../../attributes.js';
|
|
7
|
+
import '../../../../themes/color-system.js';
|
|
8
|
+
import '../../../../theme.js';
|
|
9
|
+
import 'chroma-js';
|
|
10
|
+
import '../../../../bricks.js';
|
|
11
|
+
import '../../../../manifest.js';
|
|
12
|
+
|
|
13
|
+
declare const fetchMastodonStatus: DatasourceFetcher<MastodonStatusArraySchema, null, MastodonCommonOptions>;
|
|
14
|
+
|
|
15
|
+
export { fetchMastodonStatus as default };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
import{Type as t}from"@sinclair/typebox";import{Type as o}from"@sinclair/typebox";var m=o.Object({id:o.String(),username:o.String(),acct:o.String(),url:o.String(),display_name:o.Optional(o.String()),note:o.String(),avatar:o.String(),avatar_static:o.String(),header:o.String(),header_static:o.String(),locked:o.Boolean(),fields:o.Array(o.Object({name:o.String(),value:o.String(),verified_at:o.Optional(o.String())})),emojis:o.Array(o.Object({shortcode:o.String(),url:o.String(),static_url:o.String(),visible_in_picker:o.Boolean(),category:o.Optional(o.String())})),bot:o.Boolean(),group:o.Boolean(),discoverable:o.Union([o.Boolean(),o.Null()]),noindex:o.Optional(o.Boolean()),moved:o.Optional(o.String()),suspended:o.Optional(o.Boolean()),limited:o.Optional(o.Boolean()),created_at:o.String(),last_status_at:o.Optional(o.String()),statuses_count:o.Number(),followers_count:o.Number(),following_count:o.Number()});var O=t.Object({id:t.String(),type:t.Union([t.Literal("audio"),t.Literal("image"),t.Literal("video"),t.Literal("gifv"),t.Literal("unknown")]),url:t.String(),preview_url:t.Optional(t.String()),remote_url:t.Optional(t.String()),meta:t.Record(t.String(),t.Any()),description:t.Optional(t.String()),blurhash:t.Optional(t.String())}),S=t.Object({shortcode:t.String(),url:t.String(),static_url:t.String(),visible_in_picker:t.Boolean(),category:t.Optional(t.String())}),y=t.Object({url:t.String(),title:t.String(),description:t.String(),type:t.Union([t.Literal("link"),t.Literal("photo"),t.Literal("video"),t.Literal("rich")]),author_name:t.String(),author_url:t.String(),provider_name:t.String(),provider_url:t.String(),html:t.String(),width:t.Number(),height:t.Number(),image:t.Optional(t.String()),embed_url:t.String(),blurhash:t.Optional(t.String())}),b=t.Object({id:t.String(),expires_at:t.String(),expired:t.Boolean(),multiple:t.Boolean(),votes_count:t.Number(),options:t.Array(t.Object({title:t.String(),votes_count:t.Number()})),voted:t.Optional(t.Boolean()),own_votes:t.Optional(t.Array(t.Number())),emojis:t.Array(S)}),v=t.Object({id:t.String(),uri:t.String(),created_at:t.String(),account:m,content:t.String(),visibility:t.Union([t.Literal("public"),t.Literal("unlisted"),t.Literal("private"),t.Literal("direct")]),sensitive:t.Boolean(),media_attachments:t.Array(O),application:t.Optional(t.Object({name:t.String(),website:t.Optional(t.String())})),mentions:t.Array(t.Object({id:t.String(),username:t.String(),acct:t.String(),url:t.String()})),tags:t.Array(t.Object({name:t.String(),url:t.String()})),emojis:t.Array(S),reblogs_count:t.Number(),favourites_count:t.Number(),replies_count:t.Number(),url:t.String(),in_reply_to_id:t.Optional(t.String()),in_reply_to_account_id:t.Optional(t.String()),reblog:t.Optional(t.Ref("mastodonStatus")),poll:t.Optional(b),card:t.Optional(y),language:t.Optional(t.String()),text:t.Optional(t.String()),edited_at:t.Optional(t.String()),favourited:t.Optional(t.Boolean()),reblogged:t.Optional(t.Boolean()),muted:t.Optional(t.Boolean()),bookmarked:t.Optional(t.Boolean()),pinned:t.Optional(t.Boolean())},{$id:"mastodonStatus"}),g=t.Array(v);import _ from"ajv";import A from"ajv-formats";var s=new _({useDefaults:!0});A(s,["date-time","time","date","email","hostname","ipv4","ipv6","uri","uri-reference","uuid","uri-template","json-pointer","relative-json-pointer","regex"]);s.addFormat("date-object",{validate:r=>r instanceof Date&&!Number.isNaN(r.getTime()),async:!1});function p(r){return!r||r.length===0?"Unknown validation error":r.map(l=>{let{instancePath:e,message:n,params:i}=l,a=e||"root",c=Object.entries(i||{}).map(([u,d])=>`${u}: ${d}`).join(", ");return`${a} ${n} (${c})`}).join("; ")}var j=async({options:r})=>{let e=`https://mastodon.social/api/v1/accounts/lookup?${new URLSearchParams({acct:r.username}).toString()}`,n=await fetch(e);if(!n.ok)throw new Error(`fetchMastodonAccount Error: Response status: ${n.status}`);let i=await n.json(),a=s.compile(m);if(!a(i))throw new Error(`fetchMastodonAccount Error: Invalid Mastodon account response data: ${p(a.errors)}`);return i},h=j;import{UnauthorizedError as f}from"http-errors-enhanced";var w=async({options:r,pageConfig:l})=>{let e=await h({options:{username:r.username},pageConfig:l,oauth:null}),i=`https://${new URL(e.url).host}/api/v1/accounts/${e.id}/statuses`,a=await fetch(i);if(!a.ok)throw a.status===401?new f("fetchMastodonStatus Error: Unauthorized."):new Error(`fetchMastodonStatus Error: Response status: ${a.status}`);let c=await a.json(),u=s.compile(g);if(!u(c))throw new Error(`fetchMastodonStatus Error: Invalid Mastodon status response data: ${p(u.errors)}`);return c},I=w;export{I as default};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
declare const sample: {
|
|
2
|
+
account: {
|
|
3
|
+
acct: string;
|
|
4
|
+
avatar: string;
|
|
5
|
+
avatar_static: string;
|
|
6
|
+
bot: false;
|
|
7
|
+
created_at: string;
|
|
8
|
+
display_name: string;
|
|
9
|
+
emojis: {
|
|
10
|
+
category: string;
|
|
11
|
+
shortcode: string;
|
|
12
|
+
static_url: string;
|
|
13
|
+
url: string;
|
|
14
|
+
visible_in_picker: true;
|
|
15
|
+
}[];
|
|
16
|
+
id: string;
|
|
17
|
+
url: string;
|
|
18
|
+
username: string;
|
|
19
|
+
discoverable: true;
|
|
20
|
+
fields: never[];
|
|
21
|
+
followers_count: number;
|
|
22
|
+
following_count: number;
|
|
23
|
+
group: false;
|
|
24
|
+
header: string;
|
|
25
|
+
header_static: string;
|
|
26
|
+
last_status_at: string;
|
|
27
|
+
locked: false;
|
|
28
|
+
note: string;
|
|
29
|
+
noindex: false;
|
|
30
|
+
statuses_count: number;
|
|
31
|
+
suspended: false;
|
|
32
|
+
};
|
|
33
|
+
content: string;
|
|
34
|
+
created_at: string;
|
|
35
|
+
id: string;
|
|
36
|
+
media_attachments: never[];
|
|
37
|
+
reblogs_count: number;
|
|
38
|
+
replies_count: number;
|
|
39
|
+
favourites_count: number;
|
|
40
|
+
tags: never[];
|
|
41
|
+
uri: string;
|
|
42
|
+
visibility: "public";
|
|
43
|
+
sensitive: false;
|
|
44
|
+
application: {
|
|
45
|
+
name: string;
|
|
46
|
+
website: string;
|
|
47
|
+
};
|
|
48
|
+
mentions: never[];
|
|
49
|
+
emojis: never[];
|
|
50
|
+
url: string;
|
|
51
|
+
}[];
|
|
52
|
+
|
|
53
|
+
export { sample };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! Enpage - Copyright (C) 2024 Flippable - https://github.com/enpage/enpage/blob/main/LICENSE */
|
|
2
|
+
var a=[{account:{acct:"Gargron",avatar:"https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",avatar_static:"https://files.mastodon.social/accounts/avatars/000/000/001/original/7b7e3c3e3e7e3e3e.png",bot:!1,created_at:"2016-04-04T17:41:54.000Z",display_name:"Eugen",emojis:[{category:"custom",shortcode:"blobawave",static_url:"https://files.mastodon.social/custom_emojis/images/000/000/001/static/1f4a9.png",url:"https://files.mastodon.social/custom_emojis/images/000/000/001/original/1f4a9.png",visible_in_picker:!0}],id:"1",url:"https://mastodon.social/@Gargron",username:"Gargron",discoverable:!0,fields:[],followers_count:100,following_count:100,group:!1,header:"https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",header_static:"https://files.mastodon.social/accounts/headers/000/000/001/original/7b7e3c3e3e7e3e3e.png",last_status_at:"2021-06-26T18:00:00",locked:!1,note:"Admin of mastodon.social",noindex:!1,statuses_count:100,suspended:!1},content:"Hello, world!",created_at:"2021-06-26T18:00:00",id:"1",media_attachments:[],reblogs_count:0,replies_count:0,favourites_count:0,tags:[],uri:"https://mastodon.social/@Gargron/1",visibility:"public",sensitive:!1,application:{name:"Mastodon",website:"https://joinmastodon.org"},mentions:[],emojis:[],url:"https://mastodon.social/@Gargron/1"}];export{a as sample};
|