graze-client 0.2.4 → 0.3.1-alpha.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.
- package/package.json +6 -20
- package/src/builder.ts +119 -0
- package/src/index.ts +1 -1
- package/src/schema/UpdateAlgorithmPayload.ts +14 -2
- package/build/cjs/GrazeClient.js +0 -71
- package/build/cjs/GrazeClient.js.map +0 -1
- package/build/cjs/index.js +0 -48
- package/build/cjs/index.js.map +0 -1
- package/build/cjs/schema/UpdateAlgorithmPayload.js +0 -114
- package/build/cjs/schema/UpdateAlgorithmPayload.js.map +0 -1
- package/build/cjs/schema/index.js +0 -28
- package/build/cjs/schema/index.js.map +0 -1
- package/build/cjs/schema/shared.js +0 -69
- package/build/cjs/schema/shared.js.map +0 -1
- package/build/dts/GrazeClient.d.ts +0 -153
- package/build/dts/GrazeClient.d.ts.map +0 -1
- package/build/dts/index.d.ts +0 -17
- package/build/dts/index.d.ts.map +0 -1
- package/build/dts/schema/UpdateAlgorithmPayload.d.ts +0 -328
- package/build/dts/schema/UpdateAlgorithmPayload.d.ts.map +0 -1
- package/build/dts/schema/index.d.ts +0 -3
- package/build/dts/schema/index.d.ts.map +0 -1
- package/build/dts/schema/shared.d.ts +0 -147
- package/build/dts/schema/shared.d.ts.map +0 -1
- package/build/esm/GrazeClient.js +0 -61
- package/build/esm/GrazeClient.js.map +0 -1
- package/build/esm/index.js +0 -41
- package/build/esm/index.js.map +0 -1
- package/build/esm/schema/UpdateAlgorithmPayload.js +0 -108
- package/build/esm/schema/UpdateAlgorithmPayload.js.map +0 -1
- package/build/esm/schema/index.js +0 -3
- package/build/esm/schema/index.js.map +0 -1
- package/build/esm/schema/shared.js +0 -63
- package/build/esm/schema/shared.js.map +0 -1
|
@@ -1,147 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/build/esm/GrazeClient.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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 = /*#__PURE__*/HttpApiSchema.param("userId", Schema.NumberFromString);
|
|
22
|
-
const FeedIdParam = /*#__PURE__*/HttpApiSchema.param("feedId", Schema.NumberFromString);
|
|
23
|
-
const GrazeApiGroup = /*#__PURE__*/HttpApiGroup.make("graze", {
|
|
24
|
-
topLevel: true
|
|
25
|
-
}).add(HttpApiEndpoint.get("getFeeds")`/app/my_feeds`.addSuccess(GetAlgorithmsResponse).setPayload(Schema.Struct({
|
|
26
|
-
user_id: UserIdParam
|
|
27
|
-
}))).add(HttpApiEndpoint.get("getFeed")`/app/my_feeds/${FeedIdParam}`.addSuccess(GetAlgoResponse)).add(HttpApiEndpoint.post("updateAlgorithm")`/app/edit_algo_image`.setPayload(HttpApiSchema.Multipart(Form.FullForm)).addSuccess(AlgoUpdateResponse)).add(HttpApiEndpoint.get("publishAlgorithm")`/app/publish_algo/${FeedIdParam}`.addSuccess(Schema.Unknown)).add(/*#__PURE__*/HttpApiEndpoint.post("hidePost")`/app/hide_post`.setPayload(HidePostBody).addSuccess(Schema.Unknown));
|
|
28
|
-
class GrazeApiDef extends /*#__PURE__*/HttpApi.make("grazeApi").add(GrazeApiGroup) {}
|
|
29
|
-
const grazeLive = /*#__PURE__*/Effect.gen(function* () {
|
|
30
|
-
const baseUrl = yield* Config.url("GRAZE_API_URL");
|
|
31
|
-
const cookie = yield* Config.redacted("GRAZE_COOKIE");
|
|
32
|
-
const client = yield* HttpApiClient.make(GrazeApiDef, {
|
|
33
|
-
baseUrl: baseUrl.toString(),
|
|
34
|
-
transformClient: client => client.pipe(HttpClient.filterStatusOk, HttpClient.mapRequest(HttpClientRequest.setHeaders({
|
|
35
|
-
cookie: Redacted.value(cookie)
|
|
36
|
-
})))
|
|
37
|
-
});
|
|
38
|
-
const updateAlgorithm = data => Effect.gen(function* () {
|
|
39
|
-
const formData = yield* encodeForm(data);
|
|
40
|
-
return yield* client.updateAlgorithm({
|
|
41
|
-
payload: formData
|
|
42
|
-
});
|
|
43
|
-
});
|
|
44
|
-
const userId = yield* Config.integer("GRAZE_USER_ID");
|
|
45
|
-
const getFeeds = () => client.getFeeds({
|
|
46
|
-
payload: {
|
|
47
|
-
user_id: userId
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
return {
|
|
51
|
-
...client,
|
|
52
|
-
updateAlgorithm,
|
|
53
|
-
getFeeds
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
export class GrazeClient extends /*#__PURE__*/Effect.Service()("GrazeClient", {
|
|
57
|
-
effect: grazeLive,
|
|
58
|
-
dependencies: [FetchHttpClient.layer]
|
|
59
|
-
}) {}
|
|
60
|
-
export class GrazeError extends /*#__PURE__*/Data.TaggedError("GrazeError") {}
|
|
61
|
-
//# sourceMappingURL=GrazeClient.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GrazeClient.js","names":["AlgoUpdateResponse","GetAlgoResponse","GetAlgorithmsResponse","HidePostBody","FetchHttpClient","HttpApi","HttpApiClient","HttpApiEndpoint","HttpApiGroup","HttpApiSchema","HttpClient","HttpClientRequest","Config","Data","Effect","Redacted","Schema","Form","isStringOrBlob","val","Blob","encodeForm","obj","gen","encoded","encode","FullForm","formData","FormData","key","hasOwnProperty","append","UserIdParam","param","NumberFromString","FeedIdParam","GrazeApiGroup","make","topLevel","add","get","addSuccess","setPayload","Struct","user_id","post","Multipart","Unknown","GrazeApiDef","grazeLive","baseUrl","url","cookie","redacted","client","toString","transformClient","pipe","filterStatusOk","mapRequest","setHeaders","value","updateAlgorithm","data","payload","userId","integer","getFeeds","GrazeClient","Service","effect","dependencies","layer","GrazeError","TaggedError"],"sources":["../../src/GrazeClient.ts"],"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AACK,QAAQ,EAAE;IAC3BC,eAAe,EAAGF,MAAM,IACtBA,MAAM,CAACG,IAAI,CACT/C,UAAU,CAACgD,cAAc,EACzBhD,UAAU,CAACiD,UAAU,CACnBhD,iBAAiB,CAACiD,UAAU,CAAC;MAC3BR,MAAM,EAAErC,QAAQ,CAAC8C,KAAK,CAACT,MAAM;KAC9B,CAAC,CACH;GAEN,CAAC;EAEF,MAAMU,eAAe,GAAIC,IAAmB,IAC1CjD,MAAM,CAACS,GAAG,CAAC,aAAS;IAClB,MAAMI,QAAQ,GAAG,OAAON,UAAU,CAAC0C,IAAI,CAAC;IACxC,OAAO,OAAOT,MAAM,CAACQ,eAAe,CAAC;MAAEE,OAAO,EAAErC;IAAQ,CAAE,CAAC;EAC7D,CAAC,CAAC;EAEJ,MAAMsC,MAAM,GAAG,OAAOrD,MAAM,CAACsD,OAAO,CAAC,eAAe,CAAC;EACrD,MAAMC,QAAQ,GAAGA,CAAA,KAAMb,MAAM,CAACa,QAAQ,CAAC;IAAEH,OAAO,EAAE;MAAEpB,OAAO,EAAEqB;IAAM;EAAE,CAAE,CAAC;EAExE,OAAO;IACL,GAAGX,MAAM;IACTQ,eAAe;IACfK;GACD;AACH,CAAC,CAAC;AAEF,OAAM,MAAOC,WAAY,sBAAQtD,MAAM,CAACuD,OAAO,EAAe,CAAC,aAAa,EAAE;EAC5EC,MAAM,EAAErB,SAAS;EACjBsB,YAAY,EAAE,CAACnE,eAAe,CAACoE,KAAK;CACrC,CAAC;AAIF,OAAM,MAAOC,UAAW,sBAAQ5D,IAAI,CAAC6D,WAAW,CAAC,YAAY,CAK3D","ignoreList":[]}
|
package/build/esm/index.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { ConfigProvider, Effect, Layer } from "effect";
|
|
2
|
-
import { GrazeClient } from "src/GrazeClient.js";
|
|
3
|
-
export class GrazeService {
|
|
4
|
-
getFeed;
|
|
5
|
-
getFeeds;
|
|
6
|
-
hidePost;
|
|
7
|
-
updateAlgorithm;
|
|
8
|
-
publishAlgorithm;
|
|
9
|
-
constructor({
|
|
10
|
-
apiUrl,
|
|
11
|
-
cookie,
|
|
12
|
-
userId
|
|
13
|
-
}) {
|
|
14
|
-
const envMap = new Map([["GRAZE_API_URL", apiUrl], ["GRAZE_COOKIE", cookie], ["GRAZE_USER_ID", userId.toString()]]);
|
|
15
|
-
const provider = ConfigProvider.fromMap(envMap);
|
|
16
|
-
const layer = Layer.setConfigProvider(provider);
|
|
17
|
-
const make = setup.pipe(Effect.provide(layer), Effect.provide(GrazeClient.Default));
|
|
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 = /*#__PURE__*/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
|
package/build/esm/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ConfigProvider","Effect","Layer","GrazeClient","GrazeService","getFeed","getFeeds","hidePost","updateAlgorithm","publishAlgorithm","constructor","apiUrl","cookie","userId","envMap","Map","toString","provider","fromMap","layer","setConfigProvider","make","setup","pipe","provide","Default","api","runSync","gen","client","args","runPromise"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,cAAc,EAAEC,MAAM,EAAEC,KAAK,QAAQ,QAAQ;AACtD,SAASC,WAAW,QAAQ,oBAAoB;AAQhD,OAAM,MAAOC,YAAY;EACvBC,OAAO;EACPC,QAAQ;EACRC,QAAQ;EACRC,eAAe;EACfC,gBAAgB;EAEhBC,YAAY;IACVC,MAAM;IACNC,MAAM;IACNC;EAAM,CAKP;IACC,MAAMC,MAAM,GAAG,IAAIC,GAAG,CAAC,CACrB,CAAC,eAAe,EAAEJ,MAAM,CAAC,EACzB,CAAC,cAAc,EAAEC,MAAM,CAAC,EACxB,CAAC,eAAe,EAAEC,MAAM,CAACG,QAAQ,EAAE,CAAC,CACrC,CAAC;IACF,MAAMC,QAAQ,GAAGjB,cAAc,CAACkB,OAAO,CAACJ,MAAM,CAAC;IAC/C,MAAMK,KAAK,GAAGjB,KAAK,CAACkB,iBAAiB,CAACH,QAAQ,CAAC;IAC/C,MAAMI,IAAI,GAAGC,KAAK,CAACC,IAAI,CACrBtB,MAAM,CAACuB,OAAO,CAACL,KAAK,CAAC,EACrBlB,MAAM,CAACuB,OAAO,CAACrB,WAAW,CAACsB,OAAO,CAAC,CACpC;IACD,MAAMC,GAAG,GAAGzB,MAAM,CAAC0B,OAAO,CAACN,IAAI,CAAC;IAChC,IAAI,CAAChB,OAAO,GAAGqB,GAAG,CAACrB,OAAO;IAC1B,IAAI,CAACC,QAAQ,GAAGoB,GAAG,CAACpB,QAAQ;IAC5B,IAAI,CAACC,QAAQ,GAAGmB,GAAG,CAACnB,QAAQ;IAC5B,IAAI,CAACC,eAAe,GAAGkB,GAAG,CAAClB,eAAe;IAC1C,IAAI,CAACC,gBAAgB,GAAGiB,GAAG,CAACjB,gBAAgB;EAC9C;;AAGF,MAAMa,KAAK,gBAAGrB,MAAM,CAAC2B,GAAG,CAAC,aAAS;EAChC,MAAMC,MAAM,GAAG,OAAO1B,WAAW;EACjC,MAAME,OAAO,GAAGA,CAAC,GAAGyB,IAAuC,KACzDD,MAAM,CAACxB,OAAO,CAAC,GAAGyB,IAAI,CAAC,CAACP,IAAI,CAACtB,MAAM,CAAC8B,UAAU,CAAC;EACjD,MAAMzB,QAAQ,GAAGA,CAAC,GAAGwB,IAAwC,KAC3DD,MAAM,CAACvB,QAAQ,CAAC,GAAGwB,IAAI,CAAC,CAACP,IAAI,CAACtB,MAAM,CAAC8B,UAAU,CAAC;EAClD,MAAMxB,QAAQ,GAAGA,CAAC,GAAGuB,IAAwC,KAC3DD,MAAM,CAACtB,QAAQ,CAAC,GAAGuB,IAAI,CAAC,CAACP,IAAI,CAACtB,MAAM,CAAC8B,UAAU,CAAC;EAClD,MAAMvB,eAAe,GAAGA,CACtB,GAAGsB,IAA+C,KAC/CD,MAAM,CAACrB,eAAe,CAAC,GAAGsB,IAAI,CAAC,CAACP,IAAI,CAACtB,MAAM,CAAC8B,UAAU,CAAC;EAC5D,MAAMtB,gBAAgB,GAAGA,CACvB,GAAGqB,IAAgD,KAChDD,MAAM,CAACpB,gBAAgB,CAAC,GAAGqB,IAAI,CAAC,CAACP,IAAI,CAACtB,MAAM,CAAC8B,UAAU,CAAC;EAE7D,OAAO;IACL1B,OAAO;IACPC,QAAQ;IACRC,QAAQ;IACRC,eAAe;IACfC;GACD;AACH,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { Schema as S } from "effect";
|
|
2
|
-
// ------------------- Primitives ---------------------------------
|
|
3
|
-
export const ListUri = S.String;
|
|
4
|
-
export const AttributeName = /*#__PURE__*/S.Union(/*#__PURE__*/S.Literal("text"), /*#__PURE__*/S.Literal("reply"), /*#__PURE__*/S.Literal("embed.images[*].alt"), /*#__PURE__*/S.Literal("embed.alt"), /*#__PURE__*/S.Literal("embed"), /*#__PURE__*/S.Literal("embed.external.uri"), /*#__PURE__*/S.Literal("embed.external.title"), /*#__PURE__*/S.Literal("embed.external.description"));
|
|
5
|
-
export const AttributeComparison = /*#__PURE__*/S.Literal("==", "!=", ">", "<", ">=", "<=");
|
|
6
|
-
export const AttributeValue = S.Null;
|
|
7
|
-
export const Filter = /*#__PURE__*/S.Union(/*#__PURE__*/S.suspend(() => And), /*#__PURE__*/S.suspend(() => Or), /*#__PURE__*/S.suspend(() => ListMemberFilter), /*#__PURE__*/S.suspend(() => AttributeCompare), /*#__PURE__*/S.suspend(() => RegexMatches), /*#__PURE__*/S.suspend(() => RegexNegationMatches), /*#__PURE__*/S.suspend(() => ContentModerationBlock), /*#__PURE__*/S.suspend(() => EntityExcludesLabels), /*#__PURE__*/S.suspend(() => EmbedType));
|
|
8
|
-
export const Or = /*#__PURE__*/S.Struct({
|
|
9
|
-
or: /*#__PURE__*/S.Array(Filter)
|
|
10
|
-
});
|
|
11
|
-
export const And = /*#__PURE__*/S.Struct({
|
|
12
|
-
and: /*#__PURE__*/S.Array(Filter)
|
|
13
|
-
});
|
|
14
|
-
export const ListMemberFilter = /*#__PURE__*/S.Struct({
|
|
15
|
-
list_member: /*#__PURE__*/S.Tuple(ListUri, /*#__PURE__*/S.Literal("in", "not_in"))
|
|
16
|
-
});
|
|
17
|
-
export const AttributeCompare = /*#__PURE__*/S.Struct({
|
|
18
|
-
attribute_compare: /*#__PURE__*/S.Tuple(AttributeName, AttributeComparison, AttributeValue)
|
|
19
|
-
});
|
|
20
|
-
const RegexMatchBase = /*#__PURE__*/S.Tuple(AttributeName, /*#__PURE__*/S.String.annotations({
|
|
21
|
-
title: "Regex Pattern",
|
|
22
|
-
description: "The source of the regex pattern to match against."
|
|
23
|
-
}), /*#__PURE__*/S.Boolean.annotations({
|
|
24
|
-
title: "Case Insensitive?",
|
|
25
|
-
description: "True if the regex should be case insensitive."
|
|
26
|
-
}));
|
|
27
|
-
export const RegexMatches = /*#__PURE__*/S.Struct({
|
|
28
|
-
regex_matches: RegexMatchBase
|
|
29
|
-
});
|
|
30
|
-
export const RegexNegationMatches = /*#__PURE__*/S.Struct({
|
|
31
|
-
regex_negation_matches: RegexMatchBase
|
|
32
|
-
});
|
|
33
|
-
export const ContentModerationBlock = /*#__PURE__*/S.Struct({
|
|
34
|
-
content_moderation: /*#__PURE__*/S.Tuple(/*#__PURE__*/S.Literal("OK"), /*#__PURE__*/S.Literal(">="), /*#__PURE__*/S.Number.annotations({
|
|
35
|
-
title: "Threshold",
|
|
36
|
-
description: "The threshold for content moderation."
|
|
37
|
-
}))
|
|
38
|
-
});
|
|
39
|
-
export const EntityExcludesLabels = /*#__PURE__*/S.Struct({
|
|
40
|
-
entity_excludes: /*#__PURE__*/S.Tuple(/*#__PURE__*/S.Literal("labels"), /*#__PURE__*/S.Tuple(/*#__PURE__*/S.Literal("porn"), /*#__PURE__*/S.Literal("sexual"), /*#__PURE__*/S.Literal("nudity")))
|
|
41
|
-
});
|
|
42
|
-
export const EmbedType = /*#__PURE__*/S.Struct({
|
|
43
|
-
embed_type: /*#__PURE__*/S.Tuple(/*#__PURE__*/S.Literal("==", "!="), /*#__PURE__*/S.Literal("video", "image", "link", "post", "gif", "image_group"))
|
|
44
|
-
});
|
|
45
|
-
// ---------------------- Sort Settings -----------------------------
|
|
46
|
-
export const SortSettings = /*#__PURE__*/S.Struct({
|
|
47
|
-
time_window: S.Number,
|
|
48
|
-
decay_penalty: S.Number,
|
|
49
|
-
like_count_multiplier: S.Number,
|
|
50
|
-
reply_count_multiplier: S.Number,
|
|
51
|
-
repost_count_multiplier: S.Number,
|
|
52
|
-
reader_like_count_multiplier: S.Number,
|
|
53
|
-
reader_reply_count_multiplier: S.Number,
|
|
54
|
-
reader_repost_count_multiplier: S.Number
|
|
55
|
-
});
|
|
56
|
-
// ---------------------- Form Data ---------------------------------
|
|
57
|
-
export const DisplayName = /*#__PURE__*/S.String.annotations({
|
|
58
|
-
description: "The public name of the feed."
|
|
59
|
-
});
|
|
60
|
-
export const RecordName = /*#__PURE__*/S.String.annotations({
|
|
61
|
-
description: "The slug of the feed url."
|
|
62
|
-
});
|
|
63
|
-
export const Description = /*#__PURE__*/S.String.annotations({
|
|
64
|
-
description: "The description to be shown to users of the feed."
|
|
65
|
-
});
|
|
66
|
-
export const Order = /*#__PURE__*/S.Union(/*#__PURE__*/S.Literal("new"), /*#__PURE__*/S.Literal("trending"), /*#__PURE__*/S.Literal("blend"));
|
|
67
|
-
export const FeedId = S.NumberFromString;
|
|
68
|
-
export const UserId = S.NumberFromString;
|
|
69
|
-
export const AlgorithmManifest = /*#__PURE__*/S.Struct({
|
|
70
|
-
filter: Filter,
|
|
71
|
-
sort_settings: /*#__PURE__*/S.optional(SortSettings)
|
|
72
|
-
});
|
|
73
|
-
export const Metadata = /*#__PURE__*/S.Struct({
|
|
74
|
-
document: /*#__PURE__*/S.optional(S.Unknown),
|
|
75
|
-
schema: /*#__PURE__*/S.optional(/*#__PURE__*/S.Struct({
|
|
76
|
-
schemaVersion: /*#__PURE__*/S.Literal(2),
|
|
77
|
-
sequences: /*#__PURE__*/S.Record({
|
|
78
|
-
key: S.String,
|
|
79
|
-
value: S.Number
|
|
80
|
-
})
|
|
81
|
-
})),
|
|
82
|
-
session: /*#__PURE__*/S.optional(S.Unknown)
|
|
83
|
-
});
|
|
84
|
-
export const FullForm = /*#__PURE__*/S.Struct({
|
|
85
|
-
id: FeedId,
|
|
86
|
-
user_id: UserId,
|
|
87
|
-
file: /*#__PURE__*/S.optional(S.Unknown),
|
|
88
|
-
display_name: DisplayName,
|
|
89
|
-
record_name: RecordName,
|
|
90
|
-
description: /*#__PURE__*/S.optional(Description),
|
|
91
|
-
order: Order,
|
|
92
|
-
algorithm_manifest: /*#__PURE__*/S.parseJson(AlgorithmManifest),
|
|
93
|
-
metadata: /*#__PURE__*/S.optional(/*#__PURE__*/S.parseJson(Metadata))
|
|
94
|
-
});
|
|
95
|
-
/**
|
|
96
|
-
* Actual structure of FormData
|
|
97
|
-
*
|
|
98
|
-
* display_name
|
|
99
|
-
* record_name
|
|
100
|
-
* description
|
|
101
|
-
* order
|
|
102
|
-
* algorithm_manifest
|
|
103
|
-
* metadata
|
|
104
|
-
* id
|
|
105
|
-
* user_id
|
|
106
|
-
* session_cookie
|
|
107
|
-
*/
|
|
108
|
-
//# sourceMappingURL=UpdateAlgorithmPayload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UpdateAlgorithmPayload.js","names":["Schema","S","ListUri","String","AttributeName","Union","Literal","AttributeComparison","AttributeValue","Null","Filter","suspend","And","Or","ListMemberFilter","AttributeCompare","RegexMatches","RegexNegationMatches","ContentModerationBlock","EntityExcludesLabels","EmbedType","Struct","or","Array","and","list_member","Tuple","attribute_compare","RegexMatchBase","annotations","title","description","Boolean","regex_matches","regex_negation_matches","content_moderation","Number","entity_excludes","embed_type","SortSettings","time_window","decay_penalty","like_count_multiplier","reply_count_multiplier","repost_count_multiplier","reader_like_count_multiplier","reader_reply_count_multiplier","reader_repost_count_multiplier","DisplayName","RecordName","Description","Order","FeedId","NumberFromString","UserId","AlgorithmManifest","filter","sort_settings","optional","Metadata","document","Unknown","schema","schemaVersion","sequences","Record","key","value","session","FullForm","id","user_id","file","display_name","record_name","order","algorithm_manifest","parseJson","metadata"],"sources":["../../../src/schema/UpdateAlgorithmPayload.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAM,IAAIC,CAAC,QAAQ,QAAQ;AAEpC;AAEA,OAAO,MAAMC,OAAO,GAAGD,CAAC,CAACE,MAAM;AAG/B,OAAO,MAAMC,aAAa,gBAAGH,CAAC,CAACI,KAAK,cAClCJ,CAAC,CAACK,OAAO,CAAC,MAAM,CAAC,eACjBL,CAAC,CAACK,OAAO,CAAC,OAAO,CAAC,eAClBL,CAAC,CAACK,OAAO,CAAC,qBAAqB,CAAC,eAChCL,CAAC,CAACK,OAAO,CAAC,WAAW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B,KAAK,EAAExB,KAAK;EACZyB,kBAAkB,eAAE3E,CAAC,CAAC4E,SAAS,CAACtB,iBAAiB,CAAC;EAClDuB,QAAQ,eAAE7E,CAAC,CAACyD,QAAQ,cAACzD,CAAC,CAAC4E,SAAS,CAAClB,QAAQ,CAAC;CAC3C,CAAC;AAIF","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/schema/index.ts"],"sourcesContent":[null],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,6BAA6B","ignoreList":[]}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { Schema as S } from "effect";
|
|
2
|
-
export const PartialAlgorithm = /*#__PURE__*/S.Struct({
|
|
3
|
-
algorithm_uri: S.String,
|
|
4
|
-
algorithm_manifest_id: /*#__PURE__*/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: /*#__PURE__*/S.Union(S.String, S.Null),
|
|
11
|
-
cpm_cents: /*#__PURE__*/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: /*#__PURE__*/S.Union(S.String, S.Null),
|
|
17
|
-
unique_operator_ids: /*#__PURE__*/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: /*#__PURE__*/S.Union(S.DateFromString, S.Null)
|
|
23
|
-
});
|
|
24
|
-
const Stats = S.Unknown;
|
|
25
|
-
const LatestError = S.Unknown;
|
|
26
|
-
const FullAlgorithm = /*#__PURE__*/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 = /*#__PURE__*/S.Struct({
|
|
34
|
-
...FullAlgorithm.fields,
|
|
35
|
-
draft_algorithm_manifest: S.Unknown,
|
|
36
|
-
algorithm_manifest: S.Unknown
|
|
37
|
-
});
|
|
38
|
-
export const AlgoUpdateResponse = /*#__PURE__*/S.Struct({
|
|
39
|
-
message: S.String,
|
|
40
|
-
algorithm: PartialAlgorithm
|
|
41
|
-
});
|
|
42
|
-
export const GetAlgoResponse = /*#__PURE__*/S.parseJson(FullAlgorithmWithManifest);
|
|
43
|
-
export const HidePostBody = /*#__PURE__*/S.Struct({
|
|
44
|
-
algo_id: S.Number,
|
|
45
|
-
at_uri: S.String
|
|
46
|
-
});
|
|
47
|
-
// ----------------------- Get Algorithms Response -----------------------
|
|
48
|
-
export const AlgorithWithStats = /*#__PURE__*/S.Struct({
|
|
49
|
-
...PartialAlgorithm.fields,
|
|
50
|
-
stats: /*#__PURE__*/S.Struct({
|
|
51
|
-
page_renders: S.Number,
|
|
52
|
-
unique_users: S.Number,
|
|
53
|
-
post_renders: S.Number
|
|
54
|
-
})
|
|
55
|
-
});
|
|
56
|
-
export const GetAlgorithmsResponse = /*#__PURE__*/S.Struct({
|
|
57
|
-
page: S.Number,
|
|
58
|
-
page_size: S.Number,
|
|
59
|
-
total_items: S.Number,
|
|
60
|
-
total_pages: S.Number,
|
|
61
|
-
user_algos: /*#__PURE__*/S.Array(AlgorithWithStats)
|
|
62
|
-
});
|
|
63
|
-
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["Schema","S","PartialAlgorithm","Struct","algorithm_uri","String","algorithm_manifest_id","Union","Null","Number","draft_algorithm_manifest_id","record_name","display_name","description","feed_did","avatar_url","cpm_cents","deleted","Boolean","active","public","monetization_available","status","unique_operator_ids","Array","user_id","id","created_at","DateFromString","updated_at","deleted_at","Stats","Unknown","LatestError","FullAlgorithm","fields","stats","latest_error","latest_compute_cycle","subscriber_lists","FullAlgorithmWithManifest","draft_algorithm_manifest","algorithm_manifest","AlgoUpdateResponse","message","algorithm","GetAlgoResponse","parseJson","HidePostBody","algo_id","at_uri","AlgorithWithStats","page_renders","unique_users","post_renders","GetAlgorithmsResponse","page","page_size","total_items","total_pages","user_algos"],"sources":["../../../src/schema/shared.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,MAAM,IAAIC,CAAC,QAAQ,QAAQ;AAEpC,OAAO,MAAMC,gBAAgB,gBAAGD,CAAC,CAACE,MAAM,CAAC;EACvCC,aAAa,EAAEH,CAAC,CAACI,MAAM;EACvBC,qBAAqB,eAAEL,CAAC,CAACM,KAAK,CAACN,CAAC,CAACO,IAAI,EAAEP,CAAC,CAACQ,MAAM,CAAC;EAChDC,2BAA2B,EAAET,CAAC,CAACQ,MAAM;EACrCE,WAAW,EAAEV,CAAC,CAACI,MAAM;EACrBO,YAAY,EAAEX,CAAC,CAACI,MAAM;EACtBQ,WAAW,EAAEZ,CAAC,CAACI,MAAM;EACrBS,QAAQ,EAAEb,CAAC,CAACI,MAAM;EAClBU,UAAU,eAAEd,CAAC,CAACM,KAAK,CAACN,CAAC,CAACI,MAAM,EAAEJ,CAAC,CAACO,IAAI,CAAC;EACrCQ,SAAS,eAAEf,CAAC,CAACM,KAAK,CAACN,CAAC,CAACQ,MAAM,EAAER,CAAC,CAACO,IAAI,CAAC;EACpCS,OAAO,EAAEhB,CAAC,CAACiB,OAAO;EAClBC,MAAM,EAAElB,CAAC,CAACiB,OAAO;EACjBE,MAAM,EAAEnB,CAAC,CAACiB,OAAO;EACjBG,sBAAsB,EAAEpB,CAAC,CAACiB,OAAO;EACjCI,MAAM,eAAErB,CAAC,CAACM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