diff --git a/.gitignore b/.gitignore index eb7d79a..3e40852 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ node_modules/ **/node_modules/ # Build outputs +lib/ +esm/ dist/ - diff --git a/api/openapispec/docs.go b/api/openapispec/docs.go index d5fe706..647cf0f 100644 --- a/api/openapispec/docs.go +++ b/api/openapispec/docs.go @@ -38,6 +38,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -376,6 +388,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -702,6 +726,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1046,6 +1082,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1405,6 +1453,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1649,6 +1709,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1846,6 +1918,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -2196,6 +2280,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -3280,6 +3376,18 @@ const docTemplate = `{ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -3866,18 +3974,18 @@ const docTemplate = `{ "constant.SourceProviderType": { "type": "string", "enum": [ - "git", "git", "github", "oci", - "local" + "local", + "git" ], "x-enum-varnames": [ - "DefaultSourceType", "SourceProviderTypeGit", "SourceProviderTypeGithub", "SourceProviderTypeOCI", - "SourceProviderTypeLocal" + "SourceProviderTypeLocal", + "DefaultSourceType" ] }, "constant.StackState": { @@ -4277,6 +4385,10 @@ const docTemplate = `{ "description": "ResourceType is the type of the resource.", "type": "string" }, + "resourceURN": { + "description": "ResourceURN is the urn of the resource.", + "type": "string" + }, "status": { "description": "Status is the status of the resource.", "type": "string" diff --git a/api/openapispec/swagger.json b/api/openapispec/swagger.json index bcacf91..3e4e77c 100644 --- a/api/openapispec/swagger.json +++ b/api/openapispec/swagger.json @@ -27,6 +27,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -365,6 +377,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -691,6 +715,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1035,6 +1071,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1394,6 +1442,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1638,6 +1698,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -1835,6 +1907,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -2185,6 +2269,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -3269,6 +3365,18 @@ "description": "The size of the page. Default to 10", "name": "pageSize", "in": "query" + }, + { + "type": "string", + "description": "Which field to sort the list by. Default to id", + "name": "sortBy", + "in": "query" + }, + { + "type": "boolean", + "description": "Whether to sort the list in ascending order. Default to false", + "name": "ascending", + "in": "query" } ], "responses": { @@ -3855,18 +3963,18 @@ "constant.SourceProviderType": { "type": "string", "enum": [ - "git", "git", "github", "oci", - "local" + "local", + "git" ], "x-enum-varnames": [ - "DefaultSourceType", "SourceProviderTypeGit", "SourceProviderTypeGithub", "SourceProviderTypeOCI", - "SourceProviderTypeLocal" + "SourceProviderTypeLocal", + "DefaultSourceType" ] }, "constant.StackState": { @@ -4266,6 +4374,10 @@ "description": "ResourceType is the type of the resource.", "type": "string" }, + "resourceURN": { + "description": "ResourceURN is the urn of the resource.", + "type": "string" + }, "status": { "description": "Status is the status of the resource.", "type": "string" diff --git a/api/openapispec/swagger.yaml b/api/openapispec/swagger.yaml index 6c9bedc..3fd050e 100644 --- a/api/openapispec/swagger.yaml +++ b/api/openapispec/swagger.yaml @@ -30,17 +30,17 @@ definitions: constant.SourceProviderType: enum: - git - - git - github - oci - local + - git type: string x-enum-varnames: - - DefaultSourceType - SourceProviderTypeGit - SourceProviderTypeGithub - SourceProviderTypeOCI - SourceProviderTypeLocal + - DefaultSourceType constant.StackState: enum: - UnSynced @@ -325,6 +325,9 @@ definitions: resourceType: description: ResourceType is the type of the resource. type: string + resourceURN: + description: ResourceURN is the urn of the resource. + type: string status: description: Status is the status of the resource. type: string @@ -1432,6 +1435,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -1651,6 +1662,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -1862,6 +1881,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -2086,6 +2113,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -2319,6 +2354,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -2478,6 +2521,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -2605,6 +2656,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -2832,6 +2891,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: @@ -3552,6 +3619,14 @@ paths: in: query name: pageSize type: integer + - description: Which field to sort the list by. Default to id + in: query + name: sortBy + type: string + - description: Whether to sort the list in ascending order. Default to false + in: query + name: ascending + type: boolean produces: - application/json responses: diff --git a/examples/package.json b/examples/package.json index c287ee3..1c9a4bf 100644 --- a/examples/package.json +++ b/examples/package.json @@ -6,7 +6,7 @@ "start": "node example.js" }, "dependencies": { - "@kusionstack/kusion-api-client-sdk": "^1.0.0", + "@kusionstack/kusion-api-client-sdk": "^1.1.5", "typescript": "^5.0.0" } } \ No newline at end of file diff --git a/package.json b/package.json index 430f503..bf56004 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,36 @@ { "name": "@kusionstack/kusion-api-client-sdk", - "version": "1.1.4", + "version": "1.1.5", "description": "Kusion API Client SDK", - "main": "dist/src/client/index.js", - "types": "dist/src/client/index.d.ts", + "main": "lib/index.js", + "module": "esm/index.js", + "types": "lib/index.d.ts", + "exports": { + ".": { + "require": { + "types": "./lib/index.d.ts", + "default": "./lib/index.js" + }, + "import": { + "types": "./lib/index.d.ts", + "default": "./esm/index.js" + } + } + }, "files": [ - "dist", + "lib", + "esm", + "package.json", "LICENSE", "README.md" ], "scripts": { "type-check": "tsc -p tsconfig.json --noEmit", - "build": "tsc -p tsconfig.build.json", - "tsc": "tsc", - "clean": "rm -rf dist", - "prepare": "yarn clean && yarn build", + "build": "npm run clean && npm run build:cjs && npm run build:esm", + "build:esm": "tsc -p tsconfig.json --target ES2020 --module ESNext --outDir esm", + "build:cjs": "tsc -p tsconfig.json --target ES5 --module commonjs --outDir lib", + "clean": "rm -rf lib esm", + "prepare": "npm run build", "openapi-ts": "openapi-ts", "lint": "eslint", "lint:fix": "eslint --fix", @@ -46,4 +62,4 @@ "publishConfig": { "access": "public" } -} +} \ No newline at end of file diff --git a/src/client/schemas.gen.ts b/src/client/schemas.gen.ts index 6cad4ce..25bf899 100644 --- a/src/client/schemas.gen.ts +++ b/src/client/schemas.gen.ts @@ -13,9 +13,9 @@ export const constant_RunTypeSchema = { } as const; export const constant_SourceProviderTypeSchema = { - enum: ['git', 'git', 'github', 'oci', 'local'], + enum: ['git', 'github', 'oci', 'local', 'git'], type: 'string', - 'x-enum-varnames': ['DefaultSourceType', 'SourceProviderTypeGit', 'SourceProviderTypeGithub', 'SourceProviderTypeOCI', 'SourceProviderTypeLocal'] + 'x-enum-varnames': ['SourceProviderTypeGit', 'SourceProviderTypeGithub', 'SourceProviderTypeOCI', 'SourceProviderTypeLocal', 'DefaultSourceType'] } as const; export const constant_StackStateSchema = { @@ -390,6 +390,10 @@ export const entity_ResourceInfoSchema = { description: 'ResourceType is the type of the resource.', type: 'string' }, + resourceURN: { + description: 'ResourceURN is the urn of the resource.', + type: 'string' + }, status: { description: 'Status is the status of the resource.', type: 'string' diff --git a/src/client/types.gen.ts b/src/client/types.gen.ts index dbddf34..e7d0857 100644 --- a/src/client/types.gen.ts +++ b/src/client/types.gen.ts @@ -17,10 +17,10 @@ export enum constant_RunType { } export enum constant_SourceProviderType { - DefaultSourceType = 'git', - SourceProviderTypeGit = 'github', - SourceProviderTypeGithub = 'oci', - SourceProviderTypeOCI = 'local' + SourceProviderTypeGit = 'git', + SourceProviderTypeGithub = 'github', + SourceProviderTypeOCI = 'oci', + SourceProviderTypeLocal = 'local' } export enum constant_StackState { @@ -315,6 +315,10 @@ export type entity_ResourceInfo = { * ResourceType is the type of the resource. */ resourceType?: string; + /** + * ResourceURN is the urn of the resource. + */ + resourceURN?: string; /** * Status is the status of the resource. */ @@ -1346,6 +1350,10 @@ export type url_Userinfo = unknown; export type ListBackendData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * The current page to fetch. Default to 1 */ @@ -1354,6 +1362,10 @@ export type ListBackendData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; }; }; @@ -1431,6 +1443,10 @@ export type GetEndpointsError = unknown; export type ListModuleData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * Module name to filter module list by. Default to all modules. */ @@ -1443,6 +1459,10 @@ export type ListModuleData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; /** * Workspace ID to filter module list by. Default to all workspaces. */ @@ -1520,6 +1540,10 @@ export type UpdateModuleError = (unknown); export type ListOrganizationData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * The current page to fetch. Default to 1 */ @@ -1528,6 +1552,10 @@ export type ListOrganizationData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; }; }; @@ -1601,6 +1629,10 @@ export type UpdateOrganizationError = (unknown); export type ListProjectData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * Fuzzy match project name to filter project list by. */ @@ -1621,6 +1653,10 @@ export type ListProjectData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; }; }; @@ -1694,6 +1730,10 @@ export type UpdateProjectError = (unknown); export type ListResourceData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * The organization ID */ @@ -1718,6 +1758,10 @@ export type ListResourceData = { * The resource type */ resourceType?: string; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; /** * The stack ID */ @@ -1793,6 +1837,10 @@ export type GetRunResultError = (unknown); export type ListSourceData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * The current page to fetch. Default to 1 */ @@ -1801,6 +1849,10 @@ export type ListSourceData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; /** * Source name to filter source list by. Default to all sources. */ @@ -1878,6 +1930,10 @@ export type UpdateSourceError = (unknown); export type ListRunData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * EndTime to filter runs by. Default to all. Format: RFC3339 */ @@ -1894,6 +1950,10 @@ export type ListRunData = { * ProjectID to filter runs by. Default to all */ projectID?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; /** * StackID to filter runs by. Default to all */ @@ -1925,6 +1985,10 @@ export type ListRunError = (unknown); export type ListStackData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * OrgID to filter stacks by. Default to all */ @@ -1949,6 +2013,10 @@ export type ListStackData = { * ProjectName to filter stacks by. Default to all */ projectName?: string; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; }; }; @@ -2320,6 +2388,10 @@ export type PreviewStackAsyncError = (unknown); export type ListWorkspaceData = { query?: { + /** + * Whether to sort the list in ascending order. Default to false + */ + ascending?: boolean; /** * BackendID to filter workspaces by. Default to all */ @@ -2332,6 +2404,10 @@ export type ListWorkspaceData = { * The size of the page. Default to 10 */ pageSize?: number; + /** + * Which field to sort the list by. Default to id + */ + sortBy?: string; }; }; diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index d9a4a02..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": false, - "declaration": true, - "declarationMap": true, - "sourceMap": true, - "outDir": "dist", - "removeComments": true, - "importHelpers": true, - "incremental": true, - "composite": true, - }, - "exclude": [ - "node_modules", - "dist", - "examples", - ], - "include": ["src"] -} diff --git a/tsconfig.json b/tsconfig.json index ebecf0a..bd2c4d9 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,34 +1,13 @@ { "compilerOptions": { - "target": "ES2020", "module": "ESNext", - "lib": ["ES2020", "DOM", "DOM.Iterable"], - - /* Bundler mode */ - "moduleResolution": "bundler", - "allowJs": true, - "checkJs": true, - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true, + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, - - /* JSX */ - "jsx": "react-jsx", - - /** Type Checking */ "strict": true, - "skipLibCheck": true, - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - - - /* Linting */ - "noUnusedLocals": true, - "noUnusedParameters": true, - "noFallthroughCasesInSwitch": true + "skipLibCheck": true }, "include": ["src"], - "exclude": ["node_modules", "dist"] + "exclude": ["node_modules", "lib", "esm"] } \ No newline at end of file