@smthrs/plan 1.0.0-rc.5 → 1.0.0-rc.6
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 +2 -0
- package/README.md +5 -5
- package/THIRD_PARTY_NOTICES.md +48 -0
- package/dist/cjs/KeyMaterial.d.ts +1 -1
- package/dist/cjs/KeyMaterial.js.map +1 -1
- package/dist/cjs/Node.d.ts +71 -0
- package/dist/cjs/Node.d.ts.map +1 -1
- package/dist/cjs/Node.js +7 -0
- package/dist/cjs/Node.js.map +2 -2
- package/dist/cjs/StepKey.d.ts +1 -1
- package/dist/cjs/StepKey.js.map +1 -1
- package/dist/cjs/internal/SchemaIdentity.d.ts +140 -0
- package/dist/cjs/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/cjs/internal/SchemaIdentity.js +718 -0
- package/dist/cjs/internal/SchemaIdentity.js.map +7 -0
- package/dist/cjs/internal/node.d.ts +1 -1
- package/dist/cjs/internal/node.d.ts.map +1 -1
- package/dist/cjs/internal/node.js +2 -1
- package/dist/cjs/internal/node.js.map +2 -2
- package/dist/esm/KeyMaterial.d.ts +1 -1
- package/dist/esm/KeyMaterial.js +1 -1
- package/dist/esm/KeyMaterial.js.map +1 -1
- package/dist/esm/Node.d.ts +71 -0
- package/dist/esm/Node.d.ts.map +1 -1
- package/dist/esm/Node.js +46 -0
- package/dist/esm/Node.js.map +1 -1
- package/dist/esm/StepKey.d.ts +1 -1
- package/dist/esm/StepKey.js +1 -1
- package/dist/esm/StepKey.js.map +1 -1
- package/dist/esm/internal/SchemaIdentity.d.ts +140 -0
- package/dist/esm/internal/SchemaIdentity.d.ts.map +1 -0
- package/dist/esm/internal/SchemaIdentity.js +1002 -0
- package/dist/esm/internal/SchemaIdentity.js.map +1 -0
- package/dist/esm/internal/node.d.ts +1 -1
- package/dist/esm/internal/node.d.ts.map +1 -1
- package/dist/esm/internal/node.js +3 -2
- package/dist/esm/internal/node.js.map +1 -1
- package/docs/README.md +1 -1
- package/docs/api.md +11 -1
- package/docs/concepts/authoring-ast.md +2 -1
- package/docs/installation.md +3 -3
- package/package.json +9 -8
- package/src/KeyMaterial.ts +1 -1
- package/src/Node.ts +79 -0
- package/src/StepKey.ts +1 -1
- package/src/internal/SchemaIdentity.ts +1096 -0
- package/src/internal/node.ts +3 -2
package/src/KeyMaterial.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* lives here, above `@smthrs/keys`, so the key package stays a leaf.
|
|
8
8
|
*
|
|
9
9
|
* Governing contract: the step-key rules at
|
|
10
|
-
* https://
|
|
10
|
+
* https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md. Material is computed with no I/O,
|
|
11
11
|
* and two hardening rules shape it: the nominal, never shape-sniffed
|
|
12
12
|
* `InputRef` and the hashed `version`.
|
|
13
13
|
*
|
package/src/Node.ts
CHANGED
|
@@ -31,9 +31,11 @@
|
|
|
31
31
|
import { dual } from "effect/Function"
|
|
32
32
|
import type * as Pipeable from "effect/Pipeable"
|
|
33
33
|
import type * as Schema from "effect/Schema"
|
|
34
|
+
import type * as SchemaAST from "effect/SchemaAST"
|
|
34
35
|
import type * as Types from "effect/Types"
|
|
35
36
|
import { GraphBuildError } from "./GraphBuildError.ts"
|
|
36
37
|
import * as internal from "./internal/node.ts"
|
|
38
|
+
import * as internalSchemaIdentity from "./internal/SchemaIdentity.ts"
|
|
37
39
|
import * as Planned from "./Planned.ts"
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -843,6 +845,83 @@ export const catchFilter = (ast: Ast): Schema.Top | undefined => ast._tag === "C
|
|
|
843
845
|
*/
|
|
844
846
|
export const functionIdentity = (operation: unknown): FunctionIdentity => internal.functionIdentity(operation)
|
|
845
847
|
|
|
848
|
+
/**
|
|
849
|
+
* The document a schema's identity is: JSON-Schema-shaped, and the same bytes
|
|
850
|
+
* under every `effect` release this package supports.
|
|
851
|
+
*
|
|
852
|
+
* @since 1.0.0
|
|
853
|
+
* @category engine
|
|
854
|
+
*/
|
|
855
|
+
export type SchemaIdentity = internalSchemaIdentity.Document
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* The one option a schema's identity is taken under: whether an object closes
|
|
859
|
+
* over the keys it declares (`"error"`) or leaves others open (`"ignore"`,
|
|
860
|
+
* the default). It has the meaning it has in `Schema.toJsonSchemaDocument`.
|
|
861
|
+
*
|
|
862
|
+
* @since 1.0.0
|
|
863
|
+
* @category engine
|
|
864
|
+
*/
|
|
865
|
+
export type SchemaIdentityOptions = internalSchemaIdentity.Options
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* The refusal `schemaIdentity` and `representationIdentity` raise for a schema
|
|
869
|
+
* a step key cannot be derived from. Its message is the one
|
|
870
|
+
* `effect@4.0.0-rc.115` gave for the same schema, where it gave one.
|
|
871
|
+
*
|
|
872
|
+
* @since 1.0.0
|
|
873
|
+
* @category errors
|
|
874
|
+
*/
|
|
875
|
+
export const SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* The type of {@link SchemaIdentityError}.
|
|
879
|
+
*
|
|
880
|
+
* @since 1.0.0
|
|
881
|
+
* @category errors
|
|
882
|
+
*/
|
|
883
|
+
export type SchemaIdentityError = internalSchemaIdentity.SchemaIdentityError
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* Identifies a schema by the constraints it documents, so a call re-keys when
|
|
887
|
+
* what its callee accepts or produces changes, and a catch re-keys when its
|
|
888
|
+
* filter does.
|
|
889
|
+
*
|
|
890
|
+
* The document is what `Schema.toJsonSchemaDocument(schema, options)`
|
|
891
|
+
* returned under `effect@4.0.0-rc.115`. It is printed by this package, not by
|
|
892
|
+
* the installed `effect`, because a later release prints a different document
|
|
893
|
+
* for the same schema and a moved identity re-keys every recorded step. Use
|
|
894
|
+
* it wherever the document is hashed, compared or pinned; a JSON Schema shown
|
|
895
|
+
* to a model or a person comes from `Schema.toJsonSchemaDocument`.
|
|
896
|
+
*
|
|
897
|
+
* Reserved for the packages that derive identities. Authors never call it; it
|
|
898
|
+
* throws for a schema that has no JSON Schema form.
|
|
899
|
+
*
|
|
900
|
+
* @since 1.0.0
|
|
901
|
+
* @category engine
|
|
902
|
+
*/
|
|
903
|
+
export const schemaIdentity = (schema: Schema.Top, options?: SchemaIdentityOptions): SchemaIdentity =>
|
|
904
|
+
internalSchemaIdentity.schemaIdentity(schema, options)
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* Identifies a schema AST by its encoded representation, the material a
|
|
908
|
+
* sealed action's step key folds in for its success and error schemas.
|
|
909
|
+
*
|
|
910
|
+
* The value is what `SchemaRepresentation.toJson(SchemaRepresentation.toRepresentation(ast))`
|
|
911
|
+
* returned under `effect@4.0.0-rc.115`, so a later `effect` release does not
|
|
912
|
+
* re-key recorded steps. The one exception is `Schema.brand`: from
|
|
913
|
+
* `effect@4.0.4` on a brand is not part of the AST, so a declaration with a
|
|
914
|
+
* brand re-keys once.
|
|
915
|
+
*
|
|
916
|
+
* Reserved for the packages that derive step keys. Authors never call it; it
|
|
917
|
+
* throws for an AST that has no representation.
|
|
918
|
+
*
|
|
919
|
+
* @since 1.0.0
|
|
920
|
+
* @category engine
|
|
921
|
+
*/
|
|
922
|
+
export const representationIdentity = (ast: SchemaAST.AST): Schema.Json =>
|
|
923
|
+
internalSchemaIdentity.representationIdentity(ast)
|
|
924
|
+
|
|
846
925
|
/**
|
|
847
926
|
* Binds a frozen plain copy of inert captures as the callback's this receiver.
|
|
848
927
|
*
|
package/src/StepKey.ts
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* resolved references, and the hashed `version`.
|
|
23
23
|
*
|
|
24
24
|
* Governing contract: the step-key rules at
|
|
25
|
-
* https://
|
|
25
|
+
* https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/plan/docs/concepts/step-keys.md.
|
|
26
26
|
*
|
|
27
27
|
* @since 0.1.0
|
|
28
28
|
*/
|