tjs-lang 0.6.19 → 0.6.26
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/CLAUDE.md +29 -24
- package/bin/dev.ts +9 -0
- package/demo/docs.json +49 -1
- package/demo/src/playground-shared.ts +8 -39
- package/demo/src/tjs-playground.ts +8 -0
- package/demo/src/tjs-runtime-iframe.ts +10 -0
- package/demo/src/ts-playground.ts +8 -0
- package/package.json +1 -1
- package/src/cli/commands/run.ts +4 -1
- package/src/cli/tjs.ts +1 -1
- package/src/lang/codegen.test.ts +26 -27
- package/src/lang/emitters/dts.test.ts +22 -0
- package/src/lang/emitters/dts.ts +5 -1
- package/src/lang/emitters/js-tests.ts +13 -19
- package/src/lang/emitters/js.ts +39 -7
- package/src/lang/parser-transforms.ts +18 -5
- package/src/lang/roundtrip.test.ts +1 -1
- package/src/lang/runtime.ts +88 -2
- package/src/lang/wasm.ts +1 -1
- package/dist/bin/benchmarks.d.ts +0 -9
- package/dist/bin/dev.d.ts +0 -1
- package/dist/bin/docs.d.ts +0 -1
- package/dist/bin/select-local-models.d.ts +0 -1
- package/dist/examples/modules/dist/main.d.ts +0 -34
- package/dist/examples/modules/dist/math.d.ts +0 -120
- package/dist/index.js +0 -426
- package/dist/index.js.map +0 -45
- package/dist/scripts/build-demo.d.ts +0 -2
- package/dist/scripts/build.d.ts +0 -11
- package/dist/scripts/seed-blog-rules.d.ts +0 -2
- package/dist/scripts/seed-stored-function.d.ts +0 -2
- package/dist/src/atoms/batteries.d.ts +0 -4
- package/dist/src/atoms/browser.d.ts +0 -4
- package/dist/src/atoms/index.d.ts +0 -4
- package/dist/src/batteries/audit.d.ts +0 -9
- package/dist/src/batteries/index.d.ts +0 -28
- package/dist/src/batteries/llm.d.ts +0 -18
- package/dist/src/batteries/models.d.ts +0 -19
- package/dist/src/batteries/store.d.ts +0 -13
- package/dist/src/builder.d.ts +0 -127
- package/dist/src/bun-plugin/tjs-plugin.d.ts +0 -12
- package/dist/src/cli/commands/check.d.ts +0 -4
- package/dist/src/cli/commands/convert.d.ts +0 -20
- package/dist/src/cli/commands/emit.d.ts +0 -34
- package/dist/src/cli/commands/run.d.ts +0 -6
- package/dist/src/cli/commands/test.d.ts +0 -21
- package/dist/src/cli/commands/types.d.ts +0 -4
- package/dist/src/cli/create-app.d.ts +0 -9
- package/dist/src/cli/playground.d.ts +0 -9
- package/dist/src/cli/tjs.d.ts +0 -15
- package/dist/src/cli/tjsx.d.ts +0 -16
- package/dist/src/index.d.ts +0 -11
- package/dist/src/inference.types.d.ts +0 -1
- package/dist/src/lang/core.d.ts +0 -56
- package/dist/src/lang/docs.d.ts +0 -69
- package/dist/src/lang/emitters/ast.d.ts +0 -24
- package/dist/src/lang/emitters/dts.d.ts +0 -48
- package/dist/src/lang/emitters/from-ts.d.ts +0 -94
- package/dist/src/lang/emitters/js-tests.d.ts +0 -70
- package/dist/src/lang/emitters/js-wasm.d.ts +0 -15
- package/dist/src/lang/emitters/js.d.ts +0 -175
- package/dist/src/lang/eval.d.ts +0 -63
- package/dist/src/lang/index.d.ts +0 -216
- package/dist/src/lang/inference.d.ts +0 -40
- package/dist/src/lang/linter.d.ts +0 -53
- package/dist/src/lang/metadata-cache.d.ts +0 -172
- package/dist/src/lang/parser-params.d.ts +0 -37
- package/dist/src/lang/parser-transforms.d.ts +0 -281
- package/dist/src/lang/parser-types.d.ts +0 -175
- package/dist/src/lang/parser.d.ts +0 -56
- package/dist/src/lang/runtime.d.ts +0 -454
- package/dist/src/lang/schema.d.ts +0 -35
- package/dist/src/lang/tests.d.ts +0 -94
- package/dist/src/lang/transpiler.d.ts +0 -25
- package/dist/src/lang/types.d.ts +0 -147
- package/dist/src/lang/wasm.d.ts +0 -83
- package/dist/src/rbac/index.d.ts +0 -85
- package/dist/src/rbac/rules.d.ts +0 -184
- package/dist/src/runtime.d.ts +0 -4
- package/dist/src/store/index.d.ts +0 -3
- package/dist/src/store/indexeddb.d.ts +0 -6
- package/dist/src/store/interface.d.ts +0 -90
- package/dist/src/store/memory.d.ts +0 -10
- package/dist/src/test-examples.d.ts +0 -41
- package/dist/src/test-utils.d.ts +0 -86
- package/dist/src/transpiler/index.d.ts +0 -6
- package/dist/src/transpiler/parser.d.ts +0 -4
- package/dist/src/transpiler/transformer.d.ts +0 -4
- package/dist/src/transpiler/type-system/inference.d.ts +0 -1
- package/dist/src/transpiler/types.d.ts +0 -4
- package/dist/src/types/LegalDate.d.ts +0 -241
- package/dist/src/types/Timestamp.d.ts +0 -233
- package/dist/src/types/Type.d.ts +0 -234
- package/dist/src/types/index.d.ts +0 -8
- package/dist/src/vm/atoms/batteries.d.ts +0 -6
- package/dist/src/vm/atoms/browser.d.ts +0 -18
- package/dist/src/vm/atoms/index.d.ts +0 -10
- package/dist/src/vm/index.d.ts +0 -12
- package/dist/src/vm/runtime.d.ts +0 -333
- package/dist/src/vm/vm.d.ts +0 -28
- package/dist/src/vm.d.ts +0 -4
- package/dist/test-preprocess.d.ts +0 -1
- package/dist/tjs-batteries.js +0 -4
- package/dist/tjs-batteries.js.map +0 -15
- package/dist/tjs-full.js +0 -426
- package/dist/tjs-full.js.map +0 -45
- package/dist/tjs-src/runtime.d.ts +0 -1
- package/dist/tjs-transpiler.js +0 -3
- package/dist/tjs-transpiler.js.map +0 -11
- package/dist/tjs-vm.js +0 -54
- package/dist/tjs-vm.js.map +0 -22
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where clause for queries
|
|
3
|
-
*/
|
|
4
|
-
export interface WhereClause {
|
|
5
|
-
field: string;
|
|
6
|
-
op: '==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not-in' | 'array-contains';
|
|
7
|
-
value: any;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Query constraints
|
|
11
|
-
*/
|
|
12
|
-
export interface QueryConstraints {
|
|
13
|
-
where?: WhereClause[];
|
|
14
|
-
orderBy?: string;
|
|
15
|
-
orderDirection?: 'asc' | 'desc';
|
|
16
|
-
limit?: number;
|
|
17
|
-
offset?: number;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Document with ID
|
|
21
|
-
*/
|
|
22
|
-
export interface Doc<T = Record<string, any>> {
|
|
23
|
-
id: string;
|
|
24
|
-
data: T;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Result of a write operation
|
|
28
|
-
*/
|
|
29
|
-
export interface WriteResult {
|
|
30
|
-
success: boolean;
|
|
31
|
-
error?: string;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Abstract store interface
|
|
35
|
-
*
|
|
36
|
-
* All methods are async to support both sync (IndexedDB) and
|
|
37
|
-
* async (Firestore, Postgres) backends.
|
|
38
|
-
*/
|
|
39
|
-
export interface Store {
|
|
40
|
-
/**
|
|
41
|
-
* Get a document by ID
|
|
42
|
-
* Returns null if not found
|
|
43
|
-
*/
|
|
44
|
-
get(collection: string, id: string): Promise<Record<string, any> | null>;
|
|
45
|
-
/**
|
|
46
|
-
* Set a document (create or update)
|
|
47
|
-
* If merge is true, only updates provided fields
|
|
48
|
-
*/
|
|
49
|
-
set(collection: string, id: string, data: Record<string, any>, options?: {
|
|
50
|
-
merge?: boolean;
|
|
51
|
-
}): Promise<WriteResult>;
|
|
52
|
-
/**
|
|
53
|
-
* Delete a document
|
|
54
|
-
*/
|
|
55
|
-
delete(collection: string, id: string): Promise<WriteResult>;
|
|
56
|
-
/**
|
|
57
|
-
* Query documents in a collection
|
|
58
|
-
*/
|
|
59
|
-
query(collection: string, constraints?: QueryConstraints): Promise<Doc[]>;
|
|
60
|
-
/**
|
|
61
|
-
* Check if a document exists
|
|
62
|
-
*/
|
|
63
|
-
exists(collection: string, id: string): Promise<boolean>;
|
|
64
|
-
/**
|
|
65
|
-
* Generate a unique ID for a new document
|
|
66
|
-
*/
|
|
67
|
-
generateId(collection: string): string;
|
|
68
|
-
/**
|
|
69
|
-
* Batch write operations (atomic)
|
|
70
|
-
* Optional - not all backends support transactions
|
|
71
|
-
*/
|
|
72
|
-
batch?(operations: Array<{
|
|
73
|
-
type: 'set';
|
|
74
|
-
collection: string;
|
|
75
|
-
id: string;
|
|
76
|
-
data: Record<string, any>;
|
|
77
|
-
} | {
|
|
78
|
-
type: 'delete';
|
|
79
|
-
collection: string;
|
|
80
|
-
id: string;
|
|
81
|
-
}>): Promise<WriteResult>;
|
|
82
|
-
/**
|
|
83
|
-
* Clear all data (for testing)
|
|
84
|
-
*/
|
|
85
|
-
clear?(): Promise<void>;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Factory function type for creating stores
|
|
89
|
-
*/
|
|
90
|
-
export type StoreFactory = () => Store | Promise<Store>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Store } from './interface';
|
|
2
|
-
/**
|
|
3
|
-
* Create an in-memory store
|
|
4
|
-
*/
|
|
5
|
-
export declare function createMemoryStore(): Store;
|
|
6
|
-
export declare function getMemoryStore(): Store;
|
|
7
|
-
/**
|
|
8
|
-
* Reset the default store (for tests)
|
|
9
|
-
*/
|
|
10
|
-
export declare function resetMemoryStore(): void;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Helpers for loading and testing playground example markdown files.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
* import { loadExample, loadExamples } from './test-examples'
|
|
6
|
-
*
|
|
7
|
-
* const ex = loadExample('guides/examples/tjs/wasm-starfield.md')
|
|
8
|
-
* // ex.code — the source code from the first code block
|
|
9
|
-
* // ex.language — 'tjs', 'ajs', 'javascript', etc.
|
|
10
|
-
* // ex.title — from the markdown # heading
|
|
11
|
-
* // ex.metadata — parsed JSON from <!--{...}--> comment
|
|
12
|
-
*
|
|
13
|
-
* const all = loadExamples('guides/examples/tjs')
|
|
14
|
-
* // array of all examples in that directory
|
|
15
|
-
*/
|
|
16
|
-
export interface ExampleFile {
|
|
17
|
-
/** Absolute or relative path to the source .md file */
|
|
18
|
-
path: string;
|
|
19
|
-
/** Title from the first # heading */
|
|
20
|
-
title: string;
|
|
21
|
-
/** Description — first paragraph between title and code block */
|
|
22
|
-
description: string;
|
|
23
|
-
/** Source code from the first fenced code block */
|
|
24
|
-
code: string;
|
|
25
|
-
/** Language tag from the code fence (e.g. 'tjs', 'ajs', 'javascript') */
|
|
26
|
-
language: string;
|
|
27
|
-
/** Parsed metadata from the <!--{...}--> comment, if present */
|
|
28
|
-
metadata: Record<string, any>;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Load a single example from a markdown file.
|
|
32
|
-
*/
|
|
33
|
-
export declare function loadExample(filePath: string): ExampleFile;
|
|
34
|
-
/**
|
|
35
|
-
* Load all .md examples from a directory.
|
|
36
|
-
*/
|
|
37
|
-
export declare function loadExamples(dirPath: string): ExampleFile[];
|
|
38
|
-
/**
|
|
39
|
-
* Parse example content from markdown source.
|
|
40
|
-
*/
|
|
41
|
-
export declare function parseExample(content: string, filePath?: string): ExampleFile;
|
package/dist/src/test-utils.d.ts
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test utilities for Agent99
|
|
3
|
-
*
|
|
4
|
-
* Common mock factories and helpers for testing agents.
|
|
5
|
-
*/
|
|
6
|
-
import type { Capabilities } from './runtime';
|
|
7
|
-
/**
|
|
8
|
-
* Retry a test function up to maxAttempts times.
|
|
9
|
-
* Passes if it succeeds at least minSuccesses times out of maxAttempts.
|
|
10
|
-
* This accounts for LLM variability in code generation.
|
|
11
|
-
*/
|
|
12
|
-
export declare function withRetry<T>(fn: () => Promise<T>, { maxAttempts, minSuccesses, }?: {
|
|
13
|
-
maxAttempts?: number;
|
|
14
|
-
minSuccesses?: number;
|
|
15
|
-
}): Promise<T>;
|
|
16
|
-
/**
|
|
17
|
-
* Creates a mock in-memory store capability
|
|
18
|
-
* @param initialData - Optional initial data keyed by string
|
|
19
|
-
* @param options.getOverride - Optional function to override get behavior
|
|
20
|
-
*/
|
|
21
|
-
export declare function createMockStore(initialData?: Record<string, any>, options?: {
|
|
22
|
-
getOverride?: (key: string) => any;
|
|
23
|
-
}): {
|
|
24
|
-
get: import("bun:test").Mock<(key: string) => Promise<any>>;
|
|
25
|
-
set: import("bun:test").Mock<(key: string, value: any) => Promise<void>>;
|
|
26
|
-
query: import("bun:test").Mock<(_query: any) => Promise<any[]>>;
|
|
27
|
-
_db: Map<string, any>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Creates a mock fetch capability that returns the provided response
|
|
31
|
-
*/
|
|
32
|
-
export declare function createMockFetch(response?: any): import("bun:test").Mock<(_url: string, _init?: any) => Promise<any>>;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a mock fetch capability with URL-based responses
|
|
35
|
-
*/
|
|
36
|
-
export declare function createMockFetchWithRoutes(routes: Record<string, any>, fallback?: any | ((url: string) => any)): import("bun:test").Mock<(url: string, _init?: any) => Promise<any>>;
|
|
37
|
-
/**
|
|
38
|
-
* Creates a mock LLM capability
|
|
39
|
-
*/
|
|
40
|
-
export declare function createMockLLM(response: string | ((prompt: string) => string)): {
|
|
41
|
-
predict: import("bun:test").Mock<(prompt: string, _options?: any) => Promise<string>>;
|
|
42
|
-
embed: import("bun:test").Mock<(_text: string) => Promise<any[]>>;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Creates a mock vector capability for RAG testing
|
|
46
|
-
*/
|
|
47
|
-
export declare function createMockVector(): {
|
|
48
|
-
embed: import("bun:test").Mock<(_text: string) => Promise<any[]>>;
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* Creates a mock XML parser capability
|
|
52
|
-
*/
|
|
53
|
-
export declare function createMockXML(parseResult?: any): {
|
|
54
|
-
parse: import("bun:test").Mock<(_xml: string) => Promise<any>>;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Combines multiple capability mocks into a Capabilities object
|
|
58
|
-
*/
|
|
59
|
-
export declare function createCapabilities(overrides?: Partial<Capabilities>): Capabilities;
|
|
60
|
-
/**
|
|
61
|
-
* Creates capabilities with a mock store that has vector search
|
|
62
|
-
*/
|
|
63
|
-
export declare function createMockVectorStore(documents?: Array<{
|
|
64
|
-
id: string;
|
|
65
|
-
content: string;
|
|
66
|
-
vector?: number[];
|
|
67
|
-
}>): {
|
|
68
|
-
get: import("bun:test").Mock<(key: string) => Promise<{
|
|
69
|
-
id: string;
|
|
70
|
-
content: string;
|
|
71
|
-
vector?: number[];
|
|
72
|
-
} | undefined>>;
|
|
73
|
-
set: import("bun:test").Mock<(key: string, value: any) => Promise<void>>;
|
|
74
|
-
vectorSearch: import("bun:test").Mock<(_collection: string, _vector: number[], k?: any) => Promise<{
|
|
75
|
-
id: string;
|
|
76
|
-
content: string;
|
|
77
|
-
vector?: number[];
|
|
78
|
-
}[]>>;
|
|
79
|
-
vectorAdd: import("bun:test").Mock<(_collection: string, doc: any) => Promise<void>>;
|
|
80
|
-
createCollection: import("bun:test").Mock<() => Promise<undefined>>;
|
|
81
|
-
_db: Map<string, {
|
|
82
|
-
id: string;
|
|
83
|
-
content: string;
|
|
84
|
-
vector?: number[];
|
|
85
|
-
}>;
|
|
86
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from '../../lang/inference';
|
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LegalDate - Pure functions for YYYY-MM-DD date strings
|
|
3
|
-
*
|
|
4
|
-
* A "legal date" is a calendar date without time - the kind you see on
|
|
5
|
-
* contracts, birth certificates, and legal documents. It represents a
|
|
6
|
-
* civil date, not a point in time.
|
|
7
|
-
*
|
|
8
|
-
* No Date warts:
|
|
9
|
-
* - Months are 1-based (January = 1)
|
|
10
|
-
* - All functions are pure (string in, string out)
|
|
11
|
-
* - No mutable objects
|
|
12
|
-
* - No timezone confusion (it's just a date)
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Legal date string type: YYYY-MM-DD
|
|
16
|
-
* e.g., "2024-01-15"
|
|
17
|
-
*/
|
|
18
|
-
export type LegalDateString = string;
|
|
19
|
-
/**
|
|
20
|
-
* Validate that a string is a valid YYYY-MM-DD date
|
|
21
|
-
*/
|
|
22
|
-
export declare function isValid(date: string): date is LegalDateString;
|
|
23
|
-
/**
|
|
24
|
-
* Get today's date as YYYY-MM-DD (in UTC)
|
|
25
|
-
*/
|
|
26
|
-
export declare function today(): LegalDateString;
|
|
27
|
-
/**
|
|
28
|
-
* Get today's date in a specific timezone
|
|
29
|
-
*/
|
|
30
|
-
export declare function todayIn(timezone: string): LegalDateString;
|
|
31
|
-
/**
|
|
32
|
-
* Create a date from components
|
|
33
|
-
* IMPORTANT: month is 1-based (1 = January, 12 = December)
|
|
34
|
-
*/
|
|
35
|
-
export declare function from(year: number, month: number, day: number): LegalDateString;
|
|
36
|
-
/**
|
|
37
|
-
* Parse a flexible date string into YYYY-MM-DD format
|
|
38
|
-
*/
|
|
39
|
-
export declare function parse(input: string): LegalDateString;
|
|
40
|
-
/**
|
|
41
|
-
* Try to parse a date string, returning null on failure
|
|
42
|
-
*/
|
|
43
|
-
export declare function tryParse(input: string): LegalDateString | null;
|
|
44
|
-
/**
|
|
45
|
-
* Add days to a date
|
|
46
|
-
*/
|
|
47
|
-
export declare function addDays(date: LegalDateString, days: number): LegalDateString;
|
|
48
|
-
/**
|
|
49
|
-
* Add weeks to a date
|
|
50
|
-
*/
|
|
51
|
-
export declare function addWeeks(date: LegalDateString, weeks: number): LegalDateString;
|
|
52
|
-
/**
|
|
53
|
-
* Add months to a date
|
|
54
|
-
* Handles month overflow correctly (e.g., Jan 31 + 1 month = Feb 28/29)
|
|
55
|
-
*/
|
|
56
|
-
export declare function addMonths(date: LegalDateString, months: number): LegalDateString;
|
|
57
|
-
/**
|
|
58
|
-
* Add years to a date
|
|
59
|
-
* Handles leap years correctly (Feb 29 + 1 year = Feb 28)
|
|
60
|
-
*/
|
|
61
|
-
export declare function addYears(date: LegalDateString, years: number): LegalDateString;
|
|
62
|
-
/**
|
|
63
|
-
* Get the difference between two dates in days
|
|
64
|
-
* Returns a - b (positive if a is after b)
|
|
65
|
-
*/
|
|
66
|
-
export declare function diff(a: LegalDateString, b: LegalDateString): number;
|
|
67
|
-
/**
|
|
68
|
-
* Get the difference in complete months
|
|
69
|
-
*/
|
|
70
|
-
export declare function diffMonths(a: LegalDateString, b: LegalDateString): number;
|
|
71
|
-
/**
|
|
72
|
-
* Get the difference in complete years
|
|
73
|
-
*/
|
|
74
|
-
export declare function diffYears(a: LegalDateString, b: LegalDateString): number;
|
|
75
|
-
/**
|
|
76
|
-
* Get the year component
|
|
77
|
-
*/
|
|
78
|
-
export declare function year(date: LegalDateString): number;
|
|
79
|
-
/**
|
|
80
|
-
* Get the month component (1-based: 1 = January, 12 = December)
|
|
81
|
-
*/
|
|
82
|
-
export declare function month(date: LegalDateString): number;
|
|
83
|
-
/**
|
|
84
|
-
* Get the day of month component (1-31)
|
|
85
|
-
*/
|
|
86
|
-
export declare function day(date: LegalDateString): number;
|
|
87
|
-
/**
|
|
88
|
-
* Get the day of week (1 = Monday, 7 = Sunday) - ISO 8601 convention
|
|
89
|
-
*/
|
|
90
|
-
export declare function dayOfWeek(date: LegalDateString): number;
|
|
91
|
-
/**
|
|
92
|
-
* Get the ISO week number (1-53)
|
|
93
|
-
*/
|
|
94
|
-
export declare function weekOfYear(date: LegalDateString): number;
|
|
95
|
-
/**
|
|
96
|
-
* Get the day of year (1-366)
|
|
97
|
-
*/
|
|
98
|
-
export declare function dayOfYear(date: LegalDateString): number;
|
|
99
|
-
/**
|
|
100
|
-
* Get the quarter (1-4)
|
|
101
|
-
*/
|
|
102
|
-
export declare function quarter(date: LegalDateString): number;
|
|
103
|
-
/**
|
|
104
|
-
* Check if a year is a leap year
|
|
105
|
-
*/
|
|
106
|
-
export declare function isLeapYear(y: number): boolean;
|
|
107
|
-
/**
|
|
108
|
-
* Get the number of days in a month
|
|
109
|
-
* Month is 1-based (1 = January)
|
|
110
|
-
*/
|
|
111
|
-
export declare function daysInMonth(y: number, m: number): number;
|
|
112
|
-
/**
|
|
113
|
-
* Get the number of days in a year
|
|
114
|
-
*/
|
|
115
|
-
export declare function daysInYear(y: number): number;
|
|
116
|
-
/**
|
|
117
|
-
* Convert to ISO timestamp (midnight UTC)
|
|
118
|
-
*/
|
|
119
|
-
export declare function toTimestamp(date: LegalDateString): string;
|
|
120
|
-
/**
|
|
121
|
-
* Convert to Unix timestamp (seconds since epoch, midnight UTC)
|
|
122
|
-
*/
|
|
123
|
-
export declare function toUnix(date: LegalDateString): number;
|
|
124
|
-
/**
|
|
125
|
-
* Create from Unix timestamp (seconds since epoch)
|
|
126
|
-
*/
|
|
127
|
-
export declare function fromUnix(unix: number): LegalDateString;
|
|
128
|
-
/**
|
|
129
|
-
* Format a date for display
|
|
130
|
-
*/
|
|
131
|
-
export declare function format(date: LegalDateString, options?: Intl.DateTimeFormatOptions): string;
|
|
132
|
-
/**
|
|
133
|
-
* Format as a readable date string
|
|
134
|
-
*/
|
|
135
|
-
export declare function formatLong(date: LegalDateString): string;
|
|
136
|
-
/**
|
|
137
|
-
* Format as a short date string
|
|
138
|
-
*/
|
|
139
|
-
export declare function formatShort(date: LegalDateString): string;
|
|
140
|
-
/**
|
|
141
|
-
* Check if a is before b
|
|
142
|
-
*/
|
|
143
|
-
export declare function isBefore(a: LegalDateString, b: LegalDateString): boolean;
|
|
144
|
-
/**
|
|
145
|
-
* Check if a is after b
|
|
146
|
-
*/
|
|
147
|
-
export declare function isAfter(a: LegalDateString, b: LegalDateString): boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Check if two dates are equal
|
|
150
|
-
*/
|
|
151
|
-
export declare function isEqual(a: LegalDateString, b: LegalDateString): boolean;
|
|
152
|
-
/**
|
|
153
|
-
* Get the earlier of two dates
|
|
154
|
-
*/
|
|
155
|
-
export declare function min(a: LegalDateString, b: LegalDateString): LegalDateString;
|
|
156
|
-
/**
|
|
157
|
-
* Get the later of two dates
|
|
158
|
-
*/
|
|
159
|
-
export declare function max(a: LegalDateString, b: LegalDateString): LegalDateString;
|
|
160
|
-
/**
|
|
161
|
-
* Check if a date is between two other dates (inclusive)
|
|
162
|
-
*/
|
|
163
|
-
export declare function isBetween(date: LegalDateString, start: LegalDateString, end: LegalDateString): boolean;
|
|
164
|
-
/**
|
|
165
|
-
* Get the first day of the month
|
|
166
|
-
*/
|
|
167
|
-
export declare function startOfMonth(date: LegalDateString): LegalDateString;
|
|
168
|
-
/**
|
|
169
|
-
* Get the last day of the month
|
|
170
|
-
*/
|
|
171
|
-
export declare function endOfMonth(date: LegalDateString): LegalDateString;
|
|
172
|
-
/**
|
|
173
|
-
* Get the first day of the quarter
|
|
174
|
-
*/
|
|
175
|
-
export declare function startOfQuarter(date: LegalDateString): LegalDateString;
|
|
176
|
-
/**
|
|
177
|
-
* Get the last day of the quarter
|
|
178
|
-
*/
|
|
179
|
-
export declare function endOfQuarter(date: LegalDateString): LegalDateString;
|
|
180
|
-
/**
|
|
181
|
-
* Get the first day of the year
|
|
182
|
-
*/
|
|
183
|
-
export declare function startOfYear(date: LegalDateString): LegalDateString;
|
|
184
|
-
/**
|
|
185
|
-
* Get the last day of the year
|
|
186
|
-
*/
|
|
187
|
-
export declare function endOfYear(date: LegalDateString): LegalDateString;
|
|
188
|
-
/**
|
|
189
|
-
* Get the first day of the week (Monday)
|
|
190
|
-
*/
|
|
191
|
-
export declare function startOfWeek(date: LegalDateString): LegalDateString;
|
|
192
|
-
/**
|
|
193
|
-
* Get the last day of the week (Sunday)
|
|
194
|
-
*/
|
|
195
|
-
export declare function endOfWeek(date: LegalDateString): LegalDateString;
|
|
196
|
-
export declare const LegalDate: {
|
|
197
|
-
isValid: typeof isValid;
|
|
198
|
-
today: typeof today;
|
|
199
|
-
todayIn: typeof todayIn;
|
|
200
|
-
from: typeof from;
|
|
201
|
-
parse: typeof parse;
|
|
202
|
-
tryParse: typeof tryParse;
|
|
203
|
-
addDays: typeof addDays;
|
|
204
|
-
addWeeks: typeof addWeeks;
|
|
205
|
-
addMonths: typeof addMonths;
|
|
206
|
-
addYears: typeof addYears;
|
|
207
|
-
diff: typeof diff;
|
|
208
|
-
diffMonths: typeof diffMonths;
|
|
209
|
-
diffYears: typeof diffYears;
|
|
210
|
-
year: typeof year;
|
|
211
|
-
month: typeof month;
|
|
212
|
-
day: typeof day;
|
|
213
|
-
dayOfWeek: typeof dayOfWeek;
|
|
214
|
-
weekOfYear: typeof weekOfYear;
|
|
215
|
-
dayOfYear: typeof dayOfYear;
|
|
216
|
-
quarter: typeof quarter;
|
|
217
|
-
isLeapYear: typeof isLeapYear;
|
|
218
|
-
daysInMonth: typeof daysInMonth;
|
|
219
|
-
daysInYear: typeof daysInYear;
|
|
220
|
-
toTimestamp: typeof toTimestamp;
|
|
221
|
-
toUnix: typeof toUnix;
|
|
222
|
-
fromUnix: typeof fromUnix;
|
|
223
|
-
format: typeof format;
|
|
224
|
-
formatLong: typeof formatLong;
|
|
225
|
-
formatShort: typeof formatShort;
|
|
226
|
-
isBefore: typeof isBefore;
|
|
227
|
-
isAfter: typeof isAfter;
|
|
228
|
-
isEqual: typeof isEqual;
|
|
229
|
-
min: typeof min;
|
|
230
|
-
max: typeof max;
|
|
231
|
-
isBetween: typeof isBetween;
|
|
232
|
-
startOfMonth: typeof startOfMonth;
|
|
233
|
-
endOfMonth: typeof endOfMonth;
|
|
234
|
-
startOfQuarter: typeof startOfQuarter;
|
|
235
|
-
endOfQuarter: typeof endOfQuarter;
|
|
236
|
-
startOfYear: typeof startOfYear;
|
|
237
|
-
endOfYear: typeof endOfYear;
|
|
238
|
-
startOfWeek: typeof startOfWeek;
|
|
239
|
-
endOfWeek: typeof endOfWeek;
|
|
240
|
-
};
|
|
241
|
-
export default LegalDate;
|