graze-client 0.3.1 → 0.3.3

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.
@@ -0,0 +1,153 @@
1
+ import { HttpClient } from "@effect/platform";
2
+ import { Effect } from "effect";
3
+ import * as Form from "./schema/UpdateAlgorithmPayload.js";
4
+ declare const GrazeClient_base: Effect.Service.Class<GrazeClient, "GrazeClient", {
5
+ readonly effect: Effect.Effect<{
6
+ updateAlgorithm: (data: Form.FullForm) => Effect.Effect<{
7
+ readonly message: string;
8
+ readonly algorithm: {
9
+ readonly algorithm_uri: string;
10
+ readonly algorithm_manifest_id: number | null;
11
+ readonly draft_algorithm_manifest_id: number;
12
+ readonly record_name: string;
13
+ readonly display_name: string;
14
+ readonly description: string;
15
+ readonly feed_did: string;
16
+ readonly avatar_url: string | null;
17
+ readonly cpm_cents: number | null;
18
+ readonly deleted: boolean;
19
+ readonly active: boolean;
20
+ readonly public: boolean;
21
+ readonly monetization_available: boolean;
22
+ readonly status: string | null;
23
+ readonly unique_operator_ids: readonly number[];
24
+ readonly user_id: number;
25
+ readonly id: number;
26
+ readonly created_at: Date;
27
+ readonly updated_at: Date;
28
+ readonly deleted_at: Date | null;
29
+ };
30
+ }, import("@effect/platform/HttpApiError").HttpApiDecodeError | import("@effect/platform/HttpClientError").HttpClientError | import("effect/ParseResult").ParseError, never>;
31
+ getFeeds: () => Effect.Effect<{
32
+ readonly page: number;
33
+ readonly page_size: number;
34
+ readonly total_items: number;
35
+ readonly total_pages: number;
36
+ readonly user_algos: readonly {
37
+ readonly algorithm_uri: string;
38
+ readonly algorithm_manifest_id: number | null;
39
+ readonly draft_algorithm_manifest_id: number;
40
+ readonly record_name: string;
41
+ readonly display_name: string;
42
+ readonly description: string;
43
+ readonly feed_did: string;
44
+ readonly avatar_url: string | null;
45
+ readonly cpm_cents: number | null;
46
+ readonly deleted: boolean;
47
+ readonly active: boolean;
48
+ readonly public: boolean;
49
+ readonly monetization_available: boolean;
50
+ readonly status: string | null;
51
+ readonly unique_operator_ids: readonly number[];
52
+ readonly user_id: number;
53
+ readonly id: number;
54
+ readonly created_at: Date;
55
+ readonly updated_at: Date;
56
+ readonly deleted_at: Date | null;
57
+ readonly stats: {
58
+ readonly page_renders: number;
59
+ readonly unique_users: number;
60
+ readonly post_renders: number;
61
+ };
62
+ }[];
63
+ }, import("@effect/platform/HttpApiError").HttpApiDecodeError | import("@effect/platform/HttpClientError").HttpClientError, never>;
64
+ getFeed: <WithResponse extends boolean = false>(request: {
65
+ readonly path: {
66
+ readonly feedId: number;
67
+ };
68
+ readonly withResponse?: WithResponse;
69
+ }) => Effect.Effect<WithResponse extends true ? [{
70
+ readonly algorithm_uri: string;
71
+ readonly algorithm_manifest_id: number | null;
72
+ readonly draft_algorithm_manifest_id: number;
73
+ readonly record_name: string;
74
+ readonly display_name: string;
75
+ readonly description: string;
76
+ readonly feed_did: string;
77
+ readonly avatar_url: string | null;
78
+ readonly cpm_cents: number | null;
79
+ readonly deleted: boolean;
80
+ readonly active: boolean;
81
+ readonly public: boolean;
82
+ readonly monetization_available: boolean;
83
+ readonly status: string | null;
84
+ readonly unique_operator_ids: readonly number[];
85
+ readonly user_id: number;
86
+ readonly id: number;
87
+ readonly created_at: Date;
88
+ readonly updated_at: Date;
89
+ readonly deleted_at: Date | null;
90
+ readonly stats: unknown;
91
+ readonly latest_error: unknown;
92
+ readonly latest_compute_cycle: unknown;
93
+ readonly subscriber_lists: unknown;
94
+ readonly draft_algorithm_manifest: unknown;
95
+ readonly algorithm_manifest: unknown;
96
+ }, import("@effect/platform/HttpClientResponse").HttpClientResponse] : {
97
+ readonly algorithm_uri: string;
98
+ readonly algorithm_manifest_id: number | null;
99
+ readonly draft_algorithm_manifest_id: number;
100
+ readonly record_name: string;
101
+ readonly display_name: string;
102
+ readonly description: string;
103
+ readonly feed_did: string;
104
+ readonly avatar_url: string | null;
105
+ readonly cpm_cents: number | null;
106
+ readonly deleted: boolean;
107
+ readonly active: boolean;
108
+ readonly public: boolean;
109
+ readonly monetization_available: boolean;
110
+ readonly status: string | null;
111
+ readonly unique_operator_ids: readonly number[];
112
+ readonly user_id: number;
113
+ readonly id: number;
114
+ readonly created_at: Date;
115
+ readonly updated_at: Date;
116
+ readonly deleted_at: Date | null;
117
+ readonly stats: unknown;
118
+ readonly latest_error: unknown;
119
+ readonly latest_compute_cycle: unknown;
120
+ readonly subscriber_lists: unknown;
121
+ readonly draft_algorithm_manifest: unknown;
122
+ readonly algorithm_manifest: unknown;
123
+ }, import("@effect/platform/HttpApiError").HttpApiDecodeError | import("@effect/platform/HttpClientError").HttpClientError, never>;
124
+ publishAlgorithm: <WithResponse extends boolean = false>(request: {
125
+ readonly path: {
126
+ readonly feedId: number;
127
+ };
128
+ readonly withResponse?: WithResponse;
129
+ }) => Effect.Effect<WithResponse extends true ? [unknown, import("@effect/platform/HttpClientResponse").HttpClientResponse] : unknown, import("@effect/platform/HttpApiError").HttpApiDecodeError | import("@effect/platform/HttpClientError").HttpClientError, never>;
130
+ hidePost: <WithResponse extends boolean = false>(request: {
131
+ readonly payload: {
132
+ readonly algo_id: number;
133
+ readonly at_uri: string;
134
+ };
135
+ readonly withResponse?: WithResponse;
136
+ }) => Effect.Effect<WithResponse extends true ? [unknown, import("@effect/platform/HttpClientResponse").HttpClientResponse] : unknown, import("@effect/platform/HttpApiError").HttpApiDecodeError | import("@effect/platform/HttpClientError").HttpClientError, never>;
137
+ }, import("effect/ConfigError").ConfigError, HttpClient.HttpClient>;
138
+ readonly dependencies: readonly [import("effect/Layer").Layer<HttpClient.HttpClient, never, never>];
139
+ }>;
140
+ export declare class GrazeClient extends GrazeClient_base {
141
+ }
142
+ declare const GrazeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
143
+ readonly _tag: "GrazeError";
144
+ } & Readonly<A>;
145
+ export declare class GrazeError extends GrazeError_base<{
146
+ message: string;
147
+ status: number;
148
+ statusText: string;
149
+ json: unknown;
150
+ }> {
151
+ }
152
+ export {};
153
+ //# sourceMappingURL=GrazeClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrazeClient.d.ts","sourceRoot":"","sources":["../../src/GrazeClient.ts"],"names":[],"mappings":"AAMA,OAAO,EAOL,UAAU,EAEX,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAgB,MAAM,EAAoB,MAAM,QAAQ,CAAC;AAEhE,OAAO,KAAK,IAAI,MAAM,oCAAoC,CAAC;;;gCA0E1B,IAAI,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgB9C,qBAAa,WAAY,SAAQ,gBAG/B;CAED;;;;AAED,qBAAa,UAAW,SAAQ,gBAA+B;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;CAAG"}
@@ -0,0 +1,42 @@
1
+ import { AttributeComparison, AttributeName, AttributeValue, ContentModerationBlock, Filter, ListMemberFilter, RegexMatches, RegexNegationMatches, SocialGraph } from "./schema/index.js";
2
+ export declare const Algo: {
3
+ filter: (...filters: Filter[]) => {
4
+ filter: Filter;
5
+ };
6
+ };
7
+ export declare const F: {
8
+ and: (...filters: Filter[]) => {
9
+ and: Filter[];
10
+ };
11
+ or: (...filters: Filter[]) => {
12
+ or: Filter[];
13
+ };
14
+ regexMatches: (attribute: RegexMatches["regex_matches"][0], regex: string) => RegexMatches;
15
+ regexNegationMatches: (attribute: RegexNegationMatches["regex_negation_matches"][0], regex: string) => RegexNegationMatches;
16
+ attributeCompare: (attr: AttributeName, op: AttributeComparison, value: AttributeValue) => Filter;
17
+ isListMember: (uri: string) => ListMemberFilter;
18
+ isNotListMember: (uri: string) => ListMemberFilter;
19
+ socialGraph: (identifier: string, op: SocialGraph["social_graph"][1], relation: SocialGraph["social_graph"][2]) => SocialGraph;
20
+ posterIsFollowedBy: (identifier: string) => Readonly<{
21
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
22
+ }>;
23
+ posterFollows: (identifier: string) => Readonly<{
24
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
25
+ }>;
26
+ posterIsNotFollowedBy: (identifier: string) => Readonly<{
27
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
28
+ }>;
29
+ posterDoesNotFollow: (identifier: string) => Readonly<{
30
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
31
+ }>;
32
+ hasVideo: Readonly<{
33
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
34
+ }>;
35
+ hasNoNSFWLabels: Readonly<{
36
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
37
+ }>;
38
+ isPost: Filter;
39
+ isReply: Filter;
40
+ isContentOk: (threshold?: number) => ContentModerationBlock;
41
+ };
42
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAoF3B,eAAO,MAAM,IAAI;yBACM,MAAM,EAAE,KAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE;CAGnD,CAAC;AAEF,eAAO,MAAM,CAAC;sBAxFW,MAAM,EAAE;;;qBAYT,MAAM,EAAE;;;8BAanB,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,SACpC,MAAM,KACZ,YAAY;sCAKF,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,SACrD,MAAM,KACZ,oBAAoB;6BAkCf,aAAa,MACf,mBAAmB,SAChB,cAAc,KACpB,MAAM;wBAjCkB,MAAM,KAAG,gBAAgB;2BAGtB,MAAM,KAAG,gBAAgB;8BAIzC,MAAM,MACd,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,YACxB,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KACvC,WAAW;qCAG0B,MAAM;;;gCAEX,MAAM;;;wCAEE,MAAM;;;sCAER,MAAM;;;;;;;;;;;8BAqBf,MAAM,KAAS,sBAAsB;CA4BpE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Effect } from "effect";
2
+ import { GrazeClient } from "./GrazeClient.js";
3
+ type Promisify<T> = T extends (...args: any[]) => Effect.Effect<infer A, infer E, never> ? (...args: Parameters<T>) => Promise<A> : never;
4
+ export declare class GrazeService {
5
+ getFeed: Promisify<typeof GrazeClient.Service.getFeed>;
6
+ getFeeds: Promisify<typeof GrazeClient.Service.getFeeds>;
7
+ hidePost: Promisify<typeof GrazeClient.Service.hidePost>;
8
+ updateAlgorithm: Promisify<typeof GrazeClient.Service.updateAlgorithm>;
9
+ publishAlgorithm: Promisify<typeof GrazeClient.Service.publishAlgorithm>;
10
+ constructor({ apiUrl, cookie, userId, }: {
11
+ apiUrl: string;
12
+ cookie: string;
13
+ userId: number;
14
+ });
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAS,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,KAAK,SAAS,CAAC,CAAC,IAAI,CAAC,SAAS,CAC5B,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,GACvC,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,GACtC,KAAK,CAAC;AAEV,qBAAa,YAAY;IACvB,OAAO,EAAE,SAAS,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD,QAAQ,EAAE,SAAS,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,QAAQ,EAAE,SAAS,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzD,eAAe,EAAE,SAAS,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACvE,gBAAgB,EAAE,SAAS,CAAC,OAAO,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAE7D,EACV,MAAM,EACN,MAAM,EACN,MAAM,GACP,EAAE;QACD,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;KAChB;CAmBF"}
@@ -0,0 +1,352 @@
1
+ import { Schema as S } from "effect";
2
+ export declare const ListUri: typeof S.String;
3
+ export type ListUri = typeof ListUri.Type;
4
+ export declare const AttributeName: S.Union<[S.Literal<["text"]>, S.Literal<["reply"]>, S.Literal<["embed.images[*].alt"]>, S.Literal<["embed.alt"]>, S.Literal<["embed"]>, S.Literal<["embed.external.uri"]>, S.Literal<["embed.external.title"]>, S.Literal<["embed.external.description"]>]>;
5
+ export type AttributeName = typeof AttributeName.Type;
6
+ export declare const AttributeComparison: S.Literal<["==", "!=", ">", "<", ">=", "<="]>;
7
+ export type AttributeComparison = typeof AttributeComparison.Type;
8
+ export declare const AttributeValue: typeof S.Null;
9
+ export type AttributeValue = typeof AttributeValue.Type;
10
+ export type Filter = And | Or | ListMemberFilter | AttributeCompare | RegexMatches | RegexNegationMatches | ContentModerationBlock | EntityExcludesLabels | EmbedType | SocialGraph;
11
+ export type And = Readonly<{
12
+ and: ReadonlyArray<Filter>;
13
+ }>;
14
+ export type Or = Readonly<{
15
+ or: ReadonlyArray<Filter>;
16
+ }>;
17
+ export type ListMemberFilter = Readonly<{
18
+ list_member: readonly [ListUri, "in" | "not_in"];
19
+ }>;
20
+ export type AttributeCompare = Readonly<{
21
+ attribute_compare: readonly [
22
+ AttributeName,
23
+ AttributeComparison,
24
+ AttributeValue
25
+ ];
26
+ }>;
27
+ export type RegexMatches = Readonly<{
28
+ regex_matches: readonly [AttributeName, string, boolean];
29
+ }>;
30
+ export type RegexNegationMatches = Readonly<{
31
+ regex_negation_matches: readonly [AttributeName, string, boolean];
32
+ }>;
33
+ export type ContentModerationBlock = Readonly<{
34
+ content_moderation: readonly ["OK", ">=", number];
35
+ }>;
36
+ export type EntityExcludesLabels = Readonly<{
37
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
38
+ }>;
39
+ export type EmbedType = Readonly<{
40
+ embed_type: readonly [
41
+ "==" | "!=",
42
+ "video" | "image" | "link" | "post" | "gif" | "image_group"
43
+ ];
44
+ }>;
45
+ export type SocialGraph = Readonly<{
46
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
47
+ }>;
48
+ export declare const Filter: S.Union<[S.suspend<Readonly<{
49
+ and: ReadonlyArray<Filter>;
50
+ }>, Readonly<{
51
+ and: ReadonlyArray<Filter>;
52
+ }>, never>, S.suspend<Readonly<{
53
+ or: ReadonlyArray<Filter>;
54
+ }>, Readonly<{
55
+ or: ReadonlyArray<Filter>;
56
+ }>, never>, S.suspend<Readonly<{
57
+ list_member: readonly [ListUri, "in" | "not_in"];
58
+ }>, Readonly<{
59
+ list_member: readonly [ListUri, "in" | "not_in"];
60
+ }>, never>, S.suspend<Readonly<{
61
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
62
+ }>, Readonly<{
63
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
64
+ }>, never>, S.suspend<Readonly<{
65
+ regex_matches: readonly [AttributeName, string, boolean];
66
+ }>, Readonly<{
67
+ regex_matches: readonly [AttributeName, string, boolean];
68
+ }>, never>, S.suspend<Readonly<{
69
+ regex_negation_matches: readonly [AttributeName, string, boolean];
70
+ }>, Readonly<{
71
+ regex_negation_matches: readonly [AttributeName, string, boolean];
72
+ }>, never>, S.suspend<Readonly<{
73
+ content_moderation: readonly ["OK", ">=", number];
74
+ }>, Readonly<{
75
+ content_moderation: readonly ["OK", ">=", number];
76
+ }>, never>, S.suspend<Readonly<{
77
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
78
+ }>, Readonly<{
79
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
80
+ }>, never>, S.suspend<Readonly<{
81
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
82
+ }>, Readonly<{
83
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
84
+ }>, never>, S.suspend<Readonly<{
85
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
86
+ }>, Readonly<{
87
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
88
+ }>, never>]>;
89
+ export declare const Or: S.Struct<{
90
+ or: S.Array$<S.Union<[S.suspend<Readonly<{
91
+ and: ReadonlyArray<Filter>;
92
+ }>, Readonly<{
93
+ and: ReadonlyArray<Filter>;
94
+ }>, never>, S.suspend<Readonly<{
95
+ or: ReadonlyArray<Filter>;
96
+ }>, Readonly<{
97
+ or: ReadonlyArray<Filter>;
98
+ }>, never>, S.suspend<Readonly<{
99
+ list_member: readonly [ListUri, "in" | "not_in"];
100
+ }>, Readonly<{
101
+ list_member: readonly [ListUri, "in" | "not_in"];
102
+ }>, never>, S.suspend<Readonly<{
103
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
104
+ }>, Readonly<{
105
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
106
+ }>, never>, S.suspend<Readonly<{
107
+ regex_matches: readonly [AttributeName, string, boolean];
108
+ }>, Readonly<{
109
+ regex_matches: readonly [AttributeName, string, boolean];
110
+ }>, never>, S.suspend<Readonly<{
111
+ regex_negation_matches: readonly [AttributeName, string, boolean];
112
+ }>, Readonly<{
113
+ regex_negation_matches: readonly [AttributeName, string, boolean];
114
+ }>, never>, S.suspend<Readonly<{
115
+ content_moderation: readonly ["OK", ">=", number];
116
+ }>, Readonly<{
117
+ content_moderation: readonly ["OK", ">=", number];
118
+ }>, never>, S.suspend<Readonly<{
119
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
120
+ }>, Readonly<{
121
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
122
+ }>, never>, S.suspend<Readonly<{
123
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
124
+ }>, Readonly<{
125
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
126
+ }>, never>, S.suspend<Readonly<{
127
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
128
+ }>, Readonly<{
129
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
130
+ }>, never>]>>;
131
+ }>;
132
+ export declare const And: S.Struct<{
133
+ and: S.Array$<S.Union<[S.suspend<Readonly<{
134
+ and: ReadonlyArray<Filter>;
135
+ }>, Readonly<{
136
+ and: ReadonlyArray<Filter>;
137
+ }>, never>, S.suspend<Readonly<{
138
+ or: ReadonlyArray<Filter>;
139
+ }>, Readonly<{
140
+ or: ReadonlyArray<Filter>;
141
+ }>, never>, S.suspend<Readonly<{
142
+ list_member: readonly [ListUri, "in" | "not_in"];
143
+ }>, Readonly<{
144
+ list_member: readonly [ListUri, "in" | "not_in"];
145
+ }>, never>, S.suspend<Readonly<{
146
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
147
+ }>, Readonly<{
148
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
149
+ }>, never>, S.suspend<Readonly<{
150
+ regex_matches: readonly [AttributeName, string, boolean];
151
+ }>, Readonly<{
152
+ regex_matches: readonly [AttributeName, string, boolean];
153
+ }>, never>, S.suspend<Readonly<{
154
+ regex_negation_matches: readonly [AttributeName, string, boolean];
155
+ }>, Readonly<{
156
+ regex_negation_matches: readonly [AttributeName, string, boolean];
157
+ }>, never>, S.suspend<Readonly<{
158
+ content_moderation: readonly ["OK", ">=", number];
159
+ }>, Readonly<{
160
+ content_moderation: readonly ["OK", ">=", number];
161
+ }>, never>, S.suspend<Readonly<{
162
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
163
+ }>, Readonly<{
164
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
165
+ }>, never>, S.suspend<Readonly<{
166
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
167
+ }>, Readonly<{
168
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
169
+ }>, never>, S.suspend<Readonly<{
170
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
171
+ }>, Readonly<{
172
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
173
+ }>, never>]>>;
174
+ }>;
175
+ export declare const ListMemberFilter: S.Struct<{
176
+ list_member: S.Tuple<[typeof S.String, S.Literal<["in", "not_in"]>]>;
177
+ }>;
178
+ export declare const AttributeCompare: S.Struct<{
179
+ attribute_compare: S.Tuple<[S.Union<[S.Literal<["text"]>, S.Literal<["reply"]>, S.Literal<["embed.images[*].alt"]>, S.Literal<["embed.alt"]>, S.Literal<["embed"]>, S.Literal<["embed.external.uri"]>, S.Literal<["embed.external.title"]>, S.Literal<["embed.external.description"]>]>, S.Literal<["==", "!=", ">", "<", ">=", "<="]>, typeof S.Null]>;
180
+ }>;
181
+ export declare const RegexMatches: S.Struct<{
182
+ regex_matches: S.Tuple<[S.Union<[S.Literal<["text"]>, S.Literal<["reply"]>, S.Literal<["embed.images[*].alt"]>, S.Literal<["embed.alt"]>, S.Literal<["embed"]>, S.Literal<["embed.external.uri"]>, S.Literal<["embed.external.title"]>, S.Literal<["embed.external.description"]>]>, S.SchemaClass<string, string, never>, S.SchemaClass<boolean, boolean, never>]>;
183
+ }>;
184
+ export declare const RegexNegationMatches: S.Struct<{
185
+ regex_negation_matches: S.Tuple<[S.Union<[S.Literal<["text"]>, S.Literal<["reply"]>, S.Literal<["embed.images[*].alt"]>, S.Literal<["embed.alt"]>, S.Literal<["embed"]>, S.Literal<["embed.external.uri"]>, S.Literal<["embed.external.title"]>, S.Literal<["embed.external.description"]>]>, S.SchemaClass<string, string, never>, S.SchemaClass<boolean, boolean, never>]>;
186
+ }>;
187
+ export declare const ContentModerationBlock: S.Struct<{
188
+ content_moderation: S.Tuple<[S.Literal<["OK"]>, S.Literal<[">="]>, S.SchemaClass<number, number, never>]>;
189
+ }>;
190
+ export declare const EntityExcludesLabels: S.Struct<{
191
+ entity_excludes: S.Tuple<[S.Literal<["labels"]>, S.Tuple<[S.Literal<["porn"]>, S.Literal<["sexual"]>, S.Literal<["nudity"]>]>]>;
192
+ }>;
193
+ export declare const EmbedType: S.Struct<{
194
+ embed_type: S.Tuple<[S.Literal<["==", "!="]>, S.Literal<["video", "image", "link", "post", "gif", "image_group"]>]>;
195
+ }>;
196
+ export declare const SocialGraph: S.Struct<{
197
+ social_graph: S.Tuple<[typeof S.String, S.Literal<["in", "not_in"]>, S.Literal<["follows", "followers"]>]>;
198
+ }>;
199
+ export declare const SortSettings: S.Struct<{
200
+ time_window: typeof S.Number;
201
+ decay_penalty: typeof S.Number;
202
+ like_count_multiplier: typeof S.Number;
203
+ reply_count_multiplier: typeof S.Number;
204
+ repost_count_multiplier: typeof S.Number;
205
+ reader_like_count_multiplier: typeof S.Number;
206
+ reader_reply_count_multiplier: typeof S.Number;
207
+ reader_repost_count_multiplier: typeof S.Number;
208
+ }>;
209
+ export type SortSettings = typeof SortSettings.Type;
210
+ export declare const DisplayName: S.SchemaClass<string, string, never>;
211
+ export type DisplayName = typeof DisplayName.Type;
212
+ export declare const RecordName: S.SchemaClass<string, string, never>;
213
+ export type RecordName = typeof RecordName.Type;
214
+ export declare const Description: S.SchemaClass<string, string, never>;
215
+ export type Description = typeof Description.Type;
216
+ export declare const Order: S.Union<[S.Literal<["new"]>, S.Literal<["trending"]>, S.Literal<["blend"]>]>;
217
+ export type Order = typeof Order.Type;
218
+ export declare const FeedId: typeof S.NumberFromString;
219
+ export type FeedId = typeof FeedId.Type;
220
+ export declare const UserId: typeof S.NumberFromString;
221
+ export type UserId = typeof UserId.Type;
222
+ export declare const AlgorithmManifest: S.Struct<{
223
+ filter: S.Union<[S.suspend<Readonly<{
224
+ and: ReadonlyArray<Filter>;
225
+ }>, Readonly<{
226
+ and: ReadonlyArray<Filter>;
227
+ }>, never>, S.suspend<Readonly<{
228
+ or: ReadonlyArray<Filter>;
229
+ }>, Readonly<{
230
+ or: ReadonlyArray<Filter>;
231
+ }>, never>, S.suspend<Readonly<{
232
+ list_member: readonly [ListUri, "in" | "not_in"];
233
+ }>, Readonly<{
234
+ list_member: readonly [ListUri, "in" | "not_in"];
235
+ }>, never>, S.suspend<Readonly<{
236
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
237
+ }>, Readonly<{
238
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
239
+ }>, never>, S.suspend<Readonly<{
240
+ regex_matches: readonly [AttributeName, string, boolean];
241
+ }>, Readonly<{
242
+ regex_matches: readonly [AttributeName, string, boolean];
243
+ }>, never>, S.suspend<Readonly<{
244
+ regex_negation_matches: readonly [AttributeName, string, boolean];
245
+ }>, Readonly<{
246
+ regex_negation_matches: readonly [AttributeName, string, boolean];
247
+ }>, never>, S.suspend<Readonly<{
248
+ content_moderation: readonly ["OK", ">=", number];
249
+ }>, Readonly<{
250
+ content_moderation: readonly ["OK", ">=", number];
251
+ }>, never>, S.suspend<Readonly<{
252
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
253
+ }>, Readonly<{
254
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
255
+ }>, never>, S.suspend<Readonly<{
256
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
257
+ }>, Readonly<{
258
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
259
+ }>, never>, S.suspend<Readonly<{
260
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
261
+ }>, Readonly<{
262
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
263
+ }>, never>]>;
264
+ sort_settings: S.optional<S.Struct<{
265
+ time_window: typeof S.Number;
266
+ decay_penalty: typeof S.Number;
267
+ like_count_multiplier: typeof S.Number;
268
+ reply_count_multiplier: typeof S.Number;
269
+ repost_count_multiplier: typeof S.Number;
270
+ reader_like_count_multiplier: typeof S.Number;
271
+ reader_reply_count_multiplier: typeof S.Number;
272
+ reader_repost_count_multiplier: typeof S.Number;
273
+ }>>;
274
+ }>;
275
+ export type AlgorithmManifest = typeof AlgorithmManifest.Type;
276
+ export declare const Metadata: S.Struct<{
277
+ document: S.optional<typeof S.Unknown>;
278
+ schema: S.optional<S.Struct<{
279
+ schemaVersion: S.Literal<[2]>;
280
+ sequences: S.Record$<typeof S.String, typeof S.Number>;
281
+ }>>;
282
+ session: S.optional<typeof S.Unknown>;
283
+ }>;
284
+ export type Metadata = typeof Metadata.Type;
285
+ export declare const FullForm: S.Struct<{
286
+ id: typeof S.NumberFromString;
287
+ user_id: typeof S.NumberFromString;
288
+ file: S.optional<typeof S.Unknown>;
289
+ display_name: S.SchemaClass<string, string, never>;
290
+ record_name: S.SchemaClass<string, string, never>;
291
+ description: S.optional<S.SchemaClass<string, string, never>>;
292
+ order: S.Union<[S.Literal<["new"]>, S.Literal<["trending"]>, S.Literal<["blend"]>]>;
293
+ algorithm_manifest: S.SchemaClass<{
294
+ readonly filter: Readonly<{
295
+ and: ReadonlyArray<Filter>;
296
+ }> | Readonly<{
297
+ or: ReadonlyArray<Filter>;
298
+ }> | Readonly<{
299
+ list_member: readonly [ListUri, "in" | "not_in"];
300
+ }> | Readonly<{
301
+ attribute_compare: readonly [AttributeName, AttributeComparison, AttributeValue];
302
+ }> | Readonly<{
303
+ regex_matches: readonly [AttributeName, string, boolean];
304
+ }> | Readonly<{
305
+ regex_negation_matches: readonly [AttributeName, string, boolean];
306
+ }> | Readonly<{
307
+ content_moderation: readonly ["OK", ">=", number];
308
+ }> | Readonly<{
309
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
310
+ }> | Readonly<{
311
+ embed_type: readonly ["==" | "!=", "video" | "image" | "link" | "post" | "gif" | "image_group"];
312
+ }> | Readonly<{
313
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
314
+ }>;
315
+ readonly sort_settings?: {
316
+ readonly time_window: number;
317
+ readonly decay_penalty: number;
318
+ readonly like_count_multiplier: number;
319
+ readonly reply_count_multiplier: number;
320
+ readonly repost_count_multiplier: number;
321
+ readonly reader_like_count_multiplier: number;
322
+ readonly reader_reply_count_multiplier: number;
323
+ readonly reader_repost_count_multiplier: number;
324
+ } | undefined;
325
+ }, string, never>;
326
+ metadata: S.optional<S.SchemaClass<{
327
+ readonly document?: unknown;
328
+ readonly schema?: {
329
+ readonly schemaVersion: 2;
330
+ readonly sequences: {
331
+ readonly [x: string]: number;
332
+ };
333
+ } | undefined;
334
+ readonly session?: unknown;
335
+ }, string, never>>;
336
+ }>;
337
+ export type FullForm = typeof FullForm.Type;
338
+ export type EncodedFullForm = typeof FullForm.Encoded;
339
+ /**
340
+ * Actual structure of FormData
341
+ *
342
+ * display_name
343
+ * record_name
344
+ * description
345
+ * order
346
+ * algorithm_manifest
347
+ * metadata
348
+ * id
349
+ * user_id
350
+ * session_cookie
351
+ */
352
+ //# sourceMappingURL=UpdateAlgorithmPayload.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateAlgorithmPayload.d.ts","sourceRoot":"","sources":["../../../src/schema/UpdateAlgorithmPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAIrC,eAAO,MAAM,OAAO,iBAAW,CAAC;AAChC,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,eAAO,MAAM,aAAa,6PASzB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAC;AACtD,eAAO,MAAM,mBAAmB,+CAA8C,CAAC;AAC/E,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAAC;AAClE,eAAO,MAAM,cAAc,eAAS,CAAC;AACrC,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAIxD,MAAM,MAAM,MAAM,GACd,GAAG,GACH,EAAE,GACF,gBAAgB,GAChB,gBAAgB,GAChB,YAAY,GACZ,oBAAoB,GACpB,sBAAsB,GACtB,oBAAoB,GACpB,SAAS,GACT,WAAW,CAAC;AAEhB,MAAM,MAAM,GAAG,GAAG,QAAQ,CAAC;IAAE,GAAG,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAAC;AAC3D,MAAM,MAAM,EAAE,GAAG,QAAQ,CAAC;IAAE,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC,CAAC;AACzD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,WAAW,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,GAAG,QAAQ,CAAC,CAAC;CAClD,CAAC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC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G,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAE9D,eAAO,MAAM,QAAQ;;;;;;;EASnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,eAAO,MAAM,QAAQ;;;;;;;;;;iBAxKa,aAAa,CAAC,MAAM,CAAC;;gBACvB,aAAa,CAAC,MAAM,CAAC;;yBAEtC,SAAS,CAAC,OAAO,EAAE,IAAI,GAAG,QAAQ,CAAC;;+BAG7B,SAAS,CAC1B,aAAa,EACb,mBAAmB,EACnB,cAAc,CACf;;2BAGc,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC;;oCAGhC,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC;;gCAG7C,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;;6BAGhC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;;wBAG/D,SAAS,CACnB,IAAI,GAAG,IAAI,EACX,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,aAAa,CAC5D;;0BAGa,SAAS,CAAC,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,SAAS,GAAG,WAAW,CAAC;;;;;;;;;;;;;;;;;;;;;;;EAmJzE,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAC5C,MAAM,MAAM,eAAe,GAAG,OAAO,QAAQ,CAAC,OAAO,CAAC;AAEtD;;;;;;;;;;;;GAYG"}
@@ -0,0 +1,3 @@
1
+ export * from "./shared.js";
2
+ export * from "./UpdateAlgorithmPayload.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,147 @@
1
+ import { Schema as S } from "effect";
2
+ export declare const PartialAlgorithm: S.Struct<{
3
+ algorithm_uri: typeof S.String;
4
+ algorithm_manifest_id: S.Union<[typeof S.Null, typeof S.Number]>;
5
+ draft_algorithm_manifest_id: typeof S.Number;
6
+ record_name: typeof S.String;
7
+ display_name: typeof S.String;
8
+ description: typeof S.String;
9
+ feed_did: typeof S.String;
10
+ avatar_url: S.Union<[typeof S.String, typeof S.Null]>;
11
+ cpm_cents: S.Union<[typeof S.Number, typeof S.Null]>;
12
+ deleted: typeof S.Boolean;
13
+ active: typeof S.Boolean;
14
+ public: typeof S.Boolean;
15
+ monetization_available: typeof S.Boolean;
16
+ status: S.Union<[typeof S.String, typeof S.Null]>;
17
+ unique_operator_ids: S.Array$<typeof S.Number>;
18
+ user_id: typeof S.Number;
19
+ id: typeof S.Number;
20
+ created_at: typeof S.DateFromString;
21
+ updated_at: typeof S.DateFromString;
22
+ deleted_at: S.Union<[typeof S.DateFromString, typeof S.Null]>;
23
+ }>;
24
+ export type PartialAlgorithm = typeof PartialAlgorithm.Type;
25
+ export declare const AlgoUpdateResponse: S.Struct<{
26
+ message: typeof S.String;
27
+ algorithm: S.Struct<{
28
+ algorithm_uri: typeof S.String;
29
+ algorithm_manifest_id: S.Union<[typeof S.Null, typeof S.Number]>;
30
+ draft_algorithm_manifest_id: typeof S.Number;
31
+ record_name: typeof S.String;
32
+ display_name: typeof S.String;
33
+ description: typeof S.String;
34
+ feed_did: typeof S.String;
35
+ avatar_url: S.Union<[typeof S.String, typeof S.Null]>;
36
+ cpm_cents: S.Union<[typeof S.Number, typeof S.Null]>;
37
+ deleted: typeof S.Boolean;
38
+ active: typeof S.Boolean;
39
+ public: typeof S.Boolean;
40
+ monetization_available: typeof S.Boolean;
41
+ status: S.Union<[typeof S.String, typeof S.Null]>;
42
+ unique_operator_ids: S.Array$<typeof S.Number>;
43
+ user_id: typeof S.Number;
44
+ id: typeof S.Number;
45
+ created_at: typeof S.DateFromString;
46
+ updated_at: typeof S.DateFromString;
47
+ deleted_at: S.Union<[typeof S.DateFromString, typeof S.Null]>;
48
+ }>;
49
+ }>;
50
+ export type AlgoUpdateResponse = typeof AlgoUpdateResponse.Type;
51
+ export declare const GetAlgoResponse: S.SchemaClass<{
52
+ readonly algorithm_uri: string;
53
+ readonly algorithm_manifest_id: number | null;
54
+ readonly draft_algorithm_manifest_id: number;
55
+ readonly record_name: string;
56
+ readonly display_name: string;
57
+ readonly description: string;
58
+ readonly feed_did: string;
59
+ readonly avatar_url: string | null;
60
+ readonly cpm_cents: number | null;
61
+ readonly deleted: boolean;
62
+ readonly active: boolean;
63
+ readonly public: boolean;
64
+ readonly monetization_available: boolean;
65
+ readonly status: string | null;
66
+ readonly unique_operator_ids: readonly number[];
67
+ readonly user_id: number;
68
+ readonly id: number;
69
+ readonly created_at: Date;
70
+ readonly updated_at: Date;
71
+ readonly deleted_at: Date | null;
72
+ readonly stats: unknown;
73
+ readonly latest_error: unknown;
74
+ readonly latest_compute_cycle: unknown;
75
+ readonly subscriber_lists: unknown;
76
+ readonly draft_algorithm_manifest: unknown;
77
+ readonly algorithm_manifest: unknown;
78
+ }, string, never>;
79
+ export type GetAlgoResponse = typeof GetAlgoResponse.Type;
80
+ export declare const HidePostBody: S.Struct<{
81
+ algo_id: typeof S.Number;
82
+ at_uri: typeof S.String;
83
+ }>;
84
+ export type HidePostBody = typeof HidePostBody.Type;
85
+ export declare const AlgorithWithStats: S.Struct<{
86
+ stats: S.Struct<{
87
+ page_renders: typeof S.Number;
88
+ unique_users: typeof S.Number;
89
+ post_renders: typeof S.Number;
90
+ }>;
91
+ algorithm_uri: typeof S.String;
92
+ algorithm_manifest_id: S.Union<[typeof S.Null, typeof S.Number]>;
93
+ draft_algorithm_manifest_id: typeof S.Number;
94
+ record_name: typeof S.String;
95
+ display_name: typeof S.String;
96
+ description: typeof S.String;
97
+ feed_did: typeof S.String;
98
+ avatar_url: S.Union<[typeof S.String, typeof S.Null]>;
99
+ cpm_cents: S.Union<[typeof S.Number, typeof S.Null]>;
100
+ deleted: typeof S.Boolean;
101
+ active: typeof S.Boolean;
102
+ public: typeof S.Boolean;
103
+ monetization_available: typeof S.Boolean;
104
+ status: S.Union<[typeof S.String, typeof S.Null]>;
105
+ unique_operator_ids: S.Array$<typeof S.Number>;
106
+ user_id: typeof S.Number;
107
+ id: typeof S.Number;
108
+ created_at: typeof S.DateFromString;
109
+ updated_at: typeof S.DateFromString;
110
+ deleted_at: S.Union<[typeof S.DateFromString, typeof S.Null]>;
111
+ }>;
112
+ export type AlgorithmWithStats = typeof AlgorithWithStats.Type;
113
+ export declare const GetAlgorithmsResponse: S.Struct<{
114
+ page: typeof S.Number;
115
+ page_size: typeof S.Number;
116
+ total_items: typeof S.Number;
117
+ total_pages: typeof S.Number;
118
+ user_algos: S.Array$<S.Struct<{
119
+ stats: S.Struct<{
120
+ page_renders: typeof S.Number;
121
+ unique_users: typeof S.Number;
122
+ post_renders: typeof S.Number;
123
+ }>;
124
+ algorithm_uri: typeof S.String;
125
+ algorithm_manifest_id: S.Union<[typeof S.Null, typeof S.Number]>;
126
+ draft_algorithm_manifest_id: typeof S.Number;
127
+ record_name: typeof S.String;
128
+ display_name: typeof S.String;
129
+ description: typeof S.String;
130
+ feed_did: typeof S.String;
131
+ avatar_url: S.Union<[typeof S.String, typeof S.Null]>;
132
+ cpm_cents: S.Union<[typeof S.Number, typeof S.Null]>;
133
+ deleted: typeof S.Boolean;
134
+ active: typeof S.Boolean;
135
+ public: typeof S.Boolean;
136
+ monetization_available: typeof S.Boolean;
137
+ status: S.Union<[typeof S.String, typeof S.Null]>;
138
+ unique_operator_ids: S.Array$<typeof S.Number>;
139
+ user_id: typeof S.Number;
140
+ id: typeof S.Number;
141
+ created_at: typeof S.DateFromString;
142
+ updated_at: typeof S.DateFromString;
143
+ deleted_at: S.Union<[typeof S.DateFromString, typeof S.Null]>;
144
+ }>>;
145
+ }>;
146
+ export type GetAlgorithmsResponse = typeof GetAlgorithmsResponse.Type;
147
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/schema/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;EAqB3B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAC;AAkB5D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAG7B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAC;AAEhE,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAyC,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC;AAE1D,eAAO,MAAM,YAAY;;;EAGvB,CAAC;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC;AAIpD,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAC/D,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,OAAO,qBAAqB,CAAC,IAAI,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { AlgoUpdateResponse, GetAlgoResponse, GetAlgorithmsResponse, HidePostBody, } from "./schema/shared.js";
2
+ import { FetchHttpClient, HttpApi, HttpApiClient, HttpApiEndpoint, HttpApiGroup, HttpApiSchema, HttpClient, HttpClientRequest, } from "@effect/platform";
3
+ import { Config, Data, Effect, Redacted, Schema } from "effect";
4
+ import * as Form from "./schema/UpdateAlgorithmPayload.js";
5
+ function isStringOrBlob(val) {
6
+ return typeof val === "string" || val instanceof Blob;
7
+ }
8
+ const encodeForm = (obj) => Effect.gen(function* () {
9
+ const encoded = yield* Schema.encode(Form.FullForm)(obj);
10
+ const formData = new FormData();
11
+ for (const key in encoded) {
12
+ if (encoded.hasOwnProperty(key)) {
13
+ const val = encoded[key];
14
+ if (isStringOrBlob(val)) {
15
+ formData.append(key, val);
16
+ }
17
+ }
18
+ }
19
+ return formData;
20
+ });
21
+ const UserIdParam = HttpApiSchema.param("userId", Schema.NumberFromString);
22
+ const FeedIdParam = HttpApiSchema.param("feedId", Schema.NumberFromString);
23
+ const GrazeApiGroup = HttpApiGroup.make("graze", { topLevel: true })
24
+ .add(HttpApiEndpoint.get("getFeeds") `/app/my_feeds`
25
+ .addSuccess(GetAlgorithmsResponse)
26
+ .setPayload(Schema.Struct({
27
+ user_id: UserIdParam,
28
+ })))
29
+ .add(HttpApiEndpoint.get("getFeed") `/app/my_feeds/${FeedIdParam}`.addSuccess(GetAlgoResponse))
30
+ .add(HttpApiEndpoint.post("updateAlgorithm") `/app/edit_algo_image`
31
+ .setPayload(HttpApiSchema.Multipart(Form.FullForm))
32
+ .addSuccess(AlgoUpdateResponse))
33
+ .add(HttpApiEndpoint.get("publishAlgorithm") `/app/publish_algo/${FeedIdParam}`.addSuccess(Schema.Unknown))
34
+ .add(HttpApiEndpoint.post("hidePost") `/app/hide_post`
35
+ .setPayload(HidePostBody)
36
+ .addSuccess(Schema.Unknown));
37
+ class GrazeApiDef extends HttpApi.make("grazeApi").add(GrazeApiGroup) {
38
+ }
39
+ const grazeLive = Effect.gen(function* () {
40
+ const baseUrl = yield* Config.url("GRAZE_API_URL");
41
+ const cookie = yield* Config.redacted("GRAZE_COOKIE");
42
+ const client = yield* HttpApiClient.make(GrazeApiDef, {
43
+ baseUrl: baseUrl.toString(),
44
+ transformClient: (client) => client.pipe(HttpClient.filterStatusOk, HttpClient.mapRequest(HttpClientRequest.setHeaders({
45
+ cookie: Redacted.value(cookie),
46
+ }))),
47
+ });
48
+ const updateAlgorithm = (data) => Effect.gen(function* () {
49
+ const formData = yield* encodeForm(data);
50
+ return yield* client.updateAlgorithm({ payload: formData });
51
+ });
52
+ const userId = yield* Config.integer("GRAZE_USER_ID");
53
+ const getFeeds = () => client.getFeeds({ payload: { user_id: userId } });
54
+ return {
55
+ ...client,
56
+ updateAlgorithm,
57
+ getFeeds,
58
+ };
59
+ });
60
+ export class GrazeClient extends Effect.Service()("GrazeClient", {
61
+ effect: grazeLive,
62
+ dependencies: [FetchHttpClient.layer],
63
+ }) {
64
+ }
65
+ export class GrazeError extends Data.TaggedError("GrazeError") {
66
+ }
67
+ //# sourceMappingURL=GrazeClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GrazeClient.js","sourceRoot":"","sources":["../../src/GrazeClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,qBAAqB,EACrB,YAAY,GACb,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,eAAe,EACf,OAAO,EACP,aAAa,EACb,eAAe,EACf,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhE,OAAO,KAAK,IAAI,MAAM,oCAAoC,CAAC;AAE3D,SAAS,cAAc,CAAC,GAAY;IAClC,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,YAAY,IAAI,CAAC;AACxD,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,GAAkB,EAAE,EAAE,CACxC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAA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AEL,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAEzE,OAAO;QACL,GAAG,MAAM;QACT,eAAe;QACf,QAAQ;KACT,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,OAAO,WAAY,SAAQ,MAAM,CAAC,OAAO,EAAe,CAAC,aAAa,EAAE;IAC5E,MAAM,EAAE,SAAS;IACjB,YAAY,EAAE,CAAC,eAAe,CAAC,KAAK,CAAC;CACtC,CAAC;CAED;AAED,MAAM,OAAO,UAAW,SAAQ,IAAI,CAAC,WAAW,CAAC,YAAY,CAK3D;CAAG"}
@@ -0,0 +1,83 @@
1
+ const and = (...filters) => {
2
+ const flatFilters = [];
3
+ filters.forEach((f) => {
4
+ if ("and" in f) {
5
+ // Automatically flatten nested ands.
6
+ flatFilters.push(...f.and);
7
+ }
8
+ else {
9
+ flatFilters.push(f);
10
+ }
11
+ });
12
+ return { and: flatFilters };
13
+ };
14
+ const or = (...filters) => {
15
+ const flatFilters = [];
16
+ filters.forEach((f) => {
17
+ if ("or" in f) {
18
+ flatFilters.push(...f.or);
19
+ }
20
+ else {
21
+ flatFilters.push(f);
22
+ }
23
+ });
24
+ return { or: flatFilters };
25
+ };
26
+ const regexMatches = (attribute, regex) => ({
27
+ regex_matches: [attribute, regex, true],
28
+ });
29
+ const regexNegationMatches = (attribute, regex) => ({
30
+ regex_negation_matches: [attribute, regex, true],
31
+ });
32
+ const isListMember = (uri) => ({
33
+ list_member: [uri, "in"],
34
+ });
35
+ const isNotListMember = (uri) => ({
36
+ list_member: [uri, "not_in"],
37
+ });
38
+ const socialGraph = (identifier, op, relation) => ({
39
+ social_graph: [identifier, op, relation],
40
+ });
41
+ const posterIsFollowedBy = (identifier) => socialGraph(identifier, "in", "followers");
42
+ const posterFollows = (identifier) => socialGraph(identifier, "in", "follows");
43
+ const posterIsNotFollowedBy = (identifier) => socialGraph(identifier, "not_in", "followers");
44
+ const posterDoesNotFollow = (identifier) => socialGraph(identifier, "not_in", "follows");
45
+ const hasVideo = {
46
+ embed_type: ["==", "video"],
47
+ };
48
+ const hasNoNSFWLabels = {
49
+ entity_excludes: ["labels", ["porn", "sexual", "nudity"]],
50
+ };
51
+ const attributeCompare = (attr, op, value) => ({
52
+ attribute_compare: [attr, op, value],
53
+ });
54
+ const isPost = attributeCompare("reply", "==", null);
55
+ const isReply = attributeCompare("reply", "!=", null);
56
+ const isContentOk = (threshold = 0.9) => ({
57
+ content_moderation: ["OK", ">=", threshold],
58
+ });
59
+ export const Algo = {
60
+ filter: (...filters) => ({
61
+ filter: and(...filters),
62
+ }),
63
+ };
64
+ export const F = {
65
+ and,
66
+ or,
67
+ regexMatches,
68
+ regexNegationMatches,
69
+ attributeCompare,
70
+ isListMember,
71
+ isNotListMember,
72
+ socialGraph,
73
+ posterIsFollowedBy,
74
+ posterFollows,
75
+ posterIsNotFollowedBy,
76
+ posterDoesNotFollow,
77
+ hasVideo,
78
+ hasNoNSFWLabels,
79
+ isPost,
80
+ isReply,
81
+ isContentOk,
82
+ };
83
+ //# sourceMappingURL=builder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/builder.ts"],"names":[],"mappings":"AAYA,MAAM,GAAG,GAAG,CAAC,GAAG,OAAiB,EAAE,EAAE;IACnC,MAAM,WAAW,GAAa,EAAE,CAAC;IACjC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACpB,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YACf,qCAAqC;YACrC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;aAAM,CAAC;YACN,WAAW,CAAC,IAAI,CAAC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AClB,MAAM,EAAE,CAAC,GAAG,OAAiB,EAAsB,EAAE,CAAC,CAAC;QACrD,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC;KACxB,CAAC;CACH,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG;IACf,GAAG;IACH,EAAE;IACF,YAAY;IACZ,oBAAoB;IACpB,gBAAgB;IAChB,YAAY;IACZ,eAAe;IACf,WAAW;IACX,kBAAkB;IAClB,aAAa;IACb,qBAAqB;IACrB,mBAAmB;IACnB,QAAQ;IACR,eAAe;IACf,MAAM;IACN,OAAO;IACP,WAAW;CACZ,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { ConfigProvider, Effect, Layer } from "effect";
2
+ import { GrazeClient } from "./GrazeClient.js";
3
+ export class GrazeService {
4
+ getFeed;
5
+ getFeeds;
6
+ hidePost;
7
+ updateAlgorithm;
8
+ publishAlgorithm;
9
+ constructor({ apiUrl, cookie, userId, }) {
10
+ const envMap = new Map([
11
+ ["GRAZE_API_URL", apiUrl],
12
+ ["GRAZE_COOKIE", cookie],
13
+ ["GRAZE_USER_ID", userId.toString()],
14
+ ]);
15
+ const provider = ConfigProvider.fromMap(envMap);
16
+ const layer = Layer.setConfigProvider(provider);
17
+ const make = setup.pipe(Effect.provide(GrazeClient.Default), Effect.provide(layer));
18
+ const api = Effect.runSync(make);
19
+ this.getFeed = api.getFeed;
20
+ this.getFeeds = api.getFeeds;
21
+ this.hidePost = api.hidePost;
22
+ this.updateAlgorithm = api.updateAlgorithm;
23
+ this.publishAlgorithm = api.publishAlgorithm;
24
+ }
25
+ }
26
+ const setup = Effect.gen(function* () {
27
+ const client = yield* GrazeClient;
28
+ const getFeed = (...args) => client.getFeed(...args).pipe(Effect.runPromise);
29
+ const getFeeds = (...args) => client.getFeeds(...args).pipe(Effect.runPromise);
30
+ const hidePost = (...args) => client.hidePost(...args).pipe(Effect.runPromise);
31
+ const updateAlgorithm = (...args) => client.updateAlgorithm(...args).pipe(Effect.runPromise);
32
+ const publishAlgorithm = (...args) => client.publishAlgorithm(...args).pipe(Effect.runPromise);
33
+ return {
34
+ getFeed,
35
+ getFeeds,
36
+ hidePost,
37
+ updateAlgorithm,
38
+ publishAlgorithm,
39
+ };
40
+ });
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ/C,MAAM,OAAO,YAAY;IACvB,OAAO,CAAgD;IACvD,QAAQ,CAAiD;IACzD,QAAQ,CAAiD;IACzD,eAAe,CAAwD;IACvE,gBAAgB,CAAyD;IAEzE,YAAY,EACV,MAAM,EACN,MAAM,EACN,MAAM,GAKP;QACC,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC;YACrB,CAAC,eAAe,EAAE,MAAM,CAAC;YACzB,CAAC,cAAc,EAAE,MAAM,CAAC;YACxB,CAAC,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;SACrC,CAAC,CAAC;QACH,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CACrB,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,EACnC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CACtB,CAAC;QACF,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC;QAC7B,IAAI,CAAC,QAA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
3
+ export const ListUri = S.String;
4
+ export const AttributeName = S.Union(S.Literal("text"), S.Literal("reply"), S.Literal("embed.images[*].alt"), S.Literal("embed.alt"), S.Literal("embed"), S.Literal("embed.external.uri"), S.Literal("embed.external.title"), S.Literal("embed.external.description"));
5
+ export const AttributeComparison = S.Literal("==", "!=", ">", "<", ">=", "<=");
6
+ export const AttributeValue = S.Null;
7
+ export const Filter = S.Union(S.suspend(() => And), S.suspend(() => Or), S.suspend(() => ListMemberFilter), S.suspend(() => AttributeCompare), S.suspend(() => RegexMatches), S.suspend(() => RegexNegationMatches), S.suspend(() => ContentModerationBlock), S.suspend(() => EntityExcludesLabels), S.suspend(() => EmbedType), S.suspend(() => SocialGraph));
8
+ export const Or = S.Struct({ or: S.Array(Filter) });
9
+ export const And = S.Struct({ and: S.Array(Filter) });
10
+ export const ListMemberFilter = S.Struct({
11
+ list_member: S.Tuple(ListUri, S.Literal("in", "not_in")),
12
+ });
13
+ export const AttributeCompare = S.Struct({
14
+ attribute_compare: S.Tuple(AttributeName, AttributeComparison, AttributeValue),
15
+ });
16
+ const RegexMatchBase = S.Tuple(AttributeName, S.String.annotations({
17
+ title: "Regex Pattern",
18
+ description: "The source of the regex pattern to match against.",
19
+ }), S.Boolean.annotations({
20
+ title: "Case Insensitive?",
21
+ description: "True if the regex should be case insensitive.",
22
+ }));
23
+ export const RegexMatches = S.Struct({
24
+ regex_matches: RegexMatchBase,
25
+ });
26
+ export const RegexNegationMatches = S.Struct({
27
+ regex_negation_matches: RegexMatchBase,
28
+ });
29
+ export const ContentModerationBlock = S.Struct({
30
+ content_moderation: S.Tuple(S.Literal("OK"), S.Literal(">="), S.Number.annotations({
31
+ title: "Threshold",
32
+ description: "The threshold for content moderation.",
33
+ })),
34
+ });
35
+ export const EntityExcludesLabels = S.Struct({
36
+ entity_excludes: S.Tuple(S.Literal("labels"), S.Tuple(S.Literal("porn"), S.Literal("sexual"), S.Literal("nudity"))),
37
+ });
38
+ export const EmbedType = S.Struct({
39
+ embed_type: S.Tuple(S.Literal("==", "!="), S.Literal("video", "image", "link", "post", "gif", "image_group")),
40
+ });
41
+ export const SocialGraph = S.Struct({
42
+ social_graph: S.Tuple(S.String, S.Literal("in", "not_in"), S.Literal("follows", "followers")),
43
+ });
44
+ // ---------------------- Sort Settings -----------------------------
45
+ export const SortSettings = S.Struct({
46
+ time_window: S.Number,
47
+ decay_penalty: S.Number,
48
+ like_count_multiplier: S.Number,
49
+ reply_count_multiplier: S.Number,
50
+ repost_count_multiplier: S.Number,
51
+ reader_like_count_multiplier: S.Number,
52
+ reader_reply_count_multiplier: S.Number,
53
+ reader_repost_count_multiplier: S.Number,
54
+ });
55
+ // ---------------------- Form Data ---------------------------------
56
+ export const DisplayName = S.String.annotations({
57
+ description: "The public name of the feed.",
58
+ });
59
+ export const RecordName = S.String.annotations({
60
+ description: "The slug of the feed url.",
61
+ });
62
+ export const Description = S.String.annotations({
63
+ description: "The description to be shown to users of the feed.",
64
+ });
65
+ export const Order = S.Union(S.Literal("new"), S.Literal("trending"), S.Literal("blend"));
66
+ export const FeedId = S.NumberFromString;
67
+ export const UserId = S.NumberFromString;
68
+ export const AlgorithmManifest = S.Struct({
69
+ filter: Filter,
70
+ sort_settings: S.optional(SortSettings),
71
+ });
72
+ export const Metadata = S.Struct({
73
+ document: S.optional(S.Unknown),
74
+ schema: S.optional(S.Struct({
75
+ schemaVersion: S.Literal(2),
76
+ sequences: S.Record({ key: S.String, value: S.Number }),
77
+ })),
78
+ session: S.optional(S.Unknown),
79
+ });
80
+ export const FullForm = S.Struct({
81
+ id: FeedId,
82
+ user_id: UserId,
83
+ file: S.optional(S.Unknown),
84
+ display_name: DisplayName,
85
+ record_name: RecordName,
86
+ description: S.optional(Description),
87
+ order: Order,
88
+ algorithm_manifest: S.parseJson(AlgorithmManifest),
89
+ metadata: S.optional(S.parseJson(Metadata)),
90
+ });
91
+ /**
92
+ * Actual structure of FormData
93
+ *
94
+ * display_name
95
+ * record_name
96
+ * description
97
+ * order
98
+ * algorithm_manifest
99
+ * metadata
100
+ * id
101
+ * user_id
102
+ * session_cookie
103
+ */
104
+ //# sourceMappingURL=UpdateAlgorithmPayload.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UpdateAlgorithmPayload.js","sourceRoot":"","sources":["../../../src/schema/UpdateAlgorithmPayload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,mEAAmE;AAEnE,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAM,CAAC;AAGhC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAClC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EACjB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAClB,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,EAChC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EACtB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAClB,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAC/B,CAAC,CAAC,OAAO,CAAC,sBAAsB,CAAC,EACjC,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAE/E,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;AAmDrC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC,CAAC,OAAO,CAAC,GAAkB,EAAE,CAAC,GAAG,CAAC,EACnC,CAAC,CAAC,OAAO,CAAC,GAAiB,EAAE,CAAC,EAAE,CAAC,EACjC,CAAC,CAAC,OAAO,CAAC,GAA+B,EAAE,CAAC,gBAAgB,CAAC,EAC7D,CAAC,C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 -0,0 +1,3 @@
1
+ export * from "./shared.js";
2
+ export * from "./UpdateAlgorithmPayload.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,63 @@
1
+ import { Schema as S } from "effect";
2
+ export const PartialAlgorithm = S.Struct({
3
+ algorithm_uri: S.String,
4
+ algorithm_manifest_id: S.Union(S.Null, S.Number),
5
+ draft_algorithm_manifest_id: S.Number,
6
+ record_name: S.String,
7
+ display_name: S.String,
8
+ description: S.String,
9
+ feed_did: S.String,
10
+ avatar_url: S.Union(S.String, S.Null),
11
+ cpm_cents: S.Union(S.Number, S.Null),
12
+ deleted: S.Boolean,
13
+ active: S.Boolean,
14
+ public: S.Boolean,
15
+ monetization_available: S.Boolean,
16
+ status: S.Union(S.String, S.Null),
17
+ unique_operator_ids: S.Array(S.Number),
18
+ user_id: S.Number,
19
+ id: S.Number,
20
+ created_at: S.DateFromString,
21
+ updated_at: S.DateFromString,
22
+ deleted_at: S.Union(S.DateFromString, S.Null),
23
+ });
24
+ const Stats = S.Unknown;
25
+ const LatestError = S.Unknown;
26
+ const FullAlgorithm = S.Struct({
27
+ ...PartialAlgorithm.fields,
28
+ stats: Stats,
29
+ latest_error: LatestError,
30
+ latest_compute_cycle: S.Unknown,
31
+ subscriber_lists: S.Unknown,
32
+ });
33
+ const FullAlgorithmWithManifest = S.Struct({
34
+ ...FullAlgorithm.fields,
35
+ draft_algorithm_manifest: S.Unknown,
36
+ algorithm_manifest: S.Unknown,
37
+ });
38
+ export const AlgoUpdateResponse = S.Struct({
39
+ message: S.String,
40
+ algorithm: PartialAlgorithm,
41
+ });
42
+ export const GetAlgoResponse = S.parseJson(FullAlgorithmWithManifest);
43
+ export const HidePostBody = S.Struct({
44
+ algo_id: S.Number,
45
+ at_uri: S.String,
46
+ });
47
+ // ----------------------- Get Algorithms Response -----------------------
48
+ export const AlgorithWithStats = S.Struct({
49
+ ...PartialAlgorithm.fields,
50
+ stats: S.Struct({
51
+ page_renders: S.Number,
52
+ unique_users: S.Number,
53
+ post_renders: S.Number,
54
+ }),
55
+ });
56
+ export const GetAlgorithmsResponse = S.Struct({
57
+ page: S.Number,
58
+ page_size: S.Number,
59
+ total_items: S.Number,
60
+ total_pages: S.Number,
61
+ user_algos: S.Array(AlgorithWithStats),
62
+ });
63
+ //# sourceMappingURL=shared.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/schema/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAC;AAErC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,aAAa,EAAE,CAAC,CAAC,MAAM;IACvB,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;IAChD,2BAA2B,EAAE,CAAC,CAAC,MAAM;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,YAAY,EAAE,CAAC,CAAC,MAAM;IACtB,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,QAAQ,EAAE,CAAC,CAAC,MAAM;IAClB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;IACrC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;IACpC,OAAO,EAAE,CAAC,CAAC,OAAO;IAClB,MAAM,EAAE,CAAC,CAAC,OAAO;IACjB,MAAM,EAAE,CAAC,CAAC,OAAO;IACjB,sBAAsB,EAAE,CAAC,CAAC,OAAO;IACjC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAA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jB,CAAC,CAAC;AAGH,0EAA0E;AAE1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,GAAG,gBAAgB,CAAC,MAAM;IAC1B,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,YAAY,EAAE,CAAC,CAAC,MAAM;QACtB,YAAY,EAAE,CAAC,CAAC,MAAM;QACtB,YAAY,EAAE,CAAC,CAAC,MAAM;KACvB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,IAAI,EAAE,CAAC,CAAC,MAAM;IACd,SAAS,EAAE,CAAC,CAAC,MAAM;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,WAAW,EAAE,CAAC,CAAC,MAAM;IACrB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC;CACvC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graze-client",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "A Typescript Graze API client.",
@@ -32,13 +32,13 @@
32
32
  "types": "./build/dts/schema/index.d.ts"
33
33
  },
34
34
  "./builder": {
35
- "import": "./build/esm/builder/index.js",
36
- "types": "./build/dts/builder/index.d.ts"
35
+ "import": "./build/esm/builder.js",
36
+ "types": "./build/dts/builder.d.ts"
37
37
  }
38
38
  },
39
39
  "scripts": {
40
40
  "codegen": "build-utils prepare-v2",
41
- "build": "rm -rf build && bun run build-esm",
41
+ "build": "rm -rf build && rm -rf .tsbuildinfo && bun run build-esm",
42
42
  "build-esm": "tsc -b tsconfig.build.json",
43
43
  "check": "tsc -b tsconfig.json",
44
44
  "lint": "eslint \"**/{src,test,examples,scripts,dtslint}/**/*.{ts,mjs}\"",