graze-client 0.3.0 → 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.
Files changed (38) hide show
  1. package/package.json +2 -8
  2. package/src/index.ts +1 -1
  3. package/build/cjs/GrazeClient.js +0 -71
  4. package/build/cjs/GrazeClient.js.map +0 -1
  5. package/build/cjs/builder.js +0 -91
  6. package/build/cjs/builder.js.map +0 -1
  7. package/build/cjs/index.js +0 -48
  8. package/build/cjs/index.js.map +0 -1
  9. package/build/cjs/schema/UpdateAlgorithmPayload.js +0 -117
  10. package/build/cjs/schema/UpdateAlgorithmPayload.js.map +0 -1
  11. package/build/cjs/schema/index.js +0 -28
  12. package/build/cjs/schema/index.js.map +0 -1
  13. package/build/cjs/schema/shared.js +0 -69
  14. package/build/cjs/schema/shared.js.map +0 -1
  15. package/build/dts/GrazeClient.d.ts +0 -153
  16. package/build/dts/GrazeClient.d.ts.map +0 -1
  17. package/build/dts/builder.d.ts +0 -42
  18. package/build/dts/builder.d.ts.map +0 -1
  19. package/build/dts/index.d.ts +0 -17
  20. package/build/dts/index.d.ts.map +0 -1
  21. package/build/dts/schema/UpdateAlgorithmPayload.d.ts +0 -352
  22. package/build/dts/schema/UpdateAlgorithmPayload.d.ts.map +0 -1
  23. package/build/dts/schema/index.d.ts +0 -3
  24. package/build/dts/schema/index.d.ts.map +0 -1
  25. package/build/dts/schema/shared.d.ts +0 -147
  26. package/build/dts/schema/shared.d.ts.map +0 -1
  27. package/build/esm/GrazeClient.js +0 -61
  28. package/build/esm/GrazeClient.js.map +0 -1
  29. package/build/esm/builder.js +0 -85
  30. package/build/esm/builder.js.map +0 -1
  31. package/build/esm/index.js +0 -41
  32. package/build/esm/index.js.map +0 -1
  33. package/build/esm/schema/UpdateAlgorithmPayload.js +0 -111
  34. package/build/esm/schema/UpdateAlgorithmPayload.js.map +0 -1
  35. package/build/esm/schema/index.js +0 -3
  36. package/build/esm/schema/index.js.map +0 -1
  37. package/build/esm/schema/shared.js +0 -63
  38. 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"}
@@ -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"],"sourcesContent":[null],"mappings":"AAAA,SACEA,kBAAkB,EAClBC,eAAe,EACfC,qBAAqB,EACrBC,YAAY,QACP,oBAAoB;AAC3B,SACEC,eAAe,EACfC,OAAO,EACPC,aAAa,EACbC,eAAe,EACfC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,iBAAiB,QACZ,kBAAkB;AACzB,SAASC,MAAM,EAAEC,IAAI,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,MAAM,QAAQ,QAAQ;AAE/D,OAAO,KAAKC,IAAI,MAAM,oCAAoC;AAE1D,SAASC,cAAcA,CAACC,GAAY;EAClC,OAAO,OAAO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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":[]}
@@ -1,85 +0,0 @@
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
- } else {
8
- flatFilters.push(f);
9
- }
10
- });
11
- return {
12
- and: flatFilters
13
- };
14
- };
15
- const or = (...filters) => {
16
- const flatFilters = [];
17
- filters.forEach(f => {
18
- if ("or" in f) {
19
- flatFilters.push(...f.or);
20
- } else {
21
- flatFilters.push(f);
22
- }
23
- });
24
- return {
25
- or: flatFilters
26
- };
27
- };
28
- const regexMatches = (attribute, regex) => ({
29
- regex_matches: [attribute, regex, true]
30
- });
31
- const regexNegationMatches = (attribute, regex) => ({
32
- regex_negation_matches: [attribute, regex, true]
33
- });
34
- const isListMember = uri => ({
35
- list_member: [uri, "in"]
36
- });
37
- const isNotListMember = uri => ({
38
- list_member: [uri, "not_in"]
39
- });
40
- const socialGraph = (identifier, op, relation) => ({
41
- social_graph: [identifier, op, relation]
42
- });
43
- const posterIsFollowedBy = identifier => socialGraph(identifier, "in", "followers");
44
- const posterFollows = identifier => socialGraph(identifier, "in", "follows");
45
- const posterIsNotFollowedBy = identifier => socialGraph(identifier, "not_in", "followers");
46
- const posterDoesNotFollow = identifier => socialGraph(identifier, "not_in", "follows");
47
- const hasVideo = {
48
- embed_type: ["==", "video"]
49
- };
50
- const hasNoNSFWLabels = {
51
- entity_excludes: ["labels", ["porn", "sexual", "nudity"]]
52
- };
53
- const attributeCompare = (attr, op, value) => ({
54
- attribute_compare: [attr, op, value]
55
- });
56
- const isPost = /*#__PURE__*/attributeCompare("reply", "==", null);
57
- const isReply = /*#__PURE__*/attributeCompare("reply", "!=", null);
58
- const isContentOk = (threshold = 0.9) => ({
59
- content_moderation: ["OK", ">=", threshold]
60
- });
61
- export const Algo = {
62
- filter: (...filters) => ({
63
- filter: and(...filters)
64
- })
65
- };
66
- export const F = {
67
- and,
68
- or,
69
- regexMatches,
70
- regexNegationMatches,
71
- attributeCompare,
72
- isListMember,
73
- isNotListMember,
74
- socialGraph,
75
- posterIsFollowedBy,
76
- posterFollows,
77
- posterIsNotFollowedBy,
78
- posterDoesNotFollow,
79
- hasVideo,
80
- hasNoNSFWLabels,
81
- isPost,
82
- isReply,
83
- isContentOk
84
- };
85
- //# sourceMappingURL=builder.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder.js","names":["and","filters","flatFilters","forEach","f","push","or","regexMatches","attribute","regex","regex_matches","regexNegationMatches","regex_negation_matches","isListMember","uri","list_member","isNotListMember","socialGraph","identifier","op","relation","social_graph","posterIsFollowedBy","posterFollows","posterIsNotFollowedBy","posterDoesNotFollow","hasVideo","embed_type","hasNoNSFWLabels","entity_excludes","attributeCompare","attr","value","attribute_compare","isPost","isReply","isContentOk","threshold","content_moderation","Algo","filter","F"],"sources":["../../src/builder.ts"],"sourcesContent":[null],"mappings":"AAYA,MAAMA,GAAG,GAAGA,CAAC,GAAGC,OAAiB,KAAI;EACnC,MAAM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;EACHM,EAAE;EACFC,YAAY;EACZI,oBAAoB;EACpBmB,gBAAgB;EAChBjB,YAAY;EACZG,eAAe;EACfC,WAAW;EACXK,kBAAkB;EAClBC,aAAa;EACbC,qBAAqB;EACrBC,mBAAmB;EACnBC,QAAQ;EACRE,eAAe;EACfM,MAAM;EACNC,OAAO;EACPC;CACD","ignoreList":[]}
@@ -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
@@ -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,111 +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), /*#__PURE__*/S.suspend(() => SocialGraph));
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
- export const SocialGraph = /*#__PURE__*/S.Struct({
46
- social_graph: /*#__PURE__*/S.Tuple(S.String, /*#__PURE__*/S.Literal("in", "not_in"), /*#__PURE__*/S.Literal("follows", "followers"))
47
- });
48
- // ---------------------- Sort Settings -----------------------------
49
- export const SortSettings = /*#__PURE__*/S.Struct({
50
- time_window: S.Number,
51
- decay_penalty: S.Number,
52
- like_count_multiplier: S.Number,
53
- reply_count_multiplier: S.Number,
54
- repost_count_multiplier: S.Number,
55
- reader_like_count_multiplier: S.Number,
56
- reader_reply_count_multiplier: S.Number,
57
- reader_repost_count_multiplier: S.Number
58
- });
59
- // ---------------------- Form Data ---------------------------------
60
- export const DisplayName = /*#__PURE__*/S.String.annotations({
61
- description: "The public name of the feed."
62
- });
63
- export const RecordName = /*#__PURE__*/S.String.annotations({
64
- description: "The slug of the feed url."
65
- });
66
- export const Description = /*#__PURE__*/S.String.annotations({
67
- description: "The description to be shown to users of the feed."
68
- });
69
- export const Order = /*#__PURE__*/S.Union(/*#__PURE__*/S.Literal("new"), /*#__PURE__*/S.Literal("trending"), /*#__PURE__*/S.Literal("blend"));
70
- export const FeedId = S.NumberFromString;
71
- export const UserId = S.NumberFromString;
72
- export const AlgorithmManifest = /*#__PURE__*/S.Struct({
73
- filter: Filter,
74
- sort_settings: /*#__PURE__*/S.optional(SortSettings)
75
- });
76
- export const Metadata = /*#__PURE__*/S.Struct({
77
- document: /*#__PURE__*/S.optional(S.Unknown),
78
- schema: /*#__PURE__*/S.optional(/*#__PURE__*/S.Struct({
79
- schemaVersion: /*#__PURE__*/S.Literal(2),
80
- sequences: /*#__PURE__*/S.Record({
81
- key: S.String,
82
- value: S.Number
83
- })
84
- })),
85
- session: /*#__PURE__*/S.optional(S.Unknown)
86
- });
87
- export const FullForm = /*#__PURE__*/S.Struct({
88
- id: FeedId,
89
- user_id: UserId,
90
- file: /*#__PURE__*/S.optional(S.Unknown),
91
- display_name: DisplayName,
92
- record_name: RecordName,
93
- description: /*#__PURE__*/S.optional(Description),
94
- order: Order,
95
- algorithm_manifest: /*#__PURE__*/S.parseJson(AlgorithmManifest),
96
- metadata: /*#__PURE__*/S.optional(/*#__PURE__*/S.parseJson(Metadata))
97
- });
98
- /**
99
- * Actual structure of FormData
100
- *
101
- * display_name
102
- * record_name
103
- * description
104
- * order
105
- * algorithm_manifest
106
- * metadata
107
- * id
108
- * user_id
109
- * session_cookie
110
- */
111
- //# 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","SocialGraph","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","social_graph","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,CAAC,eACtBL,CAAC,CAACK,OAAO,CAAC,OAAO,CAAC,eAClBL,CAAC,CAACK,OAAO,CAAC,oBAAoB,CAAC,eAC/BL,CAAC,CAACK,OAAO,CAAC,sBAAsB,CAAC,eACjCL,CAAC,CAACK,OAAO,CAAC,4BAA4B,CAAC,CACxC;AAED,OAAO,MAAMC,mBAAmB,gBAAGN,CAAC,CAACK,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC;AAE9E,OAAO,MAAME,cAAc,GAAGP,CAAC,CAACQ,IAAI;AAmDpC,OAAO,MAAMC,MAAM,gBAAGT,CAAC,CAACI,KAAK,cAC3BJ,CAAC,CAACU,OAAO,CAAC,MAAqBC,GAAG,CAAC,eACnCX,CAAC,CAACU,OAAO,CAAC,MAAoBE,EAAE,CAAC,eACjCZ,CAAC,CAACU,OAAO,CAAC,MAAkCG,gBAAgB,CAAC,eAC7Db,CAAC,CAACU,OAAO,CAAC,MAAkCI,gBAAgB,CAAC,eAC7Dd,CAAC,CAACU,OAAO,CAAC,MAA8BK,YAAY,CAAC,eACrDf,CAAC,C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AAC;AAGF,OAAO,MAAMoB,QAAQ,gBAAG5D,CAAC,CAACqB,MAAM,CAAC;EAC/BwC,QAAQ,eAAE7D,CAAC,CAAC2D,QAAQ,CAAC3D,CAAC,CAAC8D,OAAO,CAAC;EAC/BC,MAAM,eAAE/D,CAAC,CAAC2D,QAAQ,cAChB3D,CAAC,CAACqB,MAAM,CAAC;IACP2C,aAAa,eAAEhE,CAAC,CAACK,OAAO,CAAC,CAAC,CAAC;IAC3B4D,SAAS,eAAEjE,CAAC,CAACkE,MAAM,CAAC;MAAEC,GAAG,EAAEnE,CAAC,CAACE,MAAM;MAAEkE,KAAK,EAAEpE,CAAC,CAACoC;IAAM,CAAE;GACvD,CAAC,CACH;EACDiC,OAAO,eAAErE,CAAC,CAAC2D,QAAQ,CAAC3D,CAAC,CAAC8D,OAAO;CAC9B,CAAC;AAGF,OAAO,MAAMQ,QAAQ,gBAAGtE,CAAC,CAACqB,MAAM,CAAC;EAC/BkD,EAAE,EAAElB,MAAM;EACVmB,OAAO,EAAEjB,MAAM;EACfkB,IAAI,eAAEzE,CAAC,CAAC2D,QAAQ,CAAC3D,CAAC,CAAC8D,OAAO,CAAC;EAC3BY,YAAY,EAAEzB,WAAW;EACzB0B,WAAW,EAAEzB,UAAU;EACvBnB,WAAW,eAAE/B,CAAC,CAAC2D,QAAQ,CAACR,WAAW,CAAC;EACpCyB,KAAK,EAAExB,KAAK;EACZyB,kBAAkB,eAAE7E,CAAC,CAAC8E,SAAS,CAACtB,iBAAiB,CAAC;EAClDuB,QAAQ,eAAE/E,CAAC,CAAC2D,QAAQ,cAAC3D,CAAC,CAAC8E,SAAS,CAAClB,QAAQ,CAAC;CAC3C,CAAC;AAIF","ignoreList":[]}
@@ -1,3 +0,0 @@
1
- export * from "./shared.js";
2
- export * from "./UpdateAlgorithmPayload.js";
3
- //# sourceMappingURL=index.js.map
@@ -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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