@jarenjs/linq 0.67.0 → 0.72.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/README.md +15 -2
- package/docs/AI-PEN.md +98 -0
- package/docs/APP-PEN.md +3 -3
- package/docs/CHARTS-PEN.md +94 -0
- package/docs/CONTRACT-PEN.md +4 -4
- package/docs/DB-CLIENT.md +3 -3
- package/docs/FORMS-PEN.md +2 -2
- package/docs/JTLT-PEN.md +83 -0
- package/docs/LINQ-FORMAT.md +170 -42
- package/docs/MESSAGES-PEN.md +105 -0
- package/docs/MIGRATION-PEN.md +1 -1
- package/docs/MODEL-PEN.md +3 -3
- package/docs/PROJECT-PEN.md +75 -0
- package/docs/QUERY-PEN.md +4 -4
- package/docs/SCHEMA-PEN.md +70 -83
- package/package.json +27 -7
- package/src/ai/index.js +76 -0
- package/src/authored.js +38 -0
- package/src/charts/index.js +131 -0
- package/src/charts/vocabulary.js +119 -0
- package/src/jtlt/index.js +97 -0
- package/src/messages/index.js +96 -0
- package/src/messages/vocabulary.js +259 -0
- package/src/project/index.js +54 -0
- package/src/schema/builders.js +100 -9
- package/src/schema/emit.js +29 -13
- package/types/ai.d.ts +56 -0
- package/types/charts.d.ts +438 -0
- package/types/jtlt.d.ts +45 -0
- package/types/message-vocabulary.d.ts +96 -0
- package/types/messages.d.ts +32 -0
- package/types/project.d.ts +45 -0
- package/types/schema.d.ts +54 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Derived from the English catalogs by scripts/generate-message-pen.js.
|
|
2
|
+
export interface CatalogIds {
|
|
3
|
+
validate: "type" | "required" | "minimum" | "maximum" | "exclusiveMinimum" | "exclusiveMaximum" | "multipleOf" | "minLength" | "maxLength" | "pattern" | "additionalProperties" | "minProperties" | "maxProperties" | "minItems" | "maxItems" | "uniqueItems" | "contains" | "items" | "allOf" | "anyOf" | "oneOf" | "not" | "format" | "if" | "then" | "else" | "false schema" | "$query" | "JQ2001" | "JQ2003";
|
|
4
|
+
forms: "form/required" | "form/type" | "form/const" | "form/enum" | "form/minLength" | "form/maxLength" | "form/pattern" | "form/format" | "form/minimum" | "form/maximum" | "form/exclusiveMinimum" | "form/exclusiveMaximum" | "form/multipleOf" | "form/minItems" | "form/maxItems" | "form/uniqueItems" | "form/minProperties" | "form/maxProperties" | "x-form/assert" | "form/addItem" | "form/removeItem";
|
|
5
|
+
contract: "contract/not-found" | "contract/method-not-allowed" | "contract/body-too-large" | "contract/unsupported-media" | "contract/malformed-json" | "contract/invalid-input" | "contract/idempotency-key-required" | "contract/handler-failed" | "contract/idempotency-conflict" | "contract/invalid-output" | "contract/malformed-path" | "contract/malformed-query" | "contract/not-implemented" | "contract/precondition-failed" | "contract/invalid-header" | "contract/handler-error" | "contract/client-invalid-input" | "contract/network" | "contract/cancelled" | "contract/invalid-response" | "contract/key-storage-failed" | "contract/undeclared-response" | "contract/not-a-contract" | "contract/incompatible" | "contract/host-failed" | "contract/local-handler-failed" | "contract/unknown-operation" | "contract/port-timeout" | "contract/malformed-frame" | "contract/channel-closed" | "contract/not-a-stream" | "contract/invalid-snapshot" | "contract/seq-regression" | "contract/stream-error" | "contract/heartbeat-missed" | "contract/slow-consumer" | "contract/reconnect-exhausted";
|
|
6
|
+
}
|
|
7
|
+
export interface MessageParameters {
|
|
8
|
+
"type": "type" | "types";
|
|
9
|
+
"required": "missingProperty";
|
|
10
|
+
"minimum": "comparison" | "limit";
|
|
11
|
+
"maximum": "comparison" | "limit";
|
|
12
|
+
"exclusiveMinimum": "comparison" | "limit";
|
|
13
|
+
"exclusiveMaximum": "comparison" | "limit";
|
|
14
|
+
"multipleOf": "multipleOf";
|
|
15
|
+
"minLength": "limit";
|
|
16
|
+
"maxLength": "limit";
|
|
17
|
+
"pattern": "pattern";
|
|
18
|
+
"additionalProperties": "additionalProperty";
|
|
19
|
+
"minProperties": "limit";
|
|
20
|
+
"maxProperties": "limit";
|
|
21
|
+
"minItems": "limit";
|
|
22
|
+
"maxItems": "limit";
|
|
23
|
+
"uniqueItems": never;
|
|
24
|
+
"contains": never;
|
|
25
|
+
"items": never;
|
|
26
|
+
"allOf": never;
|
|
27
|
+
"anyOf": never;
|
|
28
|
+
"oneOf": never;
|
|
29
|
+
"not": never;
|
|
30
|
+
"format": "format";
|
|
31
|
+
"if": never;
|
|
32
|
+
"then": never;
|
|
33
|
+
"else": never;
|
|
34
|
+
"false schema": never;
|
|
35
|
+
"$query": "code" | "docPath";
|
|
36
|
+
"JQ2001": "code" | "docPath";
|
|
37
|
+
"JQ2003": "code" | "docPath";
|
|
38
|
+
"form/required": never;
|
|
39
|
+
"form/type": "type";
|
|
40
|
+
"form/const": "constValue";
|
|
41
|
+
"form/enum": "enumValues";
|
|
42
|
+
"form/minLength": "len" | "limit";
|
|
43
|
+
"form/maxLength": "len" | "limit";
|
|
44
|
+
"form/pattern": "pattern";
|
|
45
|
+
"form/format": "format";
|
|
46
|
+
"form/minimum": "limit";
|
|
47
|
+
"form/maximum": "limit";
|
|
48
|
+
"form/exclusiveMinimum": "limit";
|
|
49
|
+
"form/exclusiveMaximum": "limit";
|
|
50
|
+
"form/multipleOf": "multipleOf";
|
|
51
|
+
"form/minItems": "limit";
|
|
52
|
+
"form/maxItems": "limit";
|
|
53
|
+
"form/uniqueItems": never;
|
|
54
|
+
"form/minProperties": "limit";
|
|
55
|
+
"form/maxProperties": "limit";
|
|
56
|
+
"x-form/assert": never;
|
|
57
|
+
"form/addItem": never;
|
|
58
|
+
"form/removeItem": never;
|
|
59
|
+
"contract/not-found": never;
|
|
60
|
+
"contract/method-not-allowed": "allow";
|
|
61
|
+
"contract/body-too-large": "limit" | "op";
|
|
62
|
+
"contract/unsupported-media": "media" | "op";
|
|
63
|
+
"contract/malformed-json": "op";
|
|
64
|
+
"contract/invalid-input": "op";
|
|
65
|
+
"contract/idempotency-key-required": "op";
|
|
66
|
+
"contract/handler-failed": "op";
|
|
67
|
+
"contract/idempotency-conflict": "kind" | "op";
|
|
68
|
+
"contract/invalid-output": "op";
|
|
69
|
+
"contract/malformed-path": never;
|
|
70
|
+
"contract/malformed-query": never;
|
|
71
|
+
"contract/not-implemented": "op";
|
|
72
|
+
"contract/precondition-failed": "op";
|
|
73
|
+
"contract/invalid-header": "header" | "op";
|
|
74
|
+
"contract/handler-error": "code" | "op";
|
|
75
|
+
"contract/client-invalid-input": "op";
|
|
76
|
+
"contract/network": "name" | "op";
|
|
77
|
+
"contract/cancelled": "op";
|
|
78
|
+
"contract/invalid-response": "op";
|
|
79
|
+
"contract/key-storage-failed": "op";
|
|
80
|
+
"contract/undeclared-response": "op" | "status";
|
|
81
|
+
"contract/not-a-contract": "id";
|
|
82
|
+
"contract/incompatible": "client" | "id" | "server";
|
|
83
|
+
"contract/host-failed": "op";
|
|
84
|
+
"contract/local-handler-failed": "op";
|
|
85
|
+
"contract/unknown-operation": never;
|
|
86
|
+
"contract/port-timeout": "ms" | "op";
|
|
87
|
+
"contract/malformed-frame": "op";
|
|
88
|
+
"contract/channel-closed": "op";
|
|
89
|
+
"contract/not-a-stream": "op";
|
|
90
|
+
"contract/invalid-snapshot": "op";
|
|
91
|
+
"contract/seq-regression": "op";
|
|
92
|
+
"contract/stream-error": "code" | "op";
|
|
93
|
+
"contract/heartbeat-missed": "ms" | "op";
|
|
94
|
+
"contract/slow-consumer": "op";
|
|
95
|
+
"contract/reconnect-exhausted": "attempts" | "lastCode" | "op";
|
|
96
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { Json } from './schema.js';
|
|
2
|
+
import type { CatalogIds, MessageParameters } from './message-vocabulary.js';
|
|
3
|
+
export type { CatalogIds, MessageParameters } from './message-vocabulary.js';
|
|
4
|
+
export type CatalogSource = keyof CatalogIds | 'all';
|
|
5
|
+
export type Msgid<S extends CatalogSource = 'all'> = S extends keyof CatalogIds ? CatalogIds[S] : keyof MessageParameters;
|
|
6
|
+
export type CatalogDocument<I extends string = Msgid> = Readonly<Record<I, string>>;
|
|
7
|
+
type Present<D> = string extends keyof D ? never : {
|
|
8
|
+
[K in keyof D]-?: {} extends Pick<D, K> ? never : K
|
|
9
|
+
}[keyof D] & string;
|
|
10
|
+
// A union-valued id adds one unknown member, not every member of that union.
|
|
11
|
+
type SingleId<I, Whole = I> = I extends unknown ? [Whole] extends [I] ? I : never : never;
|
|
12
|
+
export const CATALOGS: { readonly [S in keyof CatalogIds]: { readonly [I in CatalogIds[S]]: readonly (I extends keyof MessageParameters ? MessageParameters[I] : never)[] } };
|
|
13
|
+
export class CatalogBuilder<S extends CatalogSource = 'all', P extends string = never> {
|
|
14
|
+
protected constructor();
|
|
15
|
+
readonly __source: S;
|
|
16
|
+
readonly __present: P;
|
|
17
|
+
entry<I extends Msgid<S>>(id: I, template: string): CatalogBuilder<S, P | SingleId<I>>;
|
|
18
|
+
entries<const D extends Partial<Record<Msgid<S>, string>>>(values: D & Record<Exclude<keyof D, Msgid<S>>, never>): CatalogBuilder<S, P | Present<D>>;
|
|
19
|
+
partial(): CatalogDocument<P>;
|
|
20
|
+
complete(this: Exclude<Msgid<S>, P> extends never ? CatalogBuilder<S, P> : never): CatalogDocument<Msgid<S>>;
|
|
21
|
+
toJSON(this: Exclude<Msgid<S>, P> extends never ? CatalogBuilder<S, P> : never): CatalogDocument<Msgid<S>>;
|
|
22
|
+
}
|
|
23
|
+
export function catalog<S extends CatalogSource = 'all'>(source?: S, locale?: string): CatalogBuilder<S>;
|
|
24
|
+
/** Raw drafts remain subject to runtime key/placeholder checks at either exit. */
|
|
25
|
+
export function from<const D extends Record<string, string>, S extends CatalogSource = 'all'>(document: D, options?: { readonly source?: S; readonly locale?: string }): CatalogBuilder<S, Present<D>>;
|
|
26
|
+
export function inline(template: string): string;
|
|
27
|
+
export interface MessageSpec<I extends Msgid = Msgid> {
|
|
28
|
+
readonly $msgid: I;
|
|
29
|
+
readonly message?: string;
|
|
30
|
+
readonly params?: [MessageParameters[I]] extends [never] ? Readonly<Record<string, never>> : Readonly<Partial<Record<MessageParameters[I], Json>>>;
|
|
31
|
+
}
|
|
32
|
+
export function message<I extends Msgid>(id: I, options?: Omit<MessageSpec<I>, '$msgid'>): MessageSpec<I>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** Structural JSON input: readonly documents and schema interfaces participate.
|
|
2
|
+
* Unknown schema extension members still cross the runtime JSON boundary. */
|
|
3
|
+
type JsonData = string | number | boolean | null | readonly JsonData[] | { readonly [key: string]: JsonData };
|
|
4
|
+
export type JsonInput<T> = unknown extends T ? unknown
|
|
5
|
+
: T extends JsonData ? T
|
|
6
|
+
: T extends (...args: never[]) => unknown ? never
|
|
7
|
+
: T extends object ? { readonly [K in keyof T]: JsonInput<T[K]> } : never;
|
|
8
|
+
|
|
9
|
+
export type FileKind = 'app' | 'jslt' | 'query' | 'state' | 'data' | 'schema' | 'fsm' | 'dag' | 'model' | 'contract';
|
|
10
|
+
export interface ProjectFile<Name extends string = string, Kind extends FileKind = FileKind> {
|
|
11
|
+
readonly name: Name;
|
|
12
|
+
readonly kind: Kind;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProjectLayout {
|
|
16
|
+
readonly mode?: 'classic' | 'right' | 'top';
|
|
17
|
+
readonly ratio?: number;
|
|
18
|
+
readonly autorun?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ProjectDocument {
|
|
21
|
+
readonly project: '0.1';
|
|
22
|
+
readonly files: readonly ProjectFile[];
|
|
23
|
+
readonly active?: string;
|
|
24
|
+
readonly layout?: ProjectLayout;
|
|
25
|
+
}
|
|
26
|
+
export const FILE_KINDS: readonly FileKind[];
|
|
27
|
+
export function file<const N extends string, K extends FileKind>(name: N, kind: K, text: string): ProjectFile<N, K>;
|
|
28
|
+
export function jsonFile<const N extends string, K extends FileKind, const D>(name: N, kind: K, document: D & JsonInput<D>): ProjectFile<N, K>;
|
|
29
|
+
/** Names are a phantom; the public document has no extra registry. */
|
|
30
|
+
export class ProjectBuilder<Names extends string = never> {
|
|
31
|
+
protected constructor();
|
|
32
|
+
readonly __names: Names;
|
|
33
|
+
readonly schema: ProjectDocument;
|
|
34
|
+
toJSON(): ProjectDocument;
|
|
35
|
+
files<const F extends readonly ProjectFile[]>(files: F): ProjectBuilder<F[number]['name']>;
|
|
36
|
+
file<const N extends string>(file: ProjectFile<N>): ProjectBuilder<Names | N>;
|
|
37
|
+
active(name: Names): ProjectBuilder<Names>;
|
|
38
|
+
layout(layout: ProjectLayout): ProjectBuilder<Names>;
|
|
39
|
+
}
|
|
40
|
+
export function defineProject<const F extends readonly ProjectFile[] = []>(files?: F, options?: {
|
|
41
|
+
readonly active?: F[number]['name'];
|
|
42
|
+
readonly layout?: ProjectLayout;
|
|
43
|
+
}): ProjectBuilder<F[number]['name']>;
|
|
44
|
+
/** No filename inference is claimed for an arbitrary raw document. */
|
|
45
|
+
export function from(document: ProjectDocument): ProjectBuilder<string>;
|
package/types/schema.d.ts
CHANGED
|
@@ -161,6 +161,42 @@ export class SchemaBuilder<Out = unknown, In = Out, F extends Flag = never> {
|
|
|
161
161
|
readonly schema: JsonSchema | boolean;
|
|
162
162
|
/** `JSON.stringify(builder)` is the document. */
|
|
163
163
|
toJSON(): JsonSchema | boolean;
|
|
164
|
+
/** `$id`: resource identity; the phantom is unchanged. */
|
|
165
|
+
id(uri: string): this;
|
|
166
|
+
/** Raw constraint escape hatch, without inferred narrowing. */
|
|
167
|
+
keyword(key: string, value: Json): this;
|
|
168
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
169
|
+
anchor(value: string): this;
|
|
170
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
171
|
+
dynamicRef(value: string): this;
|
|
172
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
173
|
+
dynamicAnchor(value: string): this;
|
|
174
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
175
|
+
recursiveRef(value: string): this;
|
|
176
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
177
|
+
recursiveAnchor(value: boolean): this;
|
|
178
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
179
|
+
dollarData(value: string): this;
|
|
180
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
181
|
+
vocabulary(value: Readonly<Record<string, boolean>>): this;
|
|
182
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
183
|
+
data(value: Readonly<Record<string, string>>): this;
|
|
184
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
185
|
+
not(value: AnyBuilder): this;
|
|
186
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
187
|
+
unevaluatedProperties(value: AnyBuilder): this;
|
|
188
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
189
|
+
unevaluatedItems(value: AnyBuilder): this;
|
|
190
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
191
|
+
dependentSchemas(value: Props): this;
|
|
192
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
193
|
+
definitions(value: Props): this;
|
|
194
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
195
|
+
additionalItems(value: AnyBuilder): this;
|
|
196
|
+
/** Validation or annotation only; retains the current phantom. */
|
|
197
|
+
dependencies(value: Readonly<Record<string, AnyBuilder | readonly string[]>>): this;
|
|
198
|
+
/** Legacy nullable may widen acceptance; no inferred shape is claimed. */
|
|
199
|
+
legacyNullable(value: boolean): SchemaBuilder<unknown, unknown, F>;
|
|
164
200
|
/** As an object member: left out of `required`. */
|
|
165
201
|
optional(): SchemaBuilder<Out, In, F | 'optional'>;
|
|
166
202
|
/** Admit `null`. */
|
|
@@ -183,6 +219,20 @@ export class SchemaBuilder<Out = unknown, In = Out, F extends Flag = never> {
|
|
|
183
219
|
|
|
184
220
|
/** `{ type: 'string' }` and the string constraints. */
|
|
185
221
|
export class StringBuilder<Out = string, In = Out, F extends Flag = never> extends SchemaBuilder<Out, In, F> {
|
|
222
|
+
/** `contentEncoding`; retains the current phantom. */
|
|
223
|
+
contentEncoding(value: string): this;
|
|
224
|
+
/** `contentMediaType`; retains the current phantom. */
|
|
225
|
+
contentMediaType(value: string): this;
|
|
226
|
+
/** `contentSchema`; retains the current phantom. */
|
|
227
|
+
contentSchema(value: AnyBuilder): this;
|
|
228
|
+
/** `formatMinimum`; retains the current phantom. */
|
|
229
|
+
formatMinimum(value: string): this;
|
|
230
|
+
/** `formatMaximum`; retains the current phantom. */
|
|
231
|
+
formatMaximum(value: string): this;
|
|
232
|
+
/** `formatExclusiveMinimum`; retains the current phantom. */
|
|
233
|
+
formatExclusiveMinimum(value: string): this;
|
|
234
|
+
/** `formatExclusiveMaximum`; retains the current phantom. */
|
|
235
|
+
formatExclusiveMaximum(value: string): this;
|
|
186
236
|
optional(): StringBuilder<Out, In, F | 'optional'>;
|
|
187
237
|
nullable(): StringBuilder<Out | null, In | null, F>;
|
|
188
238
|
default(value: Out): StringBuilder<Out, In, F | 'defaulted'>;
|
|
@@ -254,6 +304,10 @@ declare class NullBuilder<Out = null, In = Out, F extends Flag = never> extends
|
|
|
254
304
|
|
|
255
305
|
/** `{ type: 'array', items }` and the array constraints. */
|
|
256
306
|
export class ArrayBuilder<Out = unknown[], In = Out, F extends Flag = never> extends SchemaBuilder<Out, In, F> {
|
|
307
|
+
/** `minContains`; retains the current phantom. */
|
|
308
|
+
minContains(value: number): this;
|
|
309
|
+
/** `maxContains`; retains the current phantom. */
|
|
310
|
+
maxContains(value: number): this;
|
|
257
311
|
optional(): ArrayBuilder<Out, In, F | 'optional'>;
|
|
258
312
|
nullable(): ArrayBuilder<Out | null, In | null, F>;
|
|
259
313
|
default(value: Out): ArrayBuilder<Out, In, F | 'defaulted'>;
|