graze-client 0.8.1 → 0.9.0

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.
Files changed (49) hide show
  1. package/build/dts/GrazeClient.d.ts +368 -242
  2. package/build/dts/GrazeClient.d.ts.map +1 -1
  3. package/build/dts/builder.d.ts +2 -2
  4. package/build/dts/builder.d.ts.map +1 -1
  5. package/build/dts/common.d.ts +2 -3
  6. package/build/dts/common.d.ts.map +1 -1
  7. package/build/dts/index.d.ts +12 -12
  8. package/build/dts/index.d.ts.map +1 -1
  9. package/build/dts/schema/Post.d.ts +52 -52
  10. package/build/dts/schema/Post.d.ts.map +1 -1
  11. package/build/dts/schema/StickyPosts.d.ts +55 -56
  12. package/build/dts/schema/StickyPosts.d.ts.map +1 -1
  13. package/build/dts/schema/UpdateAlgorithmPayload.d.ts +137 -137
  14. package/build/dts/schema/UpdateAlgorithmPayload.d.ts.map +1 -1
  15. package/build/dts/schema/index.d.ts.map +1 -1
  16. package/build/dts/schema/shared.d.ts +126 -126
  17. package/build/dts/schema/shared.d.ts.map +1 -1
  18. package/build/dts/stickyposts.d.ts +80 -78
  19. package/build/dts/stickyposts.d.ts.map +1 -1
  20. package/build/esm/GrazeClient.js +47 -31
  21. package/build/esm/GrazeClient.js.map +1 -1
  22. package/build/esm/builder.js +20 -20
  23. package/build/esm/builder.js.map +1 -1
  24. package/build/esm/common.js +4 -3
  25. package/build/esm/common.js.map +1 -1
  26. package/build/esm/index.js +11 -8
  27. package/build/esm/index.js.map +1 -1
  28. package/build/esm/schema/Post.js +9 -9
  29. package/build/esm/schema/Post.js.map +1 -1
  30. package/build/esm/schema/StickyPosts.js +8 -9
  31. package/build/esm/schema/StickyPosts.js.map +1 -1
  32. package/build/esm/schema/UpdateAlgorithmPayload.js +130 -53
  33. package/build/esm/schema/UpdateAlgorithmPayload.js.map +1 -1
  34. package/build/esm/schema/index.js.map +1 -1
  35. package/build/esm/schema/shared.js +14 -14
  36. package/build/esm/schema/shared.js.map +1 -1
  37. package/build/esm/stickyposts.js +28 -13
  38. package/build/esm/stickyposts.js.map +1 -1
  39. package/package.json +21 -23
  40. package/src/GrazeClient.ts +83 -76
  41. package/src/builder.ts +78 -74
  42. package/src/common.ts +5 -10
  43. package/src/index.ts +61 -52
  44. package/src/schema/Post.ts +16 -16
  45. package/src/schema/StickyPosts.ts +22 -26
  46. package/src/schema/UpdateAlgorithmPayload.ts +153 -145
  47. package/src/schema/index.ts +2 -2
  48. package/src/schema/shared.ts +32 -32
  49. package/src/stickyposts.ts +48 -27
@@ -1,33 +1,29 @@
1
- import { HttpApiSchema } from "@effect/platform"
2
- import { Schema as S } from "effect"
3
- import { Post } from "./Post.js"
1
+ import { Schema as S } from "effect";
2
+ import { Post } from "./Post.js";
4
3
 
5
- export const StickyPostIdParam = HttpApiSchema.param(
6
- "stickyPostId",
7
- S.NumberFromString
8
- )
9
- export type StickyPostIdParam = typeof StickyPostIdParam.Type
4
+ export const StickyPostIdParam = S.NumberFromString;
5
+ export type StickyPostIdParam = typeof StickyPostIdParam.Type;
10
6
 
11
7
  export const StoppingCriteria = S.Struct({
12
- expiration_time: S.Number.pipe(S.optional)
13
- })
14
- export type StoppingCriteria = typeof StoppingCriteria.Type
8
+ expiration_time: S.Number.pipe(S.optional),
9
+ });
10
+ export type StoppingCriteria = typeof StoppingCriteria.Type;
15
11
 
16
- export const StickyType = S.Literal("pinned", "rotating")
17
- export type StickyType = typeof StickyType.Type
12
+ export const StickyType = S.Literals(["pinned", "rotating"]);
13
+ export type StickyType = typeof StickyType.Type;
18
14
 
19
15
  const StickyPostBase = S.Struct({
20
16
  is_active: S.Boolean,
21
- sticky_type: StickyType
22
- })
17
+ sticky_type: StickyType,
18
+ });
23
19
 
24
20
  export const CreateStickyPostBody = S.Struct({
25
21
  algo_id: S.Number,
26
22
  post_url: S.String,
27
23
  stopping_criteria: StoppingCriteria.pipe(S.optional),
28
- ...StickyPostBase.fields
29
- })
30
- export type CreateStickyPostBody = typeof CreateStickyPostBody.Type
24
+ ...StickyPostBase.fields,
25
+ });
26
+ export type CreateStickyPostBody = typeof CreateStickyPostBody.Type;
31
27
 
32
28
  export const GetStickyPostsBody = S.Struct({
33
29
  sticky_posts: S.Array(
@@ -40,13 +36,13 @@ export const GetStickyPostsBody = S.Struct({
40
36
  post: Post,
41
37
  author: S.String,
42
38
  created_at: S.String,
43
- updated_at: S.String
44
- })
45
- )
46
- })
47
- export type GetStickyPostsBody = typeof GetStickyPostsBody.Type
39
+ updated_at: S.String,
40
+ }),
41
+ ),
42
+ });
43
+ export type GetStickyPostsBody = typeof GetStickyPostsBody.Type;
48
44
 
49
45
  export const StickyPostSuccess = S.Struct({
50
- message: S.String
51
- })
52
- export type StickyPostSuccess = typeof StickyPostSuccess.Type
46
+ message: S.String,
47
+ });
48
+ export type StickyPostSuccess = typeof StickyPostSuccess.Type;
@@ -1,11 +1,11 @@
1
- import { Schema as S } from "effect"
1
+ import { Schema as S } from "effect";
2
2
 
3
3
  // ------------------- Primitives ---------------------------------
4
4
 
5
- export const ListUri = S.String
6
- export type ListUri = typeof ListUri.Type
5
+ export const ListUri = S.String;
6
+ export type ListUri = typeof ListUri.Type;
7
7
 
8
- export const AttributeName = S.Union(
8
+ export const AttributeName = S.Union([
9
9
  S.Literal("text"),
10
10
  S.Literal("reply"),
11
11
  S.Literal("embed.images[*].alt"),
@@ -27,15 +27,22 @@ export const AttributeName = S.Union(
27
27
  S.Literal("hydrated_metadata.user.description"),
28
28
  S.Literal("hydrated_metadata.user.display_name"),
29
29
  S.Literal("hydrated_metadata.user.labels"),
30
- S.Literal("hydrated_metadata.mentions.display_name")
31
- )
32
- export type AttributeName = typeof AttributeName.Type
33
- export const AttributeComparison = S.Literal("==", "!=", ">", "<", ">=", "<=")
34
- export type AttributeComparison = typeof AttributeComparison.Type
35
- export const AttributeValue = S.Null
36
- export type AttributeValue = typeof AttributeValue.Type
37
- export const PostType = S.Literal("reply", "quote")
38
- export type PostType = typeof PostType.Type
30
+ S.Literal("hydrated_metadata.mentions.display_name"),
31
+ ]);
32
+ export type AttributeName = typeof AttributeName.Type;
33
+ export const AttributeComparison = S.Literals([
34
+ "==",
35
+ "!=",
36
+ ">",
37
+ "<",
38
+ ">=",
39
+ "<=",
40
+ ]);
41
+ export type AttributeComparison = typeof AttributeComparison.Type;
42
+ export const AttributeValue = S.Null;
43
+ export type AttributeValue = typeof AttributeValue.Type;
44
+ export const PostType = S.Literals(["reply", "quote"]);
45
+ export type PostType = typeof PostType.Type;
39
46
 
40
47
  // ------------------- Filters ------------------------------------
41
48
 
@@ -52,149 +59,150 @@ export type Filter =
52
59
  | EntityExcludesLabels
53
60
  | EmbedType
54
61
  | SocialGraph
55
- | PostTypeFilter
62
+ | PostTypeFilter;
56
63
 
57
- export type And = Readonly<{ and: ReadonlyArray<Filter> }>
58
- export type Or = Readonly<{ or: ReadonlyArray<Filter> }>
64
+ export type And = Readonly<{ and: ReadonlyArray<Filter> }>;
65
+ export type Or = Readonly<{ or: ReadonlyArray<Filter> }>;
59
66
  export type PostTypeFilter = Readonly<{
60
- post_type: readonly ["in" | "not_in", ReadonlyArray<PostType>]
61
- }>
67
+ post_type: readonly ["in" | "not_in", ReadonlyArray<PostType>];
68
+ }>;
62
69
  export type ListMemberFilter = Readonly<{
63
- list_member: readonly [ListUri, "in" | "not_in"]
64
- }>
70
+ list_member: readonly [ListUri, "in" | "not_in"];
71
+ }>;
65
72
  export type AttributeCompare = Readonly<{
66
73
  attribute_compare: readonly [
67
74
  AttributeName,
68
75
  AttributeComparison,
69
- AttributeValue
70
- ]
71
- }>
76
+ AttributeValue,
77
+ ];
78
+ }>;
72
79
  export type RegexMatches = Readonly<{
73
- regex_matches: readonly [AttributeName, string, boolean]
74
- }>
80
+ regex_matches: readonly [AttributeName, string, boolean];
81
+ }>;
75
82
  export type RegexNegationMatches = Readonly<{
76
- regex_negation_matches: readonly [AttributeName, string, boolean]
77
- }>
83
+ regex_negation_matches: readonly [AttributeName, string, boolean];
84
+ }>;
78
85
  export type TextMatchesAny = Readonly<{
79
- regex_any: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean]
80
- }>
86
+ regex_any: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean];
87
+ }>;
81
88
  export type TextMatchesNone = Readonly<{
82
- regex_none: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean]
83
- }>
89
+ regex_none: readonly [AttributeName, ReadonlyArray<string>, boolean, boolean];
90
+ }>;
84
91
  export type ContentModerationBlock = Readonly<{
85
- content_moderation: readonly ["OK", ">=", number]
86
- }>
92
+ content_moderation: readonly ["OK", ">=", number];
93
+ }>;
87
94
  export type EntityExcludesLabels = Readonly<{
88
- entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]]
89
- }>
95
+ entity_excludes: readonly ["labels", readonly ["porn", "sexual", "nudity"]];
96
+ }>;
90
97
  export type EmbedType = Readonly<{
91
98
  embed_type: readonly [
92
99
  "==" | "!=",
93
- "video" | "image" | "link" | "post" | "gif" | "image_group"
94
- ]
95
- }>
100
+ "video" | "image" | "link" | "post" | "gif" | "image_group",
101
+ ];
102
+ }>;
96
103
  export type SocialGraph = Readonly<{
97
- social_graph: readonly [string, "in" | "not_in", "follows" | "followers"]
98
- }>
104
+ social_graph: readonly [string, "in" | "not_in", "follows" | "followers"];
105
+ }>;
99
106
 
100
- export const Filter = S.Union(
101
- S.suspend((): S.Schema<And> => And),
102
- S.suspend((): S.Schema<Or> => Or),
103
- S.suspend((): S.Schema<ListMemberFilter> => ListMemberFilter),
104
- S.suspend((): S.Schema<AttributeCompare> => AttributeCompare),
105
- S.suspend((): S.Schema<RegexMatches> => RegexMatches),
106
- S.suspend((): S.Schema<RegexNegationMatches> => RegexNegationMatches),
107
- S.suspend((): S.Schema<TextMatchesAny> => TextMatchesAny),
108
- S.suspend((): S.Schema<TextMatchesNone> => TextMatchesNone),
109
- S.suspend((): S.Schema<ContentModerationBlock> => ContentModerationBlock),
110
- S.suspend((): S.Schema<EntityExcludesLabels> => EntityExcludesLabels),
111
- S.suspend((): S.Schema<EmbedType> => EmbedType),
112
- S.suspend((): S.Schema<SocialGraph> => SocialGraph),
113
- S.suspend((): S.Schema<PostTypeFilter> => PostTypeFilter)
114
- )
107
+ export const Filter = S.Union([
108
+ S.suspend((): S.Codec<And> => And),
109
+ S.suspend((): S.Codec<Or> => Or),
110
+ S.suspend((): S.Codec<ListMemberFilter> => ListMemberFilter),
111
+ S.suspend((): S.Codec<AttributeCompare> => AttributeCompare),
112
+ S.suspend((): S.Codec<RegexMatches> => RegexMatches),
113
+ S.suspend((): S.Codec<RegexNegationMatches> => RegexNegationMatches),
114
+ S.suspend((): S.Codec<TextMatchesAny> => TextMatchesAny),
115
+ S.suspend((): S.Codec<TextMatchesNone> => TextMatchesNone),
116
+ S.suspend((): S.Codec<ContentModerationBlock> => ContentModerationBlock),
117
+ S.suspend((): S.Codec<EntityExcludesLabels> => EntityExcludesLabels),
118
+ S.suspend((): S.Codec<EmbedType> => EmbedType),
119
+ S.suspend((): S.Codec<SocialGraph> => SocialGraph),
120
+ S.suspend((): S.Codec<PostTypeFilter> => PostTypeFilter),
121
+ ]);
115
122
 
116
- export const Or = S.Struct({ or: S.Array(Filter) })
117
- export const And = S.Struct({ and: S.Array(Filter) })
123
+ export const Or = S.Struct({ or: S.Array(Filter) });
124
+ export const And = S.Struct({ and: S.Array(Filter) });
118
125
  export const PostTypeFilter = S.Struct({
119
- post_type: S.Tuple(S.Literal("in", "not_in"), S.Array(PostType))
120
- })
126
+ post_type: S.Tuple([S.Literals(["in", "not_in"]), S.Array(PostType)]),
127
+ });
121
128
  export const ListMemberFilter = S.Struct({
122
- list_member: S.Tuple(ListUri, S.Literal("in", "not_in"))
123
- })
129
+ list_member: S.Tuple([ListUri, S.Literals(["in", "not_in"])]),
130
+ });
124
131
  export const AttributeCompare = S.Struct({
125
- attribute_compare: S.Tuple(
132
+ attribute_compare: S.Tuple([
126
133
  AttributeName,
127
134
  AttributeComparison,
128
- AttributeValue
129
- )
130
- })
131
- const RegexMatchBase = S.Tuple(
135
+ AttributeValue,
136
+ ]),
137
+ });
138
+ const RegexMatchBase = S.Tuple([
132
139
  AttributeName,
133
- S.String.annotations({
140
+ S.String.annotate({
134
141
  title: "Regex Pattern",
135
- description: "The source of the regex pattern to match against."
142
+ description: "The source of the regex pattern to match against.",
136
143
  }),
137
- S.Boolean.annotations({
144
+ S.Boolean.annotate({
138
145
  title: "Case Insensitive?",
139
- description: "True if the regex should be case insensitive."
140
- })
141
- )
146
+ description: "True if the regex should be case insensitive.",
147
+ }),
148
+ ]);
142
149
  export const RegexMatches = S.Struct({
143
- regex_matches: RegexMatchBase
144
- })
150
+ regex_matches: RegexMatchBase,
151
+ });
145
152
  export const RegexNegationMatches = S.Struct({
146
- regex_negation_matches: RegexMatchBase
147
- })
148
- const TextMatchBase = S.Tuple(
153
+ regex_negation_matches: RegexMatchBase,
154
+ });
155
+ const TextMatchBase = S.Tuple([
149
156
  AttributeName,
150
- S.Array(S.String).annotations({
157
+ S.Array(S.String).annotate({
151
158
  title: "Text Patterns",
152
- description: "List of possible text patterns to match against."
159
+ description: "List of possible text patterns to match against.",
153
160
  }),
154
- S.Boolean.annotations({
161
+ S.Boolean.annotate({
155
162
  title: "Case Insensitive?",
156
- description: "True if the matching should be case insensitive."
163
+ description: "True if the matching should be case insensitive.",
157
164
  }),
158
- S.Boolean.annotations({
165
+ S.Boolean.annotate({
159
166
  title: "Use Regex?",
160
- description: "True if the values should be treated as regex patterns, false for literal strings."
161
- })
162
- )
167
+ description:
168
+ "True if the values should be treated as regex patterns, false for literal strings.",
169
+ }),
170
+ ]);
163
171
  export const TextMatchesAny = S.Struct({
164
- regex_any: TextMatchBase
165
- })
172
+ regex_any: TextMatchBase,
173
+ });
166
174
  export const TextMatchesNone = S.Struct({
167
- regex_none: TextMatchBase
168
- })
175
+ regex_none: TextMatchBase,
176
+ });
169
177
  export const ContentModerationBlock = S.Struct({
170
- content_moderation: S.Tuple(
178
+ content_moderation: S.Tuple([
171
179
  S.Literal("OK"),
172
180
  S.Literal(">="),
173
- S.Number.annotations({
181
+ S.Number.annotate({
174
182
  title: "Threshold",
175
- description: "The threshold for content moderation."
176
- })
177
- )
178
- })
183
+ description: "The threshold for content moderation.",
184
+ }),
185
+ ]),
186
+ });
179
187
  export const EntityExcludesLabels = S.Struct({
180
- entity_excludes: S.Tuple(
188
+ entity_excludes: S.Tuple([
181
189
  S.Literal("labels"),
182
- S.Tuple(S.Literal("porn"), S.Literal("sexual"), S.Literal("nudity"))
183
- )
184
- })
190
+ S.Tuple([S.Literal("porn"), S.Literal("sexual"), S.Literal("nudity")]),
191
+ ]),
192
+ });
185
193
  export const EmbedType = S.Struct({
186
- embed_type: S.Tuple(
187
- S.Literal("==", "!="),
188
- S.Literal("video", "image", "link", "post", "gif", "image_group")
189
- )
190
- })
194
+ embed_type: S.Tuple([
195
+ S.Literals(["==", "!="]),
196
+ S.Literals(["video", "image", "link", "post", "gif", "image_group"]),
197
+ ]),
198
+ });
191
199
  export const SocialGraph = S.Struct({
192
- social_graph: S.Tuple(
200
+ social_graph: S.Tuple([
193
201
  S.String,
194
- S.Literal("in", "not_in"),
195
- S.Literal("follows", "followers")
196
- )
197
- })
202
+ S.Literals(["in", "not_in"]),
203
+ S.Literals(["follows", "followers"]),
204
+ ]),
205
+ });
198
206
 
199
207
  // ---------------------- Sort Settings -----------------------------
200
208
 
@@ -206,59 +214,59 @@ export const SortSettings = S.Struct({
206
214
  repost_count_multiplier: S.Number,
207
215
  reader_like_count_multiplier: S.Number,
208
216
  reader_reply_count_multiplier: S.Number,
209
- reader_repost_count_multiplier: S.Number
210
- })
211
- export type SortSettings = typeof SortSettings.Type
217
+ reader_repost_count_multiplier: S.Number,
218
+ });
219
+ export type SortSettings = typeof SortSettings.Type;
212
220
 
213
221
  // ---------------------- Form Data ---------------------------------
214
222
 
215
- export const DisplayName = S.String.annotations({
216
- description: "The public name of the feed."
217
- })
218
- export type DisplayName = typeof DisplayName.Type
223
+ export const DisplayName = S.String.annotate({
224
+ description: "The public name of the feed.",
225
+ });
226
+ export type DisplayName = typeof DisplayName.Type;
219
227
 
220
- export const RecordName = S.String.annotations({
221
- description: "The slug of the feed url."
222
- })
223
- export type RecordName = typeof RecordName.Type
228
+ export const RecordName = S.String.annotate({
229
+ description: "The slug of the feed url.",
230
+ });
231
+ export type RecordName = typeof RecordName.Type;
224
232
 
225
- export const Description = S.String.annotations({
226
- description: "The description to be shown to users of the feed."
227
- })
228
- export type Description = typeof Description.Type
233
+ export const Description = S.String.annotate({
234
+ description: "The description to be shown to users of the feed.",
235
+ });
236
+ export type Description = typeof Description.Type;
229
237
 
230
- export const Order = S.Union(
238
+ export const Order = S.Union([
231
239
  S.Literal("new"),
232
240
  S.Literal("trending"),
233
241
  S.Literal("blend"),
234
242
  S.Literal("hackernews"),
235
- S.Literal("old")
236
- )
237
- export type Order = typeof Order.Type
243
+ S.Literal("old"),
244
+ ]);
245
+ export type Order = typeof Order.Type;
238
246
 
239
- export const FeedId = S.NumberFromString
240
- export type FeedId = typeof FeedId.Type
247
+ export const FeedId = S.NumberFromString;
248
+ export type FeedId = typeof FeedId.Type;
241
249
 
242
- export const UserId = S.NumberFromString
243
- export type UserId = typeof UserId.Type
250
+ export const UserId = S.NumberFromString;
251
+ export type UserId = typeof UserId.Type;
244
252
 
245
253
  export const AlgorithmManifest = S.Struct({
246
254
  filter: Filter,
247
- sort_settings: S.optional(SortSettings)
248
- })
249
- export type AlgorithmManifest = typeof AlgorithmManifest.Type
255
+ sort_settings: S.optional(SortSettings),
256
+ });
257
+ export type AlgorithmManifest = typeof AlgorithmManifest.Type;
250
258
 
251
259
  export const Metadata = S.Struct({
252
260
  document: S.optional(S.Unknown),
253
261
  schema: S.optional(
254
262
  S.Struct({
255
263
  schemaVersion: S.Literal(2),
256
- sequences: S.Record({ key: S.String, value: S.Number })
257
- })
264
+ sequences: S.Record(S.String, S.Number),
265
+ }),
258
266
  ),
259
- session: S.optional(S.Unknown)
260
- })
261
- export type Metadata = typeof Metadata.Type
267
+ session: S.optional(S.Unknown),
268
+ });
269
+ export type Metadata = typeof Metadata.Type;
262
270
 
263
271
  export const FullForm = S.Struct({
264
272
  id: FeedId,
@@ -268,11 +276,11 @@ export const FullForm = S.Struct({
268
276
  record_name: RecordName,
269
277
  description: S.optional(Description),
270
278
  order: Order,
271
- algorithm_manifest: S.parseJson(AlgorithmManifest),
272
- metadata: S.optional(S.parseJson(Metadata))
273
- })
274
- export type FullForm = typeof FullForm.Type
275
- export type EncodedFullForm = typeof FullForm.Encoded
279
+ algorithm_manifest: S.fromJsonString(AlgorithmManifest),
280
+ metadata: S.optional(S.fromJsonString(Metadata)),
281
+ });
282
+ export type FullForm = typeof FullForm.Type;
283
+ export type EncodedFullForm = typeof FullForm.Encoded;
276
284
 
277
285
  /**
278
286
  * Actual structure of FormData
@@ -1,2 +1,2 @@
1
- export * from "./shared.js"
2
- export * from "./UpdateAlgorithmPayload.js"
1
+ export * from "./shared.js";
2
+ export * from "./UpdateAlgorithmPayload.js";
@@ -1,65 +1,65 @@
1
- import { Schema as S } from "effect"
1
+ import { Schema as S } from "effect";
2
2
 
3
3
  export const PartialAlgorithm = S.Struct({
4
4
  algorithm_uri: S.String,
5
- algorithm_manifest_id: S.Union(S.Null, S.Number),
5
+ algorithm_manifest_id: S.Union([S.Null, S.Number]),
6
6
  draft_algorithm_manifest_id: S.Number,
7
7
  record_name: S.String,
8
8
  display_name: S.String,
9
9
  description: S.String,
10
10
  feed_did: S.String,
11
- avatar_url: S.Union(S.String, S.Null),
12
- cpm_cents: S.Union(S.Number, S.Null),
11
+ avatar_url: S.Union([S.String, S.Null]),
12
+ cpm_cents: S.Union([S.Number, S.Null]),
13
13
  deleted: S.Boolean,
14
14
  active: S.Boolean,
15
15
  public: S.Boolean,
16
16
  monetization_available: S.Boolean,
17
- status: S.Union(S.String, S.Null),
17
+ status: S.Union([S.String, S.Null]),
18
18
  unique_operator_ids: S.Array(S.Number),
19
19
  user_id: S.Number,
20
20
  id: S.Number,
21
21
  created_at: S.DateFromString,
22
22
  updated_at: S.DateFromString,
23
- deleted_at: S.Union(S.DateFromString, S.Null)
24
- })
25
- export type PartialAlgorithm = typeof PartialAlgorithm.Type
23
+ deleted_at: S.Union([S.DateFromString, S.Null]),
24
+ });
25
+ export type PartialAlgorithm = typeof PartialAlgorithm.Type;
26
26
 
27
- const Stats = S.Unknown
28
- const LatestError = S.Unknown
27
+ const Stats = S.Unknown;
28
+ const LatestError = S.Unknown;
29
29
 
30
30
  const FullAlgorithm = S.Struct({
31
31
  ...PartialAlgorithm.fields,
32
32
  stats: Stats,
33
33
  latest_error: LatestError,
34
34
  latest_compute_cycle: S.Unknown,
35
- subscriber_lists: S.Unknown
36
- })
35
+ subscriber_lists: S.Unknown,
36
+ });
37
37
  const FullAlgorithmWithManifest = S.Struct({
38
38
  ...FullAlgorithm.fields,
39
39
  draft_algorithm_manifest: S.Unknown,
40
- algorithm_manifest: S.Unknown
41
- })
40
+ algorithm_manifest: S.Unknown,
41
+ });
42
42
 
43
43
  export const AlgoUpdateResponse = S.Struct({
44
44
  message: S.String,
45
- algorithm: PartialAlgorithm
46
- })
47
- export type AlgoUpdateResponse = typeof AlgoUpdateResponse.Type
45
+ algorithm: PartialAlgorithm,
46
+ });
47
+ export type AlgoUpdateResponse = typeof AlgoUpdateResponse.Type;
48
48
 
49
- export const GetAlgoResponse = S.parseJson(FullAlgorithmWithManifest)
50
- export type GetAlgoResponse = typeof GetAlgoResponse.Type
49
+ export const GetAlgoResponse = S.fromJsonString(FullAlgorithmWithManifest);
50
+ export type GetAlgoResponse = typeof GetAlgoResponse.Type;
51
51
 
52
52
  export const HidePostBody = S.Struct({
53
53
  algo_id: S.Number,
54
- at_uri: S.String
55
- })
56
- export type HidePostBody = typeof HidePostBody.Type
54
+ at_uri: S.String,
55
+ });
56
+ export type HidePostBody = typeof HidePostBody.Type;
57
57
 
58
58
  export const UnhidePostBody = S.Struct({
59
59
  algo_id: S.Number,
60
- at_uri: S.String
61
- })
62
- export type UnhidePostBody = typeof UnhidePostBody.Type
60
+ at_uri: S.String,
61
+ });
62
+ export type UnhidePostBody = typeof UnhidePostBody.Type;
63
63
 
64
64
  // ----------------------- Get Algorithms Response -----------------------
65
65
 
@@ -68,15 +68,15 @@ export const AlgorithWithStats = S.Struct({
68
68
  stats: S.Struct({
69
69
  page_renders: S.Number,
70
70
  unique_users: S.Number,
71
- post_renders: S.Number
72
- })
73
- })
74
- export type AlgorithmWithStats = typeof AlgorithWithStats.Type
71
+ post_renders: S.Number,
72
+ }),
73
+ });
74
+ export type AlgorithmWithStats = typeof AlgorithWithStats.Type;
75
75
  export const GetAlgorithmsResponse = S.Struct({
76
76
  page: S.Number,
77
77
  page_size: S.Number,
78
78
  total_items: S.Number,
79
79
  total_pages: S.Number,
80
- user_algos: S.Array(AlgorithWithStats)
81
- })
82
- export type GetAlgorithmsResponse = typeof GetAlgorithmsResponse.Type
80
+ user_algos: S.Array(AlgorithWithStats),
81
+ });
82
+ export type GetAlgorithmsResponse = typeof GetAlgorithmsResponse.Type;