repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
ion | github_2023 | sst | typescript | Redis.port | public get port() {
return this.cluster.port.apply((v) => v!);
} | /**
* The port to connect to the Redis cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L283-L285 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.getSSTLink | public getSSTLink() {
return {
properties: {
host: this.host,
port: this.port,
username: this.username,
password: this.password,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L294-L303 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Redis.get | public static get(name: string, clusterID: Input<string>) {
const cluster = elasticache.ReplicationGroup.get(
`${name}Cluster`,
clusterID,
);
return new Redis(name, { ref: true, cluster } as unknown as RedisArgs);
} | /**
* Reference an existing Redis cluster with the given cluster name. This is useful when you
* create a Redis cluster in one stage and want to share it in another. It avoids having to
* create a new Redis cluster in the other stage.
*
* :::tip
* You can use the `static get` method to share Redis clu... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/redis.ts#L336-L342 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the Remix app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/remix.ts#L695-L699 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the app.
*/... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/remix.ts#L704-L719 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/remix.ts#L722-L728 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Router.url | public get url() {
return all([this.cdn.domainUrl, this.cdn.url]).apply(
([domainUrl, url]) => domainUrl ?? url,
);
} | /**
* The URL of the Router.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/router.ts#L885-L889 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Router.nodes | public get nodes() {
return {
/**
* The Amazon CloudFront CDN resource.
*/
cdn: this.cdn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/router.ts#L894-L901 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Router.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/router.ts#L904-L910 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.url | public get url() {
const errorMessage =
"Cannot access the URL because no public ports are exposed.";
if ($dev) {
if (!this.devUrl) throw new VisibleError(errorMessage);
return this.devUrl;
}
if (!this._url) throw new VisibleError(errorMessage);
return this._url;
} | /**
* The URL of the service.
*
* If `public.domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated load balancer URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service-v1.ts#L783-L793 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.nodes | public get nodes() {
const self = this;
return {
/**
* The Amazon ECS Service.
*/
get service() {
if ($dev)
throw new VisibleError("Cannot access `nodes.service` in dev mode.");
return self.service!;
},
/**
* The Amazon ECS Task Role.
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service-v1.ts#L798-L840 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.getSSTLink | public getSSTLink() {
return {
properties: { url: $dev ? this.devUrl : this._url },
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service-v1.ts#L843-L847 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.url | public get url() {
const errorMessage =
"Cannot access the URL because no public ports are exposed.";
if (this.dev) {
if (!this.devUrl) throw new VisibleError(errorMessage);
return this.devUrl;
}
if (!this._url) throw new VisibleError(errorMessage);
return this._url;
} | /**
* The URL of the service.
*
* If `public.domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated load balancer URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service.ts#L940-L950 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.service | public get service() {
return this.dev
? interpolate`dev.${this.cloudmapNamespace}`
: interpolate`${this.cloudmapService!.name}.${this.cloudmapNamespace}`;
} | /**
* The name of the Cloud Map service.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service.ts#L955-L959 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.nodes | public get nodes() {
const self = this;
return {
/**
* The Amazon ECS Service.
*/
get service() {
if (self.dev)
throw new VisibleError("Cannot access `nodes.service` in dev mode.");
return self.service!;
},
/**
* The Amazon ECS Execution Rol... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service.ts#L964-L1008 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Service.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.dev ? this.devUrl : this._url,
service: this.service,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/service.ts#L1011-L1018 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopicLambdaSubscriber.nodes | public get nodes() {
return {
/**
* The Lambda function that'll be notified.
*/
function: this.fn.apply((fn) => fn.getFunction()),
/**
* The Lambda permission.
*/
permission: this.permission,
/**
* The SNS Topic subscription.
*/
subscript... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic-lambda-subscriber.ts#L103-L118 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopicQueueSubscriber.nodes | public get nodes() {
return {
/**
* The SQS Queue policy.
*/
policy: this.policy,
/**
* The SNS Topic subscription.
*/
subscription: this.subscription,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic-queue-subscriber.ts#L100-L111 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.arn | public get arn() {
return this.topic.arn;
} | /**
* The ARN of the SNS Topic.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L195-L197 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.name | public get name() {
return this.topic.name;
} | /**
* The name of the SNS Topic.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L202-L204 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.nodes | public get nodes() {
return {
/**
* The Amazon SNS Topic.
*/
topic: this.topic,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L209-L216 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.subscribe | public subscribe(
subscriber: Input<string | FunctionArgs | FunctionArn>,
args: SnsTopicSubscriberArgs = {},
) {
return SnsTopic._subscribeFunction(
this.constructorName,
this.arn,
subscriber,
args,
{ provider: this.constructorOpts.provider },
);
} | /**
* Subscribe to this SNS Topic.
*
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* ```js title="sst.config.ts"
* topic.subscribe("src/subscriber.handler");
* ```
*
* Add a filter to the subscription.
*
* ```js t... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L255-L266 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.subscribe | public static subscribe(
topicArn: Input<string>,
subscriber: Input<string | FunctionArgs | FunctionArn>,
args?: SnsTopicSubscriberArgs,
) {
return output(topicArn).apply((topicArn) =>
this._subscribeFunction(
logicalName(parseTopicArn(topicArn).topicName),
topicArn,
subs... | /**
* Subscribe to an SNS Topic that was not created in your app.
*
* @param topicArn The ARN of the SNS Topic to subscribe to.
* @param subscriber The function that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have an existing SNS Topi... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L308-L321 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.subscribeQueue | public subscribeQueue(
queueArn: Input<string>,
args: SnsTopicSubscriberArgs = {},
) {
return SnsTopic._subscribeQueue(
this.constructorName,
this.arn,
queueArn,
args,
);
} | /**
* Subscribe to this SNS Topic with an SQS Queue.
*
* @param queueArn The ARN of the queue that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have a queue.
*
* ```js title="sst.config.ts"
* const queue = sst.aws.Queue("MyQueue")... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L384-L394 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.subscribeQueue | public static subscribeQueue(
topicArn: Input<string>,
queueArn: Input<string>,
args?: SnsTopicSubscriberArgs,
) {
return output(topicArn).apply((topicArn) =>
this._subscribeQueue(
logicalName(parseTopicArn(topicArn).topicName),
topicArn,
queueArn,
args,
),
... | /**
* Subscribe to an existing SNS Topic with a previously created SQS Queue.
*
* @param topicArn The ARN of the SNS Topic to subscribe to.
* @param queueArn The ARN of the queue that'll be notified.
* @param args Configure the subscription.
*
* @example
*
* For example, let's say you have an... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L428-L441 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SnsTopic.getSSTLink | public getSSTLink() {
return {
properties: {
arn: this.arn,
},
include: [
permission({
actions: ["sns:*"],
resources: [this.arn],
}),
],
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/sns-topic.ts#L470-L482 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SolidStart.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the SolidStart app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/solid-start.ts#L520-L524 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SolidStart.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/solid-start.ts#L529-L544 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SolidStart.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/solid-start.ts#L547-L553 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the website.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/static-site.ts#L968-L972 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.nodes | public get nodes() {
return {
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*/
cdn: this.cdn,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/static-site.ts#L977-L988 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/static-site.ts#L991-L997 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SvelteKit.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the SvelteKit app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/svelte-kit.ts#L584-L588 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SvelteKit.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the app.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the app.
*/
... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/svelte-kit.ts#L593-L608 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | SvelteKit.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/svelte-kit.ts#L611-L617 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | TanstackStart.url | public get url() {
return all([this.cdn?.domainUrl, this.cdn?.url, this.devUrl]).apply(
([domainUrl, url, dev]) => domainUrl ?? url ?? dev!,
);
} | /**
* The URL of the TanstackStart app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/tanstack-start.ts#L520-L524 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | TanstackStart.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
/**
* The Amazon CloudFront CDN that serves the site.
*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/tanstack-start.ts#L529-L544 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | TanstackStart.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/tanstack-start.ts#L547-L553 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vector.get | public static get(name: string, clusterID: Input<string>) {
const postgres = Postgres.get(`${name}Database`, clusterID);
return new Vector(name, {
ref: true,
postgres,
} as unknown as VectorArgs);
} | /**
* Reference an existing Vector database with the given name. This is useful when you
* create a Vector database in one stage and want to share it in another. It avoids having to
* create a new Vector database in the other stage.
*
* :::tip
* You can use the `static get` method to share Vector data... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vector.ts#L254-L260 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vector.clusterID | public get clusterID() {
return this.postgres.nodes.cluster.id;
} | /**
* The ID of the RDS Postgres Cluster.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vector.ts#L265-L267 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vector.nodes | public get nodes() {
return {
/**
* The Postgres database.
*/
postgres: this.postgres,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vector.ts#L272-L279 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vector.getSSTLink | public getSSTLink() {
return {
properties: {
/** @internal */
queryFunction: this.queryHandler.name,
/** @internal */
putFunction: this.putHandler.name,
/** @internal */
removeFunction: this.removeHandler.name,
},
include: [
permission({
... | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vector.ts#L282-L303 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.id | public get id() {
return this.vpc.id;
} | /**
* The VPC ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L383-L385 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.publicSubnets | public get publicSubnets() {
return this._publicSubnets.apply((subnets) =>
subnets.map((subnet) => subnet.id),
);
} | /**
* A list of public subnet IDs in the VPC.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L390-L394 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.privateSubnets | public get privateSubnets() {
return this._privateSubnets.apply((subnets) =>
subnets.map((subnet) => subnet.id),
);
} | /**
* A list of private subnet IDs in the VPC.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L399-L403 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.securityGroups | public get securityGroups() {
return [this.securityGroup.id];
} | /**
* A list of VPC security group IDs.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L408-L410 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.nodes | public get nodes() {
return {
/**
* The Amazon EC2 VPC.
*/
vpc: this.vpc,
/**
* The Amazon EC2 Internet Gateway.
*/
internetGateway: this.internetGateway,
/**
* The Amazon EC2 Security Group.
*/
securityGroup: this.securityGroup,
/*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L415-L454 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.get | public static get(name: string, vpcID: Input<string>) {
const vpc = ec2.Vpc.get(`${name}Vpc`, vpcID);
const internetGateway = ec2.InternetGateway.get(
`${name}InstanceGateway`,
ec2.getInternetGatewayOutput({
filters: [{ name: "attachment.vpc-id", values: [vpc.id] }],
}).internetGateway... | /**
* Reference an existing VPC with the given ID. This is useful when you
* create a VPC in one stage and want to share it in another stage. It avoids having to
* create a new VPC in the other stage.
*
* :::tip
* You can use the `static get` method to share VPCs across stages.
* :::
*
* @par... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc-v1.ts#L487-L575 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.id | public get id() {
return this.vpc.id;
} | /**
* The VPC ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L819-L821 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.publicSubnets | public get publicSubnets() {
return this._publicSubnets.apply((subnets) =>
subnets.map((subnet) => subnet.id),
);
} | /**
* A list of public subnet IDs in the VPC.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L826-L830 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.privateSubnets | public get privateSubnets() {
return this._privateSubnets.apply((subnets) =>
subnets.map((subnet) => subnet.id),
);
} | /**
* A list of private subnet IDs in the VPC.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L835-L839 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.securityGroups | public get securityGroups() {
return [this.securityGroup.id];
} | /**
* A list of VPC security group IDs.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L844-L846 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.bastion | public get bastion() {
return this.bastionInstance.apply((v) => {
if (!v)
throw new VisibleError(
`VPC bastion is not enabled. Enable it with "bastion: true".`,
);
return v.id;
});
} | /**
* The bastion instance ID.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L851-L859 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.nodes | public get nodes() {
return {
/**
* The Amazon EC2 VPC.
*/
vpc: this.vpc,
/**
* The Amazon EC2 Internet Gateway.
*/
internetGateway: this.internetGateway,
/**
* The Amazon EC2 Security Group.
*/
securityGroup: this.securityGroup,
/*... | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L864-L915 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.get | public static get(name: string, vpcId: Input<string>) {
const vpc = ec2.Vpc.get(`${name}Vpc`, vpcId);
const internetGateway = ec2.InternetGateway.get(
`${name}InstanceGateway`,
ec2.getInternetGatewayOutput({
filters: [{ name: "attachment.vpc-id", values: [vpc.id] }],
}).internetGateway... | /**
* Reference an existing VPC with the given ID. This is useful when you
* create a VPC in one stage and want to share it in another stage. It avoids having to
* create a new VPC in the other stage.
*
* :::tip
* You can use the `static get` method to share VPCs across stages.
* :::
*
* @par... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L948-L1111 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Vpc.getSSTLink | public getSSTLink() {
return {
properties: {
bastion: this.bastionInstance.apply((v) => v?.id),
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/aws/vpc.ts#L1114-L1120 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Auth.getSSTLink | public getSSTLink(): Link.Definition {
return {
properties: {
url: this._authenticator.url,
publicKey: secret(this.key.publicKeyPem),
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/auth.ts#L57-L64 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.getSSTLink | getSSTLink() {
return {
properties: {},
include: [
binding({
type: "r2BucketBindings",
properties: {
bucketName: this.bucket.name,
},
}),
],
};
} | /**
* When you link a bucket to a worker, you can interact with it using these
* [Bucket methods](https://developers.cloudflare.com/r2/api/workers/workers-api-reference/#bucket-method-definitions).
*
* @example
* ```ts title="index.ts" {3}
* import { Resource } from "sst";
*
* await Resource.MyB... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/bucket.ts#L97-L109 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.name | public get name() {
return this.bucket.name;
} | /**
* The generated name of the R2 Bucket.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/bucket.ts#L114-L116 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Bucket.nodes | public get nodes() {
return {
/**
* The Cloudflare R2 Bucket.
*/
bucket: this.bucket,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/bucket.ts#L121-L128 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Cron.nodes | public get nodes() {
return {
/**
* The Cloudflare Worker.
*/
worker: this.worker.script,
/**
* The Cloudflare Worker Cron Trigger.
*/
trigger: this.trigger,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/cron.ts#L148-L159 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | D1.getSSTLink | getSSTLink() {
return {
properties: {},
include: [
binding({
type: "d1DatabaseBindings",
properties: {
databaseId: this.database.id,
},
}),
],
};
} | /**
* When you link a D1 database, the database will be available to the worker and you can
* query it using its [API methods](https://developers.cloudflare.com/d1/build-with-d1/d1-client-api/).
*
* @example
* ```ts title="index.ts" {1} "Resource.MyDatabase.prepare"
* import { Resource } from "sst";
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/d1.ts#L97-L109 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | D1.id | public get id() {
return this.database.id;
} | /**
* The generated ID of the D1 database.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/d1.ts#L114-L116 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | D1.nodes | public get nodes() {
return {
/**
* The Cloudflare D1 database.
*/
database: this.database,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/d1.ts#L121-L128 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Kv.getSSTLink | getSSTLink() {
return {
properties: {},
include: [
binding({
type: "kvNamespaceBindings",
properties: {
namespaceId: this.namespace.id,
},
}),
],
};
} | /**
* When you link a KV storage, the storage will be available to the worker and you can
* interact with it using its [API methods](https://developers.cloudflare.com/kv/api/).
*
* @example
* ```ts title="index.ts" {3}
* import { Resource } from "sst";
*
* await Resource.MyStorage.get("someKey")... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/kv.ts#L93-L105 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Kv.id | public get id() {
return this.namespace.id;
} | /**
* The generated ID of the KV namespace.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/kv.ts#L110-L112 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Kv.nodes | public get nodes() {
return {
/**
* The Cloudflare KV namespace.
*/
namespace: this.namespace,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/kv.ts#L117-L124 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.id | public get id() {
return this.queue.id;
} | /**
* The generated id of the queue
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/queue.ts#L69-L71 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Queue.nodes | public get nodes() {
return {
/**
* The Cloudflare queue.
*/
queue: this.queue,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/queue.ts#L76-L83 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.url | public get url() {
return this.router.url;
} | /**
* The URL of the Remix app.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated CloudFront URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/remix.ts#L435-L437 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.nodes | public get nodes() {
return {
/**
* The AWS Lambda server function that renders the site.
*/
server: this.server,
/**
* The Amazon S3 Bucket that stores the assets.
*/
assets: this.assets,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/remix.ts#L442-L453 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Remix.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/remix.ts#L456-L462 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.url | public get url() {
return this.router.url;
} | /**
* The URL of the website.
*
* If the `domain` is set, this is the URL with the custom domain.
* Otherwise, it's the autogenerated worker URL.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/static-site.ts#L423-L425 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.nodes | public get nodes() {
return {
/**
* The KV namespace that stores the assets.
*/
assets: this.assets,
/**
* The worker that serves the requests.
*/
router: this.router,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/static-site.ts#L430-L441 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | StaticSite.getSSTLink | public getSSTLink() {
return {
properties: {
url: this.url,
},
};
} | /** @internal */ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/static-site.ts#L444-L450 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Worker.url | public get url() {
return this.workerDomain
? interpolate`https://${this.workerDomain.hostname}`
: this.workerUrl.url.apply((url) => (url ? `https://${url}` : url));
} | /**
* The Worker URL if `url` is enabled.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/worker.ts#L493-L497 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Worker.nodes | public get nodes() {
return {
/**
* The Cloudflare Worker script.
*/
worker: this.script,
};
} | /**
* The underlying [resources](/docs/components/#nodes) this component creates.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/worker.ts#L502-L509 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | Worker.getSSTLink | getSSTLink() {
return {
properties: {
url: this.url,
},
include: [
binding({
type: "serviceBindings",
properties: {
service: this.script.id,
},
}),
],
};
} | /**
* When you link a worker, say WorkerA, to another worker, WorkerB; it automatically creates
* a service binding between the workers. It allows WorkerA to call WorkerB without going
* through a publicly-accessible URL.
*
* @example
* ```ts title="index.ts" {3}
* import { Resource } from "sst";
... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/components/cloudflare/worker.ts#L527-L541 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | getPythonFiles | async function getPythonFiles(
filePath: string,
): Promise<{ pythonFiles: string[]; rootDir: string }> {
try {
// Get the absolute path of the file
const absPath = path.resolve(filePath);
// Get the directory of the file
const dir = path.dirname(absPath);
const pythonFiles: string[] = [];
/**
* Rec... | /**
* Recursively retrieves all Python files (.py and .pyi) from the directory of the given file path,
* excluding any directories named "__pycache__".
*
* @param filePath - The path to the file whose directory will be searched.
* @returns A promise that resolves to an array of Python file paths and the root direc... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/runtime/python.ts#L259-L312 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | walkDirectory | async function walkDirectory(currentPath: string): Promise<void> {
let entries: fsSync.Dirent[];
try {
entries = await fs.readdir(currentPath, { withFileTypes: true });
} catch (err) {
// If there's an error accessing the path, skip it
return;
}
for (const entry of entries) {
const entr... | /**
* Recursively walks through the directory and its subdirectories to find Python files.
*
* @param currentPath - The current directory path being walked.
*/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/runtime/python.ts#L276-L303 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | copyFilesPreservingStructure | async function copyFilesPreservingStructure(
pythonFiles: string[],
sourceRoot: string,
destinationRoot: string,
baseDir?: string,
): Promise<void> {
try {
const dest = baseDir
? destinationRoot.slice(0, -baseDir.length)
: destinationRoot;
for (const filePath of pythonFiles) {
// Determine the relati... | /**
* Copies the given Python files to the destination directory, preserving their directory structure relative to the source root.
*
* @param pythonFiles - An array of absolute paths to Python files.
* @param sourceRoot - The root directory from which the files are being copied.
* @param destinationRoot - The dir... | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/platform/src/runtime/python.ts#L323-L353 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | renderHeader | function renderHeader(title: string, description: string) {
return [`---`, `title: ${title}`, `description: ${description}`, `---`];
} | /*************************/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/www/generate.ts#L681-L683 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | isModuleComponent | function isModuleComponent(module: TypeDoc.DeclarationReflection) {
const sourceFile = module.sources![0].fileName;
return (
sourceFile !== "platform/src/config.ts" &&
sourceFile !== "platform/src/global-config.d.ts" &&
!sourceFile.endsWith("/dns.ts") &&
!sourceFile.endsWith("/aws/permission.ts") &&... | /***************************************/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/www/generate.ts#L1839-L1848 | d5c4855b2618198f5e9af315c5e67d4163df165a |
ion | github_2023 | sst | typescript | configureLogger | function configureLogger() {
if (process.env.DEBUG) return;
console.debug = () => {};
} | /********************/ | https://github.com/sst/ion/blob/d5c4855b2618198f5e9af315c5e67d4163df165a/www/generate.ts#L1977-L1980 | d5c4855b2618198f5e9af315c5e67d4163df165a |
Lumos | github_2023 | andrewnguonly | typescript | CSVPackedLoader.parse | public async parse(raw: string): Promise<string[]> {
const { column, separator = "," } = this.options;
const psv = dsvFormat(separator);
// cannot use psv.parse(), unsafe-eval is not allowed
let parsed = psv.parseRows(raw.trim());
if (column !== undefined) {
if (!parsed[0].includes(column)) ... | /**
* This function is copied from the CSVLoader class with a few
* modifications so that it's able to run in a Chrome extension
* context.
*/ | https://github.com/andrewnguonly/Lumos/blob/69ff12ed3da5846eb40c3233e9dcdafb6cb64f60/src/document_loaders/csv.ts#L10-L38 | 69ff12ed3da5846eb40c3233e9dcdafb6cb64f60 |
Lumos | github_2023 | andrewnguonly | typescript | classifyPrompt | const classifyPrompt = async (
options: LumosOptions,
type: string,
originalPrompt: string,
classifcationPrompt: string,
prefixTrigger?: string,
): Promise<boolean> => {
// check for prefix trigger
if (prefixTrigger) {
if (originalPrompt.trim().toLowerCase().startsWith(prefixTrigger)) {
return n... | /**
* Determine if a prompt is positively classified as described in the
* classifcation prompt. If so, return true. Otherwise, return false.
*
* @param baseURL Ollama base URL
* @param model Ollama model name
* @param type Type of classification. Only used for logging.
* @param originalPrompt Prompt to be class... | https://github.com/andrewnguonly/Lumos/blob/69ff12ed3da5846eb40c3233e9dcdafb6cb64f60/src/scripts/background.ts#L77-L107 | 69ff12ed3da5846eb40c3233e9dcdafb6cb64f60 |
Lumos | github_2023 | andrewnguonly | typescript | filterFunction | const filterFunction = (memoryVector: (typeof this.memoryVectors)[0]) => {
if (!filter) {
return true;
}
const doc = new Document({
metadata: memoryVector.metadata,
pageContent: memoryVector.content,
});
return filter(doc);
}; | // filter documents (MemoryVector interface is not exported...) | https://github.com/andrewnguonly/Lumos/blob/69ff12ed3da5846eb40c3233e9dcdafb6cb64f60/src/vectorstores/enhanced_memory.ts#L122-L132 | 69ff12ed3da5846eb40c3233e9dcdafb6cb64f60 |
cyphernetes | github_2023 | AvitalTamir | typescript | convertQueryResourceNames | async function convertQueryResourceNames(query: string): Promise<string> {
const regex = /\((\w+):(\w+)\)/g;
const matches = query.match(regex);
if (!matches) return query;
for (const match of matches) {
const [, , resourceName] = match.match(/\((\w+):(\w+)\)/) || [];
if (resourceName) {
const... | // Helper function to convert resource names in the query | https://github.com/AvitalTamir/cyphernetes/blob/941cf7a1ee1f9bc90f4f9913ced9b9791b4acd9e/web/src/api/queryApi.ts#L66-L81 | 941cf7a1ee1f9bc90f4f9913ced9b9791b4acd9e |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | filterLargeSample | function filterLargeSample(state: ApplicationState) {
if (!state || !state.selectedSample) {
return state;
}
const estimatedTotalSize = estimateSize(state.selectedSample.messages);
if (estimatedTotalSize > 400000) {
const { selectedSample, ...filteredState } = state; // eslint-disable-line
return f... | // Filters the selected Sample if it is large | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/index.tsx#L70-L82 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | filterLargeSelectedLog | function filterLargeSelectedLog(state: ApplicationState) {
if (!state || !state.selectedLog?.contents) {
return state;
}
const estimatedSize = estimateSize(
state.selectedLog.contents.sampleSummaries,
);
if (estimatedSize > 400000) {
const { selectedLog, ...filteredState } = state; // eslint-disa... | // Filters the selectedlog if it is too large | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/index.tsx#L85-L99 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | simpleHttpAPI | function simpleHttpAPI(logInfo: LogInfo): LogViewAPI {
const log_dir = logInfo.log_dir;
async function open_log_file() {
// No op
}
return {
client_events: async () => {
// There are no client events in the case of serving via
// http
return Promise.resolve([]);
},
eval_logs: ... | /**
* Fetches a file from the specified URL and parses its content.
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/api-http.ts#L39-L121 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | fetchFile | async function fetchFile<T>(
url: string,
parse: (text: string) => Promise<T>,
handleError?: (response: Response) => boolean,
): Promise<T | undefined> {
const safe_url = encodePathParts(url);
const response = await fetch(`${safe_url}`, { method: "GET" });
if (response.ok) {
const text = await response.... | /**
* Fetches a file from the specified URL and parses its content.
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/api-http.ts#L126-L146 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | fetchLogFile | const fetchLogFile = async (file: string): Promise<LogContents | undefined> => {
return fetchFile<LogContents>(file, async (text): Promise<LogContents> => {
const log = (await asyncJsonParse(text)) as EvalLog;
if (log.version === 1) {
if (log.results) {
const untypedLog = log as any;
log... | /**
* Fetches a log file and parses its content, updating the log structure if necessary.
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/api-http.ts#L151-L178 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | fetchLogHeaders | const fetchLogHeaders = async (
log_dir: string,
): Promise<LogFilesFetchResponse | undefined> => {
const logs = await fetchFile<LogFilesFetchResponse>(
log_dir + "/logs.json",
async (text) => {
const parsed = await asyncJsonParse(text);
return {
raw: text,
parsed,
};
}... | /**
* Fetches a log file and parses its content, updating the log structure if necessary.
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/api-http.ts#L183-L205 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | joinURI | function joinURI(...segments: string[]): string {
return segments
.map((segment) => segment.replace(/(^\/+|\/+$)/g, "")) // Remove leading/trailing slashes from each segment
.join("/");
} | /**
* Joins multiple URI segments into a single URI string.
*
* This function removes any leading or trailing slashes from each segment
* and then joins them with a single slash (`/`).
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/api-http.ts#L213-L217 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | get_log | const get_log = async (
log_file: string,
cached = false,
): Promise<LogContents> => {
// If the requested log is different or no cached log exists, start fetching
if (!cached || log_file !== current_path || !current_log) {
// If there's already a pending fetch, return the same promise
if ... | /**
* Gets a log
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/client-api.ts#L75-L103 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | get_log_summary | const get_log_summary = async (log_file: string): Promise<EvalSummary> => {
if (isEvalFile(log_file)) {
const remoteLogFile = await remoteEvalFile(log_file);
if (remoteLogFile) {
return await remoteLogFile.readLogSummary();
} else {
throw new Error("Unable to read remote eval file"... | /**
* Gets a log summary
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/client-api.ts#L109-L148 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | get_log_sample | const get_log_sample = async (
log_file: string,
id: string | number,
epoch: number,
): Promise<EvalSample | undefined> => {
if (isEvalFile(log_file)) {
const remoteLogFile = await remoteEvalFile(log_file, true);
try {
if (remoteLogFile) {
const sample = await remoteLogFi... | /**
* Gets a sample
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/client-api.ts#L153-L183 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | get_log_headers | const get_log_headers = async (log_files: string[]): Promise<EvalLog[]> => {
const eval_files: Record<string, number> = {};
const json_files: Record<string, number> = {};
let index = 0;
// Separate files into eval_files and json_files
for (const file of log_files) {
if (isEvalFile(file)) {
... | /**
* Gets log headers
*/ | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/client-api.ts#L198-L242 | fa64ceab7a943432114e5b8dada495d781b132ea |
inspect_ai | github_2023 | UKGovernmentBEIS | typescript | resolveApi | const resolveApi = (): ClientAPI => {
if (getVscodeApi()) {
// This is VSCode
return clientApi(vscodeApi);
} else {
// See if there is an log_file, log_dir embedded in the
// document or passed via URL (could be hosted)
const scriptEl = document.getElementById("log_dir_context");
if (scriptE... | // | https://github.com/UKGovernmentBEIS/inspect_ai/blob/fa64ceab7a943432114e5b8dada495d781b132ea/src/inspect_ai/_view/www/src/api/index.ts#L13-L49 | fa64ceab7a943432114e5b8dada495d781b132ea |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.