@soundscript/cli-darwin-arm64 0.1.2 → 0.1.3

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.
@@ -54,15 +54,15 @@ export function flatMap<A, B, E1, E2>(
54
54
  ): Task<B, E1 | E2>;
55
55
  export function recover<A, B, E>(
56
56
  task: Task<A, E>,
57
- project: (error: E) => B | PromiseLike<B>,
57
+ project: (error: E) => B | Promise<B>,
58
58
  ): Task<A | B, Error>;
59
59
  export function tap<A, E>(
60
60
  task: Task<A, E>,
61
- effect: (value: A) => unknown | PromiseLike<unknown>,
61
+ effect: (value: A) => unknown | Promise<unknown>,
62
62
  ): Task<A, E | Error>;
63
63
  export function tapError<A, E>(
64
64
  task: Task<A, E>,
65
- effect: (error: E) => unknown | PromiseLike<unknown>,
65
+ effect: (error: E) => unknown | Promise<unknown>,
66
66
  ): Task<A, E | Error>;
67
67
  export function parallel<T, E>(tasks: readonly Task<T, E>[]): Task<readonly T[], E>;
68
68
  export function race<T, E>(
@@ -6,8 +6,9 @@ import type { Invariant } from 'sts:typeclasses';
6
6
  export { booleanEncoder, contramap, numberEncoder, stringEncoder } from 'sts:encode';
7
7
  export type { EncodeFailure, Encoder } from 'sts:encode';
8
8
 
9
- export interface Codec<T, TEncoded = unknown, DE = DecodeFailure, EE = EncodeFailure>
10
- extends Decoder<T, DE>, Encoder<T, TEncoded, EE> {}
9
+ // #[variance(T: inout, TEncoded: out, DE: out, EE: out)]
10
+ export type Codec<T, TEncoded = unknown, DE = DecodeFailure, EE = EncodeFailure> =
11
+ Decoder<T, DE> & Encoder<T, TEncoded, EE>;
11
12
 
12
13
  export interface CodecF extends TypeLambda {
13
14
  readonly type: Codec<this['Args'][3], this['Args'][2], this['Args'][1], this['Args'][0]>;
@@ -17,14 +17,16 @@ export class DecodeFailure extends Failure {
17
17
  at(segment: DecodePathSegment): this;
18
18
  }
19
19
 
20
- export interface Decoder<T, E = DecodeFailure> {
20
+ // #[variance(T: out, E: out)]
21
+ export type Decoder<T, E = DecodeFailure> = {
21
22
  decode(value: unknown): Result<T, E>;
22
- }
23
+ };
23
24
 
24
- export interface OptionalDecoder<T, E = DecodeFailure> extends Decoder<T | undefined, E> {
25
+ // #[variance(T: out, E: out)]
26
+ export type OptionalDecoder<T, E = DecodeFailure> = Decoder<T | undefined, E> & {
25
27
  readonly __soundscriptOptional: true;
26
28
  readonly inner: Decoder<T, E>;
27
- }
29
+ };
28
30
 
29
31
  type DecoderValue<TDecoder> = TDecoder extends Decoder<infer TValue, unknown> ? TValue : never;
30
32
  type DecoderError<TDecoder> = TDecoder extends Decoder<unknown, infer E> ? E : never;
@@ -7,15 +7,17 @@ export class EncodeFailure extends Failure {
7
7
  constructor(message?: string, cause?: unknown);
8
8
  }
9
9
 
10
- export interface Encoder<T, TEncoded = unknown, E = EncodeFailure> {
10
+ // #[variance(T: in, TEncoded: out, E: out)]
11
+ export type Encoder<T, TEncoded = unknown, E = EncodeFailure> = {
11
12
  encode(value: T): Result<TEncoded, E>;
12
- }
13
+ };
13
14
 
14
- export interface OptionalEncoder<T, TEncoded = T, E = EncodeFailure>
15
- extends Encoder<T | undefined, TEncoded | undefined, E> {
16
- readonly __soundscriptOptional: true;
17
- readonly inner: Encoder<T, TEncoded, E>;
18
- }
15
+ // #[variance(T: in, TEncoded: out, E: out)]
16
+ export type OptionalEncoder<T, TEncoded = T, E = EncodeFailure> =
17
+ Encoder<T | undefined, TEncoded | undefined, E> & {
18
+ readonly __soundscriptOptional: true;
19
+ readonly inner: Encoder<T, TEncoded, E>;
20
+ };
19
21
 
20
22
  type EncoderInput<TEncoder> = TEncoder extends Encoder<infer TValue, unknown, unknown> ? TValue
21
23
  : never;
@@ -72,8 +74,8 @@ export function option<T, TEncoded, E>(
72
74
  item: Encoder<T, TEncoded, E>,
73
75
  ): Encoder<
74
76
  Option<T>,
75
- { readonly error?: undefined; readonly tag: 'err' } | {
76
- readonly tag: 'ok';
77
+ { readonly tag: 'none' } | {
78
+ readonly tag: 'some';
77
79
  readonly value: TEncoded;
78
80
  },
79
81
  E
@@ -1,4 +1,4 @@
1
- import { URL, URLSearchParams } from './url';
1
+ import { URL, URLSearchParams } from 'sts:url';
2
2
 
3
3
  export interface AbortSignal {
4
4
  readonly aborted: boolean;
@@ -2,6 +2,7 @@ import { Failure } from 'sts:failures';
2
2
  import type { Decoder } from 'sts:decode';
3
3
  import type { Encoder } from 'sts:encode';
4
4
  import type { Result } from 'sts:result';
5
+ import type { Numeric } from 'sts:numerics';
5
6
 
6
7
  export type JsonArray = JsonValue[];
7
8
  export type JsonObject = {
@@ -35,15 +36,33 @@ export type JsonLikeValue =
35
36
  | JsonLikeObject
36
37
  | JsonLikeArray;
37
38
 
39
+ export type MachineJsonArray = MachineJsonLikeValue[];
40
+ export type MachineJsonObject = {
41
+ [key: string]: MachineJsonLikeValue;
42
+ };
43
+ export type MachineJsonLikeValue =
44
+ | string
45
+ | number
46
+ | boolean
47
+ | bigint
48
+ | null
49
+ | undefined
50
+ | Numeric
51
+ | MachineJsonObject
52
+ | MachineJsonArray;
53
+
38
54
  export interface JsonParseOptions {
39
55
  int64?: 'default' | 'lossless';
56
+ numerics?: 'tagged';
40
57
  }
41
58
 
42
59
  export type JsonStringifyBigintMode = 'number' | 'reject' | 'string';
60
+ export type MachineJsonNumericMode = 'tagged' | 'decimal-string' | 'json-number';
43
61
 
44
62
  export interface JsonStringifyOptions {
45
63
  int64?: 'default' | 'string' | 'lossless';
46
64
  readonly bigint?: JsonStringifyBigintMode;
65
+ numerics?: MachineJsonNumericMode;
47
66
  }
48
67
 
49
68
  export class JsonParseFailure extends Failure {
@@ -59,17 +78,25 @@ export function parseJson(
59
78
  text: string,
60
79
  options: JsonParseOptions & { int64: 'lossless' },
61
80
  ): Result<LosslessJsonValue, JsonParseFailure>;
81
+ export function parseJson(
82
+ text: string,
83
+ options: JsonParseOptions & { numerics: 'tagged' },
84
+ ): Result<MachineJsonLikeValue, JsonParseFailure>;
62
85
  export function parseJson(
63
86
  text: string,
64
87
  options?: JsonParseOptions,
65
- ): Result<JsonValue | LosslessJsonValue, JsonParseFailure>;
88
+ ): Result<JsonValue | LosslessJsonValue | MachineJsonLikeValue, JsonParseFailure>;
66
89
  export function stringifyJson(value: JsonValue): Result<string, JsonStringifyFailure>;
67
90
  export function stringifyJson(
68
91
  value: LosslessJsonValue,
69
92
  options: JsonStringifyOptions & { int64: 'string' | 'lossless' },
70
93
  ): Result<string, JsonStringifyFailure>;
71
94
  export function stringifyJson(
72
- value: JsonValue | LosslessJsonValue,
95
+ value: MachineJsonLikeValue,
96
+ options: JsonStringifyOptions & { numerics: MachineJsonNumericMode },
97
+ ): Result<string, JsonStringifyFailure>;
98
+ export function stringifyJson(
99
+ value: JsonValue | LosslessJsonValue | MachineJsonLikeValue,
73
100
  options?: JsonStringifyOptions,
74
101
  ): Result<string, JsonStringifyFailure>;
75
102
  export function parseAndDecode<T, E>(