Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typedocs task api snippets fixes and unhide reference options (#537) #545

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions yajsapi/activity/activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ export interface ExeScriptRequest {
text: string;
}

/**
* @hidden
*/
export interface ActivityOptions {
yagnaOptions?: {
/** Yagna Api Key */
Expand Down
21 changes: 9 additions & 12 deletions yajsapi/executor/executor.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Package, PackageOptions } from "../package/index.js";
import { MarketService, DemandOptions } from "../market/index.js";
import { AgreementOptions, AgreementPoolService } from "../agreement/index.js";
import { MarketService } from "../market/index.js";
import { AgreementPoolService } from "../agreement/index.js";
import { Task, TaskQueue, TaskService, Worker } from "../task/index.js";
import { PaymentService, PaymentOptions } from "../payment/index.js";
import { NetworkService } from "../network/index.js";
import { ActivityOptions, Result } from "../activity/index.js";
import { Result } from "../activity/index.js";
import { sleep, Logger, runtimeContextChecker } from "../utils/index.js";
import { StorageProvider, GftpStorageProvider } from "../storage/index.js";
import { ExecutorConfig } from "./config.js";
Expand Down Expand Up @@ -46,13 +46,10 @@ export type ExecutorOptions = {
isSubprocess?: boolean;
/** Timeout for preparing activity - creating and deploy commands */
activityPreparingTimeout?: number;
} & MarketOptions &
ActivityOptions &
AgreementOptions &
PaymentOptions &
DemandOptions &
Omit<PackageOptions, "imageHash" | "imageTag"> &
} & Omit<PackageOptions, "imageHash" | "imageTag"> &
MarketOptions &
TaskOptions &
PaymentOptions &
NetworkServiceOptions &
AgreementServiceOptions &
Omit<WorkOptions, "isRunning">;
Expand Down Expand Up @@ -109,7 +106,7 @@ export class TaskExecutor {
* ```js
* const executor = await TaskExecutor.create({
* subnetTag: "public",
* payment: { driver: "erc-20", network: "rinkeby" },
* payment: { driver: "erc-20", network: "goerli" },
* package: "golem/alpine:3.18.2",
* });
* ```
Expand Down Expand Up @@ -268,7 +265,7 @@ export class TaskExecutor {
* @example
* ```typescript
* const data = [1, 2, 3, 4, 5];
* const results = executor.map(data, (ctx, item) => providerCtx.ctx(`echo "${item}"`));
* const results = executor.map(data, (ctx, item) => ctx.run(`echo "${item}"`));
* for await (const result of results) console.log(result.stdout);
* ```
*/
Expand Down Expand Up @@ -316,7 +313,7 @@ export class TaskExecutor {
* ```typescript
* const data = [1, 2, 3, 4, 5];
* await executor.forEach(data, async (ctx, item) => {
* console.log((await ctx.run(`echo "${item}"`).stdout));
* console.log((await ctx.run(`echo "${item}"`)).stdout);
* });
* ```
*/
Expand Down
3 changes: 0 additions & 3 deletions yajsapi/market/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import { sleep } from "../utils/index.js";

export type ProposalFilter = (proposal: ProposalDTO) => Promise<boolean>;

/**
* @internal
*/
export interface MarketOptions extends DemandOptions {
/** A custom filter that checks every proposal coming from the market */
proposalFilter?: ProposalFilter;
Expand Down
13 changes: 5 additions & 8 deletions yajsapi/network/service.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import { Logger } from '../utils/index.js';
import { Network } from './index.js';
import { NetworkOptions } from './network.js';
import { NetworkNode } from './node.js';
import { getIdentity } from './identity.js';
import { Logger } from "../utils/index.js";
import { Network } from "./index.js";
import { NetworkOptions } from "./network.js";
import { NetworkNode } from "./node.js";
import { getIdentity } from "./identity.js";

/**
* @internal
*/
export type NetworkServiceOptions = Omit<NetworkOptions, "networkOwnerId">;

/**
Expand Down
7 changes: 1 addition & 6 deletions yajsapi/package/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import axios from "axios";
import { PackageConfig } from "./config.js";
import { RequireAtLeastOne } from "../utils/types.js";
/**
* @hidden
*/

export type PackageOptions = RequireAtLeastOne<
{
Expand All @@ -24,7 +21,6 @@
/** finds package by its contents hash */
imageHash?: string;
/** finds package by registry tag */

imageTag?: string;
manifest?: string;
/** Signature of base64 encoded Computation Payload Manifest **/
Expand All @@ -50,7 +46,6 @@

/**
* Package module - an object for descriptions of the payload required by the requestor.
* @hidden
*/
export class Package {
private logger?: Logger;
Expand All @@ -66,10 +61,10 @@
}

static getImageIdentifier(
str: string
str: string,
): RequireAtLeastOne<{ imageHash: string; imageTag: string }, "imageHash" | "imageTag"> {
const tagRegex = /^(.*?)\/(.*?):(.*)$/;
if (tagRegex.test(str)) {

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data High

This
regular expression
that depends on
library input
may run slow on strings starting with '/' and with many repetitions of '/a'.
This
regular expression
that depends on
library input
may run slow on strings starting with '/:' and with many repetitions of ':a'.
return {
imageTag: str,
};
Expand Down
3 changes: 0 additions & 3 deletions yajsapi/payment/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ import { Accounts } from "./accounts.js";
import { Payments, PaymentEventType, DebitNoteEvent, InvoiceEvent } from "./payments.js";
import { RejectionReason } from "./rejection.js";

/**
* @internal
*/
export interface PaymentOptions extends BasePaymentOptions {
/** Interval for checking new invoices */
invoiceFetchingInterval?: number;
Expand Down
Loading