@agora-sdk/social-core 0.6.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 (51) hide show
  1. package/LICENSE +202 -0
  2. package/dist/cjs/context/social-context.d.ts +65 -0
  3. package/dist/cjs/context/social-context.js +125 -0
  4. package/dist/cjs/context/social-context.js.map +1 -0
  5. package/dist/cjs/contract/index.d.ts +19 -0
  6. package/dist/cjs/contract/index.js +57 -0
  7. package/dist/cjs/contract/index.js.map +1 -0
  8. package/dist/cjs/hooks/useSocialConstellation.d.ts +29 -0
  9. package/dist/cjs/hooks/useSocialConstellation.js +70 -0
  10. package/dist/cjs/hooks/useSocialConstellation.js.map +1 -0
  11. package/dist/cjs/hooks/useSocialNeighborhood.d.ts +29 -0
  12. package/dist/cjs/hooks/useSocialNeighborhood.js +90 -0
  13. package/dist/cjs/hooks/useSocialNeighborhood.js.map +1 -0
  14. package/dist/cjs/hooks/useSocialTransparency.d.ts +25 -0
  15. package/dist/cjs/hooks/useSocialTransparency.js +28 -0
  16. package/dist/cjs/hooks/useSocialTransparency.js.map +1 -0
  17. package/dist/cjs/hooks/useSocialWeather.d.ts +28 -0
  18. package/dist/cjs/hooks/useSocialWeather.js +72 -0
  19. package/dist/cjs/hooks/useSocialWeather.js.map +1 -0
  20. package/dist/cjs/index.d.ts +14 -0
  21. package/dist/cjs/index.js +33 -0
  22. package/dist/cjs/index.js.map +1 -0
  23. package/dist/cjs/package.json +1 -0
  24. package/dist/cjs/transport/rest.d.ts +105 -0
  25. package/dist/cjs/transport/rest.js +177 -0
  26. package/dist/cjs/transport/rest.js.map +1 -0
  27. package/dist/esm/context/social-context.d.ts +65 -0
  28. package/dist/esm/context/social-context.js +120 -0
  29. package/dist/esm/context/social-context.js.map +1 -0
  30. package/dist/esm/contract/index.d.ts +19 -0
  31. package/dist/esm/contract/index.js +54 -0
  32. package/dist/esm/contract/index.js.map +1 -0
  33. package/dist/esm/hooks/useSocialConstellation.d.ts +29 -0
  34. package/dist/esm/hooks/useSocialConstellation.js +67 -0
  35. package/dist/esm/hooks/useSocialConstellation.js.map +1 -0
  36. package/dist/esm/hooks/useSocialNeighborhood.d.ts +29 -0
  37. package/dist/esm/hooks/useSocialNeighborhood.js +87 -0
  38. package/dist/esm/hooks/useSocialNeighborhood.js.map +1 -0
  39. package/dist/esm/hooks/useSocialTransparency.d.ts +25 -0
  40. package/dist/esm/hooks/useSocialTransparency.js +25 -0
  41. package/dist/esm/hooks/useSocialTransparency.js.map +1 -0
  42. package/dist/esm/hooks/useSocialWeather.d.ts +28 -0
  43. package/dist/esm/hooks/useSocialWeather.js +69 -0
  44. package/dist/esm/hooks/useSocialWeather.js.map +1 -0
  45. package/dist/esm/index.d.ts +14 -0
  46. package/dist/esm/index.js +17 -0
  47. package/dist/esm/index.js.map +1 -0
  48. package/dist/esm/transport/rest.d.ts +105 -0
  49. package/dist/esm/transport/rest.js +168 -0
  50. package/dist/esm/transport/rest.js.map +1 -0
  51. package/package.json +51 -0
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // useSocialNeighborhood — load the caller's own named ties (self-view), gated on the feature config.
3
+ //
4
+ // Self-gates on `config.neighborhoodEnabled`. Owns the `includeInteractions` toggle: it seeds from the
5
+ // project default (`config.neighborhoodIncludeInteractions`) once config resolves, then re-fetches
6
+ // whenever the caller flips it. The server always echoes the EFFECTIVE value, so we sync local state to
7
+ // the response (`includesInteractions`) rather than trusting the request optimistically.
8
+ //
9
+ // Privacy (SOCIAL.md §6): the Neighborhood is self-view only and must not persist across sign-outs or
10
+ // user switches. This hook keeps ties in component state only (no cache) and clears them when the lens
11
+ // disables or the provider's client identity changes — so a project/token swap cannot leak a prior
12
+ // user's ties.
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useSocialNeighborhood = useSocialNeighborhood;
15
+ const react_1 = require("react");
16
+ const rest_js_1 = require("../transport/rest.js");
17
+ const social_context_js_1 = require("../context/social-context.js");
18
+ /**
19
+ * Load the caller's Neighborhood — their own named ties with dyadic brightness. Self-view only.
20
+ *
21
+ * Waits for the provider's transparency config, seeds the `includeInteractions` toggle from the
22
+ * project default, then fetches `GET /social/neighborhood` only when `neighborhoodEnabled` is true.
23
+ * Flipping the toggle re-fetches; the hook syncs to the server's echoed effective value.
24
+ *
25
+ * @returns {@link UseSocialNeighborhoodValues} — the ties, load state, and the interactions toggle.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * const { neighborhood, includeInteractions, setIncludeInteractions } = useSocialNeighborhood();
30
+ * ```
31
+ */
32
+ function useSocialNeighborhood() {
33
+ const { rest, config, configLoading } = (0, social_context_js_1.useSocial)();
34
+ const enabled = config?.neighborhoodEnabled ?? false;
35
+ const projectDefault = config?.neighborhoodIncludeInteractions ?? false;
36
+ const [neighborhood, setNeighborhood] = (0, react_1.useState)(null);
37
+ const [loading, setLoading] = (0, react_1.useState)(false);
38
+ const [error, setError] = (0, react_1.useState)(null);
39
+ const [includeInteractions, setIncludeInteractions] = (0, react_1.useState)(false);
40
+ // Seed the toggle from the project default exactly once, when config first resolves. After that the
41
+ // caller owns it. A ref guards against re-seeding (which would clobber a user's choice on re-render).
42
+ const seeded = (0, react_1.useRef)(false);
43
+ (0, react_1.useEffect)(() => {
44
+ if (configLoading || seeded.current)
45
+ return;
46
+ setIncludeInteractions(projectDefault);
47
+ seeded.current = true;
48
+ }, [configLoading, projectDefault]);
49
+ const fetchFor = (0, react_1.useCallback)(async (include) => {
50
+ if (!enabled)
51
+ return;
52
+ setLoading(true);
53
+ setError(null);
54
+ try {
55
+ const result = await rest.getNeighborhood({ includeInteractions: include });
56
+ setNeighborhood(result);
57
+ // Sync to the server's effective value (it may override the request, e.g. project policy).
58
+ setIncludeInteractions(result.includesInteractions);
59
+ }
60
+ catch (err) {
61
+ // Fail soft on degradation (graph off, or the lens disabled mid-session): hide the surface —
62
+ // clear ties and swallow the error rather than surface it to members (SOCIAL.md §7). Real
63
+ // errors still propagate via `error`.
64
+ if ((0, rest_js_1.isSocialDegradation)(err)) {
65
+ setNeighborhood(null);
66
+ setError(null);
67
+ }
68
+ else {
69
+ setError(err);
70
+ }
71
+ }
72
+ finally {
73
+ setLoading(false);
74
+ }
75
+ }, [enabled, rest]);
76
+ // Fetch on enable and whenever the toggle changes. Clear ties when disabled or before re-fetch under
77
+ // a new identity — the self-view must never linger across a user switch (SOCIAL.md §6).
78
+ (0, react_1.useEffect)(() => {
79
+ if (configLoading || !seeded.current)
80
+ return;
81
+ if (!enabled) {
82
+ setNeighborhood(null);
83
+ return;
84
+ }
85
+ void fetchFor(includeInteractions);
86
+ // eslint-disable-next-line react-hooks/exhaustive-deps
87
+ }, [configLoading, enabled, includeInteractions, fetchFor]);
88
+ return { neighborhood, loading, error, includeInteractions, setIncludeInteractions };
89
+ }
90
+ //# sourceMappingURL=useSocialNeighborhood.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSocialNeighborhood.js","sourceRoot":"","sources":["../../../src/hooks/useSocialNeighborhood.tsx"],"names":[],"mappings":";AAAA,qGAAqG;AACrG,EAAE;AACF,uGAAuG;AACvG,mGAAmG;AACnG,wGAAwG;AACxG,yFAAyF;AACzF,EAAE;AACF,sGAAsG;AACtG,uGAAuG;AACvG,mGAAmG;AACnG,eAAe;;AAmCf,sDA2DC;AA5FD,iCAAiE;AAEjE,kDAA2D;AAC3D,oEAAyD;AAgBzD;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB;IACnC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,6BAAS,GAAE,CAAC;IACpD,MAAM,OAAO,GAAG,MAAM,EAAE,mBAAmB,IAAI,KAAK,CAAC;IACrD,MAAM,cAAc,GAAG,MAAM,EAAE,+BAA+B,IAAI,KAAK,CAAC;IAExE,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,IAAA,gBAAQ,EAA4B,IAAI,CAAC,CAAC;IAClF,MAAM,CAAC,OAAO,EAAE,UAAU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G,CAAC,CAAC;YAChB,CAAC;QACH,CAAC;gBAAS,CAAC;YACT,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EACD,CAAC,OAAO,EAAE,IAAI,CAAC,CAChB,CAAC;IAEF,qGAAqG;IACrG,wFAAwF;IACxF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,aAAa,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAO;QAC7C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,eAAe,CAAC,IAAI,CAAC,CAAC;YACtB,OAAO;QACT,CAAC;QACD,KAAK,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QACnC,uDAAuD;IACzD,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5D,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;AACvF,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ResolvedSocialConfig } from "../contract/index.js";
2
+ /** The state returned by {@link useSocialTransparency}. */
3
+ export interface UseSocialTransparencyValues {
4
+ /** The resolved config, or `null` until the provider's transparency fetch resolves. */
5
+ config: ResolvedSocialConfig | null;
6
+ /** True while the provider's initial transparency fetch is in flight. */
7
+ loading: boolean;
8
+ /** A non-degradation error from the transparency fetch, or `null`. */
9
+ error: unknown;
10
+ }
11
+ /**
12
+ * Read the project's resolved social config (which lenses are enabled, decay half-lives, k-floor).
13
+ *
14
+ * Reads straight from the provider — no extra request. Returns `config: null` until the provider's
15
+ * mount-time transparency fetch resolves.
16
+ *
17
+ * @returns {@link UseSocialTransparencyValues} — the resolved config and its load state.
18
+ *
19
+ * @example
20
+ * ```tsx
21
+ * const { config } = useSocialTransparency();
22
+ * if (config?.weatherEnabled) renderWeatherNavEntry();
23
+ * ```
24
+ */
25
+ export declare function useSocialTransparency(): UseSocialTransparencyValues;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ // useSocialTransparency — read the project's resolved social config from the provider.
3
+ //
4
+ // The provider already fetches `GET /social/transparency` once on mount, so this hook issues no
5
+ // request of its own — it just surfaces the cached config + load state. Use it to render a how-it-works
6
+ // panel (which lenses are on, decay half-lives, k-floor) or to drive nav-entry visibility.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.useSocialTransparency = useSocialTransparency;
9
+ const social_context_js_1 = require("../context/social-context.js");
10
+ /**
11
+ * Read the project's resolved social config (which lenses are enabled, decay half-lives, k-floor).
12
+ *
13
+ * Reads straight from the provider — no extra request. Returns `config: null` until the provider's
14
+ * mount-time transparency fetch resolves.
15
+ *
16
+ * @returns {@link UseSocialTransparencyValues} — the resolved config and its load state.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * const { config } = useSocialTransparency();
21
+ * if (config?.weatherEnabled) renderWeatherNavEntry();
22
+ * ```
23
+ */
24
+ function useSocialTransparency() {
25
+ const { config, configLoading, configError } = (0, social_context_js_1.useSocial)();
26
+ return { config, loading: configLoading, error: configError };
27
+ }
28
+ //# sourceMappingURL=useSocialTransparency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSocialTransparency.js","sourceRoot":"","sources":["../../../src/hooks/useSocialTransparency.tsx"],"names":[],"mappings":";AAAA,uFAAuF;AACvF,EAAE;AACF,gGAAgG;AAChG,wGAAwG;AACxG,2FAA2F;;AA6B3F,sDAGC;AA7BD,oEAAyD;AAYzD;;;;;;;;;;;;;GAaG;AACH,SAAgB,qBAAqB;IACnC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,GAAG,IAAA,6BAAS,GAAE,CAAC;IAC3D,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;AAChE,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { SocialWeather } from "../contract/index.js";
2
+ /** The state and actions returned by {@link useSocialWeather}. */
3
+ export interface UseSocialWeatherValues {
4
+ /** The current Weather reading, or `null` while loading, when disabled, or on error. */
5
+ weather: SocialWeather | null;
6
+ /** True while a fetch is in flight (always `false` when the lens is disabled). */
7
+ loading: boolean;
8
+ /** The last error thrown by the fetch, or `null`. */
9
+ error: unknown;
10
+ /** Re-fetch the Weather reading. No-op when the lens is disabled. */
11
+ refresh: () => Promise<void>;
12
+ }
13
+ /**
14
+ * Load the Community Weather scalar for the current project.
15
+ *
16
+ * Waits for the provider's transparency config, then fetches `GET /social/weather` only when
17
+ * `weatherEnabled` is true. When the lens is disabled it returns `{ weather: null, loading: false }`
18
+ * and issues no request.
19
+ *
20
+ * @returns {@link UseSocialWeatherValues} — the reading, load state, and a `refresh` action.
21
+ *
22
+ * @example
23
+ * ```tsx
24
+ * const { weather, loading } = useSocialWeather();
25
+ * if (!weather) return null; // disabled or still loading
26
+ * ```
27
+ */
28
+ export declare function useSocialWeather(): UseSocialWeatherValues;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ // useSocialWeather — load the Community Weather scalar, gated on the project's feature config.
3
+ //
4
+ // Self-gates on `config.weatherEnabled` from the provider: when the lens is disabled (or the graph is
5
+ // unavailable) the hook returns `weather: null` and never issues a request, so a host app can render
6
+ // `<CommunityWeather />` unconditionally and have it disappear when off (SOCIAL.md §7). Weather is a
7
+ // ~1h server-cached aggregate, so a single fetch on enable is enough; `refresh()` is exposed for
8
+ // manual refetch (e.g. pull-to-refresh).
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.useSocialWeather = useSocialWeather;
11
+ const react_1 = require("react");
12
+ const rest_js_1 = require("../transport/rest.js");
13
+ const social_context_js_1 = require("../context/social-context.js");
14
+ /**
15
+ * Load the Community Weather scalar for the current project.
16
+ *
17
+ * Waits for the provider's transparency config, then fetches `GET /social/weather` only when
18
+ * `weatherEnabled` is true. When the lens is disabled it returns `{ weather: null, loading: false }`
19
+ * and issues no request.
20
+ *
21
+ * @returns {@link UseSocialWeatherValues} — the reading, load state, and a `refresh` action.
22
+ *
23
+ * @example
24
+ * ```tsx
25
+ * const { weather, loading } = useSocialWeather();
26
+ * if (!weather) return null; // disabled or still loading
27
+ * ```
28
+ */
29
+ function useSocialWeather() {
30
+ const { rest, config, configLoading } = (0, social_context_js_1.useSocial)();
31
+ const enabled = config?.weatherEnabled ?? false;
32
+ const [weather, setWeather] = (0, react_1.useState)(null);
33
+ const [loading, setLoading] = (0, react_1.useState)(false);
34
+ const [error, setError] = (0, react_1.useState)(null);
35
+ const refresh = (0, react_1.useCallback)(async () => {
36
+ if (!enabled)
37
+ return;
38
+ setLoading(true);
39
+ setError(null);
40
+ try {
41
+ setWeather(await rest.getWeather());
42
+ }
43
+ catch (err) {
44
+ // Fail soft on degradation (graph off, or the lens disabled mid-session): hide the surface —
45
+ // clear the reading and swallow the error rather than surface it to members (SOCIAL.md §7). Real
46
+ // errors still propagate via `error`.
47
+ if ((0, rest_js_1.isSocialDegradation)(err)) {
48
+ setWeather(null);
49
+ setError(null);
50
+ }
51
+ else {
52
+ setError(err);
53
+ }
54
+ }
55
+ finally {
56
+ setLoading(false);
57
+ }
58
+ }, [enabled, rest]);
59
+ // Fetch once the config has resolved and the lens is enabled. When disabled, clear any stale reading
60
+ // so a config flip to off (or a project switch) doesn't leave the previous community's weather on screen.
61
+ (0, react_1.useEffect)(() => {
62
+ if (configLoading)
63
+ return;
64
+ if (!enabled) {
65
+ setWeather(null);
66
+ return;
67
+ }
68
+ void refresh();
69
+ }, [configLoading, enabled, refresh]);
70
+ return { weather, loading, error, refresh };
71
+ }
72
+ //# sourceMappingURL=useSocialWeather.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSocialWeather.js","sourceRoot":"","sources":["../../../src/hooks/useSocialWeather.tsx"],"names":[],"mappings":";AAAA,+FAA+F;AAC/F,EAAE;AACF,sGAAsG;AACtG,qGAAqG;AACrG,qGAAqG;AACrG,iGAAiG;AACjG,yCAAyC;;AAkCzC,4CAyCC;AAzED,iCA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E;QACb,IAAI,aAAa;YAAE,OAAO;QAC1B,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,OAAO;QACT,CAAC;QACD,KAAK,OAAO,EAAE,CAAC;IACjB,CAAC,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAEtC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { SocialProvider, useSocial, ALL_DISABLED_SOCIAL_CONFIG } from "./context/social-context.js";
2
+ export type { SocialProviderProps, SocialContextValue } from "./context/social-context.js";
3
+ export { useSocialWeather } from "./hooks/useSocialWeather.js";
4
+ export type { UseSocialWeatherValues } from "./hooks/useSocialWeather.js";
5
+ export { useSocialConstellation } from "./hooks/useSocialConstellation.js";
6
+ export type { UseSocialConstellationValues } from "./hooks/useSocialConstellation.js";
7
+ export { useSocialNeighborhood } from "./hooks/useSocialNeighborhood.js";
8
+ export type { UseSocialNeighborhoodValues } from "./hooks/useSocialNeighborhood.js";
9
+ export { useSocialTransparency } from "./hooks/useSocialTransparency.js";
10
+ export type { UseSocialTransparencyValues } from "./hooks/useSocialTransparency.js";
11
+ export { SocialRestClient, SocialApiError, isSocialDegradation } from "./transport/rest.js";
12
+ export type { SocialRestConfig } from "./transport/rest.js";
13
+ export { WEATHER_BANDS, BLOB_SIZE_BUCKETS, NEIGHBORHOOD_TIE_KINDS, } from "./contract/index.js";
14
+ export type { SocialWeather, WeatherBand, SocialConstellation, ConstellationBlob, BlobSizeBucket, SocialNeighborhood, NeighborhoodTie, NeighborhoodTieKind, ResolvedSocialConfig, } from "./contract/index.js";
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ // @agora-sdk/social-core — platform-agnostic client for the Agora social graph.
3
+ //
4
+ // Typed REST transport + provider/hooks for the three member-facing lenses (Weather, Constellation,
5
+ // Neighborhood) plus the Transparency endpoint. Pure data — no crypto, no persistence, no realtime.
6
+ // Platform packages (@agora-sdk/social-react-js, etc.) re-export this and add the visual components.
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.NEIGHBORHOOD_TIE_KINDS = exports.BLOB_SIZE_BUCKETS = exports.WEATHER_BANDS = exports.isSocialDegradation = exports.SocialApiError = exports.SocialRestClient = exports.useSocialTransparency = exports.useSocialNeighborhood = exports.useSocialConstellation = exports.useSocialWeather = exports.ALL_DISABLED_SOCIAL_CONFIG = exports.useSocial = exports.SocialProvider = void 0;
9
+ // ── context / provider ──────────────────────────────────────────────────────
10
+ var social_context_js_1 = require("./context/social-context.js");
11
+ Object.defineProperty(exports, "SocialProvider", { enumerable: true, get: function () { return social_context_js_1.SocialProvider; } });
12
+ Object.defineProperty(exports, "useSocial", { enumerable: true, get: function () { return social_context_js_1.useSocial; } });
13
+ Object.defineProperty(exports, "ALL_DISABLED_SOCIAL_CONFIG", { enumerable: true, get: function () { return social_context_js_1.ALL_DISABLED_SOCIAL_CONFIG; } });
14
+ // ── hooks ────────────────────────────────────────────────────────────────────
15
+ var useSocialWeather_js_1 = require("./hooks/useSocialWeather.js");
16
+ Object.defineProperty(exports, "useSocialWeather", { enumerable: true, get: function () { return useSocialWeather_js_1.useSocialWeather; } });
17
+ var useSocialConstellation_js_1 = require("./hooks/useSocialConstellation.js");
18
+ Object.defineProperty(exports, "useSocialConstellation", { enumerable: true, get: function () { return useSocialConstellation_js_1.useSocialConstellation; } });
19
+ var useSocialNeighborhood_js_1 = require("./hooks/useSocialNeighborhood.js");
20
+ Object.defineProperty(exports, "useSocialNeighborhood", { enumerable: true, get: function () { return useSocialNeighborhood_js_1.useSocialNeighborhood; } });
21
+ var useSocialTransparency_js_1 = require("./hooks/useSocialTransparency.js");
22
+ Object.defineProperty(exports, "useSocialTransparency", { enumerable: true, get: function () { return useSocialTransparency_js_1.useSocialTransparency; } });
23
+ // ── transport (for advanced / non-React use) ─────────────────────────────────
24
+ var rest_js_1 = require("./transport/rest.js");
25
+ Object.defineProperty(exports, "SocialRestClient", { enumerable: true, get: function () { return rest_js_1.SocialRestClient; } });
26
+ Object.defineProperty(exports, "SocialApiError", { enumerable: true, get: function () { return rest_js_1.SocialApiError; } });
27
+ Object.defineProperty(exports, "isSocialDegradation", { enumerable: true, get: function () { return rest_js_1.isSocialDegradation; } });
28
+ // ── wire contract types + runtime const arrays (transitional — see ./contract) ──
29
+ var index_js_1 = require("./contract/index.js");
30
+ Object.defineProperty(exports, "WEATHER_BANDS", { enumerable: true, get: function () { return index_js_1.WEATHER_BANDS; } });
31
+ Object.defineProperty(exports, "BLOB_SIZE_BUCKETS", { enumerable: true, get: function () { return index_js_1.BLOB_SIZE_BUCKETS; } });
32
+ Object.defineProperty(exports, "NEIGHBORHOOD_TIE_KINDS", { enumerable: true, get: function () { return index_js_1.NEIGHBORHOOD_TIE_KINDS; } });
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,EAAE;AACF,oGAAoG;AACpG,oGAAoG;AACpG,qGAAqG;;;AAErG,+EAA+E;AAC/E,iEAAoG;AAA3F,mHAAA,cAAc,OAAA;AAAE,8GAAA,SAAS,OAAA;AAAE,+HAAA,0BAA0B,OAAA;AAG9D,gFAAgF;AAChF,mEAA+D;AAAtD,uHAAA,gBAAgB,OAAA;AAEzB,+EAA2E;AAAlE,mIAAA,sBAAsB,OAAA;AAE/B,6EAAyE;AAAhE,iIAAA,qBAAqB,OAAA;AAE9B,6EAAyE;AAAhE,iIAAA,qBAAqB,OAAA;AAG9B,gFAAgF;AAChF,+CAA4F;AAAnF,2GAAA,gBAAgB,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AAG9D,mFAAmF;AACnF,gDAI6B;AAH3B,yGAAA,aAAa,OAAA;AACb,6GAAA,iBAAiB,OAAA;AACjB,kHAAA,sBAAsB,OAAA"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,105 @@
1
+ import { ResolvedSocialConfig, SocialConstellation, SocialNeighborhood, SocialWeather } from "../contract/index.js";
2
+ /**
3
+ * Configuration for {@link SocialRestClient}. The base URL and access token are read through resolver
4
+ * callbacks rather than captured once, so a late-set `baseUrl` or a refreshed token take effect on the
5
+ * next request without rebuilding the client.
6
+ */
7
+ export interface SocialRestConfig {
8
+ /** Resolve the API base URL (e.g. `getApiBaseUrl()` from @agora-sdk/core → `http://host/v7`). */
9
+ getBaseUrl: () => string;
10
+ /** Resolve the current access token, or undefined when signed out. */
11
+ getAccessToken: () => string | undefined;
12
+ /** The Agora project id (path-scoped on every endpoint — a privacy boundary). */
13
+ projectId: string;
14
+ }
15
+ /**
16
+ * A failed social API call. Carries the HTTP `status` and, when the server supplied one, the machine
17
+ * `code` (e.g. `social/graph-unavailable`, `social/weather-disabled`) so callers can distinguish
18
+ * "hide this surface" degradation (SOCIAL.md §7) from an unexpected failure.
19
+ */
20
+ export declare class SocialApiError extends Error {
21
+ /** HTTP status code, or `0` when the request never got a response (network error). */
22
+ readonly status: number;
23
+ /** The server's machine error code (e.g. `social/graph-unavailable`), or `null` if none was sent. */
24
+ readonly code: string | null;
25
+ /**
26
+ * @param message - Human-readable summary (never contains member PII).
27
+ * @param status - HTTP status code (`0` for a network-level failure).
28
+ * @param code - The server's machine error code, or `null`.
29
+ */
30
+ constructor(message: string, status: number, code: string | null);
31
+ }
32
+ /**
33
+ * Whether an error is a "hide this surface" degradation (graph unavailable or a feature-disabled lens)
34
+ * rather than a real failure. Hooks use this to fail soft — clearing data instead of surfacing the
35
+ * error to members (`docs/SOCIAL.md` §7).
36
+ *
37
+ * @param err - Any caught error.
38
+ * @returns `true` for a {@link SocialApiError} whose `code` is a known degradation code; else `false`.
39
+ */
40
+ export declare function isSocialDegradation(err: unknown): boolean;
41
+ /**
42
+ * Typed REST client for the Agora social graph.
43
+ *
44
+ * Wraps the four social endpoints in `docs/SOCIAL.md`. Each request lazily resolves the base URL and
45
+ * bearer token, scopes the path to `{baseUrl}/{projectId}/social`, and normalizes any failure into a
46
+ * {@link SocialApiError}.
47
+ *
48
+ * @remarks
49
+ * Construct this directly only for advanced / non-React use. Inside React, prefer the `SocialProvider`
50
+ * + hooks, which build and share one client for you.
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const rest = new SocialRestClient({
55
+ * projectId,
56
+ * getBaseUrl: () => getApiBaseUrl(),
57
+ * getAccessToken: () => session.accessToken,
58
+ * });
59
+ * const weather = await rest.getWeather();
60
+ * ```
61
+ */
62
+ export declare class SocialRestClient {
63
+ private readonly config;
64
+ private readonly http;
65
+ /** @param config - Lazy resolvers for base URL + token, plus the path-scoped project id. */
66
+ constructor(config: SocialRestConfig);
67
+ /**
68
+ * Fetch the Community Weather scalar (aggregate warmth + band + 7-day trend).
69
+ *
70
+ * @returns The current {@link SocialWeather} reading (`value: null` / `band: "quiet"` when no data yet).
71
+ * @throws {SocialApiError} `400 social/weather-disabled` (feature off) or `503 social/graph-unavailable`.
72
+ */
73
+ getWeather(): Promise<SocialWeather>;
74
+ /**
75
+ * Fetch the Constellation snapshot (anonymous cluster blobs).
76
+ *
77
+ * @returns The current {@link SocialConstellation} (`asOf: null` when no snapshot exists yet).
78
+ * @throws {SocialApiError} `400 social/constellation-disabled` or `503 social/graph-unavailable`.
79
+ */
80
+ getConstellation(): Promise<SocialConstellation>;
81
+ /**
82
+ * Fetch the caller's Neighborhood (their own named ties with dyadic brightness). Self-view only.
83
+ *
84
+ * @param opts - Optional `includeInteractions` toggle; omit to use the project default. The response
85
+ * always echoes the **effective** value via `includesInteractions`.
86
+ * @returns The caller's {@link SocialNeighborhood}, ties sorted brightest-first.
87
+ * @throws {SocialApiError} `400 social/neighborhood-disabled` or `503 social/graph-unavailable`.
88
+ */
89
+ getNeighborhood(opts?: {
90
+ includeInteractions?: boolean;
91
+ }): Promise<SocialNeighborhood>;
92
+ /**
93
+ * Fetch the project's resolved social config (which lenses are enabled, decay half-lives, k-floor).
94
+ * Call this at app init to know which surfaces to render.
95
+ *
96
+ * @returns The project's {@link ResolvedSocialConfig}.
97
+ * @throws {SocialApiError} `503 social/graph-unavailable` when the graph is not configured.
98
+ */
99
+ getTransparency(): Promise<ResolvedSocialConfig>;
100
+ /**
101
+ * Shared GET helper: issues the request and normalizes any axios failure into a {@link SocialApiError}
102
+ * carrying the HTTP status + server error code.
103
+ */
104
+ private get;
105
+ }
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ // Typed REST client for the Agora social graph (Weather / Constellation / Neighborhood / Transparency).
3
+ //
4
+ // Covers every endpoint in `docs/SOCIAL.md` §1–4. Base URL and access token are resolved **lazily per
5
+ // request** (matching the @agora-sdk/core base-URL runtime), so a token refresh or a late-set baseUrl
6
+ // always wins. Every endpoint is path-scoped to `{baseUrl}/{projectId}/social` — the `:projectId`
7
+ // boundary is a privacy boundary (no cross-project social data; see SOCIAL.md §6).
8
+ //
9
+ // All four lenses are feature-gated server-side and degrade with specific error codes (SOCIAL.md §7).
10
+ // On any non-2xx, this client throws a typed {@link SocialApiError} carrying the HTTP `status` plus the
11
+ // server's machine `code` (e.g. `social/graph-unavailable`), so hooks/providers can hide a surface
12
+ // rather than surface a raw error to members.
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.SocialRestClient = exports.SocialApiError = void 0;
18
+ exports.isSocialDegradation = isSocialDegradation;
19
+ const axios_1 = __importDefault(require("axios"));
20
+ /**
21
+ * A failed social API call. Carries the HTTP `status` and, when the server supplied one, the machine
22
+ * `code` (e.g. `social/graph-unavailable`, `social/weather-disabled`) so callers can distinguish
23
+ * "hide this surface" degradation (SOCIAL.md §7) from an unexpected failure.
24
+ */
25
+ class SocialApiError extends Error {
26
+ /**
27
+ * @param message - Human-readable summary (never contains member PII).
28
+ * @param status - HTTP status code (`0` for a network-level failure).
29
+ * @param code - The server's machine error code, or `null`.
30
+ */
31
+ constructor(message, status, code) {
32
+ super(message);
33
+ this.name = "SocialApiError";
34
+ this.status = status;
35
+ this.code = code;
36
+ }
37
+ }
38
+ exports.SocialApiError = SocialApiError;
39
+ /**
40
+ * Server error codes that mean "this surface is unavailable / turned off" rather than "something went
41
+ * wrong" — the graph being unconfigured (`503`) or a lens being feature-disabled (`400`). Per
42
+ * `docs/SOCIAL.md` §7 these should make the client **hide the surface**, never show a member an error.
43
+ */
44
+ const SOCIAL_DEGRADATION_CODES = new Set([
45
+ "social/graph-unavailable",
46
+ "social/weather-disabled",
47
+ "social/constellation-disabled",
48
+ "social/neighborhood-disabled",
49
+ ]);
50
+ /**
51
+ * Whether an error is a "hide this surface" degradation (graph unavailable or a feature-disabled lens)
52
+ * rather than a real failure. Hooks use this to fail soft — clearing data instead of surfacing the
53
+ * error to members (`docs/SOCIAL.md` §7).
54
+ *
55
+ * @param err - Any caught error.
56
+ * @returns `true` for a {@link SocialApiError} whose `code` is a known degradation code; else `false`.
57
+ */
58
+ function isSocialDegradation(err) {
59
+ return (err instanceof SocialApiError && err.code !== null && SOCIAL_DEGRADATION_CODES.has(err.code));
60
+ }
61
+ /**
62
+ * Pull the server's machine error code out of an arbitrary error body. agora-server error shapes vary
63
+ * (`{ error: { code } }`, `{ code }`, or `{ error: "social/…" }`), so probe each defensively and fall
64
+ * back to `null`. Never throws.
65
+ */
66
+ function extractCode(data) {
67
+ if (!data || typeof data !== "object")
68
+ return null;
69
+ const body = data;
70
+ const nested = body.error;
71
+ if (nested && typeof nested === "object" && typeof nested.code === "string") {
72
+ return nested.code;
73
+ }
74
+ if (typeof body.code === "string")
75
+ return body.code;
76
+ if (typeof nested === "string")
77
+ return nested;
78
+ return null;
79
+ }
80
+ /**
81
+ * Typed REST client for the Agora social graph.
82
+ *
83
+ * Wraps the four social endpoints in `docs/SOCIAL.md`. Each request lazily resolves the base URL and
84
+ * bearer token, scopes the path to `{baseUrl}/{projectId}/social`, and normalizes any failure into a
85
+ * {@link SocialApiError}.
86
+ *
87
+ * @remarks
88
+ * Construct this directly only for advanced / non-React use. Inside React, prefer the `SocialProvider`
89
+ * + hooks, which build and share one client for you.
90
+ *
91
+ * @example
92
+ * ```typescript
93
+ * const rest = new SocialRestClient({
94
+ * projectId,
95
+ * getBaseUrl: () => getApiBaseUrl(),
96
+ * getAccessToken: () => session.accessToken,
97
+ * });
98
+ * const weather = await rest.getWeather();
99
+ * ```
100
+ */
101
+ class SocialRestClient {
102
+ /** @param config - Lazy resolvers for base URL + token, plus the path-scoped project id. */
103
+ constructor(config) {
104
+ this.config = config;
105
+ this.http = axios_1.default.create();
106
+ this.http.interceptors.request.use((req) => {
107
+ const base = config.getBaseUrl().replace(/\/$/, "");
108
+ req.baseURL = `${base}/${config.projectId}/social`;
109
+ const token = config.getAccessToken();
110
+ if (token)
111
+ req.headers.set("Authorization", `Bearer ${token}`);
112
+ return req;
113
+ });
114
+ }
115
+ /**
116
+ * Fetch the Community Weather scalar (aggregate warmth + band + 7-day trend).
117
+ *
118
+ * @returns The current {@link SocialWeather} reading (`value: null` / `band: "quiet"` when no data yet).
119
+ * @throws {SocialApiError} `400 social/weather-disabled` (feature off) or `503 social/graph-unavailable`.
120
+ */
121
+ async getWeather() {
122
+ return this.get("/weather");
123
+ }
124
+ /**
125
+ * Fetch the Constellation snapshot (anonymous cluster blobs).
126
+ *
127
+ * @returns The current {@link SocialConstellation} (`asOf: null` when no snapshot exists yet).
128
+ * @throws {SocialApiError} `400 social/constellation-disabled` or `503 social/graph-unavailable`.
129
+ */
130
+ async getConstellation() {
131
+ return this.get("/constellation");
132
+ }
133
+ /**
134
+ * Fetch the caller's Neighborhood (their own named ties with dyadic brightness). Self-view only.
135
+ *
136
+ * @param opts - Optional `includeInteractions` toggle; omit to use the project default. The response
137
+ * always echoes the **effective** value via `includesInteractions`.
138
+ * @returns The caller's {@link SocialNeighborhood}, ties sorted brightest-first.
139
+ * @throws {SocialApiError} `400 social/neighborhood-disabled` or `503 social/graph-unavailable`.
140
+ */
141
+ async getNeighborhood(opts) {
142
+ const params = opts?.includeInteractions === undefined
143
+ ? undefined
144
+ : { includeInteractions: opts.includeInteractions };
145
+ return this.get("/neighborhood", params);
146
+ }
147
+ /**
148
+ * Fetch the project's resolved social config (which lenses are enabled, decay half-lives, k-floor).
149
+ * Call this at app init to know which surfaces to render.
150
+ *
151
+ * @returns The project's {@link ResolvedSocialConfig}.
152
+ * @throws {SocialApiError} `503 social/graph-unavailable` when the graph is not configured.
153
+ */
154
+ async getTransparency() {
155
+ return this.get("/transparency");
156
+ }
157
+ /**
158
+ * Shared GET helper: issues the request and normalizes any axios failure into a {@link SocialApiError}
159
+ * carrying the HTTP status + server error code.
160
+ */
161
+ async get(path, params) {
162
+ try {
163
+ const { data } = await this.http.get(path, params ? { params } : undefined);
164
+ return data;
165
+ }
166
+ catch (err) {
167
+ if (axios_1.default.isAxiosError(err)) {
168
+ const status = err.response?.status ?? 0;
169
+ const code = extractCode(err.response?.data);
170
+ throw new SocialApiError(code ? `Social request failed: ${code}` : `Social request failed (HTTP ${status}).`, status, code);
171
+ }
172
+ throw err;
173
+ }
174
+ }
175
+ }
176
+ exports.SocialRestClient = SocialRestClient;
177
+ //# sourceMappingURL=rest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest.js","sourceRoot":"","sources":["../../../src/transport/rest.ts"],"names":[],"mappings":";AAAA,wGAAwG;AACxG,EAAE;AACF,sGAAsG;AACtG,sGAAsG;AACtG,kGAAkG;AAClG,mFAAmF;AACnF,EAAE;AACF,sGAAsG;AACtG,wGAAwG;AACxG,mGAAmG;AACnG,8CAA8C;;;;;;AAoE9C,kDAIC;AAtED,kDAA6C;AAsB7C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,KAAK;IAMvC;;;;OAIG;IACH,YAAY,OAAe,EAAE,MAAc,EAAE,IAAmB;QAC9D,KAAK,CA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