@beignet/core 0.0.1 → 0.0.3
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 +27 -0
- package/README.md +202 -8
- package/dist/application/index.d.ts +93 -9
- package/dist/application/index.d.ts.map +1 -1
- package/dist/application/index.js +11 -11
- package/dist/application/index.js.map +1 -1
- package/dist/client/client.d.ts +73 -12
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +37 -12
- package/dist/client/client.js.map +1 -1
- package/dist/client/index.d.ts +12 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +6 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +69 -8
- package/dist/client/types.d.ts.map +1 -1
- package/dist/config/index.d.ts +84 -0
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +36 -0
- package/dist/config/index.js.map +1 -1
- package/dist/contracts/contract-builder.d.ts +49 -22
- package/dist/contracts/contract-builder.d.ts.map +1 -1
- package/dist/contracts/contract-builder.js +48 -21
- package/dist/contracts/contract-builder.js.map +1 -1
- package/dist/contracts/contract-group.d.ts +35 -19
- package/dist/contracts/contract-group.d.ts.map +1 -1
- package/dist/contracts/contract-group.js +35 -19
- package/dist/contracts/contract-group.js.map +1 -1
- package/dist/contracts/contract-like.d.ts +4 -4
- package/dist/contracts/contract-like.d.ts.map +1 -1
- package/dist/contracts/contract-like.js +2 -1
- package/dist/contracts/contract-like.js.map +1 -1
- package/dist/contracts/index.d.ts +28 -0
- package/dist/contracts/index.d.ts.map +1 -1
- package/dist/contracts/index.js +12 -0
- package/dist/contracts/index.js.map +1 -1
- package/dist/contracts/openapi-meta.d.ts +8 -8
- package/dist/contracts/openapi-meta.d.ts.map +1 -1
- package/dist/contracts/path-template.d.ts +27 -0
- package/dist/contracts/path-template.d.ts.map +1 -1
- package/dist/contracts/path-template.js +6 -0
- package/dist/contracts/path-template.js.map +1 -1
- package/dist/contracts/types.d.ts +104 -10
- package/dist/contracts/types.d.ts.map +1 -1
- package/dist/contracts/types.js +15 -0
- package/dist/contracts/types.js.map +1 -1
- package/dist/contracts/utils.d.ts +6 -0
- package/dist/contracts/utils.d.ts.map +1 -1
- package/dist/contracts/utils.js +6 -0
- package/dist/contracts/utils.js.map +1 -1
- package/dist/domain/entity.d.ts +22 -11
- package/dist/domain/entity.d.ts.map +1 -1
- package/dist/domain/entity.js +5 -1
- package/dist/domain/entity.js.map +1 -1
- package/dist/domain/events.d.ts +5 -2
- package/dist/domain/events.d.ts.map +1 -1
- package/dist/domain/events.js +4 -1
- package/dist/domain/events.js.map +1 -1
- package/dist/domain/value-object.d.ts +19 -9
- package/dist/domain/value-object.d.ts.map +1 -1
- package/dist/domain/value-object.js +5 -1
- package/dist/domain/value-object.js.map +1 -1
- package/dist/errors/catalog.d.ts +40 -16
- package/dist/errors/catalog.d.ts.map +1 -1
- package/dist/errors/catalog.js +18 -7
- package/dist/errors/catalog.js.map +1 -1
- package/dist/errors/response.d.ts +16 -4
- package/dist/errors/response.d.ts.map +1 -1
- package/dist/errors/response.js +3 -3
- package/dist/errors/response.js.map +1 -1
- package/dist/errors/validation.d.ts +10 -1
- package/dist/errors/validation.d.ts.map +1 -1
- package/dist/errors/validation.js +3 -0
- package/dist/errors/validation.js.map +1 -1
- package/dist/events/index.d.ts +133 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +30 -0
- package/dist/events/index.js.map +1 -1
- package/dist/idempotency/index.d.ts +355 -0
- package/dist/idempotency/index.d.ts.map +1 -0
- package/dist/idempotency/index.js +360 -0
- package/dist/idempotency/index.js.map +1 -0
- package/dist/jobs/index.d.ts +248 -4
- package/dist/jobs/index.d.ts.map +1 -1
- package/dist/jobs/index.js +183 -1
- package/dist/jobs/index.js.map +1 -1
- package/dist/mail/index.d.ts +149 -0
- package/dist/mail/index.d.ts.map +1 -1
- package/dist/mail/index.js +30 -0
- package/dist/mail/index.js.map +1 -1
- package/dist/notifications/index.d.ts +369 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +310 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/openapi/index.d.ts +132 -16
- package/dist/openapi/index.d.ts.map +1 -1
- package/dist/openapi/index.js +1 -1
- package/dist/openapi/index.js.map +1 -1
- package/dist/outbox/index.d.ts +474 -0
- package/dist/outbox/index.d.ts.map +1 -0
- package/dist/outbox/index.js +538 -0
- package/dist/outbox/index.js.map +1 -0
- package/dist/pagination/index.d.ts +166 -0
- package/dist/pagination/index.d.ts.map +1 -0
- package/dist/pagination/index.js +96 -0
- package/dist/pagination/index.js.map +1 -0
- package/dist/ports/audit.d.ts +271 -0
- package/dist/ports/audit.d.ts.map +1 -1
- package/dist/ports/audit.js +128 -0
- package/dist/ports/audit.js.map +1 -1
- package/dist/ports/auth.d.ts +70 -0
- package/dist/ports/auth.d.ts.map +1 -1
- package/dist/ports/auth.js +30 -0
- package/dist/ports/auth.js.map +1 -1
- package/dist/ports/cache.d.ts +41 -0
- package/dist/ports/cache.d.ts.map +1 -1
- package/dist/ports/cache.js +10 -0
- package/dist/ports/cache.js.map +1 -1
- package/dist/ports/clock.d.ts +38 -0
- package/dist/ports/clock.d.ts.map +1 -1
- package/dist/ports/clock.js +20 -0
- package/dist/ports/clock.js.map +1 -1
- package/dist/ports/id-generator.d.ts +37 -0
- package/dist/ports/id-generator.d.ts.map +1 -1
- package/dist/ports/id-generator.js +22 -0
- package/dist/ports/id-generator.js.map +1 -1
- package/dist/ports/index.d.ts +83 -0
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +41 -5
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/logger.d.ts +56 -0
- package/dist/ports/logger.d.ts.map +1 -1
- package/dist/ports/logger.js +17 -0
- package/dist/ports/logger.js.map +1 -1
- package/dist/ports/policy.d.ts +132 -0
- package/dist/ports/policy.d.ts.map +1 -1
- package/dist/ports/policy.js +45 -0
- package/dist/ports/policy.js.map +1 -1
- package/dist/ports/rate-limit.d.ts +25 -0
- package/dist/ports/rate-limit.d.ts.map +1 -1
- package/dist/ports/rate-limit.js +10 -0
- package/dist/ports/rate-limit.js.map +1 -1
- package/dist/ports/redaction.d.ts +101 -0
- package/dist/ports/redaction.d.ts.map +1 -1
- package/dist/ports/redaction.js +59 -0
- package/dist/ports/redaction.js.map +1 -1
- package/dist/ports/storage.d.ts +100 -0
- package/dist/ports/storage.d.ts.map +1 -1
- package/dist/ports/storage.js +10 -0
- package/dist/ports/storage.js.map +1 -1
- package/dist/ports/testing.d.ts +47 -0
- package/dist/ports/testing.d.ts.map +1 -1
- package/dist/ports/testing.js +23 -0
- package/dist/ports/testing.js.map +1 -1
- package/dist/ports/unit-of-work.d.ts +60 -3
- package/dist/ports/unit-of-work.d.ts.map +1 -1
- package/dist/ports/unit-of-work.js +11 -2
- package/dist/ports/unit-of-work.js.map +1 -1
- package/dist/providers/instrumentation.d.ts +205 -1
- package/dist/providers/instrumentation.d.ts.map +1 -1
- package/dist/providers/instrumentation.js +14 -0
- package/dist/providers/instrumentation.js.map +1 -1
- package/dist/providers/provider.d.ts +14 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js.map +1 -1
- package/dist/schedules/index.d.ts +246 -0
- package/dist/schedules/index.d.ts.map +1 -1
- package/dist/schedules/index.js +27 -0
- package/dist/schedules/index.js.map +1 -1
- package/dist/server/health.d.ts +14 -5
- package/dist/server/health.d.ts.map +1 -1
- package/dist/server/health.js +5 -2
- package/dist/server/health.js.map +1 -1
- package/dist/server/hooks/auth.d.ts +68 -26
- package/dist/server/hooks/auth.d.ts.map +1 -1
- package/dist/server/hooks/auth.js +44 -55
- package/dist/server/hooks/auth.js.map +1 -1
- package/dist/server/hooks/cors.d.ts +27 -0
- package/dist/server/hooks/cors.d.ts.map +1 -1
- package/dist/server/hooks/cors.js +12 -0
- package/dist/server/hooks/cors.js.map +1 -1
- package/dist/server/hooks/errors.d.ts +15 -6
- package/dist/server/hooks/errors.d.ts.map +1 -1
- package/dist/server/hooks/errors.js.map +1 -1
- package/dist/server/hooks/index.d.ts +4 -1
- package/dist/server/hooks/index.d.ts.map +1 -1
- package/dist/server/hooks/index.js +3 -0
- package/dist/server/hooks/index.js.map +1 -1
- package/dist/server/hooks/logging.d.ts +36 -0
- package/dist/server/hooks/logging.d.ts.map +1 -1
- package/dist/server/hooks/logging.js +6 -0
- package/dist/server/hooks/logging.js.map +1 -1
- package/dist/server/hooks/rate-limit.d.ts +33 -0
- package/dist/server/hooks/rate-limit.d.ts.map +1 -1
- package/dist/server/hooks/rate-limit.js +11 -0
- package/dist/server/hooks/rate-limit.js.map +1 -1
- package/dist/server/http.d.ts +222 -0
- package/dist/server/http.d.ts.map +1 -1
- package/dist/server/http.js +20 -1
- package/dist/server/http.js.map +1 -1
- package/dist/server/index.d.ts +19 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +7 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/openapi.d.ts +5 -3
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/openapi.js +4 -2
- package/dist/server/openapi.js.map +1 -1
- package/dist/server/providers/loadProviderConfig.d.ts +9 -0
- package/dist/server/providers/loadProviderConfig.d.ts.map +1 -1
- package/dist/server/providers/loadProviderConfig.js +9 -0
- package/dist/server/providers/loadProviderConfig.js.map +1 -1
- package/dist/server/server.d.ts +159 -19
- package/dist/server/server.d.ts.map +1 -1
- package/dist/server/server.js +72 -31
- package/dist/server/server.js.map +1 -1
- package/dist/testing/index.d.ts +171 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +127 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/uploads/client.d.ts +278 -0
- package/dist/uploads/client.d.ts.map +1 -0
- package/dist/uploads/client.js +428 -0
- package/dist/uploads/client.js.map +1 -0
- package/dist/uploads/index.d.ts +361 -0
- package/dist/uploads/index.d.ts.map +1 -0
- package/dist/uploads/index.js +543 -0
- package/dist/uploads/index.js.map +1 -0
- package/package.json +31 -2
- package/src/application/index.ts +85 -22
- package/src/client/client.ts +73 -12
- package/src/client/index.ts +12 -0
- package/src/client/types.ts +70 -9
- package/src/config/index.ts +86 -0
- package/src/contracts/contract-builder.ts +49 -22
- package/src/contracts/contract-group.ts +35 -19
- package/src/contracts/contract-like.ts +4 -4
- package/src/contracts/index.ts +28 -1
- package/src/contracts/openapi-meta.ts +8 -8
- package/src/contracts/path-template.ts +27 -0
- package/src/contracts/types.ts +111 -10
- package/src/contracts/utils.ts +6 -0
- package/src/domain/entity.ts +22 -11
- package/src/domain/events.ts +5 -2
- package/src/domain/value-object.ts +19 -9
- package/src/errors/catalog.ts +40 -16
- package/src/errors/response.ts +16 -4
- package/src/errors/validation.ts +10 -1
- package/src/events/index.ts +134 -0
- package/src/idempotency/index.ts +767 -0
- package/src/jobs/index.ts +437 -5
- package/src/mail/index.ts +149 -0
- package/src/notifications/index.ts +771 -0
- package/src/openapi/index.ts +133 -16
- package/src/outbox/index.ts +1104 -0
- package/src/pagination/index.ts +278 -0
- package/src/ports/audit.ts +271 -0
- package/src/ports/auth.ts +70 -0
- package/src/ports/cache.ts +41 -0
- package/src/ports/clock.ts +38 -0
- package/src/ports/id-generator.ts +37 -0
- package/src/ports/index.ts +106 -11
- package/src/ports/logger.ts +56 -0
- package/src/ports/policy.ts +133 -0
- package/src/ports/rate-limit.ts +25 -0
- package/src/ports/redaction.ts +101 -0
- package/src/ports/storage.ts +100 -0
- package/src/ports/testing.ts +47 -0
- package/src/ports/unit-of-work.ts +60 -3
- package/src/providers/instrumentation.ts +211 -1
- package/src/providers/provider.ts +14 -1
- package/src/schedules/index.ts +247 -0
- package/src/server/health.ts +14 -5
- package/src/server/hooks/auth.ts +105 -120
- package/src/server/hooks/cors.ts +27 -0
- package/src/server/hooks/errors.ts +15 -6
- package/src/server/hooks/index.ts +4 -5
- package/src/server/hooks/logging.ts +36 -0
- package/src/server/hooks/rate-limit.ts +33 -0
- package/src/server/http.ts +249 -1
- package/src/server/index.ts +19 -1
- package/src/server/openapi.ts +5 -3
- package/src/server/providers/loadProviderConfig.ts +9 -0
- package/src/server/server.ts +296 -30
- package/src/testing/index.ts +348 -0
- package/src/uploads/client.ts +861 -0
- package/src/uploads/index.ts +1067 -0
package/dist/ports/audit.js
CHANGED
|
@@ -1,19 +1,108 @@
|
|
|
1
1
|
import { redactValue } from "./redaction";
|
|
2
|
+
/**
|
|
3
|
+
* Create an anonymous actor descriptor for unauthenticated activity.
|
|
4
|
+
*
|
|
5
|
+
* This helper only creates a normalized context value. It does not perform
|
|
6
|
+
* authentication.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const actor = createAnonymousActor();
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param options - Optional display name or metadata to include.
|
|
14
|
+
* @returns An activity actor with `type: "anonymous"`.
|
|
15
|
+
*/
|
|
2
16
|
export function createAnonymousActor(options = {}) {
|
|
3
17
|
return { type: "anonymous", ...options };
|
|
4
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Create a service actor descriptor for work initiated by another service or
|
|
21
|
+
* integration.
|
|
22
|
+
*
|
|
23
|
+
* This is useful for webhooks, internal service calls, or integration-driven
|
|
24
|
+
* background jobs.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const actor = createServiceActor("stripe-webhook");
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param id - Stable service or integration ID.
|
|
32
|
+
* @param options - Optional display name or metadata to include.
|
|
33
|
+
* @returns An activity actor with `type: "service"`.
|
|
34
|
+
*/
|
|
5
35
|
export function createServiceActor(id, options = {}) {
|
|
6
36
|
return { type: "service", id, ...options };
|
|
7
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Create a system actor descriptor for framework or app-owned background work.
|
|
40
|
+
*
|
|
41
|
+
* Use this for scheduled tasks, scripts, maintenance jobs, and other work that
|
|
42
|
+
* is not directly caused by a user or external service.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const actor = createSystemActor("nightly-maintenance");
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @param id - Stable system actor ID. Defaults to `"system"`.
|
|
50
|
+
* @param options - Optional display name or metadata to include.
|
|
51
|
+
* @returns An activity actor with `type: "system"`.
|
|
52
|
+
*/
|
|
8
53
|
export function createSystemActor(id = "system", options = {}) {
|
|
9
54
|
return { type: "system", id, ...options };
|
|
10
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Create a user actor descriptor for authenticated user activity.
|
|
58
|
+
*
|
|
59
|
+
* This helper only normalizes a known user ID for context, authorization,
|
|
60
|
+
* audit, and diagnostics. It does not verify a session or load a user record.
|
|
61
|
+
* Resolve authentication first, then call this helper with the authenticated
|
|
62
|
+
* user ID.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const actor = createUserActor(session.user.id, {
|
|
67
|
+
* displayName: session.user.name,
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* @param id - Stable application user ID.
|
|
72
|
+
* @param options - Optional display name or metadata to include.
|
|
73
|
+
* @returns An activity actor with `type: "user"`.
|
|
74
|
+
*/
|
|
11
75
|
export function createUserActor(id, options = {}) {
|
|
12
76
|
return { type: "user", id, ...options };
|
|
13
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Create a tenant/account/workspace descriptor for request or background
|
|
80
|
+
* context.
|
|
81
|
+
*
|
|
82
|
+
* This helper only creates a normalized context value used by audit,
|
|
83
|
+
* authorization, logs, and diagnostics. It does not create, load, or persist a
|
|
84
|
+
* tenant record.
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```ts
|
|
88
|
+
* const tenant = createTenant(session.organizationId, {
|
|
89
|
+
* slug: session.organizationSlug,
|
|
90
|
+
* });
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @param id - Stable tenant/account/workspace ID.
|
|
94
|
+
* @param options - Optional slug or metadata to include.
|
|
95
|
+
* @returns A normalized activity tenant descriptor.
|
|
96
|
+
*/
|
|
14
97
|
export function createTenant(id, options = {}) {
|
|
15
98
|
return { id, ...options };
|
|
16
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Fill default audit fields for an input entry.
|
|
102
|
+
*
|
|
103
|
+
* @param entry - Partial audit entry accepted by `AuditLogPort.record(...)`.
|
|
104
|
+
* @returns A complete audit entry with `occurredAt` and `outcome` populated.
|
|
105
|
+
*/
|
|
17
106
|
export function normalizeAuditLogEntry(entry) {
|
|
18
107
|
return {
|
|
19
108
|
...entry,
|
|
@@ -21,6 +110,15 @@ export function normalizeAuditLogEntry(entry) {
|
|
|
21
110
|
outcome: entry.outcome ?? "success",
|
|
22
111
|
};
|
|
23
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* Redact metadata on an already-normalized audit entry.
|
|
115
|
+
*
|
|
116
|
+
* This redacts metadata values on the entry, actor, tenant, and resource using
|
|
117
|
+
* the default redaction rules from `redactValue(...)`.
|
|
118
|
+
*
|
|
119
|
+
* @param entry - Audit entry to redact.
|
|
120
|
+
* @returns A shallow copy with redacted metadata fields.
|
|
121
|
+
*/
|
|
24
122
|
export function redactAuditLogEntry(entry) {
|
|
25
123
|
return {
|
|
26
124
|
...entry,
|
|
@@ -49,6 +147,16 @@ export function redactAuditLogEntry(entry) {
|
|
|
49
147
|
metadata: entry.metadata ? redactValue(entry.metadata) : entry.metadata,
|
|
50
148
|
};
|
|
51
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Wrap an audit log port with default audit metadata redaction.
|
|
152
|
+
*
|
|
153
|
+
* Use this around durable adapters so application code can record entries
|
|
154
|
+
* without each call site remembering to redact metadata.
|
|
155
|
+
*
|
|
156
|
+
* @param audit - Underlying audit log port to write to after redaction.
|
|
157
|
+
* @param options - Optional final redaction/customization hook.
|
|
158
|
+
* @returns An audit log port that normalizes and redacts before writing.
|
|
159
|
+
*/
|
|
52
160
|
export function createRedactedAuditLog(audit, options = {}) {
|
|
53
161
|
return {
|
|
54
162
|
record(entry) {
|
|
@@ -60,6 +168,26 @@ export function createRedactedAuditLog(audit, options = {}) {
|
|
|
60
168
|
},
|
|
61
169
|
};
|
|
62
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* Create an in-memory audit log for tests and local examples.
|
|
173
|
+
*
|
|
174
|
+
* Entries are normalized and redacted before being pushed into the shared
|
|
175
|
+
* `entries` array.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const audit = createMemoryAuditLog();
|
|
180
|
+
* await audit.record({
|
|
181
|
+
* action: "posts.publish",
|
|
182
|
+
* actor: createUserActor("user_1"),
|
|
183
|
+
* });
|
|
184
|
+
* expect(audit.entries).toHaveLength(1);
|
|
185
|
+
* ```
|
|
186
|
+
*
|
|
187
|
+
* @param entries - Optional backing array, useful when tests need shared state.
|
|
188
|
+
* @param options - Optional final redaction/customization hook.
|
|
189
|
+
* @returns An in-memory audit log port with captured `entries`.
|
|
190
|
+
*/
|
|
63
191
|
export function createMemoryAuditLog(entries = [], options = {}) {
|
|
64
192
|
return {
|
|
65
193
|
entries,
|
package/dist/ports/audit.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/ports/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/ports/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuN1C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB,CAClC,UAAuC,EAAE;IAEzC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE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G;AACH,MAAM,UAAU,oBAAoB,CAClC,UAA2B,EAAE,EAC7B,UAA2B,EAAE;IAE7B,OAAO;QACL,OAAO;QACP,MAAM,CAAC,KAAK;YACV,MAAM,UAAU,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CACV,OAAO,CAAC,MAAM;gBACZ,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;gBACjD,CAAC,CAAC,mBAAmB,CAAC,UAAU,CAAC,CACpC,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/ports/auth.d.ts
CHANGED
|
@@ -1,23 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal request shape consumed by Beignet auth ports.
|
|
3
|
+
*
|
|
4
|
+
* Framework adapters can pass richer request objects, but auth providers should
|
|
5
|
+
* only rely on headers and the optional raw platform request unless they
|
|
6
|
+
* declare a more specific `RequestLike` type.
|
|
7
|
+
*/
|
|
1
8
|
export interface AuthRequestLike {
|
|
9
|
+
/**
|
|
10
|
+
* Request headers used for cookies, bearer tokens, API keys, or provider
|
|
11
|
+
* specific auth data.
|
|
12
|
+
*/
|
|
2
13
|
headers: Headers;
|
|
14
|
+
/**
|
|
15
|
+
* Raw platform request, when the runtime has one available.
|
|
16
|
+
*/
|
|
3
17
|
raw?: Request;
|
|
4
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Normalized authenticated session returned by an `AuthPort`.
|
|
21
|
+
*
|
|
22
|
+
* `user` is the app/provider user object. `session` can carry provider-specific
|
|
23
|
+
* session state such as cookie session metadata or token claims.
|
|
24
|
+
*/
|
|
5
25
|
export interface AuthSession<User = unknown, Session = unknown> {
|
|
6
26
|
user: User;
|
|
7
27
|
session?: Session;
|
|
8
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Error thrown by auth helpers when a route or workflow requires a user but no
|
|
31
|
+
* authenticated user is available.
|
|
32
|
+
*/
|
|
9
33
|
export declare class AuthUnauthorizedError extends Error {
|
|
10
34
|
readonly code = "UNAUTHORIZED";
|
|
11
35
|
constructor(message?: string);
|
|
12
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* App-facing authentication port.
|
|
39
|
+
*
|
|
40
|
+
* Implement this with a provider adapter such as Better Auth, a custom session
|
|
41
|
+
* lookup, or a test fake. The port identifies the current user; it does not
|
|
42
|
+
* decide whether that user may perform a business action. Keep authorization in
|
|
43
|
+
* policies or use cases.
|
|
44
|
+
*/
|
|
13
45
|
export interface AuthPort<User = unknown, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike> {
|
|
46
|
+
/**
|
|
47
|
+
* Return the current session, or `null` when the request is unauthenticated.
|
|
48
|
+
*/
|
|
14
49
|
getSession(req: RequestLike): Promise<AuthSession<User, Session> | null>;
|
|
50
|
+
/**
|
|
51
|
+
* Return the current user, or `null` when unauthenticated.
|
|
52
|
+
*/
|
|
15
53
|
getUser(req: RequestLike): Promise<User | null>;
|
|
54
|
+
/**
|
|
55
|
+
* Return the current user or throw `AuthUnauthorizedError`.
|
|
56
|
+
*/
|
|
16
57
|
requireUser(req: RequestLike): Promise<User>;
|
|
17
58
|
}
|
|
18
59
|
type MaybePromise<T> = T | Promise<T>;
|
|
60
|
+
/**
|
|
61
|
+
* Request-aware factory for a static auth session.
|
|
62
|
+
*/
|
|
19
63
|
export type StaticAuthSessionFactory<User, Session, RequestLike extends AuthRequestLike> = (req: RequestLike) => MaybePromise<AuthSession<User, Session> | null>;
|
|
64
|
+
/**
|
|
65
|
+
* Create an auth port from a fixed session or request-aware session factory.
|
|
66
|
+
*
|
|
67
|
+
* This is useful for tests, examples, and simple apps. Production apps usually
|
|
68
|
+
* use a provider-backed auth port that verifies cookies, tokens, or sessions.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const auth = createStaticAuth({
|
|
73
|
+
* user: { id: "user_1", name: "Ada" },
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param session - Fixed session, `null`, or a function that resolves a session
|
|
78
|
+
* from the request.
|
|
79
|
+
* @returns An `AuthPort` implementation backed by the provided session source.
|
|
80
|
+
*/
|
|
20
81
|
export declare function createStaticAuth<User, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike>(session: AuthSession<User, Session> | null | StaticAuthSessionFactory<User, Session, RequestLike>): AuthPort<User, Session, RequestLike>;
|
|
82
|
+
/**
|
|
83
|
+
* Create an auth port that always treats requests as unauthenticated.
|
|
84
|
+
*
|
|
85
|
+
* Use this in tests or examples where auth is intentionally absent. It is not a
|
|
86
|
+
* security boundary; it simply returns `null` from `getSession`/`getUser` and
|
|
87
|
+
* throws from `requireUser`.
|
|
88
|
+
*
|
|
89
|
+
* @returns An `AuthPort` with no active session.
|
|
90
|
+
*/
|
|
21
91
|
export declare function createAnonymousAuth<User = unknown, Session = unknown, RequestLike extends AuthRequestLike = AuthRequestLike>(): AuthPort<User, Session, RequestLike>;
|
|
22
92
|
export {};
|
|
23
93
|
//# sourceMappingURL=auth.d.ts.map
|
package/dist/ports/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/ports/auth.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,WAAW,CAAC,IAAI,GAAG,OAAO,EAAE,OAAO,GAAG,OAAO;IAC5D,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,IAAI,kBAAkB;gBAEnB,OAAO,SAAiB;CAIrC;AAED,MAAM,WAAW,QAAQ,CACvB,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO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WAAW,CAAC,GACvD,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAqBtC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,WAAW,SAAS,eAAe,GAAG,eAAe,KAClD,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAExC"}
|
package/dist/ports/auth.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error thrown by auth helpers when a route or workflow requires a user but no
|
|
3
|
+
* authenticated user is available.
|
|
4
|
+
*/
|
|
1
5
|
export class AuthUnauthorizedError extends Error {
|
|
2
6
|
code = "UNAUTHORIZED";
|
|
3
7
|
constructor(message = "Unauthorized") {
|
|
@@ -5,6 +9,23 @@ export class AuthUnauthorizedError extends Error {
|
|
|
5
9
|
this.name = "AuthUnauthorizedError";
|
|
6
10
|
}
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Create an auth port from a fixed session or request-aware session factory.
|
|
14
|
+
*
|
|
15
|
+
* This is useful for tests, examples, and simple apps. Production apps usually
|
|
16
|
+
* use a provider-backed auth port that verifies cookies, tokens, or sessions.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const auth = createStaticAuth({
|
|
21
|
+
* user: { id: "user_1", name: "Ada" },
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param session - Fixed session, `null`, or a function that resolves a session
|
|
26
|
+
* from the request.
|
|
27
|
+
* @returns An `AuthPort` implementation backed by the provided session source.
|
|
28
|
+
*/
|
|
8
29
|
export function createStaticAuth(session) {
|
|
9
30
|
async function resolveSession(req) {
|
|
10
31
|
return typeof session === "function" ? session(req) : session;
|
|
@@ -25,6 +46,15 @@ export function createStaticAuth(session) {
|
|
|
25
46
|
},
|
|
26
47
|
};
|
|
27
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Create an auth port that always treats requests as unauthenticated.
|
|
51
|
+
*
|
|
52
|
+
* Use this in tests or examples where auth is intentionally absent. It is not a
|
|
53
|
+
* security boundary; it simply returns `null` from `getSession`/`getUser` and
|
|
54
|
+
* throws from `requireUser`.
|
|
55
|
+
*
|
|
56
|
+
* @returns An `AuthPort` with no active session.
|
|
57
|
+
*/
|
|
28
58
|
export function createAnonymousAuth() {
|
|
29
59
|
return createStaticAuth(null);
|
|
30
60
|
}
|
package/dist/ports/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/ports/auth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/ports/auth.ts"],"names":[],"mappings":"AA8BA;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACrC,IAAI,GAAG,cAAc,CAAC;IAE/B,YAAY,OAAO,GAAG,cAAc;QAClC,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAwCD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,gBAAgB,CAK9B,OAGwD;IAExD,KAAK,UAAU,cAAc,CAAC,GAAgB;QAC5C,OAAO,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,CAAC;IAED,OAAO;QACL,KAAK,CAAC,UAAU,CAAC,GAAG;YAClB,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;QACD,KAAK,CAAC,OAAO,CAAC,GAAG;YACf,OAAO,CAAC,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;QACnD,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,GAAG;YACnB,MAAM,IAAI,GAAG,CAAC,MAAM,cAAc,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;YACvD,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,qBAAqB,EAAE,CAAC;YACpC,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB;IAKjC,OAAO,gBAAgB,CAA6B,IAAI,CAAC,CAAC;AAC5D,CAAC"}
|
package/dist/ports/cache.d.ts
CHANGED
|
@@ -1,15 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for storing a cache value.
|
|
3
|
+
*/
|
|
1
4
|
export interface CacheSetOptions {
|
|
2
5
|
/**
|
|
3
6
|
* Time-to-live in seconds. Omit this for a value that does not expire.
|
|
4
7
|
*/
|
|
5
8
|
ttlSeconds?: number;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* App-facing string cache port.
|
|
12
|
+
*
|
|
13
|
+
* Values are intentionally strings so adapters can map cleanly to Redis,
|
|
14
|
+
* Upstash, and other key/value stores. Serialize structured values at the app
|
|
15
|
+
* boundary.
|
|
16
|
+
*/
|
|
7
17
|
export interface CachePort {
|
|
18
|
+
/**
|
|
19
|
+
* Return a fresh value for `key`, or `null` when missing or expired.
|
|
20
|
+
*/
|
|
8
21
|
get(key: string): Promise<string | null>;
|
|
22
|
+
/**
|
|
23
|
+
* Store a string value.
|
|
24
|
+
*/
|
|
9
25
|
set(key: string, value: string, options?: CacheSetOptions): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a cache key.
|
|
28
|
+
*
|
|
29
|
+
* @returns `true` when the key existed.
|
|
30
|
+
*/
|
|
10
31
|
delete(key: string): Promise<boolean>;
|
|
32
|
+
/**
|
|
33
|
+
* Return whether a fresh value exists for `key`.
|
|
34
|
+
*/
|
|
11
35
|
has(key: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Return a cached value or compute, store, and return a new value.
|
|
38
|
+
*
|
|
39
|
+
* Implementations are not required to provide single-flight behavior. If
|
|
40
|
+
* concurrent cache fills matter, choose an adapter that documents that
|
|
41
|
+
* guarantee or protect the factory at the application layer.
|
|
42
|
+
*/
|
|
12
43
|
remember(key: string, factory: () => Promise<string>, options?: CacheSetOptions): Promise<string>;
|
|
13
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Create an in-memory cache for tests, examples, and single-process
|
|
47
|
+
* development.
|
|
48
|
+
*
|
|
49
|
+
* This adapter is not durable or distributed. Values are lost when the process
|
|
50
|
+
* exits and are not shared across workers, regions, or serverless invocations.
|
|
51
|
+
*
|
|
52
|
+
* @param initialValues - Optional initial string values without TTL.
|
|
53
|
+
* @returns A cache port backed by a local `Map`.
|
|
54
|
+
*/
|
|
14
55
|
export declare function createMemoryCache(initialValues?: Record<string, string>): CachePort;
|
|
15
56
|
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAuBD,wBAAgB,iBAAiB,CAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACzC,SAAS,CAmDX"}
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1E;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACnC;;;;;;OAMG;IACH,QAAQ,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EAC9B,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAAC;CACpB;AAuBD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACzC,SAAS,CAmDX"}
|
package/dist/ports/cache.js
CHANGED
|
@@ -10,6 +10,16 @@ function resolveExpiresAt(options) {
|
|
|
10
10
|
function isExpired(entry) {
|
|
11
11
|
return entry.expiresAt != null && entry.expiresAt <= Date.now();
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Create an in-memory cache for tests, examples, and single-process
|
|
15
|
+
* development.
|
|
16
|
+
*
|
|
17
|
+
* This adapter is not durable or distributed. Values are lost when the process
|
|
18
|
+
* exits and are not shared across workers, regions, or serverless invocations.
|
|
19
|
+
*
|
|
20
|
+
* @param initialValues - Optional initial string values without TTL.
|
|
21
|
+
* @returns A cache port backed by a local `Map`.
|
|
22
|
+
*/
|
|
13
23
|
export function createMemoryCache(initialValues = {}) {
|
|
14
24
|
const values = new Map(Object.entries(initialValues).map(([key, value]) => [
|
|
15
25
|
key,
|
package/dist/ports/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/ports/cache.ts"],"names":[],"mappings":"AAuDA,SAAS,gBAAgB,CAAC,OAAoC;IAC5D,IAAI,OAAO,EAAE,UAAU,IAAI,IAAI,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;AAChD,CAAC;AAED,SAAS,SAAS,CAAC,KAAuB;IACxC,OAAO,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AAClE,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB,CAC/B,gBAAwC,EAAE;IAE1C,MAAM,MAAM,GAAG,IAAI,GAAG,CACpB,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,GAAG,CAA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CAAC;YAChB,CAAC;YAED,MAAM,KAAK,GAAG,MAAM,OAAO,EAAE,CAAC;YAC9B,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;KACF,CAAC;IAEF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/ports/clock.d.ts
CHANGED
|
@@ -1,10 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-facing time source.
|
|
3
|
+
*
|
|
4
|
+
* Use this port anywhere deterministic time matters, such as use-case tests,
|
|
5
|
+
* scheduled work, idempotency windows, or audit timestamps.
|
|
6
|
+
*/
|
|
1
7
|
export interface ClockPort {
|
|
8
|
+
/**
|
|
9
|
+
* Return the current time according to this clock.
|
|
10
|
+
*/
|
|
2
11
|
now(): Date;
|
|
3
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Mutable clock implementation used by tests.
|
|
15
|
+
*/
|
|
4
16
|
export interface FrozenClockPort extends ClockPort {
|
|
17
|
+
/**
|
|
18
|
+
* Replace the current time.
|
|
19
|
+
*/
|
|
5
20
|
setNow(value: Date | string | number): void;
|
|
21
|
+
/**
|
|
22
|
+
* Move the current time forward by the given number of milliseconds.
|
|
23
|
+
*/
|
|
6
24
|
advance(milliseconds: number): void;
|
|
7
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Create a clock backed by `new Date()`.
|
|
28
|
+
*
|
|
29
|
+
* Use this as the default production `ClockPort` when the app does not need a
|
|
30
|
+
* provider-specific time source.
|
|
31
|
+
*
|
|
32
|
+
* @returns A clock that reads the current system time.
|
|
33
|
+
*/
|
|
8
34
|
export declare function createSystemClock(): ClockPort;
|
|
35
|
+
/**
|
|
36
|
+
* Create a mutable clock for deterministic tests.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const clock = createFrozenClock("2026-01-01T00:00:00.000Z");
|
|
41
|
+
* clock.advance(1000);
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param initial - Initial time for the clock. Defaults to Unix epoch.
|
|
45
|
+
* @returns A clock whose time can be replaced or advanced.
|
|
46
|
+
*/
|
|
9
47
|
export declare function createFrozenClock(initial?: Date | string | number): FrozenClockPort;
|
|
10
48
|
//# sourceMappingURL=clock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,GAAG,IAAI,IAAI,CAAC;CACb;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAMD,wBAAgB,iBAAiB,IAAI,SAAS,CAI7C;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,IAAI,GAAG,MAAM,GAAG,MAAoB,GAC5C,eAAe,CAYjB"}
|
|
1
|
+
{"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,GAAG,IAAI,IAAI,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC5C;;OAEG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAMD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,SAAS,CAI7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,GAAE,IAAI,GAAG,MAAM,GAAG,MAAoB,GAC5C,eAAe,CAYjB"}
|
package/dist/ports/clock.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
function toDate(value) {
|
|
2
2
|
return value instanceof Date ? new Date(value.getTime()) : new Date(value);
|
|
3
3
|
}
|
|
4
|
+
/**
|
|
5
|
+
* Create a clock backed by `new Date()`.
|
|
6
|
+
*
|
|
7
|
+
* Use this as the default production `ClockPort` when the app does not need a
|
|
8
|
+
* provider-specific time source.
|
|
9
|
+
*
|
|
10
|
+
* @returns A clock that reads the current system time.
|
|
11
|
+
*/
|
|
4
12
|
export function createSystemClock() {
|
|
5
13
|
return {
|
|
6
14
|
now: () => new Date(),
|
|
7
15
|
};
|
|
8
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Create a mutable clock for deterministic tests.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const clock = createFrozenClock("2026-01-01T00:00:00.000Z");
|
|
23
|
+
* clock.advance(1000);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param initial - Initial time for the clock. Defaults to Unix epoch.
|
|
27
|
+
* @returns A clock whose time can be replaced or advanced.
|
|
28
|
+
*/
|
|
9
29
|
export function createFrozenClock(initial = new Date(0)) {
|
|
10
30
|
let current = toDate(initial);
|
|
11
31
|
return {
|
package/dist/ports/clock.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clock.js","sourceRoot":"","sources":["../../src/ports/clock.ts"],"names":[],"mappings":"AA2BA,SAAS,MAAM,CAAC,KAA6B;IAC3C,OAAO,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;KACtB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iBAAiB,CAC/B,UAAkC,IAAI,IAAI,CAAC,CAAC,CAAC;IAE7C,IAAI,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;IAE9B,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,EAAE,CAAC,YAAY,EAAE,EAAE;YACxB,OAAO,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC;QACvD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App-facing ID generation port.
|
|
3
|
+
*
|
|
4
|
+
* Use this when deterministic IDs matter in use-case tests or when production
|
|
5
|
+
* infrastructure owns ID generation.
|
|
6
|
+
*/
|
|
1
7
|
export interface IdGeneratorPort {
|
|
8
|
+
/**
|
|
9
|
+
* Return the next ID.
|
|
10
|
+
*/
|
|
2
11
|
nextId(): string;
|
|
3
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Mutable sequential ID generator used by tests and simple examples.
|
|
15
|
+
*/
|
|
4
16
|
export interface SequenceIdGeneratorPort extends IdGeneratorPort {
|
|
17
|
+
/**
|
|
18
|
+
* Reset the next sequence value.
|
|
19
|
+
*/
|
|
5
20
|
reset(next?: number): void;
|
|
6
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Create an ID generator backed by `globalThis.crypto.randomUUID()`.
|
|
24
|
+
*
|
|
25
|
+
* The factory itself does not read from `crypto`; the returned generator's
|
|
26
|
+
* `nextId()` method throws if the current runtime does not expose
|
|
27
|
+
* `globalThis.crypto.randomUUID()`.
|
|
28
|
+
*
|
|
29
|
+
* @returns An ID generator that returns UUID strings from `nextId()`.
|
|
30
|
+
*/
|
|
7
31
|
export declare function createUuidIdGenerator(): IdGeneratorPort;
|
|
32
|
+
/**
|
|
33
|
+
* Create a deterministic sequence ID generator for tests and examples.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const ids = createSequenceIdGenerator({ prefix: "post", start: 10 });
|
|
38
|
+
* ids.nextId(); // "post_10"
|
|
39
|
+
* ids.nextId(); // "post_11"
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @param options - Optional ID prefix and starting sequence number.
|
|
43
|
+
* @returns A mutable sequence ID generator.
|
|
44
|
+
*/
|
|
8
45
|
export declare function createSequenceIdGenerator(options?: {
|
|
9
46
|
prefix?: string;
|
|
10
47
|
start?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,eAAe;IAC9B,MAAM,IAAI,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAYvD;AAED,wBAAgB,yBAAyB,CACvC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,uBAAuB,CAWzB"}
|
|
1
|
+
{"version":3,"file":"id-generator.d.ts","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAYvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAChD,uBAAuB,CAWzB"}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create an ID generator backed by `globalThis.crypto.randomUUID()`.
|
|
3
|
+
*
|
|
4
|
+
* The factory itself does not read from `crypto`; the returned generator's
|
|
5
|
+
* `nextId()` method throws if the current runtime does not expose
|
|
6
|
+
* `globalThis.crypto.randomUUID()`.
|
|
7
|
+
*
|
|
8
|
+
* @returns An ID generator that returns UUID strings from `nextId()`.
|
|
9
|
+
*/
|
|
1
10
|
export function createUuidIdGenerator() {
|
|
2
11
|
return {
|
|
3
12
|
nextId: () => {
|
|
@@ -8,6 +17,19 @@ export function createUuidIdGenerator() {
|
|
|
8
17
|
},
|
|
9
18
|
};
|
|
10
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Create a deterministic sequence ID generator for tests and examples.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const ids = createSequenceIdGenerator({ prefix: "post", start: 10 });
|
|
26
|
+
* ids.nextId(); // "post_10"
|
|
27
|
+
* ids.nextId(); // "post_11"
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @param options - Optional ID prefix and starting sequence number.
|
|
31
|
+
* @returns A mutable sequence ID generator.
|
|
32
|
+
*/
|
|
11
33
|
export function createSequenceIdGenerator(options = {}) {
|
|
12
34
|
const prefix = options.prefix ?? "id";
|
|
13
35
|
const start = options.start ?? 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"id-generator.js","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"id-generator.js","sourceRoot":"","sources":["../../src/ports/id-generator.ts"],"names":[],"mappings":"AAuBA;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB;IACnC,OAAO;QACL,MAAM,EAAE,GAAG,EAAE;YACX,IAAI,OAAO,UAAU,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,EAAE,CAAC;gBACxD,MAAM,IAAI,KAAK,CACb,kHAAkH,CACnH,CAAC;YACJ,CAAC;YAED,OAAO,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;QACxC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,yBAAyB,CACvC,UAA+C,EAAE;IAEjD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;IACtC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC;IACjC,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,OAAO;QACL,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,IAAI,IAAI,EAAE,EAAE;QACnC,KAAK,EAAE,CAAC,KAAK,GAAG,KAAK,EAAE,EAAE;YACvB,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;KACF,CAAC;AACJ,CAAC"}
|