Skip to content

Downloads

Download benefit schema and validated constructor; constructing a benefit does not authorize or deliver a file.

const Downloads: Schema.Union<readonly [Schema.Struct<{
type: Schema.tag<"download">;
asset: Schema.Struct<{
key: Schema.brand<Schema.String, "DownloadAssetKey">;
revision: Schema.brand<Schema.Int, "DefinitionRevision">;
}>;
duration: Schema.Union<readonly [Schema.Literals<readonly ...>, Schema.Struct<{
type: ...;
months: ...;
anchor: ...;
calendar: ...;
}>]>;
}>]> & {
discriminants: readonly ["download"];
cases: {
download: Schema.Struct<{
type: Schema.tag<"download">;
asset: Schema.Struct<{
key: Schema.brand<Schema.String, "DownloadAssetKey">;
revision: Schema.brand<Schema.Int, "DefinitionRevision">;
}>;
duration: Schema.Union<readonly [Schema.Literals<readonly [..., ...]>, Schema.Struct<{
type: Schema.tag<...>;
months: Schema.brand<..., ...>;
anchor: Schema.Literal<...>;
calendar: Schema.Literal<...>;
}>]>;
}>;
};
isAnyOf: <Keys>(keys) => (value) => value is Extract<{ type: "download"; asset: { key: string & any; revision: number & any }; duration: "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped" } }, { type: Keys }>;
guards: {
download: (u) => u is { type: "download"; asset: { key: string & any; revision: number & any }; duration: "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped" } };
};
match: {
<Cases> (value, cases): Cases[keyof Cases] extends (value) => R ? any : never;
<Cases> (cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never;
};
} & {
download: (input) => Effect.Effect<typeof DownloadBenefit.Type, Schema.SchemaError>;
};
readonly discriminants: readonly ["download"];
readonly cases: {
download: Schema.Struct<{
type: Schema.tag<"download">;
asset: Schema.Struct<{
key: Schema.brand<Schema.String, "DownloadAssetKey">;
revision: Schema.brand<Schema.Int, "DefinitionRevision">;
}>;
duration: Schema.Union<readonly [Schema.Literals<readonly [..., ...]>, Schema.Struct<{
type: Schema.tag<...>;
months: Schema.brand<..., ...>;
anchor: Schema.Literal<...>;
calendar: Schema.Literal<...>;
}>]>;
}>;
};
download: Schema.Struct<{
type: Schema.tag<"download">;
asset: Schema.Struct<{
key: Schema.brand<Schema.String, "DownloadAssetKey">;
revision: Schema.brand<Schema.Int, "DefinitionRevision">;
}>;
duration: Schema.Union<readonly [Schema.Literals<readonly [..., ...]>, Schema.Struct<{
type: Schema.tag<...>;
months: Schema.brand<..., ...>;
anchor: Schema.Literal<...>;
calendar: Schema.Literal<...>;
}>]>;
}>;
readonly isAnyOf: <Keys>(keys) => (value) => value is Extract<{ type: "download"; asset: { key: string & any; revision: number & any }; duration: "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped" } }, { type: Keys }>;

Keys

readonly Keys[]

(value) => value is Extract<{ type: “download”; asset: { key: string & any; revision: number & any }; duration: “perpetual” | “purchased_period” | { type: “fixed”; months: number & any; anchor: “settlement”; calendar: “utc_clamped” } }, { type: Keys }>

readonly guards: {
download: (u) => u is { type: "download"; asset: { key: string & any; revision: number & any }; duration: "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped" } };
};
download: (u) => u is { type: "download"; asset: { key: string & any; revision: number & any }; duration: "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped" } };

unknown

u is { type: “download”; asset: { key: string & any; revision: number & any }; duration: “perpetual” | “purchased_period” | { type: “fixed”; months: number & any; anchor: “settlement”; calendar: “utc_clamped” } }

readonly match: {
<Cases> (value, cases): Cases[keyof Cases] extends (value) => R ? any : never;
<Cases> (cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never;
};
<Cases>(value, cases): Cases[keyof Cases] extends (value) => R ? any : never;

Cases extends { [key: string]: (value) => any; }

"download"

{ key: string & any; revision: number & any; }

string & any

number & any

| "perpetual" | "purchased_period" | { type: "fixed"; months: number & any; anchor: "settlement"; calendar: "utc_clamped"; }

Cases

Cases[keyof Cases] extends (value) => R ? any : never

<Cases>(cases): (value) => Cases[keyof Cases] extends (value) => R ? any : never;

Cases extends { [key: string]: (value) => any; }

Cases

(value) => Cases[keyof Cases] extends (value) => R ? any : never

download: (input) => Effect.Effect<typeof DownloadBenefit.Type, Schema.SchemaError>;

Parses download eligibility without requiring its wire-format tag.

Omit<typeof DownloadBenefit.Encoded, "type">

Effect.Effect<typeof DownloadBenefit.Type, Schema.SchemaError>