@systemfsoftware/effect-cell-types 6.0.1 → 7.0.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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +5 -43
- package/dist/index.mjs +1 -45
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @systemfsoftware/effect-cell-types
|
|
2
2
|
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- Removes the `Wire` namespace: `Wire.wire`, `Wire.mint`, and the `Wire.Mark`, `Wire.Minted`, `Wire.AnyMinted`, `Wire.MintedField`, and `Wire.Fields` types. Build your schema structs with Effect Schema directly: `Wire.wire({ ... })` becomes `Schema.Struct({ ... })`, and `Wire.mint(schema)` becomes `schema` itself — the call never changed the schema. A foreign schema can again be placed directly as a struct member; nothing in this package refuses it.
|
|
8
|
+
|
|
3
9
|
## 6.0.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2,10 +2,9 @@ import * as Effect$1 from "effect/Effect";
|
|
|
2
2
|
import { Effect } from "effect/Effect";
|
|
3
3
|
import * as Result$1 from "effect/Result";
|
|
4
4
|
import { Result } from "effect/Result";
|
|
5
|
-
import { Schema } from "effect";
|
|
6
5
|
import { Kind, TypeLambda } from "effect/HKT";
|
|
7
6
|
import { Layer } from "effect/Layer";
|
|
8
|
-
import * as Schema
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
9
8
|
//#region src/Facts.d.ts
|
|
10
9
|
declare const DESCRIPTION_MODULE: '@systemfsoftware/effect-cell-types';
|
|
11
10
|
declare const IO_CELLS: {
|
|
@@ -52,9 +51,9 @@ type DecisionShape<D> = [unknown] extends [D] ? unknown : AtLeastTwoDistinct<D>
|
|
|
52
51
|
type Workflow<Command, Decision, DecisionError> = [Decision] extends [never] ? UninhabitedDecision : [DecisionError] extends [never] ? UninhabitedError : ((command: Command) => Result<Decision, DecisionError>) & WorkflowBrand;
|
|
53
52
|
type DispatchableTag<E> = '_tag' extends keyof E ? [E['_tag']] extends [string] ? unknown : UntaggedError : UntaggedError;
|
|
54
53
|
type Inhabited<Decision, DecisionError> = [Decision] extends [never] ? UninhabitedDecision : [DecisionError] extends [never] ? UninhabitedError : DecisionShape<Decision> & DispatchableTag<DecisionError>;
|
|
55
|
-
declare const make: <Self, S extends Schema
|
|
56
|
-
readonly fields: Schema
|
|
57
|
-
}, Inherited, D, E>(_command: Schema
|
|
54
|
+
declare const make: <Self, S extends Schema.Constraint & {
|
|
55
|
+
readonly fields: Schema.Struct.Fields;
|
|
56
|
+
}, Inherited, D, E>(_command: Schema.Class<Self, S, Inherited>, decide: (command: Self) => Result<D, E> & Inhabited<D, E>) => Workflow<Self, D, E>;
|
|
58
57
|
declare namespace Cell_d_exports {
|
|
59
58
|
export { Cell, CellTypeId, DESCRIPTION_MODULE, IO_CELLS, IoCellClassification, Kind$1 as Kind, PhaseName, Run, TypeLambda$1 as TypeLambda, Vocabulary, andThen, layer, map, mapInput, provide, run, vocabulary, withPolicy, zip };
|
|
60
59
|
}
|
|
@@ -199,42 +198,5 @@ interface Vocabulary {
|
|
|
199
198
|
readonly composer: 'layer';
|
|
200
199
|
}
|
|
201
200
|
declare const vocabulary: Vocabulary;
|
|
202
|
-
declare namespace Wire_d_exports {
|
|
203
|
-
export { AnyMinted, Fields, Mark, Minted, MintedField, mint, wire };
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Marker a wire member carries once this workspace declares its type. The property type is the
|
|
207
|
-
* fix, so the compiler diagnostic names it.
|
|
208
|
-
*
|
|
209
|
-
* It sits on the schema, never on the decoded value: `Schema.Type<typeof Wire.mint(S.String)>` is `string`.
|
|
210
|
-
*/
|
|
211
|
-
interface Mark {
|
|
212
|
-
readonly __WIRE_MEMBER_IS_NOT_BUILT_FROM_THE_ALPHABET__: 'this member names a type this workspace does not declare; build it from Wire, or admit a foreign schema deliberately with Wire.mint';
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* A schema this workspace declares the type of. In v4 the encoded side lives on the schema
|
|
216
|
-
* itself, so the second parameter is carried for API stability rather than as a separate
|
|
217
|
-
* type argument: `Minted<A, I>` reads "decodes `A` from the wire's `I`-shaped payload".
|
|
218
|
-
*/
|
|
219
|
-
type Minted<A, I = A> = Schema.Codec<A, I> & Mark;
|
|
220
|
-
/** Any marked schema, for constraint positions. */
|
|
221
|
-
type AnyMinted = Schema.Top & Mark;
|
|
222
|
-
/**
|
|
223
|
-
* Any marked struct member — a schema, or a property signature from `S.optional`.
|
|
224
|
-
* The permissive `Constraint` arm rather than a narrower schema type, whose `never` variants
|
|
225
|
-
* would fail the assignability check before the marker is reached, leaving the diagnostic to
|
|
226
|
-
* report an unrelated type error.
|
|
227
|
-
*/
|
|
228
|
-
type MintedField = Schema.Constraint & Mark;
|
|
229
|
-
/**
|
|
230
|
-
* Mark a member whose type this workspace declares.
|
|
231
|
-
*
|
|
232
|
-
* The value returned is the one passed in, and its concrete type is preserved, so a marked
|
|
233
|
-
* struct stays a struct and Effect's inference keeps working. Reach for it to admit anything
|
|
234
|
-
* the schema library can express, including a vendor's own schema — deliberately.
|
|
235
|
-
*/
|
|
236
|
-
declare const mint: <Field extends Schema.Constraint>(field: Field) => Field & Mark;
|
|
237
|
-
type Fields = Record<string, MintedField>;
|
|
238
|
-
declare const wire: <F extends Fields>(fields: F) => Schema.Struct<F> & Mark;
|
|
239
201
|
//#endregion
|
|
240
|
-
export { Cell_d_exports as Cell, Policy_d_exports as Policy,
|
|
202
|
+
export { Cell_d_exports as Cell, Policy_d_exports as Policy, Workflow_d_exports as Workflow };
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,6 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
|
2
2
|
import * as Effect$1 from "effect/Effect";
|
|
3
3
|
import { dual } from "effect/Function";
|
|
4
4
|
import * as Result$1 from "effect/Result";
|
|
5
|
-
import { Schema } from "effect";
|
|
6
5
|
//#region src/Facts.ts
|
|
7
6
|
const DESCRIPTION_MODULE = "@systemfsoftware/effect-cell-types";
|
|
8
7
|
const IO_CELLS = {
|
|
@@ -107,47 +106,4 @@ const vocabulary = {
|
|
|
107
106
|
//#region src/Policy.ts
|
|
108
107
|
var Policy_exports = /* @__PURE__ */ __exportAll({});
|
|
109
108
|
//#endregion
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* The wire alphabet — build a schema for a foreign payload out of members you declare, so no
|
|
113
|
-
* vendor type can be named inside it.
|
|
114
|
-
*
|
|
115
|
-
* ```ts
|
|
116
|
-
* import { Wire } from '@systemfsoftware/effect-cell-types'
|
|
117
|
-
* import { Effect, Schema as S } from 'effect'
|
|
118
|
-
*
|
|
119
|
-
* const Invoice = Wire.wire({
|
|
120
|
-
* id: Wire.mint(S.String),
|
|
121
|
-
* amountDue: Wire.mint(S.NullOr(Wire.mint(S.Finite))),
|
|
122
|
-
* status: Wire.mint(S.Literals(['draft', 'open', 'paid'])),
|
|
123
|
-
* lineItems: Wire.mint(S.Array(Wire.mint(S.String))),
|
|
124
|
-
* metadata: Wire.mint(S.Record(Wire.mint(S.String), Wire.mint(S.String))),
|
|
125
|
-
* deleted: Wire.mint(S.optional(Wire.mint(S.Boolean))),
|
|
126
|
-
* })
|
|
127
|
-
*
|
|
128
|
-
* // Decodes to your own type — `{ id: string; amountDue: number | null; ... }`.
|
|
129
|
-
* const invoice = yield* Schema.decode(Invoice)(payload)
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* Only declarations that name members through {@link mint} are constrained, and mint admits a
|
|
133
|
-
* foreign schema deliberately. It is a guardrail, not a security boundary.
|
|
134
|
-
*/
|
|
135
|
-
var Wire_exports = /* @__PURE__ */ __exportAll({
|
|
136
|
-
mint: () => mint,
|
|
137
|
-
wire: () => wire
|
|
138
|
-
});
|
|
139
|
-
/**
|
|
140
|
-
* Mark a member whose type this workspace declares.
|
|
141
|
-
*
|
|
142
|
-
* The value returned is the one passed in, and its concrete type is preserved, so a marked
|
|
143
|
-
* struct stays a struct and Effect's inference keeps working. Reach for it to admit anything
|
|
144
|
-
* the schema library can express, including a vendor's own schema — deliberately.
|
|
145
|
-
*/
|
|
146
|
-
const mint = (field) => {
|
|
147
|
-
assertMinted(field);
|
|
148
|
-
return field;
|
|
149
|
-
};
|
|
150
|
-
function assertMinted(_field) {}
|
|
151
|
-
const wire = (fields) => mint(Schema.Struct(fields));
|
|
152
|
-
//#endregion
|
|
153
|
-
export { Cell_exports as Cell, Policy_exports as Policy, Wire_exports as Wire, Workflow_exports as Workflow };
|
|
109
|
+
export { Cell_exports as Cell, Policy_exports as Policy, Workflow_exports as Workflow };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@systemfsoftware/effect-cell-types",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "7.0.0",
|
|
5
5
|
"author": "Ryan Lee <drdgvhbh@gmail.com>",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"@microsoft/api-extractor": "^7.58.7",
|
|
37
37
|
"@systemfsoftware/arethetypeswrong-cli": "^1.1.1",
|
|
38
38
|
"@types/node": "^24",
|
|
39
|
-
"effect": "
|
|
39
|
+
"effect": "4.0.0-rc.112",
|
|
40
40
|
"oxlint": "^1.77.0",
|
|
41
41
|
"rimraf": "^6.1.3",
|
|
42
42
|
"tsdown": "^0.22.14",
|
|
43
43
|
"tstyche": "^7.1.0",
|
|
44
44
|
"vitest": "^4",
|
|
45
|
-
"@systemfsoftware/effect-gherkin-spec": "4.0.1",
|
|
46
|
-
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
47
45
|
"@systemfsoftware/tsconfig": "^1.3.3",
|
|
46
|
+
"@systemfsoftware/vitest-config": "^0.1.0",
|
|
47
|
+
"@systemfsoftware/effect-gherkin-spec": "4.0.1",
|
|
48
48
|
"@systemfsoftware/oxlint-config": "^0.1.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"effect": "
|
|
51
|
+
"effect": "4.0.0-rc.112"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"provenance": true
|