@knpkv/codecommit-core 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -0
- package/dist/AwsClient/createPullRequest.d.ts +1 -6
- package/dist/AwsClient/createPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/createPullRequest.js +3 -11
- package/dist/AwsClient/createPullRequest.js.map +1 -1
- package/dist/AwsClient/getCallerIdentity.d.ts +5 -6
- package/dist/AwsClient/getCallerIdentity.d.ts.map +1 -1
- package/dist/AwsClient/getCallerIdentity.js +7 -12
- package/dist/AwsClient/getCallerIdentity.js.map +1 -1
- package/dist/AwsClient/getCommentsForPullRequest.d.ts +1 -6
- package/dist/AwsClient/getCommentsForPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/getCommentsForPullRequest.js +9 -16
- package/dist/AwsClient/getCommentsForPullRequest.js.map +1 -1
- package/dist/AwsClient/getPullRequest.d.ts +2 -7
- package/dist/AwsClient/getPullRequest.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequest.js +13 -26
- package/dist/AwsClient/getPullRequest.js.map +1 -1
- package/dist/AwsClient/getPullRequests.d.ts.map +1 -1
- package/dist/AwsClient/getPullRequests.js +16 -13
- package/dist/AwsClient/getPullRequests.js.map +1 -1
- package/dist/AwsClient/index.d.ts +3 -2
- package/dist/AwsClient/index.d.ts.map +1 -1
- package/dist/AwsClient/index.js.map +1 -1
- package/dist/AwsClient/internal.d.ts +47 -11
- package/dist/AwsClient/internal.d.ts.map +1 -1
- package/dist/AwsClient/internal.js +38 -9
- package/dist/AwsClient/internal.js.map +1 -1
- package/dist/AwsClient/listBranches.d.ts +1 -6
- package/dist/AwsClient/listBranches.d.ts.map +1 -1
- package/dist/AwsClient/listBranches.js +3 -11
- package/dist/AwsClient/listBranches.js.map +1 -1
- package/dist/AwsClient/updatePullRequestDescription.d.ts +1 -6
- package/dist/AwsClient/updatePullRequestDescription.d.ts.map +1 -1
- package/dist/AwsClient/updatePullRequestDescription.js +3 -11
- package/dist/AwsClient/updatePullRequestDescription.js.map +1 -1
- package/dist/AwsClient/updatePullRequestTitle.d.ts +1 -6
- package/dist/AwsClient/updatePullRequestTitle.d.ts.map +1 -1
- package/dist/AwsClient/updatePullRequestTitle.js +3 -11
- package/dist/AwsClient/updatePullRequestTitle.js.map +1 -1
- package/dist/CacheService/CacheError.d.ts +21 -0
- package/dist/CacheService/CacheError.d.ts.map +1 -0
- package/dist/CacheService/CacheError.js +17 -0
- package/dist/CacheService/CacheError.js.map +1 -0
- package/dist/CacheService/Database.d.ts +13 -0
- package/dist/CacheService/Database.d.ts.map +1 -0
- package/dist/CacheService/Database.js +34 -0
- package/dist/CacheService/Database.js.map +1 -0
- package/dist/CacheService/EventsHub.d.ts +163 -0
- package/dist/CacheService/EventsHub.d.ts.map +1 -0
- package/dist/CacheService/EventsHub.js +22 -0
- package/dist/CacheService/EventsHub.js.map +1 -0
- package/dist/CacheService/diff.d.ts +28 -0
- package/dist/CacheService/diff.d.ts.map +1 -0
- package/dist/CacheService/diff.js +102 -0
- package/dist/CacheService/diff.js.map +1 -0
- package/dist/CacheService/index.d.ts +17 -0
- package/dist/CacheService/index.d.ts.map +1 -0
- package/dist/CacheService/index.js +15 -0
- package/dist/CacheService/index.js.map +1 -0
- package/dist/CacheService/migrations/0001_initial.d.ts +5 -0
- package/dist/CacheService/migrations/0001_initial.d.ts.map +1 -0
- package/dist/CacheService/migrations/0001_initial.js +72 -0
- package/dist/CacheService/migrations/0001_initial.js.map +1 -0
- package/dist/CacheService/migrations/0002_indexes.d.ts +5 -0
- package/dist/CacheService/migrations/0002_indexes.d.ts.map +1 -0
- package/dist/CacheService/migrations/0002_indexes.js +7 -0
- package/dist/CacheService/migrations/0002_indexes.js.map +1 -0
- package/dist/CacheService/migrations/0003_add_health_score.d.ts +5 -0
- package/dist/CacheService/migrations/0003_add_health_score.d.ts.map +1 -0
- package/dist/CacheService/migrations/0003_add_health_score.js +4 -0
- package/dist/CacheService/migrations/0003_add_health_score.js.map +1 -0
- package/dist/CacheService/migrations/0004_unify_notifications.d.ts +5 -0
- package/dist/CacheService/migrations/0004_unify_notifications.d.ts.map +1 -0
- package/dist/CacheService/migrations/0004_unify_notifications.js +7 -0
- package/dist/CacheService/migrations/0004_unify_notifications.js.map +1 -0
- package/dist/CacheService/repos/CommentRepo.d.ts +16 -0
- package/dist/CacheService/repos/CommentRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/CommentRepo.js +42 -0
- package/dist/CacheService/repos/CommentRepo.js.map +1 -0
- package/dist/CacheService/repos/NotificationRepo.d.ts +48 -0
- package/dist/CacheService/repos/NotificationRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/NotificationRepo.js +128 -0
- package/dist/CacheService/repos/NotificationRepo.js.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo.d.ts +112 -0
- package/dist/CacheService/repos/PullRequestRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/PullRequestRepo.js +146 -0
- package/dist/CacheService/repos/PullRequestRepo.js.map +1 -0
- package/dist/CacheService/repos/SubscriptionRepo.d.ts +20 -0
- package/dist/CacheService/repos/SubscriptionRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/SubscriptionRepo.js +49 -0
- package/dist/CacheService/repos/SubscriptionRepo.js.map +1 -0
- package/dist/CacheService/repos/SyncMetadataRepo.d.ts +14 -0
- package/dist/CacheService/repos/SyncMetadataRepo.d.ts.map +1 -0
- package/dist/CacheService/repos/SyncMetadataRepo.js +36 -0
- package/dist/CacheService/repos/SyncMetadataRepo.js.map +1 -0
- package/dist/ConfigService/backup.d.ts +1 -1
- package/dist/ConfigService/detectProfiles.d.ts +1 -1
- package/dist/ConfigService/index.d.ts +2 -1
- package/dist/ConfigService/index.d.ts.map +1 -1
- package/dist/ConfigService/index.js +3 -1
- package/dist/ConfigService/index.js.map +1 -1
- package/dist/ConfigService/internal.d.ts +6 -0
- package/dist/ConfigService/internal.d.ts.map +1 -1
- package/dist/ConfigService/internal.js +3 -1
- package/dist/ConfigService/internal.js.map +1 -1
- package/dist/ConfigService/load.d.ts +3 -1
- package/dist/ConfigService/load.d.ts.map +1 -1
- package/dist/ConfigService/load.js +4 -2
- package/dist/ConfigService/load.js.map +1 -1
- package/dist/ConfigService/reset.d.ts.map +1 -1
- package/dist/ConfigService/reset.js +3 -1
- package/dist/ConfigService/reset.js.map +1 -1
- package/dist/ConfigService/save.d.ts +1 -1
- package/dist/ConfigService/validate.d.ts +1 -1
- package/dist/DateUtils.d.ts +1 -1
- package/dist/DateUtils.d.ts.map +1 -1
- package/dist/DateUtils.js +2 -2
- package/dist/DateUtils.js.map +1 -1
- package/dist/Domain.d.ts +179 -10
- package/dist/Domain.d.ts.map +1 -1
- package/dist/Domain.js +23 -5
- package/dist/Domain.js.map +1 -1
- package/dist/HealthScore.d.ts.map +1 -1
- package/dist/HealthScore.js +1 -3
- package/dist/HealthScore.js.map +1 -1
- package/dist/PRService/index.d.ts +46 -18
- package/dist/PRService/index.d.ts.map +1 -1
- package/dist/PRService/index.js +58 -27
- package/dist/PRService/index.js.map +1 -1
- package/dist/PRService/internal.d.ts +86 -1
- package/dist/PRService/internal.d.ts.map +1 -1
- package/dist/PRService/internal.js +106 -1
- package/dist/PRService/internal.js.map +1 -1
- package/dist/PRService/refresh.d.ts +10 -4
- package/dist/PRService/refresh.d.ts.map +1 -1
- package/dist/PRService/refresh.js +30 -89
- package/dist/PRService/refresh.js.map +1 -1
- package/dist/PRService/refreshEnrich.d.ts +15 -0
- package/dist/PRService/refreshEnrich.d.ts.map +1 -0
- package/dist/PRService/refreshEnrich.js +72 -0
- package/dist/PRService/refreshEnrich.js.map +1 -0
- package/dist/PRService/refreshFetch.d.ts +20 -0
- package/dist/PRService/refreshFetch.d.ts.map +1 -0
- package/dist/PRService/refreshFetch.js +78 -0
- package/dist/PRService/refreshFetch.js.map +1 -0
- package/dist/PRService/refreshResolve.d.ts +29 -0
- package/dist/PRService/refreshResolve.d.ts.map +1 -0
- package/dist/PRService/refreshResolve.js +84 -0
- package/dist/PRService/refreshResolve.js.map +1 -0
- package/dist/PRService/refreshScore.d.ts +9 -0
- package/dist/PRService/refreshScore.d.ts.map +1 -0
- package/dist/PRService/refreshScore.js +24 -0
- package/dist/PRService/refreshScore.js.map +1 -0
- package/dist/PRService/refreshSinglePR.d.ts +13 -0
- package/dist/PRService/refreshSinglePR.d.ts.map +1 -0
- package/dist/PRService/refreshSinglePR.js +102 -0
- package/dist/PRService/refreshSinglePR.js.map +1 -0
- package/dist/PRService/setAllAccounts.d.ts +1 -3
- package/dist/PRService/setAllAccounts.d.ts.map +1 -1
- package/dist/PRService/setAllAccounts.js +2 -2
- package/dist/PRService/setAllAccounts.js.map +1 -1
- package/dist/PRService/toggleAccount.d.ts +1 -3
- package/dist/PRService/toggleAccount.d.ts.map +1 -1
- package/dist/PRService/toggleAccount.js +2 -2
- package/dist/PRService/toggleAccount.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
- package/dist/NotificationsService.d.ts +0 -46
- package/dist/NotificationsService.d.ts.map +0 -1
- package/dist/NotificationsService.js +0 -57
- package/dist/NotificationsService.js.map +0 -1
|
@@ -3,7 +3,5 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ConfigService } from "../ConfigService/index.js";
|
|
6
|
-
|
|
7
|
-
import type { PRState } from "./internal.js";
|
|
8
|
-
export declare const makeToggleAccount: (state: PRState, refresh: Effect.Effect<void>) => (profile: AwsProfileName) => Effect.Effect<void, never, ConfigService>;
|
|
6
|
+
export declare const makeToggleAccount: (refresh: Effect.Effect<void>) => (profile: string & import("effect/Brand").Brand<"AwsProfileName">) => Effect.Effect<void, never, ConfigService>;
|
|
9
7
|
//# sourceMappingURL=toggleAccount.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleAccount.d.ts","sourceRoot":"","sources":["../../src/PRService/toggleAccount.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"toggleAccount.d.ts","sourceRoot":"","sources":["../../src/PRService/toggleAccount.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAGzD,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,oHAyB1B,CAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Effect } from "effect";
|
|
5
5
|
import { ConfigService } from "../ConfigService/index.js";
|
|
6
|
-
export const makeToggleAccount = (
|
|
6
|
+
export const makeToggleAccount = (refresh) => Effect.fn("PRService.toggleAccount")(function* (profile) {
|
|
7
7
|
const configService = yield* ConfigService;
|
|
8
8
|
const config = yield* configService.load.pipe(Effect.orDie);
|
|
9
9
|
const existingIdx = config.accounts.findIndex((a) => a.profile === profile);
|
|
@@ -25,5 +25,5 @@ export const makeToggleAccount = (state, refresh) => (profile) => Effect.gen(fun
|
|
|
25
25
|
}
|
|
26
26
|
yield* configService.save({ ...config, accounts: newAccounts }).pipe(Effect.orDie);
|
|
27
27
|
yield* refresh;
|
|
28
|
-
})
|
|
28
|
+
});
|
|
29
29
|
//# sourceMappingURL=toggleAccount.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggleAccount.js","sourceRoot":"","sources":["../../src/PRService/toggleAccount.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,aAAa,EAAE,MA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AC,CAAC,EAAE,MAAM,IAAK,WAAyB,CAAC;YAClD,OAAO,EAAE,IAAI;SACd,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAClF,KAAK,CAAC,CAAC,OAAO,CAAA;AAChB,CAAC,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * as AwsClient from "./AwsClient/index.js";
|
|
17
17
|
export * as AwsClientConfig from "./AwsClientConfig.js";
|
|
18
|
+
export * as CacheService from "./CacheService/index.js";
|
|
18
19
|
export * as ConfigService from "./ConfigService/index.js";
|
|
19
20
|
export * as DateUtils from "./DateUtils.js";
|
|
20
21
|
export * as Domain from "./Domain.js";
|
|
21
22
|
export * as Errors from "./Errors.js";
|
|
22
|
-
export * as NotificationsService from "./NotificationsService.js";
|
|
23
23
|
export * as PRService from "./PRService/index.js";
|
|
24
24
|
export { Registry } from "@effect-atom/atom";
|
|
25
25
|
export { Reactivity } from "@effect/experimental";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAGjD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export * as AwsClient from "./AwsClient/index.js";
|
|
17
17
|
export * as AwsClientConfig from "./AwsClientConfig.js";
|
|
18
|
+
export * as CacheService from "./CacheService/index.js";
|
|
18
19
|
export * as ConfigService from "./ConfigService/index.js";
|
|
19
20
|
export * as DateUtils from "./DateUtils.js";
|
|
20
21
|
export * as Domain from "./Domain.js";
|
|
21
22
|
export * as Errors from "./Errors.js";
|
|
22
|
-
export * as NotificationsService from "./NotificationsService.js";
|
|
23
23
|
export * as PRService from "./PRService/index.js";
|
|
24
24
|
// Re-export Effect dependencies for convenience
|
|
25
25
|
export { Registry } from "@effect-atom/atom";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,eAAe,MAAM,sBAAsB,CAAA;AACvD,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,aAAa,MAAM,0BAA0B,CAAA;AACzD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AACrC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD,gDAAgD;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@knpkv/codecommit-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Core logic for CodeCommit PR browser",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
"@effect/experimental": "latest",
|
|
21
21
|
"@effect/platform": "latest",
|
|
22
22
|
"@effect/schema": "latest",
|
|
23
|
+
"@effect/sql": "latest",
|
|
24
|
+
"@effect/sql-libsql": "latest",
|
|
25
|
+
"@libsql/client": "^0.14.0",
|
|
23
26
|
"distilled-aws": "0.0.21",
|
|
24
27
|
"effect": "latest"
|
|
25
28
|
},
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notification state management service.
|
|
3
|
-
*
|
|
4
|
-
* Manages application notifications using `SubscriptionRef` for reactive state
|
|
5
|
-
* and `Clock.currentTimeMillis` for timestamps (testable with `TestClock`).
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { NotificationsService } from "@knpkv/codecommit-core"
|
|
10
|
-
*
|
|
11
|
-
* const program = Effect.gen(function* () {
|
|
12
|
-
* const notifications = yield* NotificationsService
|
|
13
|
-
* yield* notifications.add({ type: "info", title: "Refresh", message: "Complete" })
|
|
14
|
-
* })
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @category Service
|
|
18
|
-
* @module
|
|
19
|
-
*/
|
|
20
|
-
import { Context, Effect, Layer, SubscriptionRef } from "effect";
|
|
21
|
-
import type { NotificationsState, NotificationType } from "./Domain.js";
|
|
22
|
-
declare const NotificationsService_base: Context.TagClass<NotificationsService, "@knpkv/codecommit-core/NotificationsService", {
|
|
23
|
-
readonly state: SubscriptionRef.SubscriptionRef<NotificationsState>;
|
|
24
|
-
readonly add: (item: {
|
|
25
|
-
readonly type: NotificationType;
|
|
26
|
-
readonly title: string;
|
|
27
|
-
readonly message: string;
|
|
28
|
-
readonly profile?: string;
|
|
29
|
-
}) => Effect.Effect<void>;
|
|
30
|
-
readonly clear: Effect.Effect<void>;
|
|
31
|
-
}>;
|
|
32
|
-
/**
|
|
33
|
-
* Notifications service.
|
|
34
|
-
*
|
|
35
|
-
* @category Service
|
|
36
|
-
*/
|
|
37
|
-
export declare class NotificationsService extends NotificationsService_base {
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Live notifications service using Clock for timestamps.
|
|
41
|
-
*
|
|
42
|
-
* @category Service
|
|
43
|
-
*/
|
|
44
|
-
export declare const NotificationsServiceLive: Layer.Layer<NotificationsService, never, never>;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=NotificationsService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsService.d.ts","sourceRoot":"","sources":["../src/NotificationsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAS,OAAO,EAAY,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AACjF,OAAO,KAAK,EAAoB,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;;oBAcrE,eAAe,CAAC,eAAe,CAAC,kBAAkB,CAAC;kBACrD,CAAC,IAAI,EAAE;QACnB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAA;QAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;QACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAC1B,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;oBACT,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;;AAfvC;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,yBAYvC;CAAG;AAMN;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,iDA6BpC,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Notification state management service.
|
|
3
|
-
*
|
|
4
|
-
* Manages application notifications using `SubscriptionRef` for reactive state
|
|
5
|
-
* and `Clock.currentTimeMillis` for timestamps (testable with `TestClock`).
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```typescript
|
|
9
|
-
* import { NotificationsService } from "@knpkv/codecommit-core"
|
|
10
|
-
*
|
|
11
|
-
* const program = Effect.gen(function* () {
|
|
12
|
-
* const notifications = yield* NotificationsService
|
|
13
|
-
* yield* notifications.add({ type: "info", title: "Refresh", message: "Complete" })
|
|
14
|
-
* })
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @category Service
|
|
18
|
-
* @module
|
|
19
|
-
*/
|
|
20
|
-
import { Clock, Context, DateTime, Effect, Layer, SubscriptionRef } from "effect";
|
|
21
|
-
// ---------------------------------------------------------------------------
|
|
22
|
-
// Service Definition
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
/**
|
|
25
|
-
* Notifications service.
|
|
26
|
-
*
|
|
27
|
-
* @category Service
|
|
28
|
-
*/
|
|
29
|
-
export class NotificationsService extends Context.Tag("@knpkv/codecommit-core/NotificationsService")() {
|
|
30
|
-
}
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
// Live Implementation
|
|
33
|
-
// ---------------------------------------------------------------------------
|
|
34
|
-
/**
|
|
35
|
-
* Live notifications service using Clock for timestamps.
|
|
36
|
-
*
|
|
37
|
-
* @category Service
|
|
38
|
-
*/
|
|
39
|
-
export const NotificationsServiceLive = Layer.effect(NotificationsService, Effect.gen(function* () {
|
|
40
|
-
const state = yield* SubscriptionRef.make({
|
|
41
|
-
items: []
|
|
42
|
-
});
|
|
43
|
-
const add = (item) => Effect.gen(function* () {
|
|
44
|
-
const now = yield* Clock.currentTimeMillis;
|
|
45
|
-
const timestamp = DateTime.toDate(DateTime.unsafeMake(now));
|
|
46
|
-
const notification = {
|
|
47
|
-
...item,
|
|
48
|
-
timestamp
|
|
49
|
-
};
|
|
50
|
-
yield* SubscriptionRef.update(state, (s) => ({
|
|
51
|
-
items: [...s.items, notification].slice(-100)
|
|
52
|
-
}));
|
|
53
|
-
}).pipe(Effect.withSpan("NotificationsService.add"));
|
|
54
|
-
const clear = SubscriptionRef.update(state, () => ({ items: [] }));
|
|
55
|
-
return { state, add, clear };
|
|
56
|
-
}));
|
|
57
|
-
//# sourceMappingURL=NotificationsService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsService.js","sourceRoot":"","sources":["../src/NotificationsService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAGjF,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,OAAO,oBAAqB,SAAQ,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,EAYjG;CAAG;AAEN,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,wB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