/** * Copyright 2023 Fluence Labs Limited * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { JSONSchemaType } from "ajv"; import { type InitializedConfig, type InitializedReadonlyConfig } from "../initConfig.js"; type SpellProperties = { aquaFilePath: string; function: string; initArgs?: Record; clock?: { periodSec?: number; startTimestamp?: string; endTimestamp?: string; startDelaySec?: number; endDelaySec?: number; }; }; export type OverridableSpellProperties = Partial; type ConfigV0 = { version: 0; } & SpellProperties; export declare const overridableSpellProperties: { readonly aquaFilePath: { readonly nullable: true; readonly type: "string"; readonly description: "Path to Aqua file which contains an Aqua function that you want to use as a spell"; }; readonly function: { readonly nullable: true; readonly type: "string"; readonly description: "Name of the Aqua function that you want to use as a spell"; }; readonly version: { readonly type: "number"; readonly const: 0; }; readonly initArgs: { readonly type: "object"; readonly description: "A map of Aqua function arguments names as keys and arguments values as values. They will be passed to the spell function and will be stored in the key-value storage for this particular spell."; readonly nullable: true; }; readonly clock: { readonly type: "object"; readonly nullable: true; readonly description: "Trigger the spell execution periodically. If you want to disable this property by overriding it in fluence.yaml - pass empty config for it like this: `clock: {}`"; readonly properties: { readonly periodSec: { readonly type: "number"; readonly description: "How often the spell will be executed. If set to 0, the spell will be executed only once. If this value not provided at all - the spell will never be executed"; readonly minimum: 0; readonly maximum: number; readonly nullable: true; }; readonly startTimestamp: { readonly type: "string"; readonly description: "An ISO timestamp when the periodic execution should start. If this property or `startDelaySec` not specified, periodic execution will start immediately. If it is set to 0 - the spell will never be executed"; readonly nullable: true; }; readonly endTimestamp: { readonly type: "string"; readonly description: "An ISO timestamp when the periodic execution should end. If this property or `endDelaySec` not specified, periodic execution will never end. If it is in the past at the moment of spell creation on Rust peer - the spell will never be executed"; readonly nullable: true; }; readonly startDelaySec: { readonly type: "number"; readonly description: "How long to wait before the first execution in seconds. If this property or `startTimestamp` not specified, periodic execution will start immediately. WARNING! Currently your computer's clock is used to determine a final timestamp that is sent to the server. This property conflicts with `startTimestamp`. You can specify only one of them"; readonly nullable: true; readonly minimum: 0; readonly maximum: 4294967295; }; readonly endDelaySec: { readonly type: "number"; readonly description: "How long to wait before the last execution in seconds. If this property or `endTimestamp` not specified, periodic execution will never end. WARNING! Currently your computer's clock is used to determine a final timestamp that is sent to the server. If it is in the past at the moment of spell creation - the spell will never be executed. This property conflicts with `endTimestamp`. You can specify only one of them"; readonly nullable: true; readonly minimum: 0; readonly maximum: 4294967295; }; }; readonly required: readonly []; }; }; type LatestConfig = ConfigV0; export type SpellConfig = InitializedConfig; export type SpellConfigReadonly = InitializedReadonlyConfig; export declare const resolveStartSec: ({ clock }: LatestConfig) => number; export declare const resolveEndSec: ({ clock }: LatestConfig) => number; export declare const initSpellConfig: (configOrConfigDirPathOrUrl: string, absolutePath: string) => Promise | null>; export declare const initReadonlySpellConfig: (configOrConfigDirPathOrUrl: string, absolutePath: string) => Promise | null>; export declare const initNewReadonlySpellConfig: (configPath: string) => Promise | null>; export declare const spellSchema: JSONSchemaType; export {};