@shivaedev/identity 0.34.0 → 0.34.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.34.2 - 2026-11-20
4
+
5
+ ### Changed
6
+
7
+ - Update `@shivaedev/contract` from 0.50.0 to 0.51.0.
8
+
9
+ ## 0.34.1 - 2026-11-20
10
+
11
+ ### Changed
12
+
13
+ - Update `@shivaedev/access` from 0.6.5 to 0.6.6.
14
+ - Update `@shivaedev/contract` from 0.49.0 to 0.50.0.
15
+ - Update `@shivaedev/errors` from 0.13.1 to 0.14.0.
16
+ - Update `@shivaedev/rate-limit` from 0.6.14 to 0.6.15.
17
+ - Update `@shivaedev/sql` from 0.51.0 to 0.52.0.
18
+
3
19
  ## 0.34.0 - 2026-11-20
4
20
 
5
21
  ### Added
package/README.md CHANGED
@@ -57,7 +57,7 @@ const Save = command("save", {
57
57
  return `${id}: ${title}`;
58
58
  },
59
59
  });
60
- export const Account = defineModule({ name: "account", operations: [Save], requires: [], subject: selfSubject, wire: accountWire });
60
+ export const Account = defineModule({ name: "account", operations: [Save], subject: selfSubject, wire: accountWire });
61
61
  ```
62
62
 
63
63
  For delegation, use `accountSubject` with an application permission and a typed refusal:
@@ -93,7 +93,7 @@ export const actsAsCoach = delegatedSubject({
93
93
  deny: (client) => new NotYourClient({ client }),
94
94
  });
95
95
 
96
- export const Training = defineModule({ name: "training", operations: [Plan, SavePlan], requires: [SqlClient.SqlClient], subject: actsAsCoach });
96
+ export const Training = defineModule({ name: "training", operations: [Plan, SavePlan], subject: actsAsCoach, wire: trainingWire });
97
97
  ```
98
98
 
99
99
  On the server the application answers one question with a service whose id is the declaration's `service`. Its `allows` operation receives a `DelegationRequest`, `{ subject, module, operation, kind }`, and returns whether the actor may make that call; it may fail with an identity failure, such as `AuthUnavailable`, or the declared refusal. It reads the actor from `CurrentViewer` in `@shivaedev/contract/readPolicy.ts`, which the guard sets to the actor for each question; `CurrentViewer` is a reference, so the service lists only its own dependencies in `requires` and is registered once in the host's `services`:
@@ -283,7 +283,7 @@ const register = (body: { email: string; name: string; password: string }) =>
283
283
  const created = yield* Effect.tryPromise(() => auth.api.signUpEmail({ body }));
284
284
  yield* sql`insert into registrations (email) values (${created.user.email})`;
285
285
  return created.user;
286
- }).pipe(transact({ onSqlError: (error) => error }), Effect.scoped);
286
+ }).pipe(transact(), Effect.scoped);
287
287
  ```
288
288
 
289
289
  With `SqlClient`, `Reactivity` and `Store` provided, the auth and application rows commit or roll back together. The mount's `before` and `after` hook SQL shares that outer boundary too.
@@ -857,7 +857,7 @@ An operation on one record reads that record's owner and uses the application's
857
857
 
858
858
  ### Session-scoped contract keys
859
859
 
860
- For self-only features, define the module with `keyScope: "session"` and `subject: selfSubject`, as in `defineModule({ keyScope: "session", name: "preferences", operations, requires, subject: selfSubject, wire })`. The client registry owns cache isolation. Server subscriptions use the same plain record, list and bucket keys as repository writes. Handlers read their owner from `Subject`, and queries need no additional session keys. Matching keys trigger each subscriber's read policy before it can receive a hint or result; shared dependencies can cause authorized rechecks across accounts.
860
+ For self-only features, define the module with `keyScope: "session"` and `subject: selfSubject`, as in `defineModule({ keyScope: "session", name: "preferences", operations, subject: selfSubject, wire })`. The client registry owns cache isolation. Server subscriptions use the same plain record, list and bucket keys as repository writes. Handlers read their owner from `Subject`, and queries need no additional session keys. Matching keys trigger each subscriber's read policy before it can receive a hint or result; shared dependencies can cause authorized rechecks across accounts.
861
861
 
862
862
  The host's generated `$changes` handler accepts `{ queries: [{ query: "get", payload: { id: "theme" } }] }` and resolves the declared query dependencies during that subscription invocation. It accepts no physical subscription keys or caller-selected scope.
863
863
 
@@ -27,7 +27,18 @@ export declare const AccountPreferences: import("@shivaedev/contract/defineModul
27
27
  readonly InternalServerError: typeof import("@shivaedev/errors/taxonomy.ts").InternalServerError;
28
28
  readonly ServiceUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable;
29
29
  readonly AuthUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable;
30
- }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, "@shivaedev/identity/AccountPreferencesStore" | Subject>>] & readonly import("@shivaedev/contract/defineModule.ts").ModuleOperation[], readonly [import("effect/Context").Service<"@shivaedev/identity/AccountPreferencesStore", Readonly<{
30
+ }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, "@shivaedev/identity/AccountPreferencesStore" | Subject>>] & readonly import("@shivaedev/contract/defineModule.ts").ModuleOperation[], import("@shivaedev/contract/moduleProof.ts").ModuleRequirements<readonly [import("@shivaedev/contract/servedOperation.ts").ServedQuery<"get", import("effect/Schema").Void, import("effect/Schema").Void, {
31
+ readonly InternalServerError: typeof import("@shivaedev/errors/taxonomy.ts").InternalServerError;
32
+ readonly ServiceUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable;
33
+ }, never, never, import("effect/Effect").Effect<{
34
+ readonly locale: string;
35
+ readonly timezone: string;
36
+ readonly units: "imperial" | "metric";
37
+ }, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, "@shivaedev/identity/AccountPreferencesStore" | Subject>>, import("@shivaedev/contract/servedOperation.ts").ServedCommandOf<"set", {
38
+ readonly locale: import("effect/Schema").NonEmptyString;
39
+ readonly timezone: import("effect/Schema").String;
40
+ readonly units: import("effect/Schema").Literals<readonly ["metric", "imperial"]>;
41
+ }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never> | import("effect/Effect").Effect<Readonly<{
31
42
  readonly capture: (id: string, values: {
32
43
  readonly locale: string;
33
44
  readonly timezone: string;
@@ -43,9 +54,34 @@ export declare const AccountPreferences: import("@shivaedev/contract/defineModul
43
54
  readonly timezone: string;
44
55
  readonly units: "imperial" | "metric";
45
56
  }) => import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never>;
46
- }>> & {
47
- readonly layer: import("effect/Layer").Layer<"@shivaedev/identity/AccountPreferencesStore", never, "@shivaedev/identity/AccountPreferenceRows">;
48
- }], never, {
57
+ }>, never, "@shivaedev/identity/AccountPreferencesStore"> | import("effect/Effect").Effect<{
58
+ readonly id: import("#subject.ts").SubjectId;
59
+ }, never, Subject>, void>, import("@shivaedev/contract/servedOperation.ts").ServedCommandOf<"capture", {
60
+ readonly locale: import("effect/Schema").NonEmptyString;
61
+ readonly timezone: import("effect/Schema").String;
62
+ readonly units: import("effect/Schema").Literals<readonly ["metric", "imperial"]>;
63
+ }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never> | import("effect/Effect").Effect<Readonly<{
64
+ readonly capture: (id: string, values: {
65
+ readonly locale: string;
66
+ readonly timezone: string;
67
+ readonly units: "imperial" | "metric";
68
+ }) => import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never>;
69
+ readonly get: (id: string) => import("effect/Effect").Effect<{
70
+ readonly locale: string;
71
+ readonly timezone: string;
72
+ readonly units: "imperial" | "metric";
73
+ }, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never>;
74
+ readonly set: (id: string, values: {
75
+ readonly locale: string;
76
+ readonly timezone: string;
77
+ readonly units: "imperial" | "metric";
78
+ }) => import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, never>;
79
+ }>, never, "@shivaedev/identity/AccountPreferencesStore"> | import("effect/Effect").Effect<{
80
+ readonly id: import("#subject.ts").SubjectId;
81
+ }, never, Subject>, void>], never, {
82
+ error: import("effect/Schema").Union<readonly [typeof import("@shivaedev/errors/taxonomy.ts").Unauthorized, typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, typeof import("@shivaedev/errors/taxonomy.ts").Forbidden, typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>;
83
+ middleware: import("effect/Effect").Effect<import("#subject.ts").SubjectMiddleware<never, never>, never, import("#subject.ts").SubjectResolver>;
84
+ }>, never, {
49
85
  error: import("effect/Schema").Union<readonly [typeof import("@shivaedev/errors/taxonomy.ts").Unauthorized, typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable, typeof import("@shivaedev/errors/taxonomy.ts").Forbidden, typeof import("@shivaedev/contract/readPolicyErrors.ts").MissingReadPolicy, typeof import("@shivaedev/contract/readPolicyErrors.ts").QueryReadDenied]>;
50
86
  middleware: import("effect/Effect").Effect<import("#subject.ts").SubjectMiddleware<never, never>, never, import("#subject.ts").SubjectResolver>;
51
87
  }, undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"AccountPreferences.d.ts","sourceRoot":"","sources":["../src/AccountPreferences.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AA4BnD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAM7B,CAAC"}
1
+ {"version":3,"file":"AccountPreferences.d.ts","sourceRoot":"","sources":["../src/AccountPreferences.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAe,MAAM,aAAa,CAAC;AA4BnD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAK7B,CAAC"}
@@ -30,7 +30,6 @@ const CapturePreferences = command("capture", {
30
30
  export const AccountPreferences = defineModule({
31
31
  name: "identity.accountPreferences",
32
32
  operations: [GetPreferences, SetPreferences, CapturePreferences],
33
- requires: [AccountPreferencesStore],
34
33
  subject: selfSubject,
35
34
  wire: identityAccountPreferencesWire,
36
35
  });
@@ -1 +1 @@
1
- {"version":3,"file":"AccountPreferences.js","sourceRoot":"","sources":["../src/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EAAE,CAAC,CAAC;IACxD,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG,OAAO,CAAC,KAAK,EAAE;IACrC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC;IAC/C,OAAO,EAAE,uBAAuB,CAAC,MAAM;IACvC,CAAC,GAAG,CAAC,MAAM;QACV,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC;QAC9B,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACzD,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,OAAO,CAAC,SAAS,EAAE;IAC7C,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC;IAC/C,OAAO,EAAE,uBAAuB,CAAC,MAAM;IACvC,CAAC,GAAG,CAAC,MAAM;QACV,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC;QAC9B,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;CACD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,YAAY,CAAC;IAC9C,IAAI,EAAE,6BAA6B;IACnC,UAAU,EAAE,CAAC,cAAc,EAAE,cAAc,EAAE,kBAAkB,CAAC;IAChE,OAAO,EAAE,WAAW;IACpB,IAAI,EAAE,8BAA8B;CACpC,CAAC,CAAC"}
@@ -1,5 +1,4 @@
1
1
  import { Schema } from "effect";
2
- import { SqlClient } from "effect/sql";
3
2
  import { SessionsPermission } from "#sessionPermissions.ts";
4
3
  export declare const Sessions: import("@shivaedev/contract/defineModule.ts").Module<"identity.sessions", readonly [import("@shivaedev/contract/servedOperation.ts").ServedQuery<"list", Schema.Struct<{
5
4
  readonly cursor: Schema.optionalKey<Schema.Struct<{
@@ -28,7 +27,7 @@ export declare const Sessions: import("@shivaedev/contract/defineModule.ts").Mod
28
27
  readonly ServiceUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable;
29
28
  readonly AuthUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable;
30
29
  readonly Forbidden: typeof import("@shivaedev/errors/taxonomy.ts").Forbidden;
31
- }, never, never, import("effect/Effect").Effect<import("#signedInSessions.ts").SessionList, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden, import("./identity.ts").SessionUser | SqlClient.SqlClient>>, import("@shivaedev/contract/servedOperation.ts").ServedCommand<"revoke", Schema.Struct<{
30
+ }, never, never, import("effect/Effect").Effect<import("#signedInSessions.ts").SessionList, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden, import("./identity.ts").SessionUser | import("effect/sql/SqlClient").SqlClient>>, import("@shivaedev/contract/servedOperation.ts").ServedCommand<"revoke", Schema.Struct<{
32
31
  id: Schema.String;
33
32
  }>, Schema.Void, {
34
33
  readonly InternalServerError: typeof import("@shivaedev/errors/taxonomy.ts").InternalServerError;
@@ -36,5 +35,16 @@ export declare const Sessions: import("@shivaedev/contract/defineModule.ts").Mod
36
35
  readonly AuthUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").AuthUnavailable;
37
36
  readonly Forbidden: typeof import("@shivaedev/errors/taxonomy.ts").Forbidden;
38
37
  readonly NotFound: typeof import("@shivaedev/errors/taxonomy.ts").NotFound;
39
- }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden | import("@shivaedev/errors/taxonomy.ts").NotFound, import("./identity.ts").SessionUser | SqlClient.SqlClient>>] & readonly import("@shivaedev/contract/defineModule.ts").ModuleOperation[], readonly [import("effect/Context").Service<SqlClient.SqlClient, SqlClient.SqlClient>], typeof SessionsPermission, undefined, undefined>;
38
+ }, import("effect/Effect").Effect<void, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden | import("@shivaedev/errors/taxonomy.ts").NotFound, import("./identity.ts").SessionUser | import("effect/sql/SqlClient").SqlClient>>] & readonly import("@shivaedev/contract/defineModule.ts").ModuleOperation[], import("@shivaedev/contract/moduleProof.ts").ModuleRequirements<readonly [import("@shivaedev/contract/servedOperation.ts").ServedQuery<"list", Schema.Struct<{
39
+ readonly cursor: Schema.optionalKey<Schema.Struct<{
40
+ readonly id: Schema.String;
41
+ readonly lastActivityAt: Schema.DateTimeUtcFromString;
42
+ }>>;
43
+ readonly limit: Schema.Number;
44
+ }>, Schema.Void, {
45
+ readonly InternalServerError: typeof import("@shivaedev/errors/taxonomy.ts").InternalServerError;
46
+ readonly ServiceUnavailable: typeof import("@shivaedev/errors/taxonomy.ts").ServiceUnavailable;
47
+ }, never, never, import("effect/Effect").Effect<import("#signedInSessions.ts").SessionList, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden, import("./identity.ts").SessionUser | import("effect/sql/SqlClient").SqlClient>>, import("@shivaedev/contract/servedOperation.ts").ServedCommandOf<"revoke", {
48
+ id: Schema.String;
49
+ }, import("effect/Effect").Effect<undefined, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | import("@shivaedev/errors/taxonomy.ts").Forbidden | import("@shivaedev/errors/taxonomy.ts").NotFound, import("./identity.ts").SessionUser | import("effect/sql/SqlClient").SqlClient>, void>], typeof SessionsPermission, undefined>, typeof SessionsPermission, undefined, undefined>;
40
50
  //# sourceMappingURL=Sessions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sessions.d.ts","sourceRoot":"","sources":["../src/Sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAmB5D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wdAMnB,CAAC"}
1
+ {"version":3,"file":"Sessions.d.ts","sourceRoot":"","sources":["../src/Sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAKhC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAmB5D,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6XAKnB,CAAC"}
package/dist/Sessions.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Schema } from "effect";
2
- import { SqlClient } from "effect/sql";
3
2
  import { defineModule } from "@shivaedev/contract/defineModule.ts";
4
3
  import { command, query } from "@shivaedev/contract/operation.ts";
5
4
  import { identitySessionsWire } from "#generated/Sessions.ts";
@@ -24,7 +23,6 @@ export const Sessions = defineModule({
24
23
  middleware: SessionsPermission,
25
24
  name: "identity.sessions",
26
25
  operations: [ListSessions, RevokeSession],
27
- requires: [SqlClient.SqlClient],
28
26
  wire: identitySessionsWire,
29
27
  });
30
28
  //# sourceMappingURL=Sessions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Sessions.js","sourceRoot":"","sources":["../src/Sessions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,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,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,UAAU,CAAC;;;8BAOhF"}
1
+ {"version":3,"file":"dayRange.d.ts","sourceRoot":"","sources":["../../../src/server/account-clock/dayRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAGtE,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,UAAU,CAAC;;;8BAMhF"}
@@ -2,10 +2,9 @@ import { DateTime, Effect, Schema } from "effect";
2
2
  import { boundary } from "#server/account-clock/boundary.ts";
3
3
  import { LogicalDay } from "#server/account-clock/settings.ts";
4
4
  export function dayRange({ minutes, timezone }) {
5
- const decodeDay = Schema.decodeUnknownEffect(LogicalDay);
5
+ const decodeDay = Schema.decodeUnknownEffect(LogicalDay.pipe(Schema.decodeTo(Schema.DateTimeUtcFromString)));
6
6
  return Effect.fn("AccountClock.dayRange")(function* (day) {
7
- yield* decodeDay(day);
8
- const next = DateTime.makeUnsafe(day).pipe(DateTime.add({ days: 1 }), DateTime.formatIsoDateUtc);
7
+ const next = DateTime.formatIsoDateUtc(DateTime.add(yield* decodeDay(day), { days: 1 }));
9
8
  return { end: yield* boundary(next, timezone, minutes), start: yield* boundary(day, timezone, minutes) };
10
9
  });
11
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dayRange.js","sourceRoot":"","sources":["../../../src/server/account-clock/dayRange.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,mC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CAAC,EAAE,GAAW;QAC/D,MAAM,IAAI,GAAG,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACzF,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1G,CAAC,CAAC,CAAC;AACJ,CAAC"}
@@ -3,5 +3,6 @@ import { Subject } from "#subject.ts";
3
3
  export declare const initialize: Effect.Effect<{
4
4
  minutes: number;
5
5
  timezone: string;
6
+ zone: import("effect/DateTime").TimeZone.Named;
6
7
  }, import("@shivaedev/errors/taxonomy.ts").AuthUnavailable | Schema.SchemaError, "@shivaedev/identity/AccountPreferencesStore" | Subject>;
7
8
  //# sourceMappingURL=initialize.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/server/account-clock/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,eAAO,MAAM,UAAU;;;yIAKrB,CAAC"}
1
+ {"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/server/account-clock/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGxC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,eAAO,MAAM,UAAU;;;;yIAMrB,CAAC"}
@@ -6,6 +6,7 @@ export const initialize = Effect.gen(function* () {
6
6
  const { id } = yield* Subject;
7
7
  const { timezone } = yield* (yield* AccountPreferencesStore).get(id);
8
8
  const minutes = yield* Schema.decodeUnknownEffect(DayStart)(yield* AccountDayStart);
9
- return { minutes, timezone };
9
+ const zone = yield* Schema.decodeUnknownEffect(Schema.TimeZoneNamedFromString)(timezone);
10
+ return { minutes, timezone, zone };
10
11
  });
11
12
  //# sourceMappingURL=initialize.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/server/account-clock/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7C,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC;IACpF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;AAC9B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"initialize.js","sourceRoot":"","sources":["../../../src/server/account-clock/initialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC7C,MAAM,EAAE,EAAE,EAAE,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC;IAC9B,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,uBAAuB,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACrE,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,eAAe,CAAC,CAAC;IACpF,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC,QAAQ,CAAC,CAAC;IACzF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import { DateTime, Effect } from "effect";
2
2
  import type { initialize } from "#server/account-clock/initialize.ts";
3
- export declare function logicalDay({ minutes, timezone }: Effect.Success<typeof initialize>): (instant?: DateTime.Utc | undefined) => Effect.Effect<string, never, never>;
3
+ export declare function logicalDay({ minutes, timezone, zone }: Effect.Success<typeof initialize>): (instant?: DateTime.Utc | undefined) => Effect.Effect<string, never, never>;
4
4
  //# sourceMappingURL=logicalDay.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logicalDay.d.ts","sourceRoot":"","sources":["../../../src/server/account-clock/logicalDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,UAAU,CAAC,+EASlF"}
1
+ {"version":3,"file":"logicalDay.d.ts","sourceRoot":"","sources":["../../../src/server/account-clock/logicalDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AAEtE,wBAAgB,UAAU,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,UAAU,CAAC,+EAOxF"}
@@ -1,13 +1,11 @@
1
1
  import { DateTime, Effect } from "effect";
2
2
  import { boundary } from "#server/account-clock/boundary.ts";
3
- export function logicalDay({ minutes, timezone }) {
3
+ export function logicalDay({ minutes, timezone, zone }) {
4
4
  return Effect.fn("AccountClock.logicalDay")(function* (instant) {
5
5
  const now = instant ?? (yield* DateTime.now);
6
- const local = DateTime.setZoneNamedUnsafe(now, timezone);
6
+ const local = DateTime.setZone(now, zone);
7
7
  const day = DateTime.formatIsoDate(local);
8
- return DateTime.isLessThan(now, yield* boundary(day, timezone, minutes))
9
- ? DateTime.makeUnsafe(day).pipe(DateTime.subtract({ days: 1 }), DateTime.formatIsoDateUtc)
10
- : day;
8
+ return DateTime.isLessThan(now, yield* boundary(day, timezone, minutes)) ? DateTime.formatIsoDate(DateTime.subtract(local, { days: 1 })) : day;
11
9
  });
12
10
  }
13
11
  //# sourceMappingURL=logicalDay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logicalDay.js","sourceRoot":"","sources":["../../../src/server/account-clock/logicalDay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D,MAAM,UAAU,UAAU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AG,EAAE,IAAI,CAAC,CAAC;QAC1C,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,OAAO,QAAQ,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAChJ,CAAC,CAAC,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shivaedev/identity",
3
- "version": "0.34.0",
3
+ "version": "0.34.2",
4
4
  "description": "Request identity, sessions, transport trust and permission enforcement for Effect RPC servers",
5
5
  "keywords": [
6
6
  "effect"
@@ -46,25 +46,25 @@
46
46
  "README.md"
47
47
  ],
48
48
  "dependencies": {
49
- "@shivaedev/access": "0.6.5",
49
+ "@shivaedev/access": "0.6.6",
50
50
  "@shivaedev/changes": "0.14.1",
51
- "@shivaedev/contract": "0.49.0",
52
- "@shivaedev/errors": "0.13.1",
53
- "@shivaedev/rate-limit": "0.6.14",
51
+ "@shivaedev/contract": "0.51.0",
52
+ "@shivaedev/errors": "0.14.0",
53
+ "@shivaedev/rate-limit": "0.6.15",
54
54
  "@shivaedev/service": "0.9.2",
55
- "@shivaedev/sql": "0.51.0"
55
+ "@shivaedev/sql": "0.52.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@better-auth/oauth-provider": "1.7.22",
59
59
  "@effect/platform-node": "4.1.4",
60
60
  "@effect/sql-pg": "4.1.4",
61
- "@shivaedev/admin": "0.26.4",
62
- "@shivaedev/build": "0.3.0",
63
- "@shivaedev/quality": "0.78.5",
64
- "@shivaedev/server": "0.37.0",
65
- "@shivaedev/test-kits": "0.13.4",
66
- "@shivaedev/test-sql": "0.25.4",
67
- "@shivaedev/test-story": "0.49.0",
61
+ "@shivaedev/admin": "0.27.1",
62
+ "@shivaedev/build": "0.3.2",
63
+ "@shivaedev/quality": "0.79.0",
64
+ "@shivaedev/server": "0.38.1",
65
+ "@shivaedev/test-kits": "0.13.6",
66
+ "@shivaedev/test-sql": "0.25.5",
67
+ "@shivaedev/test-story": "0.50.0",
68
68
  "@types/node": "24.19.2",
69
69
  "better-auth": "1.7.22",
70
70
  "effect": "4.1.4",
@@ -34,7 +34,6 @@ const CapturePreferences = command("capture", {
34
34
  export const AccountPreferences = defineModule({
35
35
  name: "identity.accountPreferences",
36
36
  operations: [GetPreferences, SetPreferences, CapturePreferences],
37
- requires: [AccountPreferencesStore],
38
37
  subject: selfSubject,
39
38
  wire: identityAccountPreferencesWire,
40
39
  });
package/src/Sessions.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Schema } from "effect";
2
- import { SqlClient } from "effect/sql";
3
2
  import { defineModule } from "@shivaedev/contract/defineModule.ts";
4
3
  import { command, query } from "@shivaedev/contract/operation.ts";
5
4
  import { identitySessionsWire } from "#generated/Sessions.ts";
@@ -27,6 +26,5 @@ export const Sessions = defineModule({
27
26
  middleware: SessionsPermission,
28
27
  name: "identity.sessions",
29
28
  operations: [ListSessions, RevokeSession],
30
- requires: [SqlClient.SqlClient],
31
29
  wire: identitySessionsWire,
32
30
  });
@@ -4,10 +4,9 @@ import type { initialize } from "#server/account-clock/initialize.ts";
4
4
  import { LogicalDay } from "#server/account-clock/settings.ts";
5
5
 
6
6
  export function dayRange({ minutes, timezone }: Effect.Success<typeof initialize>) {
7
- const decodeDay = Schema.decodeUnknownEffect(LogicalDay);
7
+ const decodeDay = Schema.decodeUnknownEffect(LogicalDay.pipe(Schema.decodeTo(Schema.DateTimeUtcFromString)));
8
8
  return Effect.fn("AccountClock.dayRange")(function* (day: string) {
9
- yield* decodeDay(day);
10
- const next = DateTime.makeUnsafe(day).pipe(DateTime.add({ days: 1 }), DateTime.formatIsoDateUtc);
9
+ const next = DateTime.formatIsoDateUtc(DateTime.add(yield* decodeDay(day), { days: 1 }));
11
10
  return { end: yield* boundary(next, timezone, minutes), start: yield* boundary(day, timezone, minutes) };
12
11
  });
13
12
  }
@@ -7,5 +7,6 @@ export const initialize = Effect.gen(function* () {
7
7
  const { id } = yield* Subject;
8
8
  const { timezone } = yield* (yield* AccountPreferencesStore).get(id);
9
9
  const minutes = yield* Schema.decodeUnknownEffect(DayStart)(yield* AccountDayStart);
10
- return { minutes, timezone };
10
+ const zone = yield* Schema.decodeUnknownEffect(Schema.TimeZoneNamedFromString)(timezone);
11
+ return { minutes, timezone, zone };
11
12
  });
@@ -2,13 +2,11 @@ import { DateTime, Effect } from "effect";
2
2
  import { boundary } from "#server/account-clock/boundary.ts";
3
3
  import type { initialize } from "#server/account-clock/initialize.ts";
4
4
 
5
- export function logicalDay({ minutes, timezone }: Effect.Success<typeof initialize>) {
5
+ export function logicalDay({ minutes, timezone, zone }: Effect.Success<typeof initialize>) {
6
6
  return Effect.fn("AccountClock.logicalDay")(function* (instant?: DateTime.Utc) {
7
7
  const now = instant ?? (yield* DateTime.now);
8
- const local = DateTime.setZoneNamedUnsafe(now, timezone);
8
+ const local = DateTime.setZone(now, zone);
9
9
  const day = DateTime.formatIsoDate(local);
10
- return DateTime.isLessThan(now, yield* boundary(day, timezone, minutes))
11
- ? DateTime.makeUnsafe(day).pipe(DateTime.subtract({ days: 1 }), DateTime.formatIsoDateUtc)
12
- : day;
10
+ return DateTime.isLessThan(now, yield* boundary(day, timezone, minutes)) ? DateTime.formatIsoDate(DateTime.subtract(local, { days: 1 })) : day;
13
11
  });
14
12
  }