@jigging/jig 0.0.0 → 0.1.0-alpha.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/dist/json.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export type JsonScalar = null | boolean | number | string;
2
+ export type JsonValue = JsonScalar | readonly JsonValue[] | {
3
+ readonly [key: string]: JsonValue;
4
+ };
5
+ export type JsonObject = Readonly<Record<string, JsonValue>>;
6
+ export declare const JSON_1_LIMITS: Readonly<{
7
+ bytes: 16777216;
8
+ depth: 128;
9
+ nodes: 262144;
10
+ containerEntries: 65536;
11
+ stringBytes: 8388608;
12
+ memberNameBytes: 1024;
13
+ numberTokenBytes: 128;
14
+ }>;
15
+ export declare class Json1Error extends Error {
16
+ constructor(message: string);
17
+ }
18
+ export declare function decodeJson1(bytes: Uint8Array): JsonValue;
19
+ export declare function validateJson1(value: unknown): asserts value is JsonValue;
20
+ /** RFC 8785 canonical bytes for an already validated JSON/1 value. */
21
+ export declare function canonicalJson(value: JsonValue): Uint8Array;
@@ -0,0 +1,47 @@
1
+ import type { JsonObject } from "../json.js";
2
+ export interface DiscoverySource {
3
+ readonly kind: "discover";
4
+ readonly roots: readonly string[];
5
+ }
6
+ export interface MembersSource {
7
+ readonly kind: "members";
8
+ readonly paths: readonly string[];
9
+ }
10
+ export type ProjectSource = DiscoverySource | MembersSource;
11
+ export type ProjectSourceInput = DiscoverySource | readonly string[];
12
+ export interface JigDefinition {
13
+ readonly flows?: ProjectSource;
14
+ readonly bindings?: ProjectSource;
15
+ }
16
+ export interface JigDefinitionInput {
17
+ readonly flows?: ProjectSourceInput;
18
+ readonly bindings?: ProjectSourceInput;
19
+ }
20
+ export interface FlowRef {
21
+ readonly kind: "flow";
22
+ readonly path: string;
23
+ }
24
+ export interface BindingRef {
25
+ readonly kind: "binding";
26
+ readonly id: string;
27
+ }
28
+ export type RunTargetRef = FlowRef | BindingRef;
29
+ export interface PackageBindingDefinition {
30
+ readonly kind: "package";
31
+ readonly package: string;
32
+ readonly settings: JsonObject;
33
+ }
34
+ export interface PackageBindingInput {
35
+ readonly package: string;
36
+ readonly settings?: JsonObject;
37
+ }
38
+ export type BindingDefinition = PackageBindingDefinition;
39
+ export declare function discover(roots: string | readonly string[]): DiscoverySource;
40
+ export declare function defineJig(input: JigDefinitionInput): JigDefinition;
41
+ /** Evaluator-only canonical re-normalization; absent from the package root. */
42
+ export declare function normalizeJigDefinition(input: unknown): JigDefinition;
43
+ export declare function defineBinding(input: PackageBindingInput): PackageBindingDefinition;
44
+ export declare function flowRef(path: string): FlowRef;
45
+ export declare function bindingRef(id: string): BindingRef;
46
+ /** Evaluator-only canonical re-normalization; absent from the package root. */
47
+ export declare function normalizePackageBindingDefinition(input: unknown): PackageBindingDefinition;
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "https://flow.jig.md/schemas/schema-1.json",
3
+ "title": "Jig project authoring value/1",
4
+ "oneOf": [
5
+ {
6
+ "$ref": "#/$defs/project"
7
+ },
8
+ {
9
+ "$ref": "#/$defs/bindingDefinition"
10
+ }
11
+ ],
12
+ "$defs": {
13
+ "localName": {
14
+ "type": "string",
15
+ "minLength": 1,
16
+ "maxLength": 64
17
+ },
18
+ "projectPath": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "maxLength": 1024
22
+ },
23
+ "discoverSource": {
24
+ "type": "object",
25
+ "properties": {
26
+ "kind": {
27
+ "const": "discover"
28
+ },
29
+ "roots": {
30
+ "type": "array",
31
+ "items": {
32
+ "$ref": "#/$defs/projectPath"
33
+ },
34
+ "minItems": 1,
35
+ "maxItems": 65536
36
+ }
37
+ },
38
+ "required": [
39
+ "kind",
40
+ "roots"
41
+ ],
42
+ "additionalProperties": false
43
+ },
44
+ "membersSource": {
45
+ "type": "object",
46
+ "properties": {
47
+ "kind": {
48
+ "const": "members"
49
+ },
50
+ "paths": {
51
+ "type": "array",
52
+ "items": {
53
+ "$ref": "#/$defs/projectPath"
54
+ },
55
+ "maxItems": 65536
56
+ }
57
+ },
58
+ "required": [
59
+ "kind",
60
+ "paths"
61
+ ],
62
+ "additionalProperties": false
63
+ },
64
+ "source": {
65
+ "oneOf": [
66
+ {
67
+ "$ref": "#/$defs/discoverSource"
68
+ },
69
+ {
70
+ "$ref": "#/$defs/membersSource"
71
+ }
72
+ ]
73
+ },
74
+ "project": {
75
+ "type": "object",
76
+ "properties": {
77
+ "flows": {
78
+ "$ref": "#/$defs/source"
79
+ },
80
+ "bindings": {
81
+ "$ref": "#/$defs/source"
82
+ }
83
+ },
84
+ "additionalProperties": false
85
+ },
86
+ "packageBinding": {
87
+ "type": "object",
88
+ "properties": {
89
+ "kind": {
90
+ "const": "package"
91
+ },
92
+ "package": {
93
+ "$ref": "#/$defs/projectPath"
94
+ },
95
+ "settings": {
96
+ "type": "object",
97
+ "maxProperties": 65536
98
+ }
99
+ },
100
+ "required": [
101
+ "kind",
102
+ "package",
103
+ "settings"
104
+ ],
105
+ "additionalProperties": false
106
+ },
107
+ "bindingDefinition": {
108
+ "$ref": "#/$defs/packageBinding"
109
+ }
110
+ }
111
+ }