From f11fac6090e0ff74602c9757a39b6c83c3c50181 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Mon, 8 Jan 2024 17:55:20 +0800 Subject: [PATCH 01/12] enhance(base): rename the Resource interface to IResource --- components/deducers/static/src/constants.ts | 2 +- .../deducers/static/src/deducer.test.ts | 20 +++++++++---------- packages/base/src/index.ts | 2 +- packages/base/src/registry.ts | 4 ++-- packages/base/src/resource.ts | 12 +++++++---- .../pluto-infra/src/alicloud/appRouter.ts | 4 ++-- .../pluto-infra/src/aws/apiGatewayRouter.ts | 10 +++++----- .../pluto-infra/src/aws/cloudWatchSchedule.ts | 4 ++-- packages/pluto-infra/src/aws/snsQueue.ts | 4 ++-- packages/pluto-infra/src/aws/tester.ts | 4 ++-- packages/pluto-infra/src/k8s/pingSchedule.ts | 4 ++-- packages/pluto/src/function.ts | 6 +++--- packages/pluto/src/kvstore.ts | 6 +++--- packages/pluto/src/queue.ts | 6 +++--- packages/pluto/src/router.ts | 6 +++--- packages/pluto/src/schedule.ts | 6 +++--- packages/pluto/src/tester.ts | 6 +++--- 17 files changed, 55 insertions(+), 51 deletions(-) diff --git a/components/deducers/static/src/constants.ts b/components/deducers/static/src/constants.ts index 7db68a48..ab597b76 100644 --- a/components/deducers/static/src/constants.ts +++ b/components/deducers/static/src/constants.ts @@ -1,3 +1,3 @@ -export const RESOUCE_TYPE_NAME = "Resource"; +export const RESOUCE_TYPE_NAME = "IResource"; export const FN_RESOURCE_TYPE_NAME = "FnResource"; export const PLUTO_BASE_PKG = "@plutolang/base"; diff --git a/components/deducers/static/src/deducer.test.ts b/components/deducers/static/src/deducer.test.ts index 626fda67..b5929438 100644 --- a/components/deducers/static/src/deducer.test.ts +++ b/components/deducers/static/src/deducer.test.ts @@ -6,13 +6,13 @@ import { isResourceType } from "./utils"; import { visitVariableStatement } from "./visit-var-def"; import { visitBinaryExpression, visitCallExpression } from "./visit-expression"; -describe("All types implement Resource", async () => { +describe("All types implement IResource", async () => { const sourceCode = ` -import { Resource } from "@plutolang/base"; +import { IResource } from "@plutolang/base"; -class DirectCls implements Resource {} -interface DirectIntf extends Resource {} -interaface DirectCls extends Resource {} // same name with DirectCls +class DirectCls implements IResource {} +interface DirectIntf extends IResource {} +interaface DirectCls extends IResource {} // same name with DirectCls class IndirectCls implements DirectIntf {} interface IndirectIntf extends DirectIntf {} @@ -30,13 +30,13 @@ interface IndirectCls extends DirectIntf {} // same name with IndirectCls }); }); -describe("All types don't implement Resource", async () => { +describe("All types don't implement IResource", async () => { const sourceCode = ` -import { Resource } from "@plutolang/other"; +import { IResource } from "@plutolang/other"; -class DirectCls implements Resource {} -interface DirectIntf extends Resource {} -interaface DirectCls extends Resource {} // same name with DirectCls +class DirectCls implements IResource {} +interface DirectIntf extends IResource {} +interaface DirectCls extends IResource {} // same name with DirectCls class IndirectCls implements DirectIntf {} interface IndirectIntf extends DirectIntf {} diff --git a/packages/base/src/index.ts b/packages/base/src/index.ts index 80168c75..dd148687 100644 --- a/packages/base/src/index.ts +++ b/packages/base/src/index.ts @@ -1,6 +1,6 @@ export * as runtime from "./runtime"; export * as engine from "./engine"; -export { ResourceInfra, Resource, FnResource } from "./resource"; +export { ResourceInfra, IResource, FnResource } from "./resource"; export { Registry } from "./registry"; export * as core from "./core"; diff --git a/packages/base/src/registry.ts b/packages/base/src/registry.ts index 33e32158..123358da 100644 --- a/packages/base/src/registry.ts +++ b/packages/base/src/registry.ts @@ -1,10 +1,10 @@ import * as engine from "./engine"; import * as runtime from "./runtime"; -import { Resource, ResourceInfra } from "./resource"; +import { IResource, ResourceInfra } from "./resource"; import { IResourceInstance } from "./simulator"; type InfraCls = { new (name: string, opts?: object): ResourceInfra | IResourceInstance }; -type ResourceCls = { new (name: string, opts?: object): Resource } | "FnResource"; +type ResourceCls = { new (name: string, opts?: object): IResource } | "FnResource"; // eslint-disable-next-line export interface Registry { diff --git a/packages/base/src/resource.ts b/packages/base/src/resource.ts index 055d2442..d34b4f81 100644 --- a/packages/base/src/resource.ts +++ b/packages/base/src/resource.ts @@ -1,10 +1,14 @@ -export interface Resource {} +export interface FnResource extends IResource {} -export interface FnResource extends Resource {} - -export interface ResourceInfra extends Resource { +export interface ResourceInfra extends IResource { get name(): string; // eslint-disable-next-line getPermission(op: string, resource?: ResourceInfra): any; postProcess(): void; } + +/** + * The class implementing this interface represents the type of cloud resource. + * It's also the type that Pluto needs to detect and process. + */ +export interface IResource {} diff --git a/packages/pluto-infra/src/alicloud/appRouter.ts b/packages/pluto-infra/src/alicloud/appRouter.ts index 248855cd..02120578 100644 --- a/packages/pluto-infra/src/alicloud/appRouter.ts +++ b/packages/pluto-infra/src/alicloud/appRouter.ts @@ -1,5 +1,5 @@ import * as pulumi from "@pulumi/pulumi"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { RequestHandler, RouterInfra, RouterInfraOptions } from "@plutolang/pluto"; import * as alicloud from "@pulumi/alicloud"; import { FCFnResource } from "./fcFnResource"; @@ -100,7 +100,7 @@ export class AppRouter extends pulumi.ComponentResource implements RouterInfra, this.url = pulumi.interpolate`https://${this.group.subDomain}`; } - public get(path: string, fn: Resource): void { + public get(path: string, fn: IResource): void { if (!(fn instanceof FCFnResource)) throw new Error("Fn is not a subclass of LambdaDef."); const lambda = fn as FCFnResource; diff --git a/packages/pluto-infra/src/aws/apiGatewayRouter.ts b/packages/pluto-infra/src/aws/apiGatewayRouter.ts index 910271a7..ef8d99a4 100644 --- a/packages/pluto-infra/src/aws/apiGatewayRouter.ts +++ b/packages/pluto-infra/src/aws/apiGatewayRouter.ts @@ -1,7 +1,7 @@ import { assert } from "console"; import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { RouterInfra, RouterInfraOptions } from "@plutolang/pluto"; import { Api, Route } from "@pulumi/aws/apigatewayv2"; import { Lambda } from "./lambda"; @@ -36,28 +36,28 @@ export class ApiGatewayRouter * @param path The URL path to handle * @param fn */ - public get(path: string, fn: Resource): void { + public get(path: string, fn: IResource): void { if (!(fn instanceof Lambda)) throw new Error("Fn is not a subclass of LambdaDef."); const lambda = fn as Lambda; this.addHandler("GET", path, lambda); } - public post(path: string, fn: Resource): void { + public post(path: string, fn: IResource): void { if (!(fn instanceof Lambda)) throw new Error("Fn is not a subclass of LambdaDef."); const lambda = fn as Lambda; this.addHandler("POST", path, lambda); } - public put(path: string, fn: Resource): void { + public put(path: string, fn: IResource): void { if (!(fn instanceof Lambda)) throw new Error("Fn is not a subclass of LambdaDef."); const lambda = fn as Lambda; this.addHandler("PUT", path, lambda); } - public delete(path: string, fn: Resource): void { + public delete(path: string, fn: IResource): void { if (!(fn instanceof Lambda)) throw new Error("Fn is not a subclass of LambdaDef."); const lambda = fn as Lambda; diff --git a/packages/pluto-infra/src/aws/cloudWatchSchedule.ts b/packages/pluto-infra/src/aws/cloudWatchSchedule.ts index de8ee60e..6ee56f0b 100644 --- a/packages/pluto-infra/src/aws/cloudWatchSchedule.ts +++ b/packages/pluto-infra/src/aws/cloudWatchSchedule.ts @@ -1,6 +1,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { ScheduleInfra } from "@plutolang/pluto"; import { ScheduleInfraOptions } from "@plutolang/pluto/dist/schedule"; import { Lambda } from "./lambda"; @@ -16,7 +16,7 @@ export class CloudWatchSchedule this.name = name; } - public async cron(cron: string, fn: Resource): Promise { + public async cron(cron: string, fn: IResource): Promise { if (!(fn instanceof Lambda)) { throw new Error("Fn is not a subclass of LambdaDef."); } diff --git a/packages/pluto-infra/src/aws/snsQueue.ts b/packages/pluto-infra/src/aws/snsQueue.ts index 63556366..1e9c863a 100644 --- a/packages/pluto-infra/src/aws/snsQueue.ts +++ b/packages/pluto-infra/src/aws/snsQueue.ts @@ -1,7 +1,7 @@ import { assert } from "console"; import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { QueueInfra, QueueInfraOptions } from "@plutolang/pluto/dist/queue"; import { Lambda } from "./lambda"; import { Permission } from "./permission"; @@ -30,7 +30,7 @@ export class SNSQueue extends pulumi.ComponentResource implements ResourceInfra, ); } - public subscribe(fn: Resource): void { + public subscribe(fn: IResource): void { assert(fn instanceof Lambda, "Fn is not a subclass of LambdaDef."); const lambda = fn as Lambda; diff --git a/packages/pluto-infra/src/aws/tester.ts b/packages/pluto-infra/src/aws/tester.ts index 4224bba9..f984a57a 100644 --- a/packages/pluto-infra/src/aws/tester.ts +++ b/packages/pluto-infra/src/aws/tester.ts @@ -1,5 +1,5 @@ import * as pulumi from "@pulumi/pulumi"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { TestCase, TesterInfra, TesterInfraOptions } from "@plutolang/pluto"; import { Lambda } from "./lambda"; @@ -21,7 +21,7 @@ export class Tester extends pulumi.ComponentResource implements TesterInfra, Res this.outputs = pulumi.output({}); } - public it(description: string, fn: Resource): void { + public it(description: string, fn: IResource): void { if (!(fn instanceof Lambda)) { throw new Error("Tester.it only accepts Fn Resource."); } diff --git a/packages/pluto-infra/src/k8s/pingSchedule.ts b/packages/pluto-infra/src/k8s/pingSchedule.ts index e635c4c5..18d6f514 100644 --- a/packages/pluto-infra/src/k8s/pingSchedule.ts +++ b/packages/pluto-infra/src/k8s/pingSchedule.ts @@ -1,6 +1,6 @@ import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; -import { Resource, ResourceInfra } from "@plutolang/base"; +import { IResource, ResourceInfra } from "@plutolang/base"; import { ScheduleInfra, ScheduleInfraOptions } from "@plutolang/pluto"; import { ServiceLambda } from "./serviceLambda"; @@ -12,7 +12,7 @@ export class PingSchedule extends pulumi.ComponentResource implements ResourceIn this.name = name; } - public async cron(cron: string, fn: Resource): Promise { + public async cron(cron: string, fn: IResource): Promise { if (!(fn instanceof ServiceLambda)) { throw new Error("Fn is not a subclass of ServiceLambda."); } diff --git a/packages/pluto/src/function.ts b/packages/pluto/src/function.ts index 4563b1d3..9919f4e8 100644 --- a/packages/pluto/src/function.ts +++ b/packages/pluto/src/function.ts @@ -1,4 +1,4 @@ -import { Resource, runtime, simulator } from "@plutolang/base"; +import { IResource, runtime, simulator } from "@plutolang/base"; export interface FunctionClient { invoke(payload: string): Promise; @@ -6,7 +6,7 @@ export interface FunctionClient { export interface FunctionOptions {} -export class Function implements Resource { +export class Function implements IResource { constructor(name: string, opts?: FunctionOptions) { name; opts; @@ -28,4 +28,4 @@ export class Function implements Resource { } } -export interface Function extends FunctionClient, Resource {} +export interface Function extends FunctionClient, IResource {} diff --git a/packages/pluto/src/kvstore.ts b/packages/pluto/src/kvstore.ts index 33160561..79753e85 100644 --- a/packages/pluto/src/kvstore.ts +++ b/packages/pluto/src/kvstore.ts @@ -1,4 +1,4 @@ -import { Resource, runtime, simulator } from "@plutolang/base"; +import { IResource, runtime, simulator } from "@plutolang/base"; import { aws, k8s } from "./clients"; /** @@ -22,7 +22,7 @@ export interface KVStoreClientOptions {} export interface KVStoreOptions extends KVStoreInfraOptions, KVStoreClientOptions {} // TODO: abstract class -export class KVStore implements Resource { +export class KVStore implements IResource { constructor(name: string, opts?: KVStoreOptions) { name; opts; @@ -47,4 +47,4 @@ export class KVStore implements Resource { } } -export interface KVStore extends KVStoreInfra, KVStoreClient, Resource {} +export interface KVStore extends KVStoreInfra, KVStoreClient, IResource {} diff --git a/packages/pluto/src/queue.ts b/packages/pluto/src/queue.ts index d1274607..c2d787e1 100644 --- a/packages/pluto/src/queue.ts +++ b/packages/pluto/src/queue.ts @@ -1,4 +1,4 @@ -import { FnResource, Resource, runtime, simulator } from "@plutolang/base"; +import { FnResource, IResource, runtime, simulator } from "@plutolang/base"; import { aws, k8s } from "./clients"; export interface CloudEvent { @@ -31,7 +31,7 @@ export interface QueueClientOptions {} export interface QueueOptions extends QueueInfraOptions, QueueClientOptions {} // TODO: abstract class -export class Queue implements Resource { +export class Queue implements IResource { constructor(name: string, opts?: QueueOptions) { name; opts; @@ -56,4 +56,4 @@ export class Queue implements Resource { } } -export interface Queue extends QueueInfra, QueueClient, Resource {} +export interface Queue extends QueueInfra, QueueClient, IResource {} diff --git a/packages/pluto/src/router.ts b/packages/pluto/src/router.ts index f9009c90..f0ce27b2 100644 --- a/packages/pluto/src/router.ts +++ b/packages/pluto/src/router.ts @@ -1,4 +1,4 @@ -import { FnResource, Resource } from "@plutolang/base"; +import { FnResource, IResource } from "@plutolang/base"; export interface HttpRequest { path: string; @@ -34,7 +34,7 @@ export interface RouterInfraOptions {} export interface RouterOptions extends RouterInfraOptions {} // TODO: abstract class -export class Router implements Resource { +export class Router implements IResource { constructor(name: string, opts?: RouterOptions) { name; opts; @@ -44,4 +44,4 @@ export class Router implements Resource { } } -export interface Router extends RouterInfra, Resource {} +export interface Router extends RouterInfra, IResource {} diff --git a/packages/pluto/src/schedule.ts b/packages/pluto/src/schedule.ts index a260a3d0..479e2797 100644 --- a/packages/pluto/src/schedule.ts +++ b/packages/pluto/src/schedule.ts @@ -1,4 +1,4 @@ -import { FnResource, Resource } from "@plutolang/base"; +import { FnResource, IResource } from "@plutolang/base"; export interface Handler extends FnResource { (): Promise; @@ -17,7 +17,7 @@ export interface ScheduleInfraOptions {} export interface ScheduleOptions extends ScheduleInfraOptions {} -export class Schedule implements Resource { +export class Schedule implements IResource { constructor(name: string, opts?: ScheduleOptions) { name; opts; @@ -27,4 +27,4 @@ export class Schedule implements Resource { } } -export interface Schedule extends ScheduleInfra, Resource {} +export interface Schedule extends ScheduleInfra, IResource {} diff --git a/packages/pluto/src/tester.ts b/packages/pluto/src/tester.ts index 3c130a43..86f5d3cb 100644 --- a/packages/pluto/src/tester.ts +++ b/packages/pluto/src/tester.ts @@ -1,4 +1,4 @@ -import { FnResource, Resource, runtime, simulator } from "@plutolang/base"; +import { FnResource, IResource, runtime, simulator } from "@plutolang/base"; export interface TestCase { description: string; @@ -27,7 +27,7 @@ export interface TesterInfraOptions {} export interface TesterOptions extends TesterInfraOptions {} -export class Tester implements Resource { +export class Tester implements IResource { constructor(name: string, opts?: TesterOptions) { name; opts; @@ -49,4 +49,4 @@ export class Tester implements Resource { } } -export interface Tester extends TesterInfra, Resource {} +export interface Tester extends TesterInfra, IResource {} From 249875b38b3ddfd94f1e50df7b12eee1d829872e Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Mon, 8 Jan 2024 18:03:41 +0800 Subject: [PATCH 02/12] feat(base): add the interfaces for client api, infra api and captured props --- packages/base/src/index.ts | 2 +- packages/base/src/resource.ts | 25 +++++++++++++++++++++++++ packages/pluto/src/function.ts | 3 ++- packages/pluto/src/kvstore.ts | 12 +++++++++--- packages/pluto/src/queue.ts | 13 ++++++++++--- packages/pluto/src/router.ts | 4 ++-- packages/pluto/src/schedule.ts | 4 ++-- 7 files changed, 51 insertions(+), 12 deletions(-) diff --git a/packages/base/src/index.ts b/packages/base/src/index.ts index dd148687..61e37f31 100644 --- a/packages/base/src/index.ts +++ b/packages/base/src/index.ts @@ -1,6 +1,6 @@ export * as runtime from "./runtime"; export * as engine from "./engine"; -export { ResourceInfra, IResource, FnResource } from "./resource"; +export * from "./resource"; export { Registry } from "./registry"; export * as core from "./core"; diff --git a/packages/base/src/resource.ts b/packages/base/src/resource.ts index d34b4f81..d05144be 100644 --- a/packages/base/src/resource.ts +++ b/packages/base/src/resource.ts @@ -12,3 +12,28 @@ export interface ResourceInfra extends IResource { * It's also the type that Pluto needs to detect and process. */ export interface IResource {} + +/** + * The methods encapsulated within the interface that extends this interface are + * accessible during runtime. These methods typically reflect the capabilities of + * resources. For instance, the `get` and `set` methods of the KVStore type. + * The interface that extends this interface needs to be implemented within the Client SDK. + */ +export interface IResourceClientApi {} + +/** + * The methods encapsulated within the interface that extends this interface are + * available during compile time. These methods are generally employed to establish + * connections between various resources, or to set up these resources. + * The interface that extends this interface needs to be implemented within the Infra SDK. + */ +export interface IResourceInfraApi {} + +/** + * The methods encapsulated within the interface that extends this interface always + * are getter methods. These methods are used to fetch values that generated by + * infrastructure code at compile time. + * The interface that extends this interface needs to be implemented within + * both the Client SDK and the Infra SDK. + */ +export interface IResourceCapturedProps {} diff --git a/packages/pluto/src/function.ts b/packages/pluto/src/function.ts index 9919f4e8..91101692 100644 --- a/packages/pluto/src/function.ts +++ b/packages/pluto/src/function.ts @@ -1,6 +1,7 @@ import { IResource, runtime, simulator } from "@plutolang/base"; +import { IResourceClientApi } from "@plutolang/base"; -export interface FunctionClient { +export interface FunctionClient extends IResourceClientApi { invoke(payload: string): Promise; } diff --git a/packages/pluto/src/kvstore.ts b/packages/pluto/src/kvstore.ts index 79753e85..07ac3973 100644 --- a/packages/pluto/src/kvstore.ts +++ b/packages/pluto/src/kvstore.ts @@ -1,14 +1,20 @@ -import { IResource, runtime, simulator } from "@plutolang/base"; +import { + IResource, + IResourceClientApi, + IResourceInfraApi, + runtime, + simulator, +} from "@plutolang/base"; import { aws, k8s } from "./clients"; /** * Define the methods for KVStore, which operate during compilation. */ -export interface KVStoreInfra {} +export interface KVStoreInfra extends IResourceInfraApi {} /** * Define the access methods for KVStore that operate during runtime. */ -export interface KVStoreClient { +export interface KVStoreClient extends IResourceClientApi { get(key: string): Promise; set(key: string, val: string): Promise; } diff --git a/packages/pluto/src/queue.ts b/packages/pluto/src/queue.ts index c2d787e1..abfb93c0 100644 --- a/packages/pluto/src/queue.ts +++ b/packages/pluto/src/queue.ts @@ -1,4 +1,11 @@ -import { FnResource, IResource, runtime, simulator } from "@plutolang/base"; +import { + FnResource, + IResource, + IResourceClientApi, + IResourceInfraApi, + runtime, + simulator, +} from "@plutolang/base"; import { aws, k8s } from "./clients"; export interface CloudEvent { @@ -13,13 +20,13 @@ export interface EventHandler extends FnResource { /** * Define the methods for Queue, which operate during compilation. */ -export interface QueueInfra { +export interface QueueInfra extends IResourceInfraApi { subscribe(fn: EventHandler): void; } /** * Define the access methods for Queue that operate during runtime. */ -export interface QueueClient { +export interface QueueClient extends IResourceClientApi { push(msg: string): Promise; } diff --git a/packages/pluto/src/router.ts b/packages/pluto/src/router.ts index f0ce27b2..7eb721f2 100644 --- a/packages/pluto/src/router.ts +++ b/packages/pluto/src/router.ts @@ -1,4 +1,4 @@ -import { FnResource, IResource } from "@plutolang/base"; +import { FnResource, IResource, IResourceInfraApi } from "@plutolang/base"; export interface HttpRequest { path: string; @@ -20,7 +20,7 @@ export interface RequestHandler extends FnResource { /** * Define the methods for Router, which operate during compilation. */ -export interface RouterInfra { +export interface RouterInfra extends IResourceInfraApi { get(path: string, fn: RequestHandler): void; post(path: string, fn: RequestHandler): void; put(path: string, fn: RequestHandler): void; diff --git a/packages/pluto/src/schedule.ts b/packages/pluto/src/schedule.ts index 479e2797..cb031975 100644 --- a/packages/pluto/src/schedule.ts +++ b/packages/pluto/src/schedule.ts @@ -1,10 +1,10 @@ -import { FnResource, IResource } from "@plutolang/base"; +import { FnResource, IResource, IResourceInfraApi } from "@plutolang/base"; export interface Handler extends FnResource { (): Promise; } -export interface ScheduleInfra { +export interface ScheduleInfra extends IResourceInfraApi { /** * @param cron Cron expressions have six required fields, which are separated by white space. * From 886f937d8daa19f5abe13f16474be191f613ec80 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Mon, 8 Jan 2024 19:38:30 +0800 Subject: [PATCH 03/12] feat(sdk): add url property for router --- packages/base/src/utils/capturing-value.ts | 32 +++++++++++++++++++ packages/base/src/utils/configuration.ts | 16 ++++++++++ packages/base/src/utils/index.ts | 1 + packages/base/src/utils/resource-id.ts | 6 ++-- .../pluto-infra/src/alicloud/appRouter.ts | 12 ++++--- .../pluto-infra/src/aws/apiGatewayRouter.ts | 27 ++++++++++------ packages/pluto-infra/src/aws/utils.ts | 7 ++++ packages/pluto-infra/src/k8s/ingressRouter.ts | 19 +++++++---- packages/pluto/src/clients/index.ts | 1 + packages/pluto/src/clients/shared/index.ts | 1 + packages/pluto/src/clients/shared/router.ts | 16 ++++++++++ packages/pluto/src/router.ts | 28 ++++++++++++++-- 12 files changed, 140 insertions(+), 26 deletions(-) create mode 100644 packages/base/src/utils/capturing-value.ts create mode 100644 packages/pluto-infra/src/aws/utils.ts create mode 100644 packages/pluto/src/clients/shared/index.ts create mode 100644 packages/pluto/src/clients/shared/router.ts diff --git a/packages/base/src/utils/capturing-value.ts b/packages/base/src/utils/capturing-value.ts new file mode 100644 index 00000000..575600a0 --- /dev/null +++ b/packages/base/src/utils/capturing-value.ts @@ -0,0 +1,32 @@ +/** + * Generate a string represents the environment variable name for the property of given resource object. + * The result remains consistent between compile time and runtime. + */ +export function createEnvNameForProperty( + resourceType: string, + resourceId: string, + propertyName: string +) { + const envName = `${resourceType}_${resourceId}_${propertyName}` + .toUpperCase() + .replace(/[^a-zA-Z0-9_]/g, "_"); + return envName; +} + +/** + * Fetch the value that generated by infrastructure codes at compile time of an environment variable. + */ +export function getEnvValForProperty( + resourceType: string, + resourceId: string, + propertyName: string +): string { + const envName = createEnvNameForProperty(resourceType, resourceId, propertyName); + const value = process.env[envName]; + if (!value) { + throw new Error( + `The value for '${propertyName}' associated with the '<${resourceType}>${resourceId}' cannot be located within the environment variables.` + ); + } + return value; +} diff --git a/packages/base/src/utils/configuration.ts b/packages/base/src/utils/configuration.ts index 1f429d78..940cc2a6 100644 --- a/packages/base/src/utils/configuration.ts +++ b/packages/base/src/utils/configuration.ts @@ -7,3 +7,19 @@ import { join } from "path"; export function systemConfigDir(): string { return join(homedir(), ".pluto"); } + +export function currentProjectName(): string { + const projectName = process.env["PLUTO_PROJECT_NAME"]; + if (!projectName) { + throw new Error("The environment variable PLUTO_PROJECT_NAME is not set."); + } + return projectName; +} + +export function currentStackName(): string { + const stackName = process.env["PLUTO_STACK_NAME"]; + if (!stackName) { + throw new Error("The environment variable PLUTO_STACK_NAME is not set."); + } + return stackName; +} diff --git a/packages/base/src/utils/index.ts b/packages/base/src/utils/index.ts index 8204833b..0f3b855d 100644 --- a/packages/base/src/utils/index.ts +++ b/packages/base/src/utils/index.ts @@ -1,3 +1,4 @@ export * from "./resource-id"; export * from "./computing-unit"; export * from "./configuration"; +export * from "./capturing-value"; diff --git a/packages/base/src/utils/resource-id.ts b/packages/base/src/utils/resource-id.ts index 69317458..27db43a5 100644 --- a/packages/base/src/utils/resource-id.ts +++ b/packages/base/src/utils/resource-id.ts @@ -2,9 +2,9 @@ * Generate a string as the resource provisioned id on the platform. * @param project The project name. * @param stack The stack name. - * @param userProvided The resource name provided by the user. + * @param providedName The resource name provided by the user. * @returns The generated resource id. */ -export function genResourceId(project: string, stack: string, userProvided: string): string { - return `${project}_${stack}_${userProvided}`.replaceAll(/[/\s]+/g, ""); +export function genResourceId(project: string, stack: string, providedName: string): string { + return `${project}_${stack}_${providedName}`.replaceAll(/[/\s]+/g, ""); } diff --git a/packages/pluto-infra/src/alicloud/appRouter.ts b/packages/pluto-infra/src/alicloud/appRouter.ts index 02120578..8d14b36a 100644 --- a/packages/pluto-infra/src/alicloud/appRouter.ts +++ b/packages/pluto-infra/src/alicloud/appRouter.ts @@ -1,20 +1,20 @@ import * as pulumi from "@pulumi/pulumi"; import { IResource, ResourceInfra } from "@plutolang/base"; -import { RequestHandler, RouterInfra, RouterInfraOptions } from "@plutolang/pluto"; +import { RequestHandler, IRouterInfraApi, RouterInfraOptions } from "@plutolang/pluto"; import * as alicloud from "@pulumi/alicloud"; import { FCFnResource } from "./fcFnResource"; import { formatName } from "./utils"; const REGION = process.env.ALICLOUD_REGION; -export class AppRouter extends pulumi.ComponentResource implements RouterInfra, ResourceInfra { +export class AppRouter extends pulumi.ComponentResource implements IRouterInfraApi, ResourceInfra { readonly name: string; private readonly group: alicloud.apigateway.Group; private readonly app: alicloud.apigateway.App; private readonly role: alicloud.ram.Role; - url: pulumi.Output = pulumi.interpolate`unkonwn`; + private _url: pulumi.Output = pulumi.interpolate`unkonwn`; constructor(name: string, args?: RouterInfraOptions, opts?: pulumi.ComponentResourceOptions) { if (REGION == undefined) { @@ -97,7 +97,11 @@ export class AppRouter extends pulumi.ComponentResource implements RouterInfra, { parent: this } ); - this.url = pulumi.interpolate`https://${this.group.subDomain}`; + this._url = pulumi.interpolate`https://${this.group.subDomain}`; + } + + public get url(): string { + return this._url as any; } public get(path: string, fn: IResource): void { diff --git a/packages/pluto-infra/src/aws/apiGatewayRouter.ts b/packages/pluto-infra/src/aws/apiGatewayRouter.ts index ef8d99a4..43c5cd10 100644 --- a/packages/pluto-infra/src/aws/apiGatewayRouter.ts +++ b/packages/pluto-infra/src/aws/apiGatewayRouter.ts @@ -2,19 +2,22 @@ import { assert } from "console"; import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import { IResource, ResourceInfra } from "@plutolang/base"; -import { RouterInfra, RouterInfraOptions } from "@plutolang/pluto"; +import { IRouterCapturedProps, IRouterInfraApi, RouterInfraOptions } from "@plutolang/pluto"; import { Api, Route } from "@pulumi/aws/apigatewayv2"; import { Lambda } from "./lambda"; +import { currentAwsRegion } from "./utils"; + +const DEFAULT_STAGE_NAME = "dev"; export class ApiGatewayRouter extends pulumi.ComponentResource - implements RouterInfra, ResourceInfra + implements IRouterInfraApi, IRouterCapturedProps, ResourceInfra { - readonly name: string; + public readonly name: string; + public _url: pulumi.Output = pulumi.interpolate`unkonwn`; - apiGateway: Api; - routes: Route[]; - url: pulumi.Output = pulumi.interpolate`unkonwn`; + private apiGateway: Api; + private routes: Route[]; constructor(name: string, opts?: RouterInfraOptions) { super("pluto:router:aws/ApiGateway", name, opts); @@ -28,9 +31,16 @@ export class ApiGatewayRouter { parent: this } ); + const region = currentAwsRegion(); + this._url = pulumi.interpolate`https://${this.apiGateway.id}.execute-api.${region}.amazonaws.com/${DEFAULT_STAGE_NAME}`; + this.routes = []; } + public get url(): string { + return this._url as any; + } + /** * * @param path The URL path to handle @@ -124,15 +134,14 @@ export class ApiGatewayRouter { dependsOn: this.routes, parent: this } ); - const stage = new aws.apigatewayv2.Stage( + new aws.apigatewayv2.Stage( `${this.name}-stage`, { apiId: this.apiGateway.id, deploymentId: deployment.id, - name: "dev", // TODO: modifiable + name: DEFAULT_STAGE_NAME, // TODO: modifiable }, { parent: this } ); - this.url = stage.invokeUrl; } } diff --git a/packages/pluto-infra/src/aws/utils.ts b/packages/pluto-infra/src/aws/utils.ts new file mode 100644 index 00000000..030c611e --- /dev/null +++ b/packages/pluto-infra/src/aws/utils.ts @@ -0,0 +1,7 @@ +export function currentAwsRegion(): string { + const region = process.env.AWS_REGION; + if (region == undefined) { + throw new Error("AWS_REGION is not defined"); + } + return region; +} diff --git a/packages/pluto-infra/src/k8s/ingressRouter.ts b/packages/pluto-infra/src/k8s/ingressRouter.ts index 4174010d..6e3e12ea 100644 --- a/packages/pluto-infra/src/k8s/ingressRouter.ts +++ b/packages/pluto-infra/src/k8s/ingressRouter.ts @@ -1,20 +1,27 @@ import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; -import { RouterInfra, RouterOptions } from "@plutolang/pluto"; +import { IRouterInfraApi, RouterOptions } from "@plutolang/pluto"; import { FnResource, ResourceInfra } from "@plutolang/base"; import { ServiceLambda } from "./serviceLambda"; -export class IngressRouter extends pulumi.ComponentResource implements RouterInfra, ResourceInfra { +export class IngressRouter + extends pulumi.ComponentResource + implements IRouterInfraApi, ResourceInfra +{ readonly name: string; - url: pulumi.Output; - routes: { path: string; handler: ServiceLambda }[]; + private _url: pulumi.Output; + private routes: { path: string; handler: ServiceLambda }[]; constructor(name: string, args?: RouterOptions, opts?: pulumi.ComponentResourceOptions) { super("pluto:k8s:Ingress", name, args, opts); this.name = name; this.routes = []; - this.url = pulumi.interpolate`unknown`; + this._url = pulumi.interpolate`${this.name}.localdev.me`; + } + + public get url(): string { + return this._url as any; } public get(path: string, fn: FnResource): void { @@ -58,8 +65,6 @@ export class IngressRouter extends pulumi.ComponentResource implements RouterInf }); }); - this.url = pulumi.interpolate`${this.name}.localdev.me`; - new k8s.networking.v1.Ingress( `${this.name}-ingress`, { diff --git a/packages/pluto/src/clients/index.ts b/packages/pluto/src/clients/index.ts index 57fbf643..868d801a 100644 --- a/packages/pluto/src/clients/index.ts +++ b/packages/pluto/src/clients/index.ts @@ -1,2 +1,3 @@ export * as aws from "./aws"; export * as k8s from "./k8s"; +export * as shared from "./shared"; diff --git a/packages/pluto/src/clients/shared/index.ts b/packages/pluto/src/clients/shared/index.ts new file mode 100644 index 00000000..a23c05d2 --- /dev/null +++ b/packages/pluto/src/clients/shared/index.ts @@ -0,0 +1 @@ +export { RouterClient } from "./router"; diff --git a/packages/pluto/src/clients/shared/router.ts b/packages/pluto/src/clients/shared/router.ts new file mode 100644 index 00000000..b4be1d0c --- /dev/null +++ b/packages/pluto/src/clients/shared/router.ts @@ -0,0 +1,16 @@ +import { utils } from "@plutolang/base"; +import { IRouterCapturedProps, Router, RouterOptions } from "../../router"; + +export class RouterClient extends Router implements IRouterCapturedProps { + private readonly id: string; + + constructor(name: string, opts?: RouterOptions) { + super(name, opts); + + this.id = utils.genResourceId(utils.currentProjectName(), utils.currentStackName(), name); + } + + get url(): string { + return utils.getEnvValForProperty(Router.name, this.id, "url"); + } +} diff --git a/packages/pluto/src/router.ts b/packages/pluto/src/router.ts index 7eb721f2..085d6558 100644 --- a/packages/pluto/src/router.ts +++ b/packages/pluto/src/router.ts @@ -1,4 +1,11 @@ -import { FnResource, IResource, IResourceInfraApi } from "@plutolang/base"; +import { + FnResource, + IResource, + IResourceCapturedProps, + IResourceInfraApi, + runtime, +} from "@plutolang/base"; +import { shared } from "./clients"; export interface HttpRequest { path: string; @@ -17,10 +24,14 @@ export interface RequestHandler extends FnResource { (request: HttpRequest): Promise; } +export interface IRouterCapturedProps extends IResourceCapturedProps { + get url(): string; +} + /** * Define the methods for Router, which operate during compilation. */ -export interface RouterInfra extends IResourceInfraApi { +export interface IRouterInfraApi extends IResourceInfraApi { get(path: string, fn: RequestHandler): void; post(path: string, fn: RequestHandler): void; put(path: string, fn: RequestHandler): void; @@ -42,6 +53,17 @@ export class Router implements IResource { "Cannot instantiate this class, instead of its subclass depending on the target runtime." ); } + + public static buildClient(name: string, opts?: RouterOptions): IRouterCapturedProps { + const rtType = process.env["RUNTIME_TYPE"]; + switch (rtType) { + case runtime.Type.AWS: + case runtime.Type.K8s: + return new shared.RouterClient(name, opts); + default: + throw new Error(`not support this runtime '${rtType}'`); + } + } } -export interface Router extends RouterInfra, IResource {} +export interface Router extends IResource, IRouterInfraApi, IRouterCapturedProps {} From 244db87782ced830bfbf9af115aae733c3e7983b Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Tue, 9 Jan 2024 17:41:24 +0800 Subject: [PATCH 04/12] feat(deducer): add utility functions that are used to verify whether a method or property belongs to a target interface --- components/deducers/static/package.json | 6 +- components/deducers/static/src/constants.ts | 3 + components/deducers/static/src/utils-test.ts | 76 +++++++- .../static/src/utils/belong-to-iface.ts | 175 ++++++++++++++++++ components/deducers/static/src/utils/index.ts | 2 + .../src/{utils.ts => utils/type-checker.ts} | 6 +- .../test/fixtures/captured-props/valid.ts | 12 ++ .../static/test/fixtures/client-api/valid.ts | 15 ++ .../static/test/fixtures/infra-api/valid.ts | 12 ++ components/deducers/static/test/utils.test.ts | 62 +++++++ components/deducers/static/tsconfig.json | 53 ++---- 11 files changed, 380 insertions(+), 42 deletions(-) create mode 100644 components/deducers/static/src/utils/belong-to-iface.ts create mode 100644 components/deducers/static/src/utils/index.ts rename components/deducers/static/src/{utils.ts => utils/type-checker.ts} (97%) create mode 100644 components/deducers/static/test/fixtures/captured-props/valid.ts create mode 100644 components/deducers/static/test/fixtures/client-api/valid.ts create mode 100644 components/deducers/static/test/fixtures/infra-api/valid.ts create mode 100644 components/deducers/static/test/utils.test.ts diff --git a/components/deducers/static/package.json b/components/deducers/static/package.json index 00cef2e9..13c7043b 100644 --- a/components/deducers/static/package.json +++ b/components/deducers/static/package.json @@ -7,10 +7,10 @@ "directory": "components/deducers/static" }, "author": "plutolang", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", + "main": "./dist/src/index.js", + "types": "./dist/src/index.d.ts", "files": [ - "dist/" + "dist/src/" ], "scripts": { "build": "tsc", diff --git a/components/deducers/static/src/constants.ts b/components/deducers/static/src/constants.ts index ab597b76..8aa1c483 100644 --- a/components/deducers/static/src/constants.ts +++ b/components/deducers/static/src/constants.ts @@ -1,3 +1,6 @@ export const RESOUCE_TYPE_NAME = "IResource"; export const FN_RESOURCE_TYPE_NAME = "FnResource"; export const PLUTO_BASE_PKG = "@plutolang/base"; +export const CAPTURED_PROPS_IFACE_NAME = "IResourceCapturedProps"; +export const CLIENT_API_IFACE_NAME = "IResourceClientApi"; +export const INFRA_API_IFACE_NAME = "IResourceInfraApi"; diff --git a/components/deducers/static/src/utils-test.ts b/components/deducers/static/src/utils-test.ts index afe64e50..16ef6af8 100644 --- a/components/deducers/static/src/utils-test.ts +++ b/components/deducers/static/src/utils-test.ts @@ -16,6 +16,7 @@ export function genAnalyzerForInline(sourceCode: string): SourceFileWithChecker getCompilationSettings: () => ({ target: ts.ScriptTarget.ES2022, module: ts.ModuleKind.CommonJS, + moduleResolution: ts.ModuleResolutionKind.Node10, }), getCurrentDirectory: () => process.cwd(), getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), @@ -23,8 +24,29 @@ export function genAnalyzerForInline(sourceCode: string): SourceFileWithChecker getScriptVersion: () => "0", getScriptSnapshot: (name) => name === fileName ? ts.ScriptSnapshot.fromString(sourceCode) : undefined, - readFile: () => undefined, - fileExists: () => true, + readFile: ts.sys.readFile, + fileExists: ts.sys.fileExists, + resolveModuleNameLiterals: ( + moduleLiterals: readonly ts.StringLiteralLike[], + containingFile: string, + redirectedReference: ts.ResolvedProjectReference | undefined, + options: ts.CompilerOptions, + containingSourceFile: ts.SourceFile, + reusedNames: readonly ts.StringLiteralLike[] | undefined + ) => { + return moduleLiterals.map((moduleLiteral) => { + const result = ts.resolveModuleName( + moduleLiteral.text, + containingFile, + options, + ts.sys, + undefined, + redirectedReference + ); + console.log(result); + return result; + }); + }, }; const service = ts.createLanguageService(host); @@ -32,6 +54,21 @@ export function genAnalyzerForInline(sourceCode: string): SourceFileWithChecker const program = service.getProgram(); expect(program).toBeDefined(); + const allDiagnostics = ts.getPreEmitDiagnostics(program!); + // Emit errors + allDiagnostics.forEach((diagnostic) => { + if (diagnostic.file) { + const { line, character } = ts.getLineAndCharacterOfPosition( + diagnostic.file, + diagnostic.start! + ); + const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); + console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); + } else { + console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + } + }); + const sourceFile = program!.getSourceFile(fileName); expect(sourceFile).toBeDefined(); return { @@ -59,3 +96,38 @@ export function genAnalyzerForFile(content: string): SourceFileWithChecker { export function rmSourceFile(sourceFile: ts.SourceFile) { fs.rmSync(sourceFile.fileName); } + +export function genAnalyzerForFixture(filepath: string): SourceFileWithChecker { + const tsOpts = { + target: ts.ScriptTarget.ES2022, + module: ts.ModuleKind.CommonJS, + moduleResolution: ts.ModuleResolutionKind.Node10, + }; + + const program = ts.createProgram([filepath], tsOpts); + const allDiagnostics = ts.getPreEmitDiagnostics(program); + // Emit errors + allDiagnostics.forEach((diagnostic) => { + if (diagnostic.file) { + const { line, character } = ts.getLineAndCharacterOfPosition( + diagnostic.file, + diagnostic.start! + ); + const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"); + console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); + } else { + console.log(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + } + }); + + const sourceFile = program.getSourceFile(filepath)!; + expect(sourceFile).toBeDefined(); + + const checker = program.getTypeChecker(); + expect(checker).toBeDefined(); + + return { + sourceFile, + checker, + }; +} diff --git a/components/deducers/static/src/utils/belong-to-iface.ts b/components/deducers/static/src/utils/belong-to-iface.ts new file mode 100644 index 00000000..ca6b9b04 --- /dev/null +++ b/components/deducers/static/src/utils/belong-to-iface.ts @@ -0,0 +1,175 @@ +import { dirname, resolve } from "path"; +import { existsSync, readFileSync, statSync } from "fs"; +import ts from "typescript"; +import { + CAPTURED_PROPS_IFACE_NAME, + CLIENT_API_IFACE_NAME, + INFRA_API_IFACE_NAME, + PLUTO_BASE_PKG, +} from "../constants"; + +export function methodBelongsToClientApi( + callExpression: ts.CallExpression, + typeChecker: ts.TypeChecker +): boolean { + return methodBelongsToIface(callExpression, typeChecker, PLUTO_BASE_PKG, CLIENT_API_IFACE_NAME); +} + +export function methodBelongsToInfraApi( + callExpression: ts.CallExpression, + typeChecker: ts.TypeChecker +): boolean { + return methodBelongsToIface(callExpression, typeChecker, PLUTO_BASE_PKG, INFRA_API_IFACE_NAME); +} + +export function propBelongsToCapturedProps( + propAccessExpression: ts.PropertyAccessExpression, + typeChecker: ts.TypeChecker +): boolean { + return propBelongsToIface( + propAccessExpression, + typeChecker, + PLUTO_BASE_PKG, + CAPTURED_PROPS_IFACE_NAME + ); +} + +/** + * Checks if the given call expression belongs to a specified interface. + * + * @param {ts.CallExpression} callExpression - The call expression node representing the method invocation. + * @param {ts.TypeChecker} typeChecker - The type checker instance used to resolve types and symbols. + * @param {string} targetIfaceName - The name of the target interface to check against. + * @returns {boolean} - True if the method belongs to the target interface, false otherwise. + */ +function methodBelongsToIface( + callExpression: ts.CallExpression, + typeChecker: ts.TypeChecker, + targetPkgName: string, + targetIfaceName: string +): boolean { + // Resolve the call signature from the call expression. + const signature = typeChecker.getResolvedSignature(callExpression); + if (!signature) { + return false; + } + + // Get the declaration of the given call expression. + const declaration = signature.getDeclaration(); + if (!declaration) { + return false; + } + return declarationBelongsToIface(declaration, typeChecker, targetPkgName, targetIfaceName); +} + +/** + * Checks if the given property access expression belongs to a specified interface. + * + * @param {ts.PropertyAccessExpression} propAccessExpression - The property access expression node representing the method invocation. + * @param {ts.TypeChecker} typeChecker - The type checker instance used to resolve types and symbols. + * @param {string} targetIfaceName - The name of the target interface to check against. + * @returns {boolean} - True if the method belongs to the target interface, false otherwise. + */ +function propBelongsToIface( + propAccessExpression: ts.PropertyAccessExpression, + typeChecker: ts.TypeChecker, + targetPkgName: string, + targetIfaceName: string +): boolean { + const symbol = typeChecker.getSymbolAtLocation(propAccessExpression); + const declarations = symbol?.declarations; + if (!declarations || declarations.length === 0) { + return false; + } + + if (declarations.length > 1) { + throw new Error( + `The property '${propAccessExpression.getText()}' has multiple declarations. We are unable to handle this situation.` + ); + } + + return declarationBelongsToIface(declarations[0], typeChecker, targetPkgName, targetIfaceName); +} + +function declarationBelongsToIface( + declaration: ts.Declaration, + typeChecker: ts.TypeChecker, + targetPkgName: string, + targetIfaceName: string +): boolean { + if ( + !ts.isClassDeclaration(declaration.parent) && + !ts.isInterfaceDeclaration(declaration.parent) + ) { + return false; + } + + // Recursively inspect the type inheritance chain to determine whether the target interface exists within it. + const typeChain: ts.Type[] = []; + typeChain.push(typeChecker.getTypeAtLocation(declaration.parent)); + let belongsToTargetIface = false; + while (typeChain.length > 0) { + const currentType = typeChain.pop()!; + if (!currentType.isClassOrInterface()) { + continue; + } + + const symbol = currentType.getSymbol(); + if (symbol && symbol.name === targetIfaceName && isSymbolFromPackage(symbol, targetPkgName)) { + belongsToTargetIface = true; + break; + } + + const baseTypes = typeChecker.getBaseTypes(currentType); + typeChain.push(...baseTypes); + } + return belongsToTargetIface; +} + +/** + * Check if a symbol comes from a specific package. + * + * @param {ts.Symbol} symbol - The symbol to check. + * @param {string} packageName - The name of the package to check against. + * @returns {boolean} - True if the symbol is from the package, false otherwise. + */ +function isSymbolFromPackage(symbol: ts.Symbol, packageName: string): boolean { + // Get the declaration(s) of the symbol + const declarations = symbol.getDeclarations(); + + // If there are no declarations available, the symbol does not belong to any package + if (!declarations || declarations.length === 0) { + return false; + } + + // Check each declaration to see if any come from the target package + for (const declaration of declarations) { + const sourceFile = declaration.getSourceFile(); + const filepath = sourceFile.fileName; + if (packageName === findPackageName(filepath)) { + return true; + } + } + // The symbol does not come from the target package + return false; +} + +function findPackageName(filepath: string): string | undefined { + let dirpath = filepath; + if (statSync(dirpath).isFile()) { + dirpath = dirname(dirpath); + } + + let packageName: string | undefined; + while (dirpath.length >= 1) { + const pkgJsonPath = resolve(dirpath, "package.json"); + if (existsSync(pkgJsonPath)) { + const pkgJsonContent = readFileSync(pkgJsonPath).toString(); + const pkgJsonData = JSON.parse(pkgJsonContent); + packageName = pkgJsonData["name"]; + break; + } + dirpath = dirname(dirpath); + } + return packageName; +} diff --git a/components/deducers/static/src/utils/index.ts b/components/deducers/static/src/utils/index.ts new file mode 100644 index 00000000..b4a0ee48 --- /dev/null +++ b/components/deducers/static/src/utils/index.ts @@ -0,0 +1,2 @@ +export * from "./belong-to-iface"; +export * from "./type-checker"; diff --git a/components/deducers/static/src/utils.ts b/components/deducers/static/src/utils/type-checker.ts similarity index 97% rename from components/deducers/static/src/utils.ts rename to components/deducers/static/src/utils/type-checker.ts index 4675c435..5495df42 100644 --- a/components/deducers/static/src/utils.ts +++ b/components/deducers/static/src/utils/type-checker.ts @@ -1,7 +1,7 @@ import ts from "typescript"; -import { Location } from "./types"; -import { ImportStore, extractImportElements } from "./imports"; -import { FN_RESOURCE_TYPE_NAME, PLUTO_BASE_PKG, RESOUCE_TYPE_NAME } from "./constants"; +import { Location } from "../types"; +import { ImportStore, extractImportElements } from "../imports"; +import { FN_RESOURCE_TYPE_NAME, PLUTO_BASE_PKG, RESOUCE_TYPE_NAME } from "../constants"; export function isPrimitive(val: string): boolean { const primitiveTypes = [ diff --git a/components/deducers/static/test/fixtures/captured-props/valid.ts b/components/deducers/static/test/fixtures/captured-props/valid.ts new file mode 100644 index 00000000..7780b537 --- /dev/null +++ b/components/deducers/static/test/fixtures/captured-props/valid.ts @@ -0,0 +1,12 @@ +import { IResourceCapturedProps } from "@plutolang/base"; + +interface ResourceCapturedProps extends IResourceCapturedProps { + get oneProp(): string; +} + +interface Resource extends ResourceCapturedProps {} + +class Resource {} + +const resource = new Resource(); +resource.oneProp; diff --git a/components/deducers/static/test/fixtures/client-api/valid.ts b/components/deducers/static/test/fixtures/client-api/valid.ts new file mode 100644 index 00000000..509f49db --- /dev/null +++ b/components/deducers/static/test/fixtures/client-api/valid.ts @@ -0,0 +1,15 @@ +import { IResourceClientApi } from "@plutolang/base"; + +interface ResourceClientApi extends IResourceClientApi { + method(): string; +} + +interface Resource extends ResourceClientApi {} + +class Resource {} + +const resource = new Resource(); +resource.method(); + +const aliasResource = resource; +aliasResource.method(); diff --git a/components/deducers/static/test/fixtures/infra-api/valid.ts b/components/deducers/static/test/fixtures/infra-api/valid.ts new file mode 100644 index 00000000..d414548f --- /dev/null +++ b/components/deducers/static/test/fixtures/infra-api/valid.ts @@ -0,0 +1,12 @@ +import { IResourceInfraApi } from "@plutolang/base"; + +interface ResourceInfraApi extends IResourceInfraApi { + method(): string; +} + +interface Resource extends ResourceInfraApi {} + +class Resource {} + +const resource = new Resource(); +resource.method(); diff --git a/components/deducers/static/test/utils.test.ts b/components/deducers/static/test/utils.test.ts new file mode 100644 index 00000000..299ec78d --- /dev/null +++ b/components/deducers/static/test/utils.test.ts @@ -0,0 +1,62 @@ +import path from "path"; +import ts from "typescript"; +import { test, expect } from "vitest"; +import { + methodBelongsToClientApi, + methodBelongsToInfraApi, + propBelongsToCapturedProps, +} from "../src/utils"; +import { genAnalyzerForFixture } from "../src/utils-test"; + +const baseDir = path.join(__dirname, "fixtures"); + +test.concurrent("method should belong to client api", () => { + const codeFile = path.join(baseDir, "client-api/valid.ts"); + const { sourceFile, checker } = genAnalyzerForFixture(codeFile); + + let caseCount = 0; + ts.forEachChild(sourceFile, (node: ts.Node) => { + if (!ts.isExpressionStatement(node) || !ts.isCallExpression(node.expression)) { + return; + } + caseCount++; + + const belongsToTargetIface = methodBelongsToClientApi(node.expression, checker); + expect(belongsToTargetIface).toEqual(true); + }); + expect(caseCount).toBeGreaterThan(0); +}); + +test.concurrent("method should belong to infra api", () => { + const codeFile = path.join(baseDir, "infra-api/valid.ts"); + const { sourceFile, checker } = genAnalyzerForFixture(codeFile); + + let caseCount = 0; + ts.forEachChild(sourceFile, (node: ts.Node) => { + if (!ts.isExpressionStatement(node) || !ts.isCallExpression(node.expression)) { + return; + } + caseCount++; + + const belongsToTargetIface = methodBelongsToInfraApi(node.expression, checker); + expect(belongsToTargetIface).toEqual(true); + }); + expect(caseCount).toBeGreaterThan(0); +}); + +test.concurrent("property should belong to captured props", () => { + const codeFile = path.join(baseDir, "captured-props/valid.ts"); + const { sourceFile, checker } = genAnalyzerForFixture(codeFile); + + let caseCount = 0; + ts.forEachChild(sourceFile, (node: ts.Node) => { + if (!ts.isExpressionStatement(node) || !ts.isPropertyAccessExpression(node.expression)) { + return; + } + caseCount++; + + const belongsToTargetIface = propBelongsToCapturedProps(node.expression, checker); + expect(belongsToTargetIface).toEqual(true); + }); + expect(caseCount).toBeGreaterThan(0); +}); diff --git a/components/deducers/static/tsconfig.json b/components/deducers/static/tsconfig.json index 1ffaef3a..225da180 100644 --- a/components/deducers/static/tsconfig.json +++ b/components/deducers/static/tsconfig.json @@ -1,35 +1,20 @@ { - "compilerOptions": { - "target": "es2022", - "module": "commonjs", - "moduleResolution": "node", - "lib": [ - "es2022", - "dom" - ], - "sourceMap": true, - "outDir": "./dist", - "rootDir": "./src", - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitThis": true, - "alwaysStrict": true, - // "noUnusedLocals": true, - // "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "allowSyntheticDefaultImports": true, - "experimentalDecorators": true, - "emitDecoratorMetadata": true, - "declaration": true, - "baseUrl": ".", - "esModuleInterop": true, - }, - "include": [ - "src/**/*" - ], - "exclude": [ - "node_modules" - ] -} \ No newline at end of file + "compilerOptions": { + "strict": true, + "outDir": "dist", + "target": "es2022", + "module": "commonjs", + "moduleResolution": "node", + "declaration": true, + "resolveJsonModule": true, + "sourceMap": true, + "stripInternal": true, + "experimentalDecorators": true, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "exclude": ["node_modules", "test/fixtures", "dist"] +} From 48c2868217a030150ca23d59325abbb3c97ee9e8 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Tue, 9 Jan 2024 19:50:48 +0800 Subject: [PATCH 05/12] feat(deducer): support detecting property access in computing closure --- components/deducers/static/.gitignore | 3 ++ components/deducers/static/index.ts | 1 + components/deducers/static/package.json | 8 ++-- .../static/src/utils/belong-to-iface.ts | 11 ++--- .../deducers/static/src/visit-fn-res.ts | 46 +++++++++++++++++-- components/deducers/static/tsconfig.json | 2 +- packages/base/src/arch/relationship.ts | 1 + 7 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 components/deducers/static/.gitignore create mode 100644 components/deducers/static/index.ts diff --git a/components/deducers/static/.gitignore b/components/deducers/static/.gitignore new file mode 100644 index 00000000..8c6c962e --- /dev/null +++ b/components/deducers/static/.gitignore @@ -0,0 +1,3 @@ +**/*.d.ts +**/*.js +**/*.js.map \ No newline at end of file diff --git a/components/deducers/static/index.ts b/components/deducers/static/index.ts new file mode 100644 index 00000000..a52464b8 --- /dev/null +++ b/components/deducers/static/index.ts @@ -0,0 +1 @@ +export { default as default } from "./src"; diff --git a/components/deducers/static/package.json b/components/deducers/static/package.json index 13c7043b..742a9a90 100644 --- a/components/deducers/static/package.json +++ b/components/deducers/static/package.json @@ -7,10 +7,12 @@ "directory": "components/deducers/static" }, "author": "plutolang", - "main": "./dist/src/index.js", - "types": "./dist/src/index.d.ts", + "main": "./index.js", + "types": "./index.d.ts", "files": [ - "dist/src/" + "**/*.d.ts", + "**/*.js", + "**/*.js.map" ], "scripts": { "build": "tsc", diff --git a/components/deducers/static/src/utils/belong-to-iface.ts b/components/deducers/static/src/utils/belong-to-iface.ts index ca6b9b04..03e8317e 100644 --- a/components/deducers/static/src/utils/belong-to-iface.ts +++ b/components/deducers/static/src/utils/belong-to-iface.ts @@ -82,13 +82,12 @@ function propBelongsToIface( return false; } - if (declarations.length > 1) { - throw new Error( - `The property '${propAccessExpression.getText()}' has multiple declarations. We are unable to handle this situation.` - ); + for (const declaration of declarations) { + if (declarationBelongsToIface(declaration, typeChecker, targetPkgName, targetIfaceName)) { + return true; + } } - - return declarationBelongsToIface(declarations[0], typeChecker, targetPkgName, targetIfaceName); + return false; } function declarationBelongsToIface( diff --git a/components/deducers/static/src/visit-fn-res.ts b/components/deducers/static/src/visit-fn-res.ts index dc197221..add116ec 100644 --- a/components/deducers/static/src/visit-fn-res.ts +++ b/components/deducers/static/src/visit-fn-res.ts @@ -9,7 +9,7 @@ import { import { ImportElement, buildImportStore } from "./imports"; import { resolveImportDeps } from "./dep-resolve"; import { FN_RESOURCE_TYPE_NAME } from "./constants"; -import { getLocationOfNode, isConstVar, isResourceVar } from "./utils"; +import { getLocationOfNode, isConstVar, isResourceVar, propBelongsToCapturedProps } from "./utils"; type Scope = [number, number]; @@ -118,7 +118,10 @@ function detectAccessChain( combinedRes = detectFnAccessFn(curNode, curScope, checker, rootFnName, depth); } else if (ts.isExpressionStatement(curNode) || ts.isVariableStatement(curNode)) { // Might be calling a resource method. - combinedRes = detectFnAccessResource(curNode, checker, rootFnName); + combinedRes = detectFnCallClientApi(curNode, checker, rootFnName); + } else if (ts.isPropertyAccessExpression(curNode)) { + // Might be accessing a property of a resource. + combinedRes = detectFnAccessCapturedProp(curNode, checker, rootFnName); } curNode.forEachChild((childNode) => { @@ -130,10 +133,45 @@ function detectAccessChain( } /** - * Check if this node is using resource. + * Check if this node is access a property of a resource, which belongs to captured props. + */ +function detectFnAccessCapturedProp( + propAccessExpression: ts.PropertyAccessExpression, + checker: ts.TypeChecker, + fnResName: string +): DetectFnAccessChainResult | undefined { + if (propBelongsToCapturedProps(propAccessExpression, checker)) { + const accessorName = propAccessExpression.expression.getText(); + + const symbol = checker.getSymbolAtLocation(propAccessExpression); + if (symbol == undefined) { + throw new Error( + "The symbol of this property is undefined: " + propAccessExpression.getText() + ); + } + const propertyName = checker.symbolToString(symbol); + + const resRelatInfo: ResourceRelationshipInfo = { + fromVarName: fnResName, + toVarNames: [accessorName], + type: arch.RelatType.PROPERTY, + operation: propertyName, + parameters: [], + }; + return { + resRelatInfos: [resRelatInfo], + importElements: [], + depLocs: [], + }; + } + return; +} + +/** + * Check if this node is calling a function of a resource, which belongs to client API. * This information will be utilized to generate the permission configuration for this FnResource. */ -function detectFnAccessResource( +function detectFnCallClientApi( curNode: ts.Node, checker: ts.TypeChecker, fnResName: string diff --git a/components/deducers/static/tsconfig.json b/components/deducers/static/tsconfig.json index 225da180..db542ccd 100644 --- a/components/deducers/static/tsconfig.json +++ b/components/deducers/static/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "strict": true, - "outDir": "dist", + // "outDir": "dist", "target": "es2022", "module": "commonjs", "moduleResolution": "node", diff --git a/packages/base/src/arch/relationship.ts b/packages/base/src/arch/relationship.ts index 32eeafb6..bc1280d0 100644 --- a/packages/base/src/arch/relationship.ts +++ b/packages/base/src/arch/relationship.ts @@ -4,6 +4,7 @@ import { Resource } from "./resource"; export enum RelatType { CREATE = "create", ACCESS = "access", + PROPERTY = "property", } export class Relationship { From b4d176169ab8b11fa526dba1e76752cd24282699 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Tue, 9 Jan 2024 20:05:06 +0800 Subject: [PATCH 06/12] feat(deducer): add env option to function's option list --- .../pluto-infra/src/alicloud/fcFnResource.ts | 16 ++++++++----- packages/pluto-infra/src/aws/lambda.ts | 14 +++++++---- packages/pluto-infra/src/k8s/serviceLambda.ts | 24 ++++++++++--------- .../pluto-infra/src/simulator/function.ts | 14 +++++++---- packages/pluto/src/function.ts | 4 +++- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/packages/pluto-infra/src/alicloud/fcFnResource.ts b/packages/pluto-infra/src/alicloud/fcFnResource.ts index 725fbe12..2a69af89 100644 --- a/packages/pluto-infra/src/alicloud/fcFnResource.ts +++ b/packages/pluto-infra/src/alicloud/fcFnResource.ts @@ -4,6 +4,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as archive from "@pulumi/archive"; import * as alicloud from "@pulumi/alicloud"; import { ResourceInfra } from "@plutolang/base"; +import { FunctionOptions } from "@plutolang/pluto"; import { formatName } from "./utils"; export enum Ops { @@ -36,7 +37,7 @@ export class FCFnResource extends pulumi.ComponentResource implements ResourceIn private readonly policies: RamPolicy[]; - constructor(name: string, args?: object, opts?: pulumi.ComponentResourceOptions) { + constructor(name: string, args?: FunctionOptions, opts?: pulumi.ComponentResourceOptions) { super("pluto:lambda:alicloud/FC", name, args, opts); this.name = name; this.policies = []; @@ -91,9 +92,15 @@ export class FCFnResource extends pulumi.ComponentResource implements ResourceIn }, { parent: this } ); + const entrypoint = `${this.name}.js`; + + const envs: Record = { + ...args?.envs, + COMPUTE_MODULE: entrypoint, + RUNTIME_TYPE: "ALICLOUD", + }; const insName = formatName(`${name}_fc`); - const entrypoint = `${this.name}.js`; this.fcInstance = new alicloud.fc.Function( insName, { @@ -103,10 +110,7 @@ export class FCFnResource extends pulumi.ComponentResource implements ResourceIn filename: this.buildZip(entrypoint), runtime: "nodejs16", handler: "runtime.default", - environmentVariables: { - COMPUTE_MODULE: entrypoint, - RUNTIME_TYPE: "ALICLOUD", - }, + environmentVariables: envs, }, { parent: this } ); diff --git a/packages/pluto-infra/src/aws/lambda.ts b/packages/pluto-infra/src/aws/lambda.ts index a453529d..00330595 100644 --- a/packages/pluto-infra/src/aws/lambda.ts +++ b/packages/pluto-infra/src/aws/lambda.ts @@ -6,6 +6,7 @@ import * as pulumi from "@pulumi/pulumi"; import { ResourceInfra } from "@plutolang/base"; import { Role } from "@pulumi/aws/iam"; import { Function } from "@pulumi/aws/lambda"; +import { FunctionOptions } from "@plutolang/pluto"; export enum Ops { WATCH_LOG = "WATCH_LOG", @@ -24,7 +25,7 @@ export class Lambda extends pulumi.ComponentResource implements ResourceInfra { iam: Role; statements: aws.types.input.iam.GetPolicyDocumentStatement[]; - constructor(name: string, args?: object, opts?: pulumi.ComponentResourceOptions) { + constructor(name: string, args?: FunctionOptions, opts?: pulumi.ComponentResourceOptions) { super("pluto:lambda:aws/Lambda", name, args, opts); this.name = name; this.statements = []; @@ -72,6 +73,12 @@ export class Lambda extends pulumi.ComponentResource implements ResourceInfra { { parent: this } ); + const envs: Record = { + ...args?.envs, + COMPUTE_MODULE: moduleFilename, + RUNTIME_TYPE: "AWS", + }; + this.lambda = new aws.lambda.Function( `${this.name}-lambda`, { @@ -80,10 +87,7 @@ export class Lambda extends pulumi.ComponentResource implements ResourceInfra { handler: "runtime.default", runtime: "nodejs18.x", environment: { - variables: { - COMPUTE_MODULE: moduleFilename, - RUNTIME_TYPE: "AWS", - }, + variables: envs, }, timeout: 30, }, diff --git a/packages/pluto-infra/src/k8s/serviceLambda.ts b/packages/pluto-infra/src/k8s/serviceLambda.ts index 9752e697..38bbe22f 100644 --- a/packages/pluto-infra/src/k8s/serviceLambda.ts +++ b/packages/pluto-infra/src/k8s/serviceLambda.ts @@ -4,6 +4,7 @@ import * as pulumi from "@pulumi/pulumi"; import * as k8s from "@pulumi/kubernetes"; import * as docker from "@pulumi/docker"; import { ResourceInfra } from "@plutolang/base"; +import { FunctionOptions } from "@plutolang/pluto"; if (!process.env["WORK_DIR"]) { throw new Error("Missing environment variable WORK_DIR"); @@ -17,7 +18,7 @@ export class ServiceLambda extends pulumi.ComponentResource implements ResourceI kservice: k8s.apiextensions.CustomResource; url: pulumi.Output; - constructor(name: string, args?: object, opts?: pulumi.ComponentResourceOptions) { + constructor(name: string, args?: FunctionOptions, opts?: pulumi.ComponentResourceOptions) { super("pluto:k8s:Service", name, args, opts); this.name = name; @@ -64,6 +65,16 @@ CMD [ "node", "runtime.js" ] const appLabels = { app: name }; const namespace = "default"; + const envs: { name: string; value: string }[] = [ + { name: "COMPUTE_MODULE", value: `/app/${name}.js` }, + { name: "RUNTIME_TYPE", value: "K8S" }, + ]; + if (args?.envs) { + for (const key of Object.keys(args?.envs)) { + envs.push({ name: key, value: args.envs[key] }); + } + } + this.kservice = new k8s.apiextensions.CustomResource( `${name}-kservice`, { @@ -90,16 +101,7 @@ CMD [ "node", "runtime.js" ] containers: [ { image: image.imageName, - env: [ - { - name: "COMPUTE_MODULE", - value: `/app/${name}.js`, - }, - { - name: "RUNTIME_TYPE", - value: "K8S", - }, - ], + env: envs, }, ], }, diff --git a/packages/pluto-infra/src/simulator/function.ts b/packages/pluto-infra/src/simulator/function.ts index 65692d5c..f284ffd9 100644 --- a/packages/pluto-infra/src/simulator/function.ts +++ b/packages/pluto-infra/src/simulator/function.ts @@ -4,6 +4,7 @@ import { FunctionClient, FunctionOptions } from "@plutolang/pluto"; export class SimFunction implements simulator.IResourceInstance, FunctionClient { private readonly entrypoint: string; + private readonly opts?: FunctionOptions; private context?: simulator.IContext; constructor(name: string, opts?: FunctionOptions) { @@ -12,7 +13,7 @@ export class SimFunction implements simulator.IResourceInstance, FunctionClient } this.entrypoint = path.join(process.env.WORK_DIR, name + ".js"); - opts; + this.opts = opts; } public async setup(context: simulator.IContext) { @@ -29,11 +30,14 @@ export class SimFunction implements simulator.IResourceInstance, FunctionClient public async cleanup(): Promise {} public async invoke(payload: string): Promise { + const envs: Record = { + ...this.opts?.envs, + PLUTO_SIMULATOR_URL: this.context!.serverUrl, + RUNTIME_TYPE: "SIMULATOR", + }; + const sb = new sandbox.Sandbox(this.entrypoint, { - env: { - PLUTO_SIMULATOR_URL: this.context!.serverUrl, - RUNTIME_TYPE: "SIMULATOR", - }, + env: envs, }); return await sb.call(payload); diff --git a/packages/pluto/src/function.ts b/packages/pluto/src/function.ts index 91101692..668328b2 100644 --- a/packages/pluto/src/function.ts +++ b/packages/pluto/src/function.ts @@ -5,7 +5,9 @@ export interface FunctionClient extends IResourceClientApi { invoke(payload: string): Promise; } -export interface FunctionOptions {} +export interface FunctionOptions { + envs?: Record; +} export class Function implements IResource { constructor(name: string, opts?: FunctionOptions) { From 667eda5a27b69fcd4380a03dc64286c49d52a94d Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Tue, 9 Jan 2024 21:04:41 +0800 Subject: [PATCH 07/12] feat(generator): generate the envs associated with the resource properties accessed by the function instance --- apps/cli/src/commands/deploy.ts | 3 +- components/generators/static/src/generator.ts | 28 +++++++++++++------ packages/base/src/utils/capturing-value.ts | 2 +- packages/pluto/src/clients/shared/router.ts | 9 +++--- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/apps/cli/src/commands/deploy.ts b/apps/cli/src/commands/deploy.ts index 96c9f00b..7f4f6066 100644 --- a/apps/cli/src/commands/deploy.ts +++ b/apps/cli/src/commands/deploy.ts @@ -164,8 +164,7 @@ async function confirmArch(archRef: arch.Architecture, confirmed: boolean): Prom for (const relat of archRef.relationships) { if (relat.from.type == "Root") continue; - const typ = relat.type == "access" ? "Access" : "Create"; - relatData.push([relat.from.name, relat.to.name, typ, relat.operation]); + relatData.push([relat.from.name, relat.to.name, relat.type, relat.operation]); } // To display the relationship table, which includes the relationships among resources in the arch ref. diff --git a/components/generators/static/src/generator.ts b/components/generators/static/src/generator.ts index a0d19891..7c7cb56d 100644 --- a/components/generators/static/src/generator.ts +++ b/components/generators/static/src/generator.ts @@ -2,7 +2,7 @@ import path from "path"; import fs from "fs"; import * as ts from "typescript"; import * as esbuild from "esbuild"; -import { arch, core } from "@plutolang/base"; +import { arch, core, utils } from "@plutolang/base"; import { writeToFile } from "./utils"; // The name of the compiled entrypoint @@ -23,7 +23,7 @@ export class StaticGenerator extends core.Generator { public async generate(archRef: arch.Architecture, outdir: string): Promise { const compiledDir = path.join(outdir, "compiled"); - const pirTsCode = genPirCode(archRef); + const pirTsCode = genPirCode(archRef, this.project, this.stack.name); writeToFile(outdir, ENTRYPOINT_FILENAME + ".ts", pirTsCode); const pirJsCode = compileTs(pirTsCode); writeToFile(compiledDir, ENTRYPOINT_FILENAME + ".js", pirJsCode); @@ -59,7 +59,7 @@ function compileTs(code: string): string { }).outputText; } -function genPirCode(archRef: arch.Architecture): string { +function genPirCode(archRef: arch.Architecture, projectName: string, stackName: string): string { let iacSource = `// Register all IaC SDK import { Registry } from "@plutolang/base"; @@ -97,16 +97,28 @@ const ${resName} = new resDefCls(${res.getParamString()});\n\n`; const res = archRef.getResource(resName); if (res.type != "FnResource") continue; + const envVars = [`PLUTO_PROJECT_NAME: "${projectName}"`, `PLUTO_STACK_NAME: "${stackName}"`]; const deps = []; for (const relat of archRef.relationships) { - if (relat.from != res || relat.type != arch.RelatType.ACCESS) continue; - deps.push(relat.to.name); + if (relat.from != res) continue; + if (relat.type === arch.RelatType.ACCESS) { + deps.push(relat.to.name); + } else if (relat.type === arch.RelatType.PROPERTY) { + const resourceId = utils.genResourceId(projectName, stackName, relat.to.name); + const propEnvName = utils.createEnvNameForProperty( + /* Resource type */ relat.to.type, + /* Reosurce id */ resourceId, + /* Property Name */ relat.operation + ); + const propEnvVal = `${relat.to.name}.${relat.operation}`; + envVars.push(`${propEnvName}: ${propEnvVal}`); + } } iacSource += `resDefCls = reg.getResourceDef(RUNTIME_TYPE, ENGINE_TYPE, "${res.type}"); -const ${resName} = new resDefCls(${res.getParamString()}, {}, { dependsOn: [${deps.join( - "," - )}] });\n\n`; +const ${resName} = new resDefCls(${res.getParamString()}, { + envs: {${envVars.join(",\n")}} +}, { dependsOn: [${deps.join(",")}] });\n\n`; } // Establish resource dependencies, including triggering and accessing. diff --git a/packages/base/src/utils/capturing-value.ts b/packages/base/src/utils/capturing-value.ts index 575600a0..1e70c040 100644 --- a/packages/base/src/utils/capturing-value.ts +++ b/packages/base/src/utils/capturing-value.ts @@ -25,7 +25,7 @@ export function getEnvValForProperty( const value = process.env[envName]; if (!value) { throw new Error( - `The value for '${propertyName}' associated with the '<${resourceType}>${resourceId}' cannot be located within the environment variables.` + `The environment variable '${envName}', representing the value for '${propertyName}' associated with the '<${resourceType}>${resourceId}', cannot be located within the environment variables.` ); } return value; diff --git a/packages/pluto/src/clients/shared/router.ts b/packages/pluto/src/clients/shared/router.ts index b4be1d0c..93aded1c 100644 --- a/packages/pluto/src/clients/shared/router.ts +++ b/packages/pluto/src/clients/shared/router.ts @@ -1,16 +1,15 @@ import { utils } from "@plutolang/base"; -import { IRouterCapturedProps, Router, RouterOptions } from "../../router"; +import { IRouterCapturedProps, RouterOptions } from "../../router"; -export class RouterClient extends Router implements IRouterCapturedProps { +export class RouterClient implements IRouterCapturedProps { private readonly id: string; constructor(name: string, opts?: RouterOptions) { - super(name, opts); - this.id = utils.genResourceId(utils.currentProjectName(), utils.currentStackName(), name); + opts; } get url(): string { - return utils.getEnvValForProperty(Router.name, this.id, "url"); + return utils.getEnvValForProperty("Router", this.id, "url"); } } From 38ae4b3595bac939ae93cfb252794654f6e548c4 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Tue, 9 Jan 2024 21:13:46 +0800 Subject: [PATCH 08/12] feat: add testapps, app-with-prop-access --- .changeset/config.json | 2 +- pnpm-lock.yaml | 19 ++++++++++ testapps/app-with-prop-access/.gitignore | 38 +++++++++++++++++++ .../app-with-prop-access/.pluto/pluto.yml | 7 ++++ testapps/app-with-prop-access/README.md | 1 + testapps/app-with-prop-access/package.json | 19 ++++++++++ testapps/app-with-prop-access/src/index.ts | 25 ++++++++++++ testapps/app-with-prop-access/tsconfig.json | 35 +++++++++++++++++ 8 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 testapps/app-with-prop-access/.gitignore create mode 100644 testapps/app-with-prop-access/.pluto/pluto.yml create mode 100644 testapps/app-with-prop-access/README.md create mode 100644 testapps/app-with-prop-access/package.json create mode 100644 testapps/app-with-prop-access/src/index.ts create mode 100644 testapps/app-with-prop-access/tsconfig.json diff --git a/.changeset/config.json b/.changeset/config.json index 691d9927..eb30abc8 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -7,5 +7,5 @@ "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", - "ignore": ["tester"] + "ignore": ["tester", "app-with-prop-access"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2e8ddb66..6d4c66a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -345,6 +345,25 @@ importers: specifier: ^0.34.6 version: 0.34.6 + testapps/app-with-prop-access: + dependencies: + '@plutolang/pluto': + specifier: 'workspace: *' + version: link:../../packages/pluto + devDependencies: + '@plutolang/base': + specifier: 'workspace: *' + version: link:../../packages/base + '@plutolang/pluto-infra': + specifier: 'workspace: *' + version: link:../../packages/pluto-infra + '@types/node': + specifier: ^20 + version: 20.10.4 + typescript: + specifier: ^5.2.2 + version: 5.2.2 + testapps/tester: dependencies: '@plutolang/pluto': diff --git a/testapps/app-with-prop-access/.gitignore b/testapps/app-with-prop-access/.gitignore new file mode 100644 index 00000000..e5e7f043 --- /dev/null +++ b/testapps/app-with-prop-access/.gitignore @@ -0,0 +1,38 @@ +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +node_modules +.pnp +.pnp.js + +# testing +coverage + +# misc +.DS_Store +*.pem + +# debug +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# local env files +.env +.env.local +.env.development.local +.env.test.local +.env.production.local + +# turbo +.turbo + +# vercel +.vercel + +# compilation result +**/dist/ + +# pluto +**/compiled/ +.pluto/*/ \ No newline at end of file diff --git a/testapps/app-with-prop-access/.pluto/pluto.yml b/testapps/app-with-prop-access/.pluto/pluto.yml new file mode 100644 index 00000000..f4ac1708 --- /dev/null +++ b/testapps/app-with-prop-access/.pluto/pluto.yml @@ -0,0 +1,7 @@ +current: dev +stacks: + - configs: {} + deployed: false + engineType: pulumi + name: dev + platformType: AWS diff --git a/testapps/app-with-prop-access/README.md b/testapps/app-with-prop-access/README.md new file mode 100644 index 00000000..8d9a3e0c --- /dev/null +++ b/testapps/app-with-prop-access/README.md @@ -0,0 +1 @@ +# A Pluto Application diff --git a/testapps/app-with-prop-access/package.json b/testapps/app-with-prop-access/package.json new file mode 100644 index 00000000..f8925cde --- /dev/null +++ b/testapps/app-with-prop-access/package.json @@ -0,0 +1,19 @@ +{ + "name": "app-with-prop-access", + "private": true, + "version": "0.0.0", + "scripts": { + "test": "DEBUG=1 ../../apps/cli/bin/pluto test --sim", + "build": "mkdir -p .pluto/dev && DEBUG=1 ../../apps/cli/bin/pluto compile" + }, + "dependencies": { + "@plutolang/pluto": "workspace: *" + }, + "devDependencies": { + "@types/node": "^20", + "typescript": "^5.2.2", + "@plutolang/base": "workspace: *", + "@plutolang/pluto-infra": "workspace: *" + }, + "main": "dist/index.js" +} diff --git a/testapps/app-with-prop-access/src/index.ts b/testapps/app-with-prop-access/src/index.ts new file mode 100644 index 00000000..ee6b01e9 --- /dev/null +++ b/testapps/app-with-prop-access/src/index.ts @@ -0,0 +1,25 @@ +import { Router, Tester, HttpRequest, HttpResponse } from "@plutolang/pluto"; + +const router = new Router("router"); + +router.get("/echo", async (req: HttpRequest): Promise => { + const message = req.query["message"] ?? "Hello, Pluto!"; + return { + statusCode: 200, + body: message, + }; +}); + +const tester = new Tester("e2e"); + +tester.it("test echo", async () => { + // Verify the correctness of business logic. + const res = await fetch(router.url + "/echo?message=Hello%20Pluto!"); + const body = await res.text(); + if (res.status !== 200) { + throw new Error(`Unexpected status code: ${res.status}`); + } + if (body !== "Hello, Pluto!") { + throw new Error(`Unexpected body: ${body}`); + } +}); diff --git a/testapps/app-with-prop-access/tsconfig.json b/testapps/app-with-prop-access/tsconfig.json new file mode 100644 index 00000000..957dddad --- /dev/null +++ b/testapps/app-with-prop-access/tsconfig.json @@ -0,0 +1,35 @@ +{ + "compilerOptions": { + "rootDir": "./src", + "outDir": "./dist", + "alwaysStrict": true, + "declaration": true, + "esModuleInterop": true, + "experimentalDecorators": true, + "inlineSourceMap": true, + "inlineSources": true, + "lib": [ + "es2019" + ], + "module": "CommonJS", + "noEmitOnError": false, + "noFallthroughCasesInSwitch": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "resolveJsonModule": true, + "strict": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "stripInternal": true, + "target": "ES2019" + }, + "include": [ + "src/**/*.ts" + ], + "exclude": [ + "node_modules" + ] +} From 04963f4b0242659a870640b347ecef4281ec4faa Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Wed, 10 Jan 2024 16:07:46 +0800 Subject: [PATCH 09/12] enhance(deducer): add unit tests for property access --- components/deducers/static/package.json | 14 +- components/deducers/static/src/deducer.ts | 4 +- .../deducers/static/src/visit-expression.ts | 2 +- .../static/{src => test}/deducer.test.ts | 92 +- .../static/{src => test}/dep-resolve.test.ts | 8 +- .../test/fixtures/captured-props/valid.ts | 1 + .../static/test/fixtures/client-api/valid.ts | 1 + .../static/test/fixtures/infra-api/valid.ts | 1 + .../static/{src => test}/imports.test.ts | 6 +- components/deducers/static/test/utils.test.ts | 6 +- .../{src/utils-test.ts => test/utils.ts} | 119 ++- components/deducers/static/tsconfig.json | 5 +- pnpm-lock.yaml | 857 +++++++++++------- 13 files changed, 712 insertions(+), 404 deletions(-) rename components/deducers/static/{src => test}/deducer.test.ts (74%) rename components/deducers/static/{src => test}/dep-resolve.test.ts (93%) rename components/deducers/static/{src => test}/imports.test.ts (90%) rename components/deducers/static/{src/utils-test.ts => test/utils.ts} (53%) diff --git a/components/deducers/static/package.json b/components/deducers/static/package.json index 742a9a90..4a560751 100644 --- a/components/deducers/static/package.json +++ b/components/deducers/static/package.json @@ -7,29 +7,31 @@ "directory": "components/deducers/static" }, "author": "plutolang", - "main": "./index.js", - "types": "./index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "files": [ - "**/*.d.ts", - "**/*.js", - "**/*.js.map" + "dist" ], "scripts": { "build": "tsc", "watch": "npm run build -- --watch", "test": "vitest run --coverage", "test:watch": "vitest --coverage", - "lint": "eslint ." + "lint": "eslint .", + "clean": "tsc --build --clean" }, "dependencies": { "@plutolang/base": "workspace:^", + "fs-extra": "^11.1.1", "js-yaml": "^4.1.0", "typescript": "^5.2.2" }, "devDependencies": { "@plutolang/pluto": "workspace:^", + "@types/fs-extra": "^11.0.4", "@types/node": "^20.8.4", "@vitest/coverage-v8": "^0.34.6", + "vite": "4", "vitest": "^0.34.6" } } diff --git a/components/deducers/static/src/deducer.ts b/components/deducers/static/src/deducer.ts index 857a8d17..e109073d 100644 --- a/components/deducers/static/src/deducer.ts +++ b/components/deducers/static/src/deducer.ts @@ -1,5 +1,5 @@ -import * as ts from "typescript"; -import * as path from "path"; +import ts from "typescript"; +import path from "path"; import { arch, core } from "@plutolang/base"; import { genImportStats } from "./imports"; import { ResourceRelationshipInfo, ResourceVariableInfo } from "./types"; diff --git a/components/deducers/static/src/visit-expression.ts b/components/deducers/static/src/visit-expression.ts index 94c3b79c..084d015f 100644 --- a/components/deducers/static/src/visit-expression.ts +++ b/components/deducers/static/src/visit-expression.ts @@ -1,4 +1,4 @@ -import * as ts from "typescript"; +import ts from "typescript"; import { arch } from "@plutolang/base"; import { ParameterInfo, diff --git a/components/deducers/static/src/deducer.test.ts b/components/deducers/static/test/deducer.test.ts similarity index 74% rename from components/deducers/static/src/deducer.test.ts rename to components/deducers/static/test/deducer.test.ts index b5929438..42101846 100644 --- a/components/deducers/static/src/deducer.test.ts +++ b/components/deducers/static/test/deducer.test.ts @@ -1,10 +1,10 @@ -import ts from "typescript"; +import * as ts from "typescript"; import { test, describe, expect } from "vitest"; -import { genAnalyzerForInline, genAnalyzerForFile, rmSourceFile } from "./utils-test"; -import { ImportElement, ImportType } from "./imports"; -import { isResourceType } from "./utils"; -import { visitVariableStatement } from "./visit-var-def"; -import { visitBinaryExpression, visitCallExpression } from "./visit-expression"; +import { genAnalyzerForFile, rmSourceFile } from "./utils"; +import { ImportElement, ImportType } from "../src/imports"; +import { isResourceType } from "../src/utils"; +import { visitVariableStatement } from "../src/visit-var-def"; +import { visitBinaryExpression, visitCallExpression } from "../src/visit-expression"; describe("All types implement IResource", async () => { const sourceCode = ` @@ -12,14 +12,14 @@ import { IResource } from "@plutolang/base"; class DirectCls implements IResource {} interface DirectIntf extends IResource {} -interaface DirectCls extends IResource {} // same name with DirectCls +interface DirectCls extends IResource {} // same name with DirectCls class IndirectCls implements DirectIntf {} interface IndirectIntf extends DirectIntf {} interface IndirectCls extends DirectIntf {} // same name with IndirectCls `; - const { sourceFile, checker } = genAnalyzerForInline(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("all-types-impl-resource.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isInterfaceDeclaration(node) || ts.isClassDeclaration(node)) { @@ -32,18 +32,21 @@ interface IndirectCls extends DirectIntf {} // same name with IndirectCls describe("All types don't implement IResource", async () => { const sourceCode = ` -import { IResource } from "@plutolang/other"; +interface IResource {} class DirectCls implements IResource {} interface DirectIntf extends IResource {} -interaface DirectCls extends IResource {} // same name with DirectCls +interface DirectCls extends IResource {} // same name with DirectCls class IndirectCls implements DirectIntf {} interface IndirectIntf extends DirectIntf {} interface IndirectCls extends DirectIntf {} // same name with IndirectCls `; - const { sourceFile, checker } = genAnalyzerForInline(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile( + "all-types-do-not-impl-resource.ts", + sourceCode + ); ts.forEachChild(sourceFile, (node) => { if (ts.isInterfaceDeclaration(node) || ts.isClassDeclaration(node)) { @@ -60,10 +63,10 @@ import { Router } from "@plutolang/pluto"; import * as pluto from "@plutolang/pluto"; const obj1 = new Router("obj1"); -const obj2 = new Router("obj2"), obj3 = new pluto.Router("obj3"), obj4; +const obj2 = new Router("obj2"), obj3 = new pluto.Router("obj3"); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("valid-resource-var-stats.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isVariableStatement(node)) { @@ -113,10 +116,10 @@ let obj1; obj1 = new Router("obj1"); obj1 = 1; -let obj2, obj3, obj4; +let obj2: Router | undefined, obj3: Router | undefined, obj4: Router | undefined; obj2 = new Router("obj2"), obj3 = new Router("obj3"), obj4 = new Router("obj4"); -obj3.get("/", async (req: HttpRequest) => Promise { +obj3.get("/", async (req: HttpRequest): Promise => { return { statusCode: 200, body: "hello" @@ -124,7 +127,7 @@ obj3.get("/", async (req: HttpRequest) => Promise { }); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("valid-expressions.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isExpressionStatement(node)) { @@ -138,7 +141,9 @@ obj3.get("/", async (req: HttpRequest) => Promise { } else if (ts.isCallExpression(childNode)) { test("check call expression: " + childNode.getText().split("\n")[0], async () => { const union = visitCallExpression(childNode, checker); + expect(union?.resourceVarInfos).toBeDefined(); expect(union?.resourceVarInfos).toHaveLength(1); + expect(union?.resourceRelatInfos).toBeDefined(); expect(union?.resourceRelatInfos).toHaveLength(1); }); } @@ -155,7 +160,7 @@ import * as pluto from "@plutolang/pluto"; let obj2 = new Router("obj2"); const getFn = obj2.get; -getFn("/", async (req: HttpRequest) => Promise { +getFn("/", async (req: HttpRequest): Promise => { return { statusCode: 200, body: "hello" @@ -163,7 +168,7 @@ getFn("/", async (req: HttpRequest) => Promise { }); const getFn2 = getFn; -getFn2("/", async function hello (req: HttpRequest) => Promise { +getFn2("/", async function hello (req: HttpRequest): Promise { return { statusCode: 200, body: "hello" @@ -183,7 +188,7 @@ const cls = new Cls(); cls.add(1); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("invalid-call-expressions.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isExpressionStatement(node)) { @@ -227,7 +232,7 @@ router.get("/store", async (req: HttpRequest): Promise => { }; }); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("valid-constants-accessing.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isExpressionStatement(node)) { @@ -262,7 +267,7 @@ router.get("/store", async (req: HttpRequest): Promise => { }; }); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("invalid-constants-accessing.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isExpressionStatement(node)) { @@ -298,11 +303,11 @@ router.get("/store", async (req: HttpRequest): Promise => { const str = await test(); return { statusCode: 200, - body: \`Fetch access message. \${test2()}\`, + body: \`Fetch access message. \${test()}\`, }; }); `; - const { sourceFile, checker } = genAnalyzerForFile(sourceCode); + const { sourceFile, checker } = genAnalyzerForFile("valid-function-calling.ts", sourceCode); ts.forEachChild(sourceFile, (node) => { if (ts.isExpressionStatement(node)) { @@ -323,3 +328,44 @@ router.get("/store", async (req: HttpRequest): Promise => { rmSourceFile(sourceFile); }); + +describe("Valid property accessing", async () => { + const sourceCode = ` +import { Router, HttpRequest, HttpResponse, Queue } from "@plutolang/pluto"; +const router = new Router("router"); + +router.get("/store", async (req: HttpRequest): Promise => { + console.log(router.url); + return { + statusCode: 200, + body: \`Fetch access message.\`, + }; +}); + +const queue = new Queue("queue"); + +queue.subscribe(async () => { + const url = router.url; +}) +`; + const { sourceFile, checker } = genAnalyzerForFile("valid-constants-accessing.ts", sourceCode); + + ts.forEachChild(sourceFile, (node) => { + if (ts.isExpressionStatement(node)) { + const childNode = node.expression; + if (!ts.isCallExpression(childNode)) { + return; + } + + test("check call expression: " + childNode.getText().split("\n")[0], async () => { + const union = visitCallExpression(childNode, checker); + expect(union?.resourceVarInfos).toBeDefined(); + expect(union?.resourceVarInfos).toHaveLength(1); + expect(union?.resourceRelatInfos).toBeDefined(); + expect(union?.resourceRelatInfos).toHaveLength(2); + }); + } + }); + + rmSourceFile(sourceFile); +}); diff --git a/components/deducers/static/src/dep-resolve.test.ts b/components/deducers/static/test/dep-resolve.test.ts similarity index 93% rename from components/deducers/static/src/dep-resolve.test.ts rename to components/deducers/static/test/dep-resolve.test.ts index 0cb9ee16..74fdf9eb 100644 --- a/components/deducers/static/src/dep-resolve.test.ts +++ b/components/deducers/static/test/dep-resolve.test.ts @@ -1,8 +1,8 @@ -import ts from "typescript"; +import * as ts from "typescript"; import { expect, describe, test } from "vitest"; -import { genAnalyzerForInline } from "./utils-test"; -import { ImportStore, extractImportElements } from "./imports"; -import { resolveImportDeps } from "./dep-resolve"; +import { genAnalyzerForInline } from "./utils"; +import { ImportStore, extractImportElements } from "../src/imports"; +import { resolveImportDeps } from "../src/dep-resolve"; function testOnce(code: string, importStatNum: number, expectDepNum: number) { const { sourceFile } = genAnalyzerForInline(code); diff --git a/components/deducers/static/test/fixtures/captured-props/valid.ts b/components/deducers/static/test/fixtures/captured-props/valid.ts index 7780b537..0ae98078 100644 --- a/components/deducers/static/test/fixtures/captured-props/valid.ts +++ b/components/deducers/static/test/fixtures/captured-props/valid.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import { IResourceCapturedProps } from "@plutolang/base"; interface ResourceCapturedProps extends IResourceCapturedProps { diff --git a/components/deducers/static/test/fixtures/client-api/valid.ts b/components/deducers/static/test/fixtures/client-api/valid.ts index 509f49db..266ac622 100644 --- a/components/deducers/static/test/fixtures/client-api/valid.ts +++ b/components/deducers/static/test/fixtures/client-api/valid.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import { IResourceClientApi } from "@plutolang/base"; interface ResourceClientApi extends IResourceClientApi { diff --git a/components/deducers/static/test/fixtures/infra-api/valid.ts b/components/deducers/static/test/fixtures/infra-api/valid.ts index d414548f..8d38df38 100644 --- a/components/deducers/static/test/fixtures/infra-api/valid.ts +++ b/components/deducers/static/test/fixtures/infra-api/valid.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ import { IResourceInfraApi } from "@plutolang/base"; interface ResourceInfraApi extends IResourceInfraApi { diff --git a/components/deducers/static/src/imports.test.ts b/components/deducers/static/test/imports.test.ts similarity index 90% rename from components/deducers/static/src/imports.test.ts rename to components/deducers/static/test/imports.test.ts index f084ed0e..f46c4b46 100644 --- a/components/deducers/static/src/imports.test.ts +++ b/components/deducers/static/test/imports.test.ts @@ -1,7 +1,7 @@ -import ts from "typescript"; +import * as ts from "typescript"; import { test, expect } from "vitest"; -import { ImportType, extractImportElements } from "./imports"; -import { genAnalyzerForInline } from "./utils-test"; +import { ImportType, extractImportElements } from "../src/imports"; +import { genAnalyzerForInline } from "./utils"; test("case: direct import", () => { const importStat = `import "fs";`; diff --git a/components/deducers/static/test/utils.test.ts b/components/deducers/static/test/utils.test.ts index 299ec78d..1d7aa45d 100644 --- a/components/deducers/static/test/utils.test.ts +++ b/components/deducers/static/test/utils.test.ts @@ -1,12 +1,12 @@ -import path from "path"; -import ts from "typescript"; +import * as path from "path"; +import * as ts from "typescript"; import { test, expect } from "vitest"; import { methodBelongsToClientApi, methodBelongsToInfraApi, propBelongsToCapturedProps, } from "../src/utils"; -import { genAnalyzerForFixture } from "../src/utils-test"; +import { genAnalyzerForFixture } from "./utils"; const baseDir = path.join(__dirname, "fixtures"); diff --git a/components/deducers/static/src/utils-test.ts b/components/deducers/static/test/utils.ts similarity index 53% rename from components/deducers/static/src/utils-test.ts rename to components/deducers/static/test/utils.ts index 16ef6af8..82d21e0b 100644 --- a/components/deducers/static/src/utils-test.ts +++ b/components/deducers/static/test/utils.ts @@ -1,7 +1,8 @@ import { randomUUID } from "crypto"; -import fs from "fs"; -import path from "path"; -import ts from "typescript"; +import * as os from "os"; +import * as fs from "fs-extra"; +import * as path from "path"; +import * as ts from "typescript"; import { expect } from "vitest"; interface SourceFileWithChecker { @@ -9,43 +10,41 @@ interface SourceFileWithChecker { checker: ts.TypeChecker; } +const tsOpts: ts.CompilerOptions = { + target: ts.ScriptTarget.ES2020, + module: ts.ModuleKind.CommonJS, + moduleResolution: ts.ModuleResolutionKind.Node10, +}; + +const moduleResolutionHost: ts.ModuleResolutionHost = { + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + directoryExists: ts.sys.directoryExists, + getDirectories: ts.sys.getDirectories, +}; + // For testing purposes, the task is to generate a TypeScript `ts.SourceFile` from an inline code. export function genAnalyzerForInline(sourceCode: string): SourceFileWithChecker { const fileName = "inline.ts"; const host: ts.LanguageServiceHost = { - getCompilationSettings: () => ({ - target: ts.ScriptTarget.ES2022, - module: ts.ModuleKind.CommonJS, - moduleResolution: ts.ModuleResolutionKind.Node10, - }), + getCompilationSettings: () => tsOpts, + ...moduleResolutionHost, + useCaseSensitiveFileNames: () => true, getCurrentDirectory: () => process.cwd(), getDefaultLibFileName: (options) => ts.getDefaultLibFilePath(options), getScriptFileNames: () => [fileName], getScriptVersion: () => "0", getScriptSnapshot: (name) => name === fileName ? ts.ScriptSnapshot.fromString(sourceCode) : undefined, - readFile: ts.sys.readFile, - fileExists: ts.sys.fileExists, resolveModuleNameLiterals: ( moduleLiterals: readonly ts.StringLiteralLike[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, - options: ts.CompilerOptions, - containingSourceFile: ts.SourceFile, - reusedNames: readonly ts.StringLiteralLike[] | undefined + options: ts.CompilerOptions ) => { - return moduleLiterals.map((moduleLiteral) => { - const result = ts.resolveModuleName( - moduleLiteral.text, - containingFile, - options, - ts.sys, - undefined, - redirectedReference - ); - console.log(result); - return result; - }); + return moduleLiterals.map((moduleLiteral) => + resolveModule(moduleLiteral.text, containingFile, options, redirectedReference) + ); }, }; @@ -77,20 +76,14 @@ export function genAnalyzerForInline(sourceCode: string): SourceFileWithChecker }; } -export function genAnalyzerForFile(content: string): SourceFileWithChecker { - const filename = "testtmp-" + randomUUID() + ".ts"; - const filepath = path.join(__dirname, filename); - fs.writeFileSync(filepath, content); +export function genAnalyzerForFile(filename: string, content: string): SourceFileWithChecker { + const basedir = path.join(os.tmpdir(), "pluto-test-" + randomUUID()); + fs.ensureDirSync(basedir); - const tsconfigPath = path.resolve("./", "tsconfig.json"); - const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile); - const configJson = ts.parseJsonConfigFileContent(configFile.config, ts.sys, "./"); - // return await compilePluto(filepaths, configJson.options); - const program = ts.createProgram([filepath], configJson.options); + const filepath = path.join(basedir, filename); + fs.writeFileSync(filepath, content); - const sourceFile = program.getSourceFile(filepath)!; - const checker = program.getTypeChecker(); - return { sourceFile, checker }; + return genAnalyzerForFixture(filepath); } export function rmSourceFile(sourceFile: ts.SourceFile) { @@ -98,13 +91,23 @@ export function rmSourceFile(sourceFile: ts.SourceFile) { } export function genAnalyzerForFixture(filepath: string): SourceFileWithChecker { - const tsOpts = { - target: ts.ScriptTarget.ES2022, - module: ts.ModuleKind.CommonJS, - moduleResolution: ts.ModuleResolutionKind.Node10, + const host: ts.CompilerHost = { + ...ts.createCompilerHost(tsOpts), + ...moduleResolutionHost, + useCaseSensitiveFileNames: () => true, + resolveModuleNameLiterals: ( + moduleLiterals: readonly ts.StringLiteralLike[], + containingFile: string, + redirectedReference: ts.ResolvedProjectReference | undefined, + options: ts.CompilerOptions + ): readonly ts.ResolvedModuleWithFailedLookupLocations[] => { + return moduleLiterals.map((moduleLiteral) => + resolveModule(moduleLiteral.text, containingFile, options, redirectedReference) + ); + }, }; - const program = ts.createProgram([filepath], tsOpts); + const program = ts.createProgram([filepath], tsOpts, host); const allDiagnostics = ts.getPreEmitDiagnostics(program); // Emit errors allDiagnostics.forEach((diagnostic) => { @@ -131,3 +134,35 @@ export function genAnalyzerForFixture(filepath: string): SourceFileWithChecker { checker, }; } + +function resolveModule( + pkgName: string, + containingFile: string, + options: ts.CompilerOptions, + redirectedReference?: ts.ResolvedProjectReference +) { + // Search for the target package within the current project directory. + const nodeModulesPath = path.resolve(__dirname, "../node_modules"); + const pkgPath = path.resolve(nodeModulesPath, pkgName); + const result = ts.resolveModuleName( + pkgPath, + containingFile, + options, + ts.sys, + undefined, + redirectedReference + ); + if (result.resolvedModule != undefined) { + return result; + } + + // If it's not found there, look for it in the default path. + return ts.resolveModuleName( + pkgName, + containingFile, + options, + ts.sys, + undefined, + redirectedReference + ); +} diff --git a/components/deducers/static/tsconfig.json b/components/deducers/static/tsconfig.json index db542ccd..c41fa1b6 100644 --- a/components/deducers/static/tsconfig.json +++ b/components/deducers/static/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "strict": true, - // "outDir": "dist", + "outDir": "dist", "target": "es2022", "module": "commonjs", "moduleResolution": "node", @@ -16,5 +16,6 @@ "forceConsistentCasingInFileNames": true, "esModuleInterop": true }, - "exclude": ["node_modules", "test/fixtures", "dist"] + "include": ["src"], + "exclude": ["node_modules", "**/*.test.ts"] } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6d4c66a1..4badc414 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -10,28 +10,28 @@ importers: devDependencies: '@changesets/cli': specifier: ^2.26.2 - version: 2.26.2 + version: 2.27.1 '@typescript-eslint/eslint-plugin': specifier: ^6.9.0 - version: 6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.48.0)(typescript@5.2.2) + version: 6.18.1(@typescript-eslint/parser@6.18.1)(eslint@8.56.0)(typescript@5.3.3) '@typescript-eslint/parser': specifier: ^6.9.0 - version: 6.9.0(eslint@8.48.0)(typescript@5.2.2) + version: 6.18.1(eslint@8.56.0)(typescript@5.3.3) eslint: specifier: ^8.48.0 - version: 8.48.0 + version: 8.56.0 eslint-config-prettier: specifier: ^9.0.0 - version: 9.0.0(eslint@8.48.0) + version: 9.1.0(eslint@8.56.0) husky: specifier: ^8.0.3 version: 8.0.3 prettier: specifier: ^3.0.3 - version: 3.0.3 + version: 3.1.1 turbo: specifier: latest - version: 1.10.16 + version: 1.11.3 apps/cli: dependencies: @@ -176,6 +176,9 @@ importers: '@plutolang/base': specifier: workspace:^ version: link:../../../packages/base + fs-extra: + specifier: ^11.1.1 + version: 11.1.1 js-yaml: specifier: ^4.1.0 version: 4.1.0 @@ -186,12 +189,18 @@ importers: '@plutolang/pluto': specifier: workspace:^ version: link:../../../packages/pluto + '@types/fs-extra': + specifier: ^11.0.4 + version: 11.0.4 '@types/node': specifier: ^20.8.4 - version: 20.8.4 + version: 20.10.4 '@vitest/coverage-v8': specifier: ^0.34.6 version: 0.34.6(vitest@0.34.6) + vite: + specifier: '4' + version: 4.5.1(@types/node@20.10.4) vitest: specifier: ^0.34.6 version: 0.34.6 @@ -1771,11 +1780,11 @@ packages: tslib: 2.6.2 dev: false - /@babel/code-frame@7.22.13: - resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} + /@babel/code-frame@7.23.5: + resolution: {integrity: sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==} engines: {node: '>=6.9.0'} dependencies: - '@babel/highlight': 7.22.20 + '@babel/highlight': 7.23.4 chalk: 2.4.2 dev: true @@ -1784,8 +1793,8 @@ packages: engines: {node: '>=6.9.0'} dev: true - /@babel/highlight@7.22.20: - resolution: {integrity: sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==} + /@babel/highlight@7.23.4: + resolution: {integrity: sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==} engines: {node: '>=6.9.0'} dependencies: '@babel/helper-validator-identifier': 7.22.20 @@ -1793,25 +1802,25 @@ packages: js-tokens: 4.0.0 dev: true - /@babel/runtime@7.23.2: - resolution: {integrity: sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==} + /@babel/runtime@7.23.8: + resolution: {integrity: sha512-Y7KbAP984rn1VGMbGqKmBLio9V7y5Je9GvU4rQPCPinCyNfUcToxIXl06d59URp/F3LwinvODxab5N/G6qggkw==} engines: {node: '>=6.9.0'} dependencies: - regenerator-runtime: 0.14.0 + regenerator-runtime: 0.14.1 dev: true /@bcoe/v8-coverage@0.2.3: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@changesets/apply-release-plan@6.1.4: - resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} + /@changesets/apply-release-plan@7.0.0: + resolution: {integrity: sha512-vfi69JR416qC9hWmFGSxj7N6wA5J222XNBmezSVATPWDVPIF7gkd4d8CpbEbXmRWbVrkoli3oerGS6dcL/BGsQ==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/config': 2.3.1 - '@changesets/get-version-range-type': 0.3.2 - '@changesets/git': 2.0.0 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/config': 3.0.0 + '@changesets/get-version-range-type': 0.4.0 + '@changesets/git': 3.0.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 detect-indent: 6.1.0 fs-extra: 7.0.1 @@ -1822,51 +1831,50 @@ packages: semver: 7.5.4 dev: true - /@changesets/assemble-release-plan@5.2.4: - resolution: {integrity: sha512-xJkWX+1/CUaOUWTguXEbCDTyWJFECEhmdtbkjhn5GVBGxdP/JwaHBIU9sW3FR6gD07UwZ7ovpiPclQZs+j+mvg==} + /@changesets/assemble-release-plan@6.0.0: + resolution: {integrity: sha512-4QG7NuisAjisbW4hkLCmGW2lRYdPrKzro+fCtZaILX+3zdUELSvYjpL4GTv0E4aM9Mef3PuIQp89VmHJ4y2bfw==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 semver: 7.5.4 dev: true - /@changesets/changelog-git@0.1.14: - resolution: {integrity: sha512-+vRfnKtXVWsDDxGctOfzJsPhaCdXRYoe+KyWYoq5X/GqoISREiat0l3L8B0a453B2B4dfHGcZaGyowHbp9BSaA==} + /@changesets/changelog-git@0.2.0: + resolution: {integrity: sha512-bHOx97iFI4OClIT35Lok3sJAwM31VbUM++gnMBV16fdbtBhgYu4dxsphBF/0AZZsyAHMrnM0yFcj5gZM1py6uQ==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 dev: true - /@changesets/cli@2.26.2: - resolution: {integrity: sha512-dnWrJTmRR8bCHikJHl9b9HW3gXACCehz4OasrXpMp7sx97ECuBGGNjJhjPhdZNCvMy9mn4BWdplI323IbqsRig==} + /@changesets/cli@2.27.1: + resolution: {integrity: sha512-iJ91xlvRnnrJnELTp4eJJEOPjgpF3NOh4qeQehM6Ugiz9gJPRZ2t+TsXun6E3AMN4hScZKjqVXl0TX+C7AB3ZQ==} hasBin: true dependencies: - '@babel/runtime': 7.23.2 - '@changesets/apply-release-plan': 6.1.4 - '@changesets/assemble-release-plan': 5.2.4 - '@changesets/changelog-git': 0.1.14 - '@changesets/config': 2.3.1 - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/get-release-plan': 3.0.17 - '@changesets/git': 2.0.0 - '@changesets/logger': 0.0.5 - '@changesets/pre': 1.0.14 - '@changesets/read': 0.5.9 - '@changesets/types': 5.2.1 - '@changesets/write': 0.2.3 + '@babel/runtime': 7.23.8 + '@changesets/apply-release-plan': 7.0.0 + '@changesets/assemble-release-plan': 6.0.0 + '@changesets/changelog-git': 0.2.0 + '@changesets/config': 3.0.0 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/get-release-plan': 4.0.0 + '@changesets/git': 3.0.0 + '@changesets/logger': 0.1.0 + '@changesets/pre': 2.0.0 + '@changesets/read': 0.6.0 + '@changesets/types': 6.0.0 + '@changesets/write': 0.3.0 '@manypkg/get-packages': 1.1.3 - '@types/is-ci': 3.0.3 - '@types/semver': 7.5.4 + '@types/semver': 7.5.6 ansi-colors: 4.1.3 chalk: 2.4.2 + ci-info: 3.9.0 enquirer: 2.4.1 external-editor: 3.1.0 fs-extra: 7.0.1 human-id: 1.0.2 - is-ci: 3.0.1 meow: 6.1.1 outdent: 0.5.0 p-limit: 2.3.0 @@ -1875,96 +1883,96 @@ packages: semver: 7.5.4 spawndamnit: 2.0.0 term-size: 2.2.1 - tty-table: 4.2.2 + tty-table: 4.2.3 dev: true - /@changesets/config@2.3.1: - resolution: {integrity: sha512-PQXaJl82CfIXddUOppj4zWu+987GCw2M+eQcOepxN5s+kvnsZOwjEJO3DH9eVy+OP6Pg/KFEWdsECFEYTtbg6w==} + /@changesets/config@3.0.0: + resolution: {integrity: sha512-o/rwLNnAo/+j9Yvw9mkBQOZySDYyOr/q+wptRLcAVGlU6djOeP9v1nlalbL9MFsobuBVQbZCTp+dIzdq+CLQUA==} dependencies: - '@changesets/errors': 0.1.4 - '@changesets/get-dependents-graph': 1.3.6 - '@changesets/logger': 0.0.5 - '@changesets/types': 5.2.1 + '@changesets/errors': 0.2.0 + '@changesets/get-dependents-graph': 2.0.0 + '@changesets/logger': 0.1.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 micromatch: 4.0.5 dev: true - /@changesets/errors@0.1.4: - resolution: {integrity: sha512-HAcqPF7snsUJ/QzkWoKfRfXushHTu+K5KZLJWPb34s4eCZShIf8BFO3fwq6KU8+G7L5KdtN2BzQAXOSXEyiY9Q==} + /@changesets/errors@0.2.0: + resolution: {integrity: sha512-6BLOQUscTpZeGljvyQXlWOItQyU71kCdGz7Pi8H8zdw6BI0g3m43iL4xKUVPWtG+qrrL9DTjpdn8eYuCQSRpow==} dependencies: extendable-error: 0.1.7 dev: true - /@changesets/get-dependents-graph@1.3.6: - resolution: {integrity: sha512-Q/sLgBANmkvUm09GgRsAvEtY3p1/5OCzgBE5vX3vgb5CvW0j7CEljocx5oPXeQSNph6FXulJlXV3Re/v3K3P3Q==} + /@changesets/get-dependents-graph@2.0.0: + resolution: {integrity: sha512-cafUXponivK4vBgZ3yLu944mTvam06XEn2IZGjjKc0antpenkYANXiiE6GExV/yKdsCnE8dXVZ25yGqLYZmScA==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 chalk: 2.4.2 fs-extra: 7.0.1 semver: 7.5.4 dev: true - /@changesets/get-release-plan@3.0.17: - resolution: {integrity: sha512-6IwKTubNEgoOZwDontYc2x2cWXfr6IKxP3IhKeK+WjyD6y3M4Gl/jdQvBw+m/5zWILSOCAaGLu2ZF6Q+WiPniw==} + /@changesets/get-release-plan@4.0.0: + resolution: {integrity: sha512-9L9xCUeD/Tb6L/oKmpm8nyzsOzhdNBBbt/ZNcjynbHC07WW4E1eX8NMGC5g5SbM5z/V+MOrYsJ4lRW41GCbg3w==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/assemble-release-plan': 5.2.4 - '@changesets/config': 2.3.1 - '@changesets/pre': 1.0.14 - '@changesets/read': 0.5.9 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/assemble-release-plan': 6.0.0 + '@changesets/config': 3.0.0 + '@changesets/pre': 2.0.0 + '@changesets/read': 0.6.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 dev: true - /@changesets/get-version-range-type@0.3.2: - resolution: {integrity: sha512-SVqwYs5pULYjYT4op21F2pVbcrca4qA/bAA3FmFXKMN7Y+HcO8sbZUTx3TAy2VXulP2FACd1aC7f2nTuqSPbqg==} + /@changesets/get-version-range-type@0.4.0: + resolution: {integrity: sha512-hwawtob9DryoGTpixy1D3ZXbGgJu1Rhr+ySH2PvTLHvkZuQ7sRT4oQwMh0hbqZH1weAooedEjRsbrWcGLCeyVQ==} dev: true - /@changesets/git@2.0.0: - resolution: {integrity: sha512-enUVEWbiqUTxqSnmesyJGWfzd51PY4H7mH9yUw0hPVpZBJ6tQZFMU3F3mT/t9OJ/GjyiM4770i+sehAn6ymx6A==} + /@changesets/git@3.0.0: + resolution: {integrity: sha512-vvhnZDHe2eiBNRFHEgMiGd2CT+164dfYyrJDhwwxTVD/OW0FUD6G7+4DIx1dNwkwjHyzisxGAU96q0sVNBns0w==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/errors': 0.2.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 is-subdir: 1.2.0 micromatch: 4.0.5 spawndamnit: 2.0.0 dev: true - /@changesets/logger@0.0.5: - resolution: {integrity: sha512-gJyZHomu8nASHpaANzc6bkQMO9gU/ib20lqew1rVx753FOxffnCrJlGIeQVxNWCqM+o6OOleCo/ivL8UAO5iFw==} + /@changesets/logger@0.1.0: + resolution: {integrity: sha512-pBrJm4CQm9VqFVwWnSqKEfsS2ESnwqwH+xR7jETxIErZcfd1u2zBSqrHbRHR7xjhSgep9x2PSKFKY//FAshA3g==} dependencies: chalk: 2.4.2 dev: true - /@changesets/parse@0.3.16: - resolution: {integrity: sha512-127JKNd167ayAuBjUggZBkmDS5fIKsthnr9jr6bdnuUljroiERW7FBTDNnNVyJ4l69PzR57pk6mXQdtJyBCJKg==} + /@changesets/parse@0.4.0: + resolution: {integrity: sha512-TS/9KG2CdGXS27S+QxbZXgr8uPsP4yNJYb4BC2/NeFUj80Rni3TeD2qwWmabymxmrLo7JEsytXH1FbpKTbvivw==} dependencies: - '@changesets/types': 5.2.1 + '@changesets/types': 6.0.0 js-yaml: 3.14.1 dev: true - /@changesets/pre@1.0.14: - resolution: {integrity: sha512-dTsHmxQWEQekHYHbg+M1mDVYFvegDh9j/kySNuDKdylwfMEevTeDouR7IfHNyVodxZXu17sXoJuf2D0vi55FHQ==} + /@changesets/pre@2.0.0: + resolution: {integrity: sha512-HLTNYX/A4jZxc+Sq8D1AMBsv+1qD6rmmJtjsCJa/9MSRybdxh0mjbTvE6JYZQ/ZiQ0mMlDOlGPXTm9KLTU3jyw==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/errors': 0.1.4 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/errors': 0.2.0 + '@changesets/types': 6.0.0 '@manypkg/get-packages': 1.1.3 fs-extra: 7.0.1 dev: true - /@changesets/read@0.5.9: - resolution: {integrity: sha512-T8BJ6JS6j1gfO1HFq50kU3qawYxa4NTbI/ASNVVCBTsKquy2HYwM9r7ZnzkiMe8IEObAJtUVGSrePCOxAK2haQ==} + /@changesets/read@0.6.0: + resolution: {integrity: sha512-ZypqX8+/im1Fm98K4YcZtmLKgjs1kDQ5zHpc2U1qdtNBmZZfo/IBiG162RoP0CUF05tvp2y4IspH11PLnPxuuw==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/git': 2.0.0 - '@changesets/logger': 0.0.5 - '@changesets/parse': 0.3.16 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/git': 3.0.0 + '@changesets/logger': 0.1.0 + '@changesets/parse': 0.4.0 + '@changesets/types': 6.0.0 chalk: 2.4.2 fs-extra: 7.0.1 p-filter: 2.1.0 @@ -1974,15 +1982,15 @@ packages: resolution: {integrity: sha512-LDQvVDv5Kb50ny2s25Fhm3d9QSZimsoUGBsUioj6MC3qbMUCuC8GPIvk/M6IvXx3lYhAs0lwWUQLb+VIEUCECw==} dev: true - /@changesets/types@5.2.1: - resolution: {integrity: sha512-myLfHbVOqaq9UtUKqR/nZA/OY7xFjQMdfgfqeZIBK4d0hA6pgxArvdv8M+6NUzzBsjWLOtvApv8YHr4qM+Kpfg==} + /@changesets/types@6.0.0: + resolution: {integrity: sha512-b1UkfNulgKoWfqyHtzKS5fOZYSJO+77adgL7DLRDr+/7jhChN+QcHnbjiQVOz/U+Ts3PGNySq7diAItzDgugfQ==} dev: true - /@changesets/write@0.2.3: - resolution: {integrity: sha512-Dbamr7AIMvslKnNYsLFafaVORx4H0pvCA2MHqgtNCySMe1blImEyAEOzDmcgKAkgz4+uwoLz7demIrX+JBr/Xw==} + /@changesets/write@0.3.0: + resolution: {integrity: sha512-slGLb21fxZVUYbyea+94uFiD6ntQW0M2hIKNznFizDhZPDgn2c/fv1UzzlW43RVzh1BEDuIqW6hzlJ1OflNmcw==} dependencies: - '@babel/runtime': 7.23.2 - '@changesets/types': 5.2.1 + '@babel/runtime': 7.23.8 + '@changesets/types': 6.0.0 fs-extra: 7.0.1 human-id: 1.0.2 prettier: 2.8.8 @@ -2384,30 +2392,30 @@ packages: dev: false optional: true - /@eslint-community/eslint-utils@4.4.0(eslint@8.48.0): + /@eslint-community/eslint-utils@4.4.0(eslint@8.56.0): resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 dependencies: - eslint: 8.48.0 + eslint: 8.56.0 eslint-visitor-keys: 3.4.3 dev: true - /@eslint-community/regexpp@4.7.0: - resolution: {integrity: sha512-+HencqxU7CFJnQb7IKtuNBqS6Yx3Tz4kOL8BJXo+JyeiBm5MEX6pO8onXDkjrkCRlfYXS1Axro15ZjVFe9YgsA==} + /@eslint-community/regexpp@4.10.0: + resolution: {integrity: sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true - /@eslint/eslintrc@2.1.2: - resolution: {integrity: sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==} + /@eslint/eslintrc@2.1.4: + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 debug: 4.3.4 espree: 9.6.1 - globals: 13.20.0 - ignore: 5.2.4 + globals: 13.24.0 + ignore: 5.3.0 import-fresh: 3.3.0 js-yaml: 4.1.0 minimatch: 3.1.2 @@ -2416,8 +2424,8 @@ packages: - supports-color dev: true - /@eslint/js@8.48.0: - resolution: {integrity: sha512-ZSjtmelB7IJfWD2Fvb7+Z+ChTIKWq6kjda95fLcQKNS5aheVHn4IkfgRQE3sIIzTcSLwLcLZUD9UBt+V7+h+Pw==} + /@eslint/js@8.56.0: + resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true @@ -2426,7 +2434,7 @@ packages: engines: {node: ^8.13.0 || >=10.10.0} dependencies: '@grpc/proto-loader': 0.7.10 - '@types/node': 20.10.4 + '@types/node': 20.10.8 /@grpc/proto-loader@0.7.10: resolution: {integrity: sha512-CAqDfoaQ8ykFd9zqBDn4k6iWT9loLAlc2ETmDFS9JCD70gDcnA4L3AFEo2iV7KyAtAAHFW9ftq1Fz+Vsgq80RQ==} @@ -2438,11 +2446,11 @@ packages: protobufjs: 7.2.5 yargs: 17.7.2 - /@humanwhocodes/config-array@0.11.10: - resolution: {integrity: sha512-KVVjQmNUepDVGXNuoRRdmmEjruj0KfiGSbS8LVc12LMsWDQzRXJ0qdhN8L8uUigKpfEHRhlaQFY0ib1tnUbNeQ==} + /@humanwhocodes/config-array@0.11.13: + resolution: {integrity: sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==} engines: {node: '>=10.10.0'} dependencies: - '@humanwhocodes/object-schema': 1.2.1 + '@humanwhocodes/object-schema': 2.0.1 debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: @@ -2454,8 +2462,8 @@ packages: engines: {node: '>=12.22'} dev: true - /@humanwhocodes/object-schema@1.2.1: - resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} + /@humanwhocodes/object-schema@2.0.1: + resolution: {integrity: sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==} dev: true /@inquirer/checkbox@1.4.0: @@ -2484,7 +2492,7 @@ packages: dependencies: '@inquirer/type': 1.1.5 '@types/mute-stream': 0.0.2 - '@types/node': 20.10.4 + '@types/node': 20.10.8 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 chalk: 4.1.2 @@ -2626,7 +2634,7 @@ packages: /@manypkg/find-root@1.1.0: resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.8 '@types/node': 12.20.55 find-up: 4.1.0 fs-extra: 8.1.0 @@ -2635,7 +2643,7 @@ packages: /@manypkg/get-packages@1.1.3: resolution: {integrity: sha512-fo+QhuU3qE/2TQMQmbVMqaQ6EWbMhi4ABWP+O4AM1NqPBuy0OrApV5LO6BrrgnhtAHS2NH6RrVk9OL181tTi8A==} dependencies: - '@babel/runtime': 7.23.2 + '@babel/runtime': 7.23.8 '@changesets/types': 4.1.0 '@manypkg/find-root': 1.1.0 fs-extra: 8.1.0 @@ -2661,7 +2669,7 @@ packages: engines: {node: '>= 8'} dependencies: '@nodelib/fs.scandir': 2.1.5 - fastq: 1.15.0 + fastq: 1.16.0 dev: true /@opentelemetry/api-metrics@0.32.0: @@ -3916,17 +3924,17 @@ packages: resolution: {integrity: sha512-N7UDG0/xiPQa2D/XrVJXjkWbpqHCd2sBaB32ggRF2l83RhPfamgKGF8gwwqyksS95qUS5ZYF9aF+lLPRlwI2UA==} dependencies: '@types/connect': 3.4.37 - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true - /@types/chai-subset@1.3.4: - resolution: {integrity: sha512-CCWNXrJYSUIojZ1149ksLl3AN9cmZ5djf+yUoVVV+NuYrtydItQVlL2ZDqyC6M6O9LWRnVf8yYDxbXHO2TfQZg==} + /@types/chai-subset@1.3.5: + resolution: {integrity: sha512-c2mPnw+xHtXDoHmdtcCXGwyLMiauiAyxWMzhGpqHC4nqI/Y5G2XhTampslK2rb59kpcuHon03UH8W6iYUzw88A==} dependencies: - '@types/chai': 4.3.9 + '@types/chai': 4.3.11 dev: true - /@types/chai@4.3.9: - resolution: {integrity: sha512-69TtiDzu0bcmKQv3yg1Zx409/Kd7r0b5F1PfpYJfSHzLGtB53547V4u+9iqKYsTu/O2ai6KTb0TInNpvuQ3qmg==} + /@types/chai@4.3.11: + resolution: {integrity: sha512-qQR1dr2rGIHYlJulmr8Ioq3De0Le9E4MJ5AiaeAETJJpndT1uUNHsGFK3L/UIu+rbkQSdj8J/w2bCsBZc/Y5fQ==} dev: true /@types/configstore@6.0.2: @@ -3936,13 +3944,13 @@ packages: /@types/connect@3.4.37: resolution: {integrity: sha512-zBUSRqkfZ59OcwXon4HVxhx5oWCJmc0OtBTK05M+p0dYjgN6iTwIL2T/WbsQZrEsdnwaF9cWQ+azOnpPvIqY3Q==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true /@types/express-serve-static-core@4.17.38: resolution: {integrity: sha512-hXOtc0tuDHZPFwwhuBJXPbjemWtXnJjbvuuyNH2Y5Z6in+iXc63c4eXYDc7GGGqHy+iwYqAJMdaItqdnbcBKmg==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 '@types/qs': 6.9.9 '@types/range-parser': 1.2.6 '@types/send': 0.17.3 @@ -3961,48 +3969,42 @@ packages: resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} dependencies: '@types/jsonfile': 6.1.4 - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true /@types/glob@5.0.38: resolution: {integrity: sha512-rTtf75rwyP9G2qO5yRpYtdJ6aU1QqEhWbtW55qEgquEDa6bXW0s2TWZfDm02GuppjEozOWG/F2UnPq5hAQb+gw==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: false /@types/http-errors@2.0.3: resolution: {integrity: sha512-pP0P/9BnCj1OVvQR2lF41EkDG/lWWnDyA203b/4Fmi2eTyORnBtcDoKDwjWQthELrBvWkMOrvSOnZ8OVlW6tXA==} dev: true - /@types/is-ci@3.0.3: - resolution: {integrity: sha512-FdHbjLiN2e8fk9QYQyVYZrK8svUDJpxSaSWLUga8EZS1RGAvvrqM9zbVARBtQuYPeLgnJxM2xloOswPwj1o2cQ==} - dependencies: - ci-info: 3.9.0 - dev: true - - /@types/istanbul-lib-coverage@2.0.5: - resolution: {integrity: sha512-zONci81DZYCZjiLe0r6equvZut0b+dBRPBN5kBDjsONnutYNtJMoWQ9uR2RkL1gLG9NMTzvf+29e5RFfPbeKhQ==} + /@types/istanbul-lib-coverage@2.0.6: + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} dev: true /@types/js-yaml@4.0.7: resolution: {integrity: sha512-RJZP9WAMMr1514KbdSXkLRrKvYQacjr1+HWnY8pui/uBTBoSgD9ZGR17u/d4nb9NpERp0FkdLBe7hq8NIPBgkg==} dev: true - /@types/json-schema@7.0.14: - resolution: {integrity: sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==} + /@types/json-schema@7.0.15: + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} dev: true /@types/jsonfile@6.1.4: resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: false /@types/mime@1.3.4: @@ -4017,20 +4019,20 @@ packages: resolution: {integrity: sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==} dev: false - /@types/minimist@1.2.4: - resolution: {integrity: sha512-Kfe/D3hxHTusnPNRbycJE1N77WHDsdS4AjUYIzlDzhDrS47NrwuL3YW4VITxwR7KCVpzwgy4Rbj829KSSQmwXQ==} + /@types/minimist@1.2.5: + resolution: {integrity: sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==} dev: true /@types/mute-stream@0.0.2: resolution: {integrity: sha512-FpiGjk6+IOrN0lZEfUUjdra1csU1VxwYFj4S0Zj+TJpu5x5mZW30RkEZojTadrNZHNmpCHgoE62IQZAH0OeuIA==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: false /@types/node-fetch@2.6.6: resolution: {integrity: sha512-95X8guJYhfqiuVVhRFxVQcf4hW/2bCuoPwDasMf/531STFoNoWTT7YDnWdXHEZKqAGUigmpG31r2FE70LwnzJw==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 form-data: 4.0.0 dev: false @@ -4048,6 +4050,12 @@ packages: resolution: {integrity: sha512-D08YG6rr8X90YB56tSIuBaddy/UXAA9RKJoFvrsnogAum/0pmjkgi4+2nx96A330FmioegBWmEYQ+syqCFaveg==} dependencies: undici-types: 5.26.5 + dev: true + + /@types/node@20.10.8: + resolution: {integrity: sha512-f8nQs3cLxbAFc00vEU59yf9UyGUftkPaLGfvbVOIDdx2i1b8epBqj2aNGyP19fiyXWvlmZ7qC1XLjAzw/OKIeA==} + dependencies: + undici-types: 5.26.5 /@types/node@20.8.4: resolution: {integrity: sha512-ZVPnqU58giiCjSxjVUESDtdPk4QR5WQhhINbc9UBrKLU68MX5BF6kbQzTrkwbolyr0X8ChBpXfavr5mZFKZQ5A==} @@ -4055,8 +4063,8 @@ packages: undici-types: 5.25.3 dev: true - /@types/normalize-package-data@2.4.3: - resolution: {integrity: sha512-ehPtgRgaULsFG8x0NeYJvmyH1hmlfsNLujHe9dQEia/7MAJYdzMSi19JtchUHjmBA6XC/75dK55mzZH+RyieSg==} + /@types/normalize-package-data@2.4.4: + resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true /@types/qs@6.9.9: @@ -4070,18 +4078,18 @@ packages: /@types/responselike@1.0.3: resolution: {integrity: sha512-H/+L+UkTV33uf49PH5pCAUBVPNj2nDBXTN+qS1dOwyyg24l3CcicicCA7ca+HMvJBZcFgl5r8e+RR6elsb4Lyw==} dependencies: - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: false - /@types/semver@7.5.4: - resolution: {integrity: sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==} + /@types/semver@7.5.6: + resolution: {integrity: sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==} dev: true /@types/send@0.17.3: resolution: {integrity: sha512-/7fKxvKUoETxjFUsuFlPB9YndePpxxRAOfGC/yJdc9kTjTeP5kRCTzfnE8kPUKCeyiyIZu0YQ76s50hCedI1ug==} dependencies: '@types/mime': 1.3.4 - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true /@types/serve-static@1.15.4: @@ -4089,7 +4097,7 @@ packages: dependencies: '@types/http-errors': 2.0.3 '@types/mime': 3.0.3 - '@types/node': 20.10.4 + '@types/node': 20.10.8 dev: true /@types/tmp@0.0.33: @@ -4107,8 +4115,8 @@ packages: resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==} dev: false - /@typescript-eslint/eslint-plugin@6.9.0(@typescript-eslint/parser@6.9.0)(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==} + /@typescript-eslint/eslint-plugin@6.18.1(@typescript-eslint/parser@6.18.1)(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-nISDRYnnIpk7VCFrGcu1rnZfM1Dh9LRHnfgdkjcbi/l7g16VYRri3TjXi9Ir4lOZSw5N/gnV/3H7jIPQ8Q4daA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -4118,26 +4126,26 @@ packages: typescript: optional: true dependencies: - '@eslint-community/regexpp': 4.7.0 - '@typescript-eslint/parser': 6.9.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/type-utils': 6.9.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/utils': 6.9.0(eslint@8.48.0)(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.9.0 + '@eslint-community/regexpp': 4.10.0 + '@typescript-eslint/parser': 6.18.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/scope-manager': 6.18.1 + '@typescript-eslint/type-utils': 6.18.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/utils': 6.18.1(eslint@8.56.0)(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.18.1 debug: 4.3.4 - eslint: 8.48.0 + eslint: 8.56.0 graphemer: 1.4.0 - ignore: 5.2.4 + ignore: 5.3.0 natural-compare: 1.4.0 semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/parser@6.9.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==} + /@typescript-eslint/parser@6.18.1(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-zct/MdJnVaRRNy9e84XnVtRv9Vf91/qqe+hZJtKanjojud4wAVy/7lXxJmMyX6X6J+xc6c//YEWvpeif8cAhWA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -4146,27 +4154,27 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/scope-manager': 6.18.1 + '@typescript-eslint/types': 6.18.1 + '@typescript-eslint/typescript-estree': 6.18.1(typescript@5.3.3) + '@typescript-eslint/visitor-keys': 6.18.1 debug: 4.3.4 - eslint: 8.48.0 - typescript: 5.2.2 + eslint: 8.56.0 + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/scope-manager@6.9.0: - resolution: {integrity: sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==} + /@typescript-eslint/scope-manager@6.18.1: + resolution: {integrity: sha512-BgdBwXPFmZzaZUuw6wKiHKIovms97a7eTImjkXCZE04TGHysG+0hDQPmygyvgtkoB/aOQwSM/nWv3LzrOIQOBw==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/types': 6.18.1 + '@typescript-eslint/visitor-keys': 6.18.1 dev: true - /@typescript-eslint/type-utils@6.9.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==} + /@typescript-eslint/type-utils@6.18.1(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-wyOSKhuzHeU/5pcRDP2G2Ndci+4g653V43gXTpt4nbyoIOAASkGDA9JIAgbQCdCkcr1MvpSYWzxTz0olCn8+/Q==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -4175,23 +4183,23 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - '@typescript-eslint/utils': 6.9.0(eslint@8.48.0)(typescript@5.2.2) + '@typescript-eslint/typescript-estree': 6.18.1(typescript@5.3.3) + '@typescript-eslint/utils': 6.18.1(eslint@8.56.0)(typescript@5.3.3) debug: 4.3.4 - eslint: 8.48.0 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 + eslint: 8.56.0 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/types@6.9.0: - resolution: {integrity: sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==} + /@typescript-eslint/types@6.18.1: + resolution: {integrity: sha512-4TuMAe+tc5oA7wwfqMtB0Y5OrREPF1GeJBAjqwgZh1lEMH5PJQgWgHGfYufVB51LtjD+peZylmeyxUXPfENLCw==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.9.0(typescript@5.2.2): - resolution: {integrity: sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==} + /@typescript-eslint/typescript-estree@6.18.1(typescript@5.3.3): + resolution: {integrity: sha512-fv9B94UAhywPRhUeeV/v+3SBDvcPiLxRZJw/xZeeGgRLQZ6rLMG+8krrJUyIf6s1ecWTzlsbp0rlw7n9sjufHA==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -4199,45 +4207,50 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/visitor-keys': 6.9.0 + '@typescript-eslint/types': 6.18.1 + '@typescript-eslint/visitor-keys': 6.18.1 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 + minimatch: 9.0.3 semver: 7.5.4 - ts-api-utils: 1.0.3(typescript@5.2.2) - typescript: 5.2.2 + ts-api-utils: 1.0.3(typescript@5.3.3) + typescript: 5.3.3 transitivePeerDependencies: - supports-color dev: true - /@typescript-eslint/utils@6.9.0(eslint@8.48.0)(typescript@5.2.2): - resolution: {integrity: sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==} + /@typescript-eslint/utils@6.18.1(eslint@8.56.0)(typescript@5.3.3): + resolution: {integrity: sha512-zZmTuVZvD1wpoceHvoQpOiewmWu3uP9FuTWo8vqpy2ffsmfCE8mklRPi+vmnIYAIk9t/4kOThri2QCDgor+OpQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) - '@types/json-schema': 7.0.14 - '@types/semver': 7.5.4 - '@typescript-eslint/scope-manager': 6.9.0 - '@typescript-eslint/types': 6.9.0 - '@typescript-eslint/typescript-estree': 6.9.0(typescript@5.2.2) - eslint: 8.48.0 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@types/json-schema': 7.0.15 + '@types/semver': 7.5.6 + '@typescript-eslint/scope-manager': 6.18.1 + '@typescript-eslint/types': 6.18.1 + '@typescript-eslint/typescript-estree': 6.18.1(typescript@5.3.3) + eslint: 8.56.0 semver: 7.5.4 transitivePeerDependencies: - supports-color - typescript dev: true - /@typescript-eslint/visitor-keys@6.9.0: - resolution: {integrity: sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==} + /@typescript-eslint/visitor-keys@6.18.1: + resolution: {integrity: sha512-/kvt0C5lRqGoCfsbmm7/CwMqoSkY3zzHLIjdhHZQW3VFrnz7ATecOHR7nb7V+xn4286MBxfnQfQhAmCI0u+bJA==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.9.0 + '@typescript-eslint/types': 6.18.1 eslint-visitor-keys: 3.4.3 dev: true + /@ungap/structured-clone@1.2.0: + resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} + dev: true + /@vitest/coverage-v8@0.34.6(vitest@0.34.6): resolution: {integrity: sha512-fivy/OK2d/EsJFoEoxHFEnNGTg+MmdZBAVK9Ka4qhXR2K3J0DS08vcGVwzDtXSuUMabLv4KtPcpSKkcMXFDViw==} peerDependencies: @@ -4245,15 +4258,15 @@ packages: dependencies: '@ampproject/remapping': 2.2.1 '@bcoe/v8-coverage': 0.2.3 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 4.0.1 istanbul-reports: 3.1.6 magic-string: 0.30.5 picocolors: 1.0.0 - std-env: 3.4.3 + std-env: 3.7.0 test-exclude: 6.0.0 - v8-to-istanbul: 9.1.3 + v8-to-istanbul: 9.2.0 vitest: 0.34.6 transitivePeerDependencies: - supports-color @@ -4264,7 +4277,7 @@ packages: dependencies: '@vitest/spy': 0.34.6 '@vitest/utils': 0.34.6 - chai: 4.3.10 + chai: 4.4.0 dev: true /@vitest/runner@0.34.6: @@ -4305,16 +4318,16 @@ packages: negotiator: 0.6.3 dev: true - /acorn-jsx@5.3.2(acorn@8.10.0): + /acorn-jsx@5.3.2(acorn@8.11.3): resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 dependencies: - acorn: 8.10.0 + acorn: 8.11.3 dev: true - /acorn-walk@8.2.0: - resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} + /acorn-walk@8.3.1: + resolution: {integrity: sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==} engines: {node: '>=0.4.0'} dev: true @@ -4323,6 +4336,12 @@ packages: engines: {node: '>=0.4.0'} dev: true + /acorn@8.11.3: + resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + /ajv-formats@2.1.1(ajv@8.12.0): resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} peerDependencies: @@ -4427,9 +4446,9 @@ packages: resolution: {integrity: sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==} engines: {node: '>= 0.4'} dependencies: - call-bind: 1.0.2 + call-bind: 1.0.5 define-properties: 1.2.1 - es-abstract: 1.22.2 + es-abstract: 1.22.3 es-shim-unscopables: 1.0.2 dev: true @@ -4551,6 +4570,12 @@ packages: balanced-match: 1.0.2 concat-map: 0.0.1 + /brace-expansion@2.0.1: + resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} + dependencies: + balanced-match: 1.0.2 + dev: true + /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} engines: {node: '>=8'} @@ -4601,6 +4626,14 @@ packages: function-bind: 1.1.1 get-intrinsic: 1.2.1 + /call-bind@1.0.5: + resolution: {integrity: sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==} + dependencies: + function-bind: 1.1.2 + get-intrinsic: 1.2.2 + set-function-length: 1.1.1 + dev: true + /callsites@3.1.0: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} @@ -4630,8 +4663,8 @@ packages: engines: {node: '>=14.16'} dev: true - /chai@4.3.10: - resolution: {integrity: sha512-0UXG04VuVbruMUYbJ6JctvH0YnC/4q3/AkT18q4NaITo91CUm0liMS9VqzT9vZhVQ/1eqPanMWjBM+Juhfb/9g==} + /chai@4.4.0: + resolution: {integrity: sha512-x9cHNq1uvkCdU+5xTkNh5WtgD4e4yDFCsp9jVc7N7qVeKeftv3gO/ZrviX5d+3ZfxdYnZXZYujjRInu1RogU6A==} engines: {node: '>=4'} dependencies: assertion-error: 1.1.0 @@ -4940,6 +4973,15 @@ packages: gopd: 1.0.1 has-property-descriptors: 1.0.0 + /define-data-property@1.1.1: + resolution: {integrity: sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + /define-lazy-prop@2.0.0: resolution: {integrity: sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==} engines: {node: '>=8'} @@ -5102,6 +5144,51 @@ packages: unbox-primitive: 1.0.2 which-typed-array: 1.1.11 + /es-abstract@1.22.3: + resolution: {integrity: sha512-eiiY8HQeYfYH2Con2berK+To6GrK2RxbPawDkGq4UiCQQfZHb6wX9qQqkbpPqaxQFcl8d9QzZqo0tGE0VcrdwA==} + engines: {node: '>= 0.4'} + dependencies: + array-buffer-byte-length: 1.0.0 + arraybuffer.prototype.slice: 1.0.2 + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + es-set-tostringtag: 2.0.2 + es-to-primitive: 1.2.1 + function.prototype.name: 1.1.6 + get-intrinsic: 1.2.2 + get-symbol-description: 1.0.0 + globalthis: 1.0.3 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + internal-slot: 1.0.6 + is-array-buffer: 3.0.2 + is-callable: 1.2.7 + is-negative-zero: 2.0.2 + is-regex: 1.1.4 + is-shared-array-buffer: 1.0.2 + is-string: 1.0.7 + is-typed-array: 1.1.12 + is-weakref: 1.0.2 + object-inspect: 1.13.1 + object-keys: 1.1.1 + object.assign: 4.1.5 + regexp.prototype.flags: 1.5.1 + safe-array-concat: 1.0.1 + safe-regex-test: 1.0.1 + string.prototype.trim: 1.2.8 + string.prototype.trimend: 1.0.7 + string.prototype.trimstart: 1.0.7 + typed-array-buffer: 1.0.0 + typed-array-byte-length: 1.0.0 + typed-array-byte-offset: 1.0.0 + typed-array-length: 1.0.4 + unbox-primitive: 1.0.2 + which-typed-array: 1.1.13 + dev: true + /es-array-method-boxes-properly@1.0.0: resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} @@ -5113,6 +5200,15 @@ packages: has: 1.0.4 has-tostringtag: 1.0.0 + /es-set-tostringtag@2.0.2: + resolution: {integrity: sha512-BuDyupZt65P9D2D2vA/zqcI3G5xRsklm5N3xCwuiy+/vKy8i0ifdsQP1sLgO4tZDSCaQUSnmC48khknGMV3D2Q==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + has-tostringtag: 1.0.0 + hasown: 2.0.0 + dev: true + /es-shim-unscopables@1.0.2: resolution: {integrity: sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==} dependencies: @@ -5209,13 +5305,13 @@ packages: engines: {node: '>=10'} dev: true - /eslint-config-prettier@9.0.0(eslint@8.48.0): - resolution: {integrity: sha512-IcJsTkJae2S35pRsRAwoCE+925rJJStOdkKnLVgtE+tEpqU0EVVM7OqrwxqgptKdX29NUwC82I5pXsGFIgSevw==} + /eslint-config-prettier@9.1.0(eslint@8.56.0): + resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true peerDependencies: eslint: '>=7.0.0' dependencies: - eslint: 8.48.0 + eslint: 8.56.0 dev: true /eslint-scope@7.2.2: @@ -5231,17 +5327,19 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dev: true - /eslint@8.48.0: - resolution: {integrity: sha512-sb6DLeIuRXxeM1YljSe1KEx9/YYeZFQWcV8Rq9HfigmdDEugjLEVEa1ozDjL6YDjBpQHPJxJzze+alxi4T3OLg==} + /eslint@8.56.0: + resolution: {integrity: sha512-Go19xM6T9puCOWntie1/P997aXxFsOi37JIHRWI514Hc6ZnaHGKY9xFhrU65RT6CcBEzZoGG1e6Nq+DT04ZtZQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + hasBin: true dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.48.0) - '@eslint-community/regexpp': 4.7.0 - '@eslint/eslintrc': 2.1.2 - '@eslint/js': 8.48.0 - '@humanwhocodes/config-array': 0.11.10 + '@eslint-community/eslint-utils': 4.4.0(eslint@8.56.0) + '@eslint-community/regexpp': 4.10.0 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.56.0 + '@humanwhocodes/config-array': 0.11.13 '@humanwhocodes/module-importer': 1.0.1 '@nodelib/fs.walk': 1.2.8 + '@ungap/structured-clone': 1.2.0 ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 @@ -5257,9 +5355,9 @@ packages: file-entry-cache: 6.0.1 find-up: 5.0.0 glob-parent: 6.0.2 - globals: 13.20.0 + globals: 13.24.0 graphemer: 1.4.0 - ignore: 5.2.4 + ignore: 5.3.0 imurmurhash: 0.1.4 is-glob: 4.0.3 is-path-inside: 3.0.3 @@ -5280,8 +5378,8 @@ packages: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: - acorn: 8.10.0 - acorn-jsx: 5.3.2(acorn@8.10.0) + acorn: 8.11.3 + acorn-jsx: 5.3.2(acorn@8.11.3) eslint-visitor-keys: 3.4.3 dev: true @@ -5387,8 +5485,8 @@ packages: /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} - /fast-glob@3.3.1: - resolution: {integrity: sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==} + /fast-glob@3.3.2: + resolution: {integrity: sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==} engines: {node: '>=8.6.0'} dependencies: '@nodelib/fs.stat': 2.0.5 @@ -5413,8 +5511,8 @@ packages: strnum: 1.0.5 dev: false - /fastq@1.15.0: - resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==} + /fastq@1.16.0: + resolution: {integrity: sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==} dependencies: reusify: 1.0.4 dev: true @@ -5430,7 +5528,7 @@ packages: resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} engines: {node: ^10.12.0 || >=12.0.0} dependencies: - flat-cache: 3.0.4 + flat-cache: 3.2.0 dev: true /fill-range@7.0.1: @@ -5485,16 +5583,17 @@ packages: pkg-dir: 4.2.0 dev: true - /flat-cache@3.0.4: - resolution: {integrity: sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==} + /flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} engines: {node: ^10.12.0 || >=12.0.0} dependencies: - flatted: 3.2.7 + flatted: 3.2.9 + keyv: 4.5.4 rimraf: 3.0.2 dev: true - /flatted@3.2.7: - resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} + /flatted@3.2.9: + resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==} dev: true /for-each@0.3.3: @@ -5599,6 +5698,15 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 + /get-intrinsic@1.2.2: + resolution: {integrity: sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==} + dependencies: + function-bind: 1.1.2 + has-proto: 1.0.1 + has-symbols: 1.0.3 + hasown: 2.0.0 + dev: true + /get-stream@4.1.0: resolution: {integrity: sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==} engines: {node: '>=6'} @@ -5655,8 +5763,8 @@ packages: ini: 2.0.0 dev: false - /globals@13.20.0: - resolution: {integrity: sha512-Qg5QtVkCy/kv3FUSlu4ukeZDVf9ee0iXLAUYX13gbR17bnejFTzr4iS9bY7kwCf1NztRNm1t91fjOiyx4CSwPQ==} + /globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} dependencies: type-fest: 0.20.2 @@ -5674,8 +5782,8 @@ packages: dependencies: array-union: 2.1.0 dir-glob: 3.0.1 - fast-glob: 3.3.1 - ignore: 5.2.4 + fast-glob: 3.3.2 + ignore: 5.3.0 merge2: 1.4.1 slash: 3.0.0 dev: true @@ -5740,6 +5848,12 @@ packages: dependencies: get-intrinsic: 1.2.1 + /has-property-descriptors@1.0.1: + resolution: {integrity: sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==} + dependencies: + get-intrinsic: 1.2.2 + dev: true + /has-proto@1.0.1: resolution: {integrity: sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==} engines: {node: '>= 0.4'} @@ -5818,8 +5932,8 @@ packages: dependencies: safer-buffer: 2.1.2 - /ignore@5.2.4: - resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==} + /ignore@5.3.0: + resolution: {integrity: sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==} engines: {node: '>= 4'} dev: true @@ -5870,6 +5984,15 @@ packages: has: 1.0.4 side-channel: 1.0.4 + /internal-slot@1.0.6: + resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==} + engines: {node: '>= 0.4'} + dependencies: + get-intrinsic: 1.2.2 + hasown: 2.0.0 + side-channel: 1.0.4 + dev: true + /ipaddr.js@1.9.1: resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} engines: {node: '>= 0.10'} @@ -5917,13 +6040,6 @@ packages: ci-info: 2.0.0 dev: false - /is-ci@3.0.1: - resolution: {integrity: sha512-ZYvCgrefwqoQ6yTyYUbQu64HsITZ3NfKX1lzaEYdkTDcfKzzCI/wthRRYKkdjHKFVgNiXKAKm65Zo1pk2as/QQ==} - hasBin: true - dependencies: - ci-info: 3.9.0 - dev: true - /is-core-module@2.13.0: resolution: {integrity: sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==} dependencies: @@ -6078,8 +6194,8 @@ packages: /isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} - /istanbul-lib-coverage@3.2.0: - resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} + /istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} engines: {node: '>=8'} dev: true @@ -6087,7 +6203,7 @@ packages: resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} engines: {node: '>=10'} dependencies: - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 make-dir: 4.0.0 supports-color: 7.2.0 dev: true @@ -6097,7 +6213,7 @@ packages: engines: {node: '>=10'} dependencies: debug: 4.3.4 - istanbul-lib-coverage: 3.2.0 + istanbul-lib-coverage: 3.2.2 source-map: 0.6.1 transitivePeerDependencies: - supports-color @@ -6138,6 +6254,10 @@ packages: resolution: {integrity: sha512-CuUqjv0FUZIdXkHPI8MezCnFCdaTAacej1TZYulLoAg1h/PhwkdXFN4V/gzY4g+fMBCOV2xF+rp7t2XD2ns/NQ==} dev: false + /json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + dev: true + /json-parse-even-better-errors@2.3.1: resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} @@ -6176,6 +6296,12 @@ packages: json-buffer: 3.0.0 dev: false + /keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + dependencies: + json-buffer: 3.0.1 + dev: true + /kind-of@6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} engines: {node: '>=0.10.0'} @@ -6330,7 +6456,7 @@ packages: resolution: {integrity: sha512-3YffViIt2QWgTy6Pale5QpopX/IvU3LPL03jOTqp6pGj3VjesdO/U8CuHMKpnQr4shCNCM5fd5XFFvIIl6JBHg==} engines: {node: '>=8'} dependencies: - '@types/minimist': 1.2.4 + '@types/minimist': 1.2.5 camelcase-keys: 6.2.2 decamelize-keys: 1.1.1 hard-rejection: 2.1.0 @@ -6409,6 +6535,13 @@ packages: dependencies: brace-expansion: 1.1.11 + /minimatch@9.0.3: + resolution: {integrity: sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: true + /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} engines: {node: '>= 6'} @@ -6421,8 +6554,8 @@ packages: /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} - /mixme@0.5.9: - resolution: {integrity: sha512-VC5fg6ySUscaWUpI4gxCBTQMH2RdUpNrk+MsbpCYtIvf9SBJdiUey4qE7BXviJsJR4nDQxCZ+3yaYNW3guz/Pw==} + /mixme@0.5.10: + resolution: {integrity: sha512-5H76ANWinB1H3twpJ6JY8uvAtpmFvHNArpilJAjXRKXSDDLPIMoZArw5SH0q9z+lLs8IrMw7Q2VWpWimFKFT1Q==} engines: {node: '>= 8.0.0'} dev: true @@ -6466,8 +6599,8 @@ packages: engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} dev: false - /nanoid@3.3.6: - resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true dev: true @@ -6527,6 +6660,10 @@ packages: /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} + /object-inspect@1.13.1: + resolution: {integrity: sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==} + dev: true + /object-keys@1.1.1: resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} engines: {node: '>= 0.4'} @@ -6540,6 +6677,16 @@ packages: has-symbols: 1.0.3 object-keys: 1.1.1 + /object.assign@4.1.5: + resolution: {integrity: sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + has-symbols: 1.0.3 + object-keys: 1.1.1 + dev: true + /object.getownpropertydescriptors@2.1.7: resolution: {integrity: sha512-PrJz0C2xJ58FNn11XV2lr4Jt5Gzl94qpy9Lu0JlfEj14z88sqbSBJCBEzdlNUCzY2gburhbrwOZ5BHCmuNUy0g==} engines: {node: '>= 0.8'} @@ -6684,7 +6831,7 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} dependencies: - '@babel/code-frame': 7.22.13 + '@babel/code-frame': 7.23.5 error-ex: 1.3.2 json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 @@ -6767,11 +6914,11 @@ packages: pathe: 1.1.1 dev: true - /postcss@8.4.31: - resolution: {integrity: sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==} + /postcss@8.4.33: + resolution: {integrity: sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==} engines: {node: ^10 || ^12 || >=14} dependencies: - nanoid: 3.3.6 + nanoid: 3.3.7 picocolors: 1.0.0 source-map-js: 1.0.2 dev: true @@ -6802,9 +6949,10 @@ packages: hasBin: true dev: true - /prettier@3.0.3: - resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + /prettier@3.1.1: + resolution: {integrity: sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==} engines: {node: '>=14'} + hasBin: true dev: true /pretty-format@29.7.0: @@ -6836,7 +6984,7 @@ packages: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 20.10.4 + '@types/node': 20.10.8 long: 5.2.3 /proxy-addr@2.0.7: @@ -6943,7 +7091,7 @@ packages: resolution: {integrity: sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg==} engines: {node: '>=8'} dependencies: - '@types/normalize-package-data': 2.4.3 + '@types/normalize-package-data': 2.4.4 normalize-package-data: 2.5.0 parse-json: 5.2.0 type-fest: 0.6.0 @@ -6987,8 +7135,8 @@ packages: '@redis/time-series': 1.0.5(@redis/client@1.5.11) dev: false - /regenerator-runtime@0.14.0: - resolution: {integrity: sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==} + /regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} dev: true /regexp.prototype.flags@1.5.1: @@ -7066,6 +7214,7 @@ packages: /rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + hasBin: true dependencies: glob: 7.2.3 dev: true @@ -7109,6 +7258,15 @@ packages: get-intrinsic: 1.2.1 is-regex: 1.1.4 + /safe-regex-test@1.0.1: + resolution: {integrity: sha512-Y5NejJTTliTyY4H7sipGqY+RX5P87i3F7c4Rcepy72nq+mNLhIsD0W4c7kEmduMDQCSqtPsXPlSTsFhh2LQv+g==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + get-intrinsic: 1.2.2 + is-regex: 1.1.4 + dev: true + /safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} @@ -7172,6 +7330,16 @@ packages: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} dev: true + /set-function-length@1.1.1: + resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==} + engines: {node: '>= 0.4'} + dependencies: + define-data-property: 1.1.1 + get-intrinsic: 1.2.2 + gopd: 1.0.1 + has-property-descriptors: 1.0.1 + dev: true + /set-function-name@2.0.1: resolution: {integrity: sha512-tMNCiqYVkXIZgc2Hnoy2IvC/f8ezc5koaRFkCjrpWzGpCd3qbZXPzVy9MAZzK1ch/X0jvSkojys3oqJN0qCmdA==} engines: {node: '>= 0.4'} @@ -7311,14 +7479,14 @@ packages: engines: {node: '>= 0.8'} dev: true - /std-env@3.4.3: - resolution: {integrity: sha512-f9aPhy8fYBuMN+sNfakZV18U39PbalgjXG3lLB9WkaYTxijru61wb57V9wxxNthXM5Sd88ETBWi29qLAsHO52Q==} + /std-env@3.7.0: + resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} dev: true /stream-transform@2.1.3: resolution: {integrity: sha512-9GHUiM5hMiCi6Y03jD2ARC1ettBXkQBoQAe7nJsPknnI0ow10aXjTnew8QtYQmLjzn974BnmWEAJgCY6ZP1DeQ==} dependencies: - mixme: 0.5.9 + mixme: 0.5.10 dev: true /string-width@4.2.3: @@ -7402,7 +7570,7 @@ packages: /strip-literal@1.3.0: resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} dependencies: - acorn: 8.10.0 + acorn: 8.11.3 dev: true /strnum@1.0.5: @@ -7501,13 +7669,13 @@ packages: engines: {node: '>=8'} dev: true - /ts-api-utils@1.0.3(typescript@5.2.2): + /ts-api-utils@1.0.3(typescript@5.3.3): resolution: {integrity: sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==} engines: {node: '>=16.13.0'} peerDependencies: typescript: '>=4.2.0' dependencies: - typescript: 5.2.2 + typescript: 5.3.3 dev: true /ts-graphviz@1.8.1: @@ -7536,8 +7704,8 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tty-table@4.2.2: - resolution: {integrity: sha512-2gvCArMZLxgvpZ2NvQKdnYWIFLe7I/z5JClMuhrDXunmKgSZcQKcZRjN9XjAFiToMz2pUo1dEIXyrm0AwgV5Tw==} + /tty-table@4.2.3: + resolution: {integrity: sha512-Fs15mu0vGzCrj8fmJNP7Ynxt5J7praPXqFN0leZeZBXJwkMxv9cb2D454k1ltrtUSJbZ4yH4e0CynsHLxmUfFA==} engines: {node: '>=8.0.0'} hasBin: true dependencies: @@ -7550,64 +7718,64 @@ packages: yargs: 17.7.2 dev: true - /turbo-darwin-64@1.10.16: - resolution: {integrity: sha512-+Jk91FNcp9e9NCLYlvDDlp2HwEDp14F9N42IoW3dmHI5ZkGSXzalbhVcrx3DOox3QfiNUHxzWg4d7CnVNCuuMg==} + /turbo-darwin-64@1.11.3: + resolution: {integrity: sha512-IsOOg2bVbIt3o/X8Ew9fbQp5t1hTHN3fGNQYrPQwMR2W1kIAC6RfbVD4A9OeibPGyEPUpwOH79hZ9ydFH5kifw==} cpu: [x64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-darwin-arm64@1.10.16: - resolution: {integrity: sha512-jqGpFZipIivkRp/i+jnL8npX0VssE6IAVNKtu573LXtssZdV/S+fRGYA16tI46xJGxSAivrZ/IcgZrV6Jk80bw==} + /turbo-darwin-arm64@1.11.3: + resolution: {integrity: sha512-FsJL7k0SaPbJzI/KCnrf/fi3PgCDCjTliMc/kEFkuWVA6Httc3Q4lxyLIIinz69q6JTx8wzh6yznUMzJRI3+dg==} cpu: [arm64] os: [darwin] requiresBuild: true dev: true optional: true - /turbo-linux-64@1.10.16: - resolution: {integrity: sha512-PpqEZHwLoizQ6sTUvmImcRmACyRk9EWLXGlqceogPZsJ1jTRK3sfcF9fC2W56zkSIzuLEP07k5kl+ZxJd8JMcg==} + /turbo-linux-64@1.11.3: + resolution: {integrity: sha512-SvW7pvTVRGsqtSkII5w+wriZXvxqkluw5FO/MNAdFw0qmoov+PZ237+37/NgArqE3zVn1GX9P6nUx9VO+xcQAg==} cpu: [x64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-linux-arm64@1.10.16: - resolution: {integrity: sha512-TMjFYz8to1QE0fKVXCIvG/4giyfnmqcQIwjdNfJvKjBxn22PpbjeuFuQ5kNXshUTRaTJihFbuuCcb5OYFNx4uw==} + /turbo-linux-arm64@1.11.3: + resolution: {integrity: sha512-YhUfBi1deB3m+3M55X458J6B7RsIS7UtM3P1z13cUIhF+pOt65BgnaSnkHLwETidmhRh8Dl3GelaQGrB3RdCDw==} cpu: [arm64] os: [linux] requiresBuild: true dev: true optional: true - /turbo-windows-64@1.10.16: - resolution: {integrity: sha512-+jsf68krs0N66FfC4/zZvioUap/Tq3sPFumnMV+EBo8jFdqs4yehd6+MxIwYTjSQLIcpH8KoNMB0gQYhJRLZzw==} + /turbo-windows-64@1.11.3: + resolution: {integrity: sha512-s+vEnuM2TiZuAUUUpmBHDr6vnNbJgj+5JYfnYmVklYs16kXh+EppafYQOAkcRIMAh7GjV3pLq5/uGqc7seZeHA==} cpu: [x64] os: [win32] requiresBuild: true dev: true optional: true - /turbo-windows-arm64@1.10.16: - resolution: {integrity: sha512-sKm3hcMM1bl0B3PLG4ifidicOGfoJmOEacM5JtgBkYM48ncMHjkHfFY7HrJHZHUnXM4l05RQTpLFoOl/uIo2HQ==} + /turbo-windows-arm64@1.11.3: + resolution: {integrity: sha512-ZR5z5Zpc7cASwfdRAV5yNScCZBsgGSbcwiA/u3farCacbPiXsfoWUkz28iyrx21/TRW0bi6dbsB2v17swa8bjw==} cpu: [arm64] os: [win32] requiresBuild: true dev: true optional: true - /turbo@1.10.16: - resolution: {integrity: sha512-2CEaK4FIuSZiP83iFa9GqMTQhroW2QryckVqUydmg4tx78baftTOS0O+oDAhvo9r9Nit4xUEtC1RAHoqs6ZEtg==} + /turbo@1.11.3: + resolution: {integrity: sha512-RCJOUFcFMQNIGKSjC9YmA5yVP1qtDiBA0Lv9VIgrXraI5Da1liVvl3VJPsoDNIR9eFMyA/aagx1iyj6UWem5hA==} hasBin: true optionalDependencies: - turbo-darwin-64: 1.10.16 - turbo-darwin-arm64: 1.10.16 - turbo-linux-64: 1.10.16 - turbo-linux-arm64: 1.10.16 - turbo-windows-64: 1.10.16 - turbo-windows-arm64: 1.10.16 + turbo-darwin-64: 1.11.3 + turbo-darwin-arm64: 1.11.3 + turbo-linux-64: 1.11.3 + turbo-linux-arm64: 1.11.3 + turbo-windows-64: 1.11.3 + turbo-windows-arm64: 1.11.3 dev: true /type-check@0.4.0: @@ -7709,6 +7877,12 @@ packages: engines: {node: '>=14.17'} hasBin: true + /typescript@5.3.3: + resolution: {integrity: sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + /ufo@1.3.1: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} dev: true @@ -7810,12 +7984,12 @@ packages: resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} hasBin: true - /v8-to-istanbul@9.1.3: - resolution: {integrity: sha512-9lDD+EVI2fjFsMWXc6dy5JJzBsVTcQ2fVkfBvncZ6xJWG9wtBhOldG+mHkSL0+V1K/xgZz0JDO5UT5hFwHUghg==} + /v8-to-istanbul@9.2.0: + resolution: {integrity: sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==} engines: {node: '>=10.12.0'} dependencies: '@jridgewell/trace-mapping': 0.3.20 - '@types/istanbul-lib-coverage': 2.0.5 + '@types/istanbul-lib-coverage': 2.0.6 convert-source-map: 2.0.0 dev: true @@ -7830,7 +8004,7 @@ packages: engines: {node: '>= 0.8'} dev: true - /vite-node@0.34.6(@types/node@20.10.4): + /vite-node@0.34.6(@types/node@20.10.8): resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} engines: {node: '>=v14.18.0'} hasBin: true @@ -7840,7 +8014,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.5.0(@types/node@20.10.4) + vite: 4.5.1(@types/node@20.10.8) transitivePeerDependencies: - '@types/node' - less @@ -7852,8 +8026,8 @@ packages: - terser dev: true - /vite@4.5.0(@types/node@20.10.4): - resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} + /vite@4.5.1(@types/node@20.10.4): + resolution: {integrity: sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -7882,7 +8056,43 @@ packages: dependencies: '@types/node': 20.10.4 esbuild: 0.18.20 - postcss: 8.4.31 + postcss: 8.4.33 + rollup: 3.29.4 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vite@4.5.1(@types/node@20.10.8): + resolution: {integrity: sha512-AXXFaAJ8yebyqzoNB9fu2pHoo/nWX+xZlaRwoeYUxEqBO+Zj4msE5G+BhGBll9lYEKv9Hfks52PAF2X7qDYXQA==} + engines: {node: ^14.18.0 || >=16.0.0} + hasBin: true + peerDependencies: + '@types/node': '>= 14' + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 20.10.8 + esbuild: 0.18.20 + postcss: 8.4.33 rollup: 3.29.4 optionalDependencies: fsevents: 2.3.3 @@ -7919,29 +8129,29 @@ packages: webdriverio: optional: true dependencies: - '@types/chai': 4.3.9 - '@types/chai-subset': 1.3.4 - '@types/node': 20.10.4 + '@types/chai': 4.3.11 + '@types/chai-subset': 1.3.5 + '@types/node': 20.10.8 '@vitest/expect': 0.34.6 '@vitest/runner': 0.34.6 '@vitest/snapshot': 0.34.6 '@vitest/spy': 0.34.6 '@vitest/utils': 0.34.6 - acorn: 8.10.0 - acorn-walk: 8.2.0 + acorn: 8.11.3 + acorn-walk: 8.3.1 cac: 6.7.14 - chai: 4.3.10 + chai: 4.4.0 debug: 4.3.4 local-pkg: 0.4.3 magic-string: 0.30.5 pathe: 1.1.1 picocolors: 1.0.0 - std-env: 3.4.3 + std-env: 3.7.0 strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.7.0 - vite: 4.5.0(@types/node@20.10.4) - vite-node: 0.34.6(@types/node@20.10.4) + vite: 4.5.1(@types/node@20.10.8) + vite-node: 0.34.6(@types/node@20.10.8) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -8001,6 +8211,17 @@ packages: gopd: 1.0.1 has-tostringtag: 1.0.0 + /which-typed-array@1.1.13: + resolution: {integrity: sha512-P5Nra0qjSncduVPEAr7xhoF5guty49ArDTwzJ/yNuPIbZppyRxFQsRCWrocxIY+CnMVG+qfbU2FmDKyvSGClow==} + engines: {node: '>= 0.4'} + dependencies: + available-typed-arrays: 1.0.5 + call-bind: 1.0.5 + for-each: 0.3.3 + gopd: 1.0.1 + has-tostringtag: 1.0.0 + dev: true + /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true From 6394887808aa31049d8e66535e593831af602e14 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Wed, 10 Jan 2024 16:18:45 +0800 Subject: [PATCH 10/12] fix: extra comma added in app-with-prop-access --- pnpm-lock.yaml | 3 +++ testapps/app-with-prop-access/package.json | 4 ++-- testapps/app-with-prop-access/src/index.ts | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4badc414..f11100d5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -366,6 +366,9 @@ importers: '@plutolang/pluto-infra': specifier: 'workspace: *' version: link:../../packages/pluto-infra + '@pulumi/pulumi': + specifier: ^3.88.0 + version: 3.88.0 '@types/node': specifier: ^20 version: 20.10.4 diff --git a/testapps/app-with-prop-access/package.json b/testapps/app-with-prop-access/package.json index f8925cde..e04d690b 100644 --- a/testapps/app-with-prop-access/package.json +++ b/testapps/app-with-prop-access/package.json @@ -3,7 +3,6 @@ "private": true, "version": "0.0.0", "scripts": { - "test": "DEBUG=1 ../../apps/cli/bin/pluto test --sim", "build": "mkdir -p .pluto/dev && DEBUG=1 ../../apps/cli/bin/pluto compile" }, "dependencies": { @@ -13,7 +12,8 @@ "@types/node": "^20", "typescript": "^5.2.2", "@plutolang/base": "workspace: *", - "@plutolang/pluto-infra": "workspace: *" + "@plutolang/pluto-infra": "workspace: *", + "@pulumi/pulumi": "^3.88.0" }, "main": "dist/index.js" } diff --git a/testapps/app-with-prop-access/src/index.ts b/testapps/app-with-prop-access/src/index.ts index ee6b01e9..7c3af4c3 100644 --- a/testapps/app-with-prop-access/src/index.ts +++ b/testapps/app-with-prop-access/src/index.ts @@ -19,7 +19,7 @@ tester.it("test echo", async () => { if (res.status !== 200) { throw new Error(`Unexpected status code: ${res.status}`); } - if (body !== "Hello, Pluto!") { + if (body !== "Hello Pluto!") { throw new Error(`Unexpected body: ${body}`); } }); From 5ae1dec1ecb3b4c6b88741f3b25840630274daab Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Wed, 10 Jan 2024 16:24:19 +0800 Subject: [PATCH 11/12] add changeset --- .changeset/real-laws-hope.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .changeset/real-laws-hope.md diff --git a/.changeset/real-laws-hope.md b/.changeset/real-laws-hope.md new file mode 100644 index 00000000..2c270c48 --- /dev/null +++ b/.changeset/real-laws-hope.md @@ -0,0 +1,12 @@ +--- +"@plutolang/static-generator": patch +"@plutolang/static-deducer": patch +"@plutolang/pluto-infra": patch +"@plutolang/pluto": patch +"@plutolang/base": patch +"@plutolang/cli": patch +--- + +feat: support for transfering the values generated by compile-time to runtime + +Note: it hasn't supported for simulation testing yet, but it already can be used on the cloud platform. From e1e2ec60e8eb096a6c2cd768c1a0936fbeda82d9 Mon Sep 17 00:00:00 2001 From: Shoujian Zheng Date: Wed, 10 Jan 2024 16:32:19 +0800 Subject: [PATCH 12/12] fix: add missing CLI dependency to app-with-prop-access's turbo configuration --- testapps/app-with-prop-access/turbo.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 testapps/app-with-prop-access/turbo.json diff --git a/testapps/app-with-prop-access/turbo.json b/testapps/app-with-prop-access/turbo.json new file mode 100644 index 00000000..4536299a --- /dev/null +++ b/testapps/app-with-prop-access/turbo.json @@ -0,0 +1,10 @@ +{ + "$schema": "https://turborepo.org/schema.json", + "extends": ["//"], + "pipeline": { + "build": { + "dependsOn": ["@plutolang/cli#build"], + "inputs": ["src/**"] + } + } +}