@amityco/ts-sdk 7.29.1-e932a95f.0 → 7.30.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 (29) hide show
  1. package/dist/@types/core/events.d.ts +4 -0
  2. package/dist/@types/core/events.d.ts.map +1 -1
  3. package/dist/@types/domains/user.d.ts +16 -10
  4. package/dist/@types/domains/user.d.ts.map +1 -1
  5. package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
  6. package/dist/core/events.d.ts +3 -3
  7. package/dist/core/events.d.ts.map +1 -1
  8. package/dist/index.cjs.js +384 -136
  9. package/dist/index.esm.js +384 -136
  10. package/dist/index.umd.js +2 -2
  11. package/dist/userRepository/api/flagUser.d.ts.map +1 -1
  12. package/dist/userRepository/api/isUserFlaggedByMe.d.ts +9 -23
  13. package/dist/userRepository/api/isUserFlaggedByMe.d.ts.map +1 -1
  14. package/dist/userRepository/api/unflagUser.d.ts +5 -4
  15. package/dist/userRepository/api/unflagUser.d.ts.map +1 -1
  16. package/dist/userRepository/internalApi/getFlagsByMe.d.ts +4 -3
  17. package/dist/userRepository/internalApi/getFlagsByMe.d.ts.map +1 -1
  18. package/dist/userRepository/internalApi/tests/getFlagsByMe.test.d.ts +2 -0
  19. package/dist/userRepository/internalApi/tests/getFlagsByMe.test.d.ts.map +1 -0
  20. package/dist/userRepository/observers/getUser.d.ts.map +1 -1
  21. package/dist/userRepository/observers/getUsers/UserLiveCollectionController.d.ts.map +1 -1
  22. package/dist/userRepository/observers/searchUserByDisplayName/SearchUserLiveCollectionController.d.ts.map +1 -1
  23. package/dist/userRepository/utils/submitUserReport.d.ts.map +1 -1
  24. package/dist/userRepository/utils/userFlagByMe.d.ts +68 -0
  25. package/dist/userRepository/utils/userFlagByMe.d.ts.map +1 -0
  26. package/dist/utils/bloomFilter.d.ts +8 -3
  27. package/dist/utils/bloomFilter.d.ts.map +1 -1
  28. package/dist/utils/linkedObject/userLinkedObject.d.ts.map +1 -1
  29. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUser.ts"],"names":[],"mappings":"AAkBA,aAAK,QAAQ,GAAG;IACd;;;;;;;;;;;;;OAaG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;CACxF,CAAC;AAKF;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,QAAQ,EAAE,QAuBtB,CAAC"}
1
+ {"version":3,"file":"flagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/flagUser.ts"],"names":[],"mappings":"AAmBA,aAAK,QAAQ,GAAG;IACd;;;;;;;;;;;;;OAaG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;CACxF,CAAC;AAKF;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,QAAQ,EAAE,QA4BtB,CAAC"}
@@ -1,36 +1,22 @@
1
1
  /**
2
2
  * ```js
3
3
  * import { UserRepository } from '@amityco/ts-sdk'
4
- *
5
- * const { isFlagByMe, flags } = await UserRepository.isUserFlaggedByMe('userId')
6
- *
7
- * // Grey out the report options already used; null marks the typeless report.
8
- * const used = new Set(flags.map(flag => flag.reportType))
4
+ * const isFlagged = await UserRepository.isUserFlaggedByMe(userId)
9
5
  * ```
10
6
  *
11
- * Returns whether the caller has reported a user, with each of the caller's own reports
12
- * on that user, exactly as `GET /api/v4/users/:userId/isFlagByMe` answers. Each report
13
- * carries `reportType`, `reason`, `comment` and `createdAt`; a field the report does not
14
- * have is `null`. `reportType: null` is the typeless (legacy) report, which `unflagUser`
15
- * withdraws with `UserReportTypeFilterEnum.UNTYPED`. Only the caller's reports come back.
16
- *
17
- * This is the only source of per-type state. Nothing is filtered, cached or persisted:
18
- * the call reads the server every time and does not consult `hashFlag`, which is a
19
- * type-blind bloom filter. Call it again after a flag or unflag when the UI needs the
20
- * updated per-type state.
21
- *
22
- * Breaking change: earlier versions returned a boolean from the v3 endpoint, which the
23
- * backend has deprecated. Read `isFlagByMe` on the result for the same answer.
7
+ * Whether the current user has reported a user. Sends one request per call and caches
8
+ * nothing.
24
9
  *
25
- * @deprecated On an {@link Amity.User} you already hold, read `user.isFlaggedByMe` for a
26
- * request-free badge and call `user.getUserFlagsByMe()` for the reports; it skips the request
27
- * when the Bloom test says the user is not flagged. This function remains the underlying request.
10
+ * @deprecated Read `user.isFlaggedByMe` on an {@link Amity.User} for a yes/no hint that
11
+ * usually needs no request, and call `user.getUserFlagsByMe()` for the exact answer with the
12
+ * caller's reports by type. Observe the user with `UserRepository.getUser(userId, callback)`
13
+ * to follow a flag or unflag.
28
14
  *
29
15
  * @param userId The ID of the user to check
30
- * @returns the caller's {@link Amity.UserFlagByMe} on that user
16
+ * @returns `true` if the current user has reported the user, `false` if not
31
17
  *
32
18
  * @category Report API
33
19
  * @async
34
20
  * */
35
- export declare const isUserFlaggedByMe: (userId: Amity.User['userId']) => Promise<Amity.UserFlagByMe>;
21
+ export declare const isUserFlaggedByMe: (userId: Amity.User['userId']) => Promise<boolean>;
36
22
  //# sourceMappingURL=isUserFlaggedByMe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"isUserFlaggedByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/isUserFlaggedByMe.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCK;AACL,eAAO,MAAM,iBAAiB,WACpB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAC3B,QAAQ,MAAM,YAAY,CAK5B,CAAC"}
1
+ {"version":3,"file":"isUserFlaggedByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/isUserFlaggedByMe.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;KAmBK;AACL,eAAO,MAAM,iBAAiB,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,OAAO,CAOrF,CAAC"}
@@ -18,14 +18,15 @@
18
18
  * untouched. Withdrawing a report that does not exist succeeds and changes nothing.
19
19
  *
20
20
  * The returned user is persisted to the cache, so its `hashFlag` says whether the caller
21
- * still holds any report on the user. Do not flip a local "flagged by me" flag to `false`
22
- * after a per-type withdrawal; read the fresh user, or call `isUserFlaggedByMe` for the
23
- * remaining per-type state (`flags`).
21
+ * may still hold a report on the user. Do not flip a local "flagged by me" flag to `false`
22
+ * after a per-type withdrawal; observe the user and read `isFlaggedByMe`, or call
23
+ * `user.getUserFlagsByMe()` for the remaining per-type state (`flags`). The SDK drops the
24
+ * answer it confirmed for this user, so the next "maybe" is confirmed again.
24
25
  *
25
26
  * Sends `DELETE /api/v4/me/flags/:userId`, with `?reportType=<type>` when one is given.
26
27
  *
27
28
  * @param userId The ID of the user to unflag
28
- * @param options Optional; `reportType` selects a single report to withdraw. For a report that `isUserFlaggedByMe` lists with `reportType: null`, pass `UserReportTypeFilterEnum.UNTYPED`
29
+ * @param options Optional; `reportType` selects a single report to withdraw. For a report that `user.getUserFlagsByMe()` lists with `reportType: null`, pass `UserReportTypeFilterEnum.UNTYPED`
29
30
  * @returns `true` once the server has processed the withdrawal
30
31
  * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `reportType` is not a `UserReportTypeFilterEnum` value, before any request is made
31
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"unflagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/unflagUser.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCK;AACL,eAAO,MAAM,UAAU,WACb,MAAM,IAAI,CAAC,QAAQ,CAAC,YAClB,MAAM,2BAA2B,KAC1C,QAAQ,OAAO,CAoBjB,CAAC"}
1
+ {"version":3,"file":"unflagUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/api/unflagUser.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCK;AACL,eAAO,MAAM,UAAU,WACb,MAAM,IAAI,CAAC,QAAQ,CAAC,YAClB,MAAM,2BAA2B,KAC1C,QAAQ,OAAO,CAuBjB,CAAC"}
@@ -4,9 +4,10 @@
4
4
  * const { isFlagByMe, flags } = await getFlagsByMe('userId')
5
5
  * ```
6
6
  *
7
- * The v4 read behind `user.getUserFlagsByMe()` and the deprecated
8
- * `UserRepository.isUserFlaggedByMe`: `GET /api/v4/users/:userId/isFlagByMe`, returned as
9
- * received. Nothing is filtered, cached or persisted, and `hashFlag` is not consulted here.
7
+ * The v4 read behind `user.getUserFlagsByMe()`, the background confirm of
8
+ * `user.isFlaggedByMe`, and the deprecated `UserRepository.isUserFlaggedByMe`:
9
+ * `GET /api/v4/users/:userId/isFlagByMe`, returned as received. Nothing is filtered, cached or
10
+ * persisted here, and `hashFlag` is not consulted.
10
11
  * This is the Web counterpart of iOS `ASCUserService.getFlagsByMe` and Android
11
12
  * `UserRepository.getFlagsByMe`, kept apart from the deprecated public function so the
12
13
  * user-object read does not change if that function ever does.
@@ -1 +1 @@
1
- {"version":3,"file":"getFlagsByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/internalApi/getFlagsByMe.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,MAAM,YAAY,CAS3F,CAAC"}
1
+ {"version":3,"file":"getFlagsByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/internalApi/getFlagsByMe.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,YAAY,WAAkB,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAG,QAAQ,MAAM,YAAY,CAS3F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=getFlagsByMe.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFlagsByMe.test.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/internalApi/tests/getFlagsByMe.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/observers/getUser.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,WACV,MAAM,IAAI,CAAC,QAAQ,CAAC,YAClB,MAAM,kBAAkB,CAAC,MAAM,IAAI,CAAC,KAC7C,MAAM,YAkBR,CAAC"}
1
+ {"version":3,"file":"getUser.d.ts","sourceRoot":"","sources":["../../../src/userRepository/observers/getUser.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,WACV,MAAM,IAAI,CAAC,QAAQ,CAAC,YAClB,MAAM,kBAAkB,CAAC,MAAM,IAAI,CAAC,KAC7C,MAAM,YA+BR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"UserLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/observers/getUsers/UserLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAc1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,qBAAa,4BAA6B,SAAQ,wBAAwB,CACxE,MAAM,EACN,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,IAAI,EACV,wBAAwB,CACzB;IACC,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,KAAK,CAA2B;gBAE5B,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;IAmB/F,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU;IAI/E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,MAAM,CAAC;IAIvD,iBAAiB;IAUjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAuBzE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;CAwB/B"}
1
+ {"version":3,"file":"UserLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/observers/getUsers/UserLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAe1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,qBAAa,4BAA6B,SAAQ,wBAAwB,CACxE,MAAM,EACN,KAAK,CAAC,kBAAkB,EACxB,KAAK,CAAC,IAAI,EACV,wBAAwB,CACzB;IACC,OAAO,CAAC,qBAAqB,CAA4B;IAEzD,OAAO,CAAC,KAAK,CAA2B;gBAE5B,KAAK,EAAE,KAAK,CAAC,kBAAkB,EAAE,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;IAmB/F,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU;IAI/E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,MAAM,CAAC;IAIvD,iBAAiB;IAoBjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAuBzE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;CAwB/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchUserLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/observers/searchUserByDisplayName/SearchUserLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAa1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,kCAAmC,SAAQ,wBAAwB,CAC9E,MAAM,EACN,KAAK,CAAC,wBAAwB,EAC9B,KAAK,CAAC,IAAI,EACV,8BAA8B,CAC/B;IACC,OAAO,CAAC,qBAAqB,CAAkC;IAE/D,OAAO,CAAC,KAAK,CAAiC;gBAG5C,KAAK,EAAE,KAAK,CAAC,wBAAwB,EACrC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;IAoBpD,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU;IAI/E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,MAAM,CAAC;IAIvD,iBAAiB;IAUjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAuBzE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;CAW/B"}
1
+ {"version":3,"file":"SearchUserLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/userRepository/observers/searchUserByDisplayName/SearchUserLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAc1F,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF,qBAAa,kCAAmC,SAAQ,wBAAwB,CAC9E,MAAM,EACN,KAAK,CAAC,wBAAwB,EAC9B,KAAK,CAAC,IAAI,EACV,8BAA8B,CAC/B;IACC,OAAO,CAAC,qBAAqB,CAAkC;IAE/D,OAAO,CAAC,KAAK,CAAiC;gBAG5C,KAAK,EAAE,KAAK,CAAC,wBAAwB,EACrC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,IAAI,CAAC;IAoBpD,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,UAAU;IAI/E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,MAAM,CAAC;IAIvD,iBAAiB;IAoBjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAuBzE,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;CAW/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"submitUserReport.d.ts","sourceRoot":"","sources":["../../../src/userRepository/utils/submitUserReport.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,GAAG,kBAAkB,UACvC,MAAM,IAAI,CAAC,QAAQ,CAAC,QACtB,cAAc,KACnB,QAAQ,MAAM,IAAI,CAkBpB,CAAC"}
1
+ {"version":3,"file":"submitUserReport.d.ts","sourceRoot":"","sources":["../../../src/userRepository/utils/submitUserReport.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,GAAG,kBAAkB,UACvC,MAAM,IAAI,CAAC,QAAQ,CAAC,QACtB,cAAc,KACnB,QAAQ,MAAM,IAAI,CAuBpB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Flag state of the current user on a target user, behind `Amity.User.isFlaggedByMe` and
3
+ * `Amity.User.getUserFlagsByMe()` (`user.check_flag_by_me` v1, REQ-011, REQ-012, REQ-016).
4
+ *
5
+ * `hashFlag` is a Bloom filter of reporter ids. "Definitely not" is exact. "Maybe" can be a
6
+ * false positive caused by other reporters, so the SDK confirms it with the server once per
7
+ * `hashFlag` value and records the answer in the cache under its own key, never on the user's
8
+ * cache row (REQ-015). Observers are told through `local.user.flagConfirmed` when a recorded
9
+ * answer changes what a user object would show.
10
+ *
11
+ * Not exported from the public API.
12
+ */
13
+ /** Confirms for the same user are at least this far apart, as Android's `EkoFlag.expired`. */
14
+ export declare const FLAG_CONFIRM_INTERVAL = 1000;
15
+ declare type HashFlag = NonNullable<Amity.Flaggable['hashFlag']>;
16
+ /** The current user's id, or `undefined` when there is no active client. Never throws. */
17
+ export declare const currentUserId: () => string | undefined;
18
+ /**
19
+ * The server's answer recorded for this user and this exact `hashFlag`, or `undefined` when there
20
+ * is none for the current user. Never throws.
21
+ */
22
+ export declare const readConfirmedFlag: (userId: Amity.InternalUser['userId'], hashFlag: Amity.Flaggable['hashFlag'] | undefined) => boolean | undefined;
23
+ /**
24
+ * Starts one background confirm of a "maybe" (REQ-016): at most one in flight per user, and
25
+ * confirms for the same user at least {@link FLAG_CONFIRM_INTERVAL} apart. A failed confirm
26
+ * records nothing, surfaces no error, and a later read tries again.
27
+ */
28
+ export declare const confirmFlagByMe: (userId: Amity.InternalUser['userId'], hashFlag: HashFlag) => void;
29
+ /**
30
+ * The value of `Amity.User.isFlaggedByMe` for a user object whose confirmed answer was captured
31
+ * (`confirmed`) when the object was linked, so a held object never changes (REQ-014).
32
+ *
33
+ * - No current user, `hashFlag: null` or a missing `hashFlag`, or "definitely not": `false`.
34
+ * - "Maybe" with a confirmed answer: that answer, no request.
35
+ * - "Maybe" without one: `true`, and one background confirm (REQ-016).
36
+ *
37
+ * The linked object declares this as a getter inside an object spread, which the build compiles
38
+ * to `Object.assign`, so it runs once when the user is linked and the object keeps that value.
39
+ */
40
+ export declare const isFlaggedByMeFor: (user: Amity.InternalUser, confirmed: boolean | undefined) => boolean;
41
+ export declare const getUserFlagsByMeFor: (user: Amity.InternalUser) => () => Promise<Amity.UserFlagByMe>;
42
+ /**
43
+ * The current user's own flag succeeded (REQ-016). Their report may leave `hashFlag` unchanged
44
+ * when other reporters had already set all of their bits, so the answer is known: record `true`
45
+ * for the `hashFlag` the response carries, or drop the answer when it carries none.
46
+ */
47
+ export declare const onFlaggedByMe: (user: Amity.InternalUser | undefined, userId: string) => void;
48
+ /**
49
+ * The current user's own unflag succeeded (`user.unflag` REQ-010, REQ-016). A per-type unflag can
50
+ * leave other reports in place, so the answer is dropped, never set to `false`; the next "maybe"
51
+ * is confirmed again.
52
+ */
53
+ export declare const onUnflaggedByMe: (userId: string) => void;
54
+ /** Forgets every in-memory trace of the current user's flag state. Records live in the cache. */
55
+ export declare const resetUserFlagByMe: () => void;
56
+ /**
57
+ * Registered through `setupLoginSubscriptions`. Every confirmed answer belongs to the current
58
+ * user, so the state is cleared on logout; the records themselves go with the cache, and each
59
+ * also carries the reporter's id.
60
+ */
61
+ export declare const userFlagByMeOnLoginHandler: () => Amity.Unsubscriber;
62
+ /**
63
+ * Called with the cached user when a recorded answer changes what that user would show, so live
64
+ * objects and live collections deliver it again (REQ-016, delivery).
65
+ */
66
+ export declare const onUserFlagConfirmed: (callback: Amity.Listener<Amity.InternalUser>) => Amity.Unsubscriber;
67
+ export {};
68
+ //# sourceMappingURL=userFlagByMe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userFlagByMe.d.ts","sourceRoot":"","sources":["../../../src/userRepository/utils/userFlagByMe.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AAEH,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAU1C,aAAK,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC;AAgBzD,0FAA0F;AAC1F,eAAO,MAAM,aAAa,QAAO,MAAM,GAAG,SAMzC,CAAC;AAUF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,WACpB,MAAM,YAAY,CAAC,QAAQ,CAAC,YAC1B,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,KAChD,OAAO,GAAG,SAQZ,CAAC;AAiDF;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,YAAY,CAAC,QAAQ,CAAC,YAAY,QAAQ,SAqBvF,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,SACrB,MAAM,YAAY,aACb,OAAO,GAAG,SAAS,KAC7B,OASF,CAAC;AAiDF,eAAO,MAAM,mBAAmB,SAAU,MAAM,YAAY,WA9BJ,QAAQ,MAAM,YAAY,CAyCjF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa,SAAU,MAAM,YAAY,GAAG,SAAS,UAAU,MAAM,SAWjF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,SAM7C,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,YAK7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,QAAO,MAAM,YAWnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAc,MAAM,QAAQ,CAAC,MAAM,YAAY,CAAC,uBAS7E,CAAC"}
@@ -1,9 +1,14 @@
1
1
  /** FNV-1a with the same mixing step and signed-byte handling as the native SDKs. */
2
2
  export declare const fnv1a: (bytes: Uint8Array, seed: number) => number;
3
3
  /**
4
- * Whether `value` is probably in the filter. `false` is exact; `true` may be a false positive.
5
- * A missing filter (`null`, the server's value when nobody has flagged the object), a missing
6
- * value or a malformed filter all answer `false`.
4
+ * Whether `value` is probably in the filter. `false` is exact; `true` means "maybe", which may be
5
+ * a false positive. `null` (the server's value when nobody has flagged the object), a missing
6
+ * filter or a missing value answer `false`.
7
+ *
8
+ * A filter that cannot be read answers `true` ("maybe") and never throws, so the caller asks the
9
+ * server instead of trusting a "definitely not" it cannot back up (REQ-017): `bits` or `hashes`
10
+ * not a positive integer, a `hash` that is not base64, or a `hash` shorter than `ceil(bits / 8)`
11
+ * bytes.
7
12
  */
8
13
  export declare const testBloomFilter: (hashFlag: Amity.Flaggable['hashFlag'] | undefined, value: string | undefined) => boolean;
9
14
  //# sourceMappingURL=bloomFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bloomFilter.d.ts","sourceRoot":"","sources":["../../src/utils/bloomFilter.ts"],"names":[],"mappings":"AAmBA,oFAAoF;AACpF,eAAO,MAAM,KAAK,UAAW,UAAU,QAAQ,MAAM,KAAG,MAgBvD,CAAC;AAkBF;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAChB,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,SAC1C,MAAM,GAAG,SAAS,KACxB,OAsBF,CAAC"}
1
+ {"version":3,"file":"bloomFilter.d.ts","sourceRoot":"","sources":["../../src/utils/bloomFilter.ts"],"names":[],"mappings":"AAmBA,oFAAoF;AACpF,eAAO,MAAM,KAAK,UAAW,UAAU,QAAQ,MAAM,KAAG,MAgBvD,CAAC;AAqBF;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,aAChB,MAAM,SAAS,CAAC,UAAU,CAAC,GAAG,SAAS,SAC1C,MAAM,GAAG,SAAS,KACxB,OA0BF,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"userLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/userLinkedObject.ts"],"names":[],"mappings":"AA0DA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IAuBjE,CAAC"}
1
+ {"version":3,"file":"userLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/userLinkedObject.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB,SAAU,MAAM,YAAY,KAAG,MAAM,IA2BjE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.29.1-e932a95f.0",
3
+ "version": "7.30.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",