@elaraai/east-web-std 1.0.85

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.
Files changed (102) hide show
  1. package/CLA.md +26 -0
  2. package/CONTRIBUTING.md +28 -0
  3. package/LICENSE.md +31 -0
  4. package/README.md +191 -0
  5. package/THIRD_PARTY_NOTICES.md +123 -0
  6. package/dist/src/compliance.spec.d.ts +6 -0
  7. package/dist/src/compliance.spec.d.ts.map +1 -0
  8. package/dist/src/compliance.spec.js +89 -0
  9. package/dist/src/compliance.spec.js.map +1 -0
  10. package/dist/src/console.d.ts +237 -0
  11. package/dist/src/console.d.ts.map +1 -0
  12. package/dist/src/console.js +260 -0
  13. package/dist/src/console.js.map +1 -0
  14. package/dist/src/crypto.d.ts +224 -0
  15. package/dist/src/crypto.d.ts.map +1 -0
  16. package/dist/src/crypto.js +295 -0
  17. package/dist/src/crypto.js.map +1 -0
  18. package/dist/src/fetch.d.ts +383 -0
  19. package/dist/src/fetch.d.ts.map +1 -0
  20. package/dist/src/fetch.js +412 -0
  21. package/dist/src/fetch.js.map +1 -0
  22. package/dist/src/index.d.ts +106 -0
  23. package/dist/src/index.d.ts.map +1 -0
  24. package/dist/src/index.js +93 -0
  25. package/dist/src/index.js.map +1 -0
  26. package/dist/src/path.d.ts +243 -0
  27. package/dist/src/path.d.ts.map +1 -0
  28. package/dist/src/path.js +562 -0
  29. package/dist/src/path.js.map +1 -0
  30. package/dist/src/random/crypto-rng.d.ts +38 -0
  31. package/dist/src/random/crypto-rng.d.ts.map +1 -0
  32. package/dist/src/random/crypto-rng.js +55 -0
  33. package/dist/src/random/crypto-rng.js.map +1 -0
  34. package/dist/src/random/distributions/bates.d.ts +17 -0
  35. package/dist/src/random/distributions/bates.d.ts.map +1 -0
  36. package/dist/src/random/distributions/bates.js +15 -0
  37. package/dist/src/random/distributions/bates.js.map +1 -0
  38. package/dist/src/random/distributions/bernoulli.d.ts +17 -0
  39. package/dist/src/random/distributions/bernoulli.d.ts.map +1 -0
  40. package/dist/src/random/distributions/bernoulli.js +13 -0
  41. package/dist/src/random/distributions/bernoulli.js.map +1 -0
  42. package/dist/src/random/distributions/binomial.d.ts +17 -0
  43. package/dist/src/random/distributions/binomial.d.ts.map +1 -0
  44. package/dist/src/random/distributions/binomial.js +24 -0
  45. package/dist/src/random/distributions/binomial.js.map +1 -0
  46. package/dist/src/random/distributions/exponential.d.ts +17 -0
  47. package/dist/src/random/distributions/exponential.d.ts.map +1 -0
  48. package/dist/src/random/distributions/exponential.js +13 -0
  49. package/dist/src/random/distributions/exponential.js.map +1 -0
  50. package/dist/src/random/distributions/geometric.d.ts +17 -0
  51. package/dist/src/random/distributions/geometric.d.ts.map +1 -0
  52. package/dist/src/random/distributions/geometric.js +14 -0
  53. package/dist/src/random/distributions/geometric.js.map +1 -0
  54. package/dist/src/random/distributions/irwin-hall.d.ts +17 -0
  55. package/dist/src/random/distributions/irwin-hall.d.ts.map +1 -0
  56. package/dist/src/random/distributions/irwin-hall.js +18 -0
  57. package/dist/src/random/distributions/irwin-hall.js.map +1 -0
  58. package/dist/src/random/distributions/log-normal.d.ts +17 -0
  59. package/dist/src/random/distributions/log-normal.d.ts.map +1 -0
  60. package/dist/src/random/distributions/log-normal.js +12 -0
  61. package/dist/src/random/distributions/log-normal.js.map +1 -0
  62. package/dist/src/random/distributions/normal.d.ts +18 -0
  63. package/dist/src/random/distributions/normal.d.ts.map +1 -0
  64. package/dist/src/random/distributions/normal.js +16 -0
  65. package/dist/src/random/distributions/normal.js.map +1 -0
  66. package/dist/src/random/distributions/pareto.d.ts +17 -0
  67. package/dist/src/random/distributions/pareto.d.ts.map +1 -0
  68. package/dist/src/random/distributions/pareto.js +14 -0
  69. package/dist/src/random/distributions/pareto.js.map +1 -0
  70. package/dist/src/random/distributions/poisson.d.ts +17 -0
  71. package/dist/src/random/distributions/poisson.d.ts.map +1 -0
  72. package/dist/src/random/distributions/poisson.js +81 -0
  73. package/dist/src/random/distributions/poisson.js.map +1 -0
  74. package/dist/src/random/distributions/uniform-int.d.ts +17 -0
  75. package/dist/src/random/distributions/uniform-int.d.ts.map +1 -0
  76. package/dist/src/random/distributions/uniform-int.js +16 -0
  77. package/dist/src/random/distributions/uniform-int.js.map +1 -0
  78. package/dist/src/random/distributions/uniform.d.ts +17 -0
  79. package/dist/src/random/distributions/uniform.d.ts.map +1 -0
  80. package/dist/src/random/distributions/uniform.js +10 -0
  81. package/dist/src/random/distributions/uniform.js.map +1 -0
  82. package/dist/src/random/rng.d.ts +21 -0
  83. package/dist/src/random/rng.d.ts.map +1 -0
  84. package/dist/src/random/rng.js +7 -0
  85. package/dist/src/random/rng.js.map +1 -0
  86. package/dist/src/random/xorshift128.d.ts +42 -0
  87. package/dist/src/random/xorshift128.d.ts.map +1 -0
  88. package/dist/src/random/xorshift128.js +119 -0
  89. package/dist/src/random/xorshift128.js.map +1 -0
  90. package/dist/src/random.d.ts +822 -0
  91. package/dist/src/random.d.ts.map +1 -0
  92. package/dist/src/random.js +992 -0
  93. package/dist/src/random.js.map +1 -0
  94. package/dist/src/test.d.ts +86 -0
  95. package/dist/src/test.d.ts.map +1 -0
  96. package/dist/src/test.js +160 -0
  97. package/dist/src/test.js.map +1 -0
  98. package/dist/src/time.d.ts +201 -0
  99. package/dist/src/time.d.ts.map +1 -0
  100. package/dist/src/time.js +300 -0
  101. package/dist/src/time.js.map +1 -0
  102. package/package.json +64 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"random.js","sourceRoot":"","sources":["../../src/random.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAInD,OAAO,SAAS,MAAM,wBAAwB,CAAC;AAC/C,OAAO,cAAc,MAAM,yBAAyB,CAAC;AACrD,OAAO,WA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SAAS,EAAE,iBAAiB;IAE5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,EAAE,iBAAiB;IAE5B;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,EAAE,YAAY;IAEnB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,IAAI,EAAE,WAAW;IAEjB;;;;OAIG;IACH,cAAc,EAAE,UAAU;CACpB,CAAC;AAEX,yEAAyE;AACzE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,86 @@
1
+ import type { PlatformFunction } from "@elaraai/east/internal";
2
+ /**
3
+ * A failed East test assertion: what `testFail` throws.
4
+ *
5
+ * It is not an `EastError`, so an East `try`/`catch` does not catch it — as it
6
+ * does not catch the `node:assert` error east-node-std throws — and an
7
+ * assertion that fails inside one still fails the test.
8
+ */
9
+ export declare class TestFailure extends Error {
10
+ /**
11
+ * @param message - What failed
12
+ * @param options - The error that caused it, if any
13
+ */
14
+ constructor(message: string, options?: {
15
+ cause?: unknown;
16
+ });
17
+ }
18
+ /**
19
+ * Runs the suites and tests an East test program declares.
20
+ *
21
+ * The program calls `describe` and `test` (as east-node-std's `describeEast`
22
+ * builds them, and as east-node-std's exported compliance suite does), and
23
+ * the host decides how each runs and where its result goes: in place
24
+ * (the default), through `node:test`, or into a browser test page's report.
25
+ *
26
+ * @remarks
27
+ * A test's body rejects when an assertion in it fails, with a
28
+ * {@link TestFailure}, or when the East code in it throws.
29
+ */
30
+ export interface TestHost {
31
+ /**
32
+ * Runs a suite: `body` declares its tests, calling {@link TestHost.test}.
33
+ *
34
+ * @param name - The suite's name
35
+ * @param body - The suite's body
36
+ */
37
+ describe(name: string, body: () => Promise<void>): Promise<void>;
38
+ /**
39
+ * Runs one test.
40
+ *
41
+ * @param name - The test's name
42
+ * @param body - The test's body, which rejects when the test fails
43
+ */
44
+ test(name: string, body: () => Promise<void>): Promise<void>;
45
+ }
46
+ /**
47
+ * Creates the test platform functions — `testPass`, `testFail`, `test` and
48
+ * `describe` — over a host that runs them.
49
+ *
50
+ * These are the functions east-node-std's `describeEast` and `Assert` build
51
+ * East tests from, and so the functions its exported compliance suite calls.
52
+ *
53
+ * @param host - Runs the suites and tests; by default, in place (see
54
+ * {@link TestImpl})
55
+ * @returns The test platform functions
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * import { createWebPlatform, type TestHost } from "@elaraai/east-web-std";
60
+ *
61
+ * const results: string[] = [];
62
+ * const recording: TestHost = {
63
+ * describe: async (_name, body) => { await body(); },
64
+ * test: async (name, body) => {
65
+ * try { await body(); results.push(`pass ${name}`); }
66
+ * catch (error) { results.push(`fail ${name}`); }
67
+ * },
68
+ * };
69
+ * const platform = createWebPlatform({ test: recording });
70
+ * ```
71
+ */
72
+ export declare function createTestImpl(host?: TestHost): PlatformFunction[];
73
+ /**
74
+ * The test platform functions, running each suite and test in place.
75
+ *
76
+ * Every test runs; when the outermost suite ends, it fails with a
77
+ * {@link TestFailure} listing every test that failed, so a test program
78
+ * fails when a test did. Give `createWebPlatform` (or
79
+ * {@link createTestImpl}) a {@link TestHost} to report tests another way.
80
+ *
81
+ * @remarks
82
+ * Its failures are kept for the suite that is running, so run one test
83
+ * program at a time over it; each {@link createTestImpl} keeps its own.
84
+ */
85
+ export declare const TestImpl: PlatformFunction[];
86
+ //# sourceMappingURL=test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../src/test.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AA0C/D;;;;;;GAMG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAI7D;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjE;;;;;OAKG;IACH,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChE;AAsDD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,QAA4B,GAAG,gBAAgB,EAAE,CAcrF;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,EAAE,gBAAgB,EAAqB,CAAC"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { AsyncFunctionType, East, NullType, StringType } from "@elaraai/east";
6
+ /**
7
+ * Platform function that indicates a test assertion passed.
8
+ *
9
+ * This is used by East test code to signal successful assertions. It does
10
+ * nothing: the test continues.
11
+ */
12
+ const testPass = East.platform("testPass", [], NullType);
13
+ /**
14
+ * Platform function that indicates a test assertion failed.
15
+ *
16
+ * This is used by East test code to signal failed assertions. It throws a
17
+ * {@link TestFailure}, which fails the test.
18
+ *
19
+ * @param message - The error message describing the assertion failure
20
+ */
21
+ const testFail = East.platform("testFail", [StringType], NullType);
22
+ /**
23
+ * Platform function that defines a single test case.
24
+ *
25
+ * This is used by East test code to define individual tests. The host's
26
+ * {@link TestHost.test} runs it.
27
+ *
28
+ * @param name - The name of the test
29
+ * @param body - The test body function
30
+ */
31
+ const test = East.asyncPlatform("test", [StringType, AsyncFunctionType([], NullType)], NullType);
32
+ /**
33
+ * Platform function that defines a test suite.
34
+ *
35
+ * This is used by East test code to group related tests. The host's
36
+ * {@link TestHost.describe} runs it.
37
+ *
38
+ * @param name - The name of the test suite
39
+ * @param body - A function that calls test() to define tests
40
+ */
41
+ const describe = East.asyncPlatform("describe", [StringType, AsyncFunctionType([], NullType)], NullType);
42
+ /**
43
+ * A failed East test assertion: what `testFail` throws.
44
+ *
45
+ * It is not an `EastError`, so an East `try`/`catch` does not catch it — as it
46
+ * does not catch the `node:assert` error east-node-std throws — and an
47
+ * assertion that fails inside one still fails the test.
48
+ */
49
+ export class TestFailure extends Error {
50
+ /**
51
+ * @param message - What failed
52
+ * @param options - The error that caused it, if any
53
+ */
54
+ constructor(message, options) {
55
+ super(message, options);
56
+ this.name = "TestFailure";
57
+ }
58
+ }
59
+ /** The message of whatever a failing body threw. */
60
+ function messageOf(error) {
61
+ return error instanceof Error ? error.message : `${error}`;
62
+ }
63
+ /**
64
+ * A host that runs each suite and test where the program declares it.
65
+ *
66
+ * Every test runs, whether or not the ones before it passed. When the
67
+ * outermost suite ends, it fails with a {@link TestFailure} that lists every
68
+ * failure in it, so the program fails when a test did. A test declared
69
+ * outside any suite fails the program at once.
70
+ */
71
+ function inPlaceTestHost() {
72
+ const suites = [];
73
+ const failures = [];
74
+ return {
75
+ async describe(name, body) {
76
+ suites.push(name);
77
+ try {
78
+ await body();
79
+ }
80
+ catch (error) {
81
+ // The suite failed outside its tests
82
+ failures.push({ path: [...suites], error });
83
+ }
84
+ finally {
85
+ suites.pop();
86
+ }
87
+ if (suites.length === 0 && failures.length > 0) {
88
+ const failed = failures.splice(0);
89
+ const lines = failed.map(({ path, error }) => ` ${path.join(" > ")}: ${messageOf(error)}`);
90
+ throw new TestFailure(`East tests failed:\n${lines.join("\n")}`, { cause: failed[0].error });
91
+ }
92
+ },
93
+ async test(name, body) {
94
+ try {
95
+ await body();
96
+ }
97
+ catch (error) {
98
+ if (suites.length === 0) {
99
+ throw new TestFailure(`${name}: ${messageOf(error)}`, { cause: error });
100
+ }
101
+ failures.push({ path: [...suites, name], error });
102
+ }
103
+ },
104
+ };
105
+ }
106
+ /**
107
+ * Creates the test platform functions — `testPass`, `testFail`, `test` and
108
+ * `describe` — over a host that runs them.
109
+ *
110
+ * These are the functions east-node-std's `describeEast` and `Assert` build
111
+ * East tests from, and so the functions its exported compliance suite calls.
112
+ *
113
+ * @param host - Runs the suites and tests; by default, in place (see
114
+ * {@link TestImpl})
115
+ * @returns The test platform functions
116
+ *
117
+ * @example
118
+ * ```ts
119
+ * import { createWebPlatform, type TestHost } from "@elaraai/east-web-std";
120
+ *
121
+ * const results: string[] = [];
122
+ * const recording: TestHost = {
123
+ * describe: async (_name, body) => { await body(); },
124
+ * test: async (name, body) => {
125
+ * try { await body(); results.push(`pass ${name}`); }
126
+ * catch (error) { results.push(`fail ${name}`); }
127
+ * },
128
+ * };
129
+ * const platform = createWebPlatform({ test: recording });
130
+ * ```
131
+ */
132
+ export function createTestImpl(host = inPlaceTestHost()) {
133
+ return [
134
+ testPass.implement(() => { }), // Assertion passed - do nothing (test continues)
135
+ testFail.implement((message) => {
136
+ // Assertion failed - throw to fail the test
137
+ throw new TestFailure(message);
138
+ }),
139
+ test.implement(async (name, body) => {
140
+ await host.test(name, async () => { await body(); });
141
+ }),
142
+ describe.implement(async (name, body) => {
143
+ await host.describe(name, async () => { await body(); });
144
+ }),
145
+ ];
146
+ }
147
+ /**
148
+ * The test platform functions, running each suite and test in place.
149
+ *
150
+ * Every test runs; when the outermost suite ends, it fails with a
151
+ * {@link TestFailure} listing every test that failed, so a test program
152
+ * fails when a test did. Give `createWebPlatform` (or
153
+ * {@link createTestImpl}) a {@link TestHost} to report tests another way.
154
+ *
155
+ * @remarks
156
+ * Its failures are kept for the suite that is running, so run one test
157
+ * program at a time over it; each {@link createTestImpl} keeps its own.
158
+ */
159
+ export const TestImpl = createTestImpl();
160
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test.js","sourceRoot":"","sources":["../../src/test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,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QACL,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAiB,eAAe,EAAE;IAC7D,OAAO;QACH,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,EAAE,iDAAiD;QAChF,QAAQ,CAAC,SAAS,CAAC,CAAC,OAAe,EAAE,EAAE;YACnC,4CAA4C;YAC5C,MAAM,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAY,EAAE,IAAyB,EAAE,EAAE;YAC7D,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC;QACF,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,IAAY,EAAE,IAAyB,EAAE,EAAE;YACjE,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC;KACL,CAAC;AACN,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuB,cAAc,EAAE,CAAC"}
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ import { IntegerType, NullType, DateTimeType, StringType } from "@elaraai/east";
6
+ import type { PlatformFunction } from "@elaraai/east/internal";
7
+ /**
8
+ * Gets the current Unix timestamp in milliseconds.
9
+ *
10
+ * Returns the number of milliseconds elapsed since the Unix epoch
11
+ * (January 1, 1970 00:00:00 UTC). This is useful for timestamping events,
12
+ * measuring durations, and working with date/time data.
13
+ *
14
+ * This is a platform function for the East language, enabling time access
15
+ * in East programs running in a browser.
16
+ *
17
+ * @returns The current time as milliseconds since epoch (January 1, 1970 UTC)
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const getTimestamp = East.function([], IntegerType, $ => {
22
+ * return Time.now();
23
+ * // Returns: 1735689600000n (example)
24
+ * });
25
+ * ```
26
+ */
27
+ export declare const time_now: import("@elaraai/east").PlatformDefinition<[], IntegerType>;
28
+ /**
29
+ * Sleeps for the specified number of milliseconds.
30
+ *
31
+ * Pauses execution asynchronously for the given duration. This is a non-blocking
32
+ * sleep that allows other operations to run during the wait period. Useful for
33
+ * rate limiting, delays, and timing control.
34
+ *
35
+ * This is a platform function for the East language, enabling timed delays
36
+ * in East programs running in a browser.
37
+ *
38
+ * @param ms - The number of milliseconds to sleep (must be non-negative)
39
+ * @returns Null after sleeping completes
40
+ *
41
+ * @throws {EastError} When sleep fails
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const delayedTask = East.function([], NullType, $ => {
46
+ * $(Console.log("Starting..."));
47
+ * $(Time.sleep(1000n)); // Wait 1 second
48
+ * $(Console.log("Done!"));
49
+ * });
50
+ * ```
51
+ *
52
+ * @remarks
53
+ * A browser may slow the timers of a page in a background tab, so a sleep
54
+ * there can last longer than asked.
55
+ */
56
+ export declare const time_sleep: import("@elaraai/east").AsyncPlatformDefinition<[IntegerType], NullType>;
57
+ /**
58
+ * Gets the UTC offset in minutes for an IANA timezone at a given UTC datetime.
59
+ *
60
+ * Returns the number of minutes that the given timezone is ahead of (positive)
61
+ * or behind (negative) UTC at the specified instant. This accounts for DST
62
+ * transitions — the same timezone can return different offsets depending on
63
+ * the datetime.
64
+ *
65
+ * The timezone must be a valid IANA timezone name (e.g., "Australia/Sydney",
66
+ * "America/New_York", "Europe/London", "Asia/Tokyo"). See the IANA Time Zone
67
+ * Database for the full list of valid names.
68
+ *
69
+ * @param datetime - A UTC datetime to compute the offset for
70
+ * @param zone - An IANA timezone name (e.g., "Australia/Sydney")
71
+ * @returns UTC offset in minutes (e.g., 660 for Sydney in summer, 600 in winter)
72
+ *
73
+ * @throws {EastError} When the timezone name is not a valid IANA timezone
74
+ *
75
+ * @example
76
+ * ```ts
77
+ * const toSydneyTime = East.function([DateTimeType], DateTimeType, ($, dt) => {
78
+ * const offset = $.let(Time.getTimezoneOffset(dt, "Australia/Sydney"));
79
+ * $.return(dt.addMinutes(offset));
80
+ * });
81
+ * ```
82
+ */
83
+ export declare const time_get_timezone_offset: import("@elaraai/east").PlatformDefinition<[DateTimeType, StringType], IntegerType>;
84
+ /**
85
+ * Browser implementation of time platform functions, whose sleeps a host may
86
+ * stop.
87
+ *
88
+ * @param signal - Stops the program's sleeps, for a host that stops a program
89
+ * without ending its thread: once it aborts, a sleep under way fails at
90
+ * once, its timer cleared, and a later one fails as it starts. Unset, a
91
+ * sleep ends once its time has passed
92
+ * @returns The platform functions, to pass to {@link East.compileAsync}
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const stop = new AbortController();
97
+ * const compiled = await East.compileAsync(delayedTask.toIR(), createTimeImpl(stop.signal));
98
+ * const running = compiled();
99
+ * stop.abort(); // the sleep under way fails at once: "Failed to sleep: the program was stopped"
100
+ * ```
101
+ */
102
+ export declare function createTimeImpl(signal?: AbortSignal): PlatformFunction[];
103
+ /**
104
+ * Browser implementation of time platform functions.
105
+ *
106
+ * Pass this array to {@link East.compileAsync} to enable time operations.
107
+ */
108
+ declare const TimeImpl: PlatformFunction[];
109
+ /**
110
+ * Grouped time platform functions.
111
+ *
112
+ * Provides time, sleep, and timezone operations for East programs.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * import { East, NullType } from "@elaraai/east";
117
+ * import { Time } from "@elaraai/east-web-std";
118
+ *
119
+ * const timedTask = East.function([], NullType, $ => {
120
+ * const start = $.let(Time.now());
121
+ * $(Time.sleep(1000n)); // Sleep for 1 second
122
+ * const end = $.let(Time.now());
123
+ * });
124
+ *
125
+ * const compiled = await East.compileAsync(timedTask.toIR(), Time.Implementation);
126
+ * await compiled();
127
+ * ```
128
+ */
129
+ export declare const Time: {
130
+ /**
131
+ * Gets the current Unix timestamp in milliseconds.
132
+ *
133
+ * Returns the number of milliseconds elapsed since the Unix epoch
134
+ * (January 1, 1970 00:00:00 UTC). Useful for timestamping and measuring durations.
135
+ *
136
+ * @returns The current time as milliseconds since epoch
137
+ *
138
+ * @example
139
+ * ```ts
140
+ * const getTimestamp = East.function([], IntegerType, $ => {
141
+ * return Time.now();
142
+ * });
143
+ *
144
+ * const compiled = await East.compileAsync(getTimestamp.toIR(), Time.Implementation);
145
+ * await compiled(); // Returns: 1735689600000n (example timestamp)
146
+ * ```
147
+ */
148
+ readonly now: import("@elaraai/east").PlatformDefinition<[], IntegerType>;
149
+ /**
150
+ * Sleeps for the specified number of milliseconds.
151
+ *
152
+ * Pauses execution asynchronously for the given duration. Non-blocking sleep
153
+ * that allows other operations to run during the wait period.
154
+ *
155
+ * @param ms - The number of milliseconds to sleep (must be non-negative)
156
+ * @returns Null after sleeping completes
157
+ * @throws {EastError} When sleep fails
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * const delayedTask = East.function([], NullType, $ => {
162
+ * $(Console.log("Starting..."));
163
+ * $(Time.sleep(1000n));
164
+ * $(Console.log("Done!"));
165
+ * });
166
+ *
167
+ * const compiled = await East.compileAsync(delayedTask.toIR(), Time.Implementation);
168
+ * await compiled(); // Waits 1 second between log messages
169
+ * ```
170
+ */
171
+ readonly sleep: import("@elaraai/east").AsyncPlatformDefinition<[IntegerType], NullType>;
172
+ /**
173
+ * Gets the UTC offset in minutes for an IANA timezone at a given UTC datetime.
174
+ *
175
+ * Accounts for DST — the same timezone returns different offsets depending
176
+ * on the datetime. Use the result with `addMinutes` to convert a UTC datetime
177
+ * to local time.
178
+ *
179
+ * @param datetime - A UTC datetime
180
+ * @param zone - An IANA timezone name (e.g., "Australia/Sydney")
181
+ * @returns UTC offset in minutes
182
+ * @throws {EastError} When the timezone name is invalid
183
+ *
184
+ * @example
185
+ * ```ts
186
+ * const toSydneyTime = East.function([DateTimeType], DateTimeType, ($, dt) => {
187
+ * const offset = $.let(Time.getTimezoneOffset(dt, "Australia/Sydney"));
188
+ * $.return(dt.addMinutes(offset));
189
+ * });
190
+ * ```
191
+ */
192
+ readonly getTimezoneOffset: import("@elaraai/east").PlatformDefinition<[DateTimeType, StringType], IntegerType>;
193
+ /**
194
+ * Browser implementation of time platform functions.
195
+ *
196
+ * Pass this to {@link East.compileAsync} to enable time operations.
197
+ */
198
+ readonly Implementation: PlatformFunction[];
199
+ };
200
+ export { TimeImpl };
201
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../../src/time.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAQ,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAqC/D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,QAAQ,6DAA6C,CAAC;AAEnE;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,UAAU,0EAA4D,CAAC;AAEpF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,wBAAwB,qFAIpC,CAAC;AA4BF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,gBAAgB,EAAE,CA2CvE;AAED;;;;GAIG;AACH,QAAA,MAAM,QAAQ,EAAE,gBAAgB,EAAqB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,IAAI;IACb;;;;;;;;;;;;;;;;;OAiBG;;IAGH;;;;;;;;;;;;;;;;;;;;;OAqBG;;IAGH;;;;;;;;;;;;;;;;;;;OAmBG;;IAGH;;;;OAIG;;CAEG,CAAC;AAGX,OAAO,EAAE,QAAQ,EAAE,CAAC"}