From 068f6eed3ce25824afe6467bbe6fc8ef0370e473 Mon Sep 17 00:00:00 2001 From: Matt Fedderly Date: Tue, 6 Feb 2024 10:57:17 -0500 Subject: [PATCH 1/5] Update api-gateway definitions, add sls information to @osdk/gateway package.json --- packages/cli/package.json | 2 +- packages/create-app/package.json | 2 +- packages/gateway-generator/package.json | 2 + .../src/cli/generateCommand.ts | 15 ++++ .../gateway-generator/src/cli/updateSls.ts | 71 +++++++++++++++++++ packages/gateway/package.json | 8 +++ .../generated/openapi/components/DataValue.ts | 2 +- .../errors/MarketplaceLinkMappingNotFound.ts | 2 - .../openapi/errors/ObjectTypeNotSynced.ts | 2 +- .../openapi/errors/ObjectTypesNotSynced.ts | 30 ++++++++ .../errors/OntologySyncingObjectTypes.ts | 30 ++++++++ .../errors/PropertiesHaveDifferentIds.ts | 29 ++++++++ .../errors/SharedPropertiesNotFound.ts | 29 ++++++++ .../src/generated/openapi/errors/index.ts | 4 ++ .../generated/openapi/namespaces/Datasets.ts | 9 +-- .../openapi/namespaces/OntologiesV2.ts | 8 ++- .../src/client/interfaces/aggregations.ts | 16 ----- pnpm-lock.yaml | 22 +++--- scripts/generateOpenApi.sh | 3 +- scripts/getOpenApiIr.sh | 3 +- 20 files changed, 247 insertions(+), 42 deletions(-) create mode 100644 packages/gateway-generator/src/cli/updateSls.ts create mode 100644 packages/gateway/src/generated/openapi/errors/ObjectTypesNotSynced.ts create mode 100644 packages/gateway/src/generated/openapi/errors/OntologySyncingObjectTypes.ts create mode 100644 packages/gateway/src/generated/openapi/errors/PropertiesHaveDifferentIds.ts create mode 100644 packages/gateway/src/generated/openapi/errors/SharedPropertiesNotFound.ts diff --git a/packages/cli/package.json b/packages/cli/package.json index 332a81e6e..9f403a3cb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -35,7 +35,7 @@ "archiver": "^6.0.1", "conjure-lite": "^0.3.3", "consola": "^3.2.3", - "find-up": "^6.3.0", + "find-up": "^7.0.0", "open": "^9.1.0", "yargs": "^17.7.2" }, diff --git a/packages/create-app/package.json b/packages/create-app/package.json index 6e0c11842..309fe194e 100644 --- a/packages/create-app/package.json +++ b/packages/create-app/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "consola": "^3.2.3", - "find-up": "^6.3.0", + "find-up": "^7.0.0", "handlebars": "^4.7.8", "yargs": "^17.7.2" }, diff --git a/packages/gateway-generator/package.json b/packages/gateway-generator/package.json index 7bd3c6250..02bf79ed8 100644 --- a/packages/gateway-generator/package.json +++ b/packages/gateway-generator/package.json @@ -26,7 +26,9 @@ "typecheck": "tsc-absolute --build" }, "dependencies": { + "find-up": "^7.0.0", "ts-morph": "^19.0.0", + "yaml": "^2.3.4", "yargs": "^17.7.2" }, "devDependencies": { diff --git a/packages/gateway-generator/src/cli/generateCommand.ts b/packages/gateway-generator/src/cli/generateCommand.ts index 2682246fa..f5ff27dbc 100644 --- a/packages/gateway-generator/src/cli/generateCommand.ts +++ b/packages/gateway-generator/src/cli/generateCommand.ts @@ -15,15 +15,18 @@ */ import { readFile } from "fs/promises"; +import { parse } from "yaml"; import type { Arguments, Argv, CommandModule } from "yargs"; import { generate } from "../generate/generate"; import type { ApiSpec } from "../spec"; +import { updateSls } from "./updateSls"; export interface GenerateOpenApiArgs { /* * Positional arguments */ inputFile: string; + manifestFile: string; outputDir: string; generateVisitors: boolean; } @@ -42,6 +45,11 @@ export class GenerateCommand implements CommandModule<{}, GenerateOpenApiArgs> { type: "string", demandOption: true, }) + .positional("manifestFile", { + describe: "The location of the API manifest.yml", + type: "string", + demandOption: true, + }) .positional("outputDir", { describe: "The output directory for the generated code", type: "string", @@ -68,8 +76,15 @@ export class GenerateCommand implements CommandModule<{}, GenerateOpenApiArgs> { const irSpecRead = await readFile(`${input}`, { encoding: "utf8" }); const irSpec: ApiSpec = JSON.parse(irSpecRead); + const manifestRead = await readFile(`${args.manifestFile}`, { + encoding: "utf8", + }); + const manifest = parse(manifestRead); + await generate(irSpec, output, { generateVisitors, }); + + await updateSls(manifest, output); }; } diff --git a/packages/gateway-generator/src/cli/updateSls.ts b/packages/gateway-generator/src/cli/updateSls.ts new file mode 100644 index 000000000..9041b2aa7 --- /dev/null +++ b/packages/gateway-generator/src/cli/updateSls.ts @@ -0,0 +1,71 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { readFile, writeFile } from "fs/promises"; + +export interface Manifest { + "manifest-version": string; + "extensions": { + "product-dependencies": ReadonlyArray<{ + "product-group": string; + "product-name": string; + "minimum-version": string; + "maximum-version": string; + "optional": boolean; + }>; + }; +} + +export async function updateSls(manifest: Manifest, output: string) { + // the whole manifest shape is hand-jammed so lets have a quick sanity check to make sure we're ok + if (manifest["manifest-version"] !== "1.0") { + throw new Error( + `Unsupported manifest version ${manifest["manifest-version"]}`, + ); + } + + const { findUp } = await import("find-up"); + + const packageJsonFile = await findUp("package.json", { cwd: output }); + if (!packageJsonFile) { + throw new Error("Could not find target package.json"); + } + const packageJsonRead = await readFile(packageJsonFile, { encoding: "utf8" }); + const packageJson = JSON.parse(packageJsonRead); + + const dependencies: + | Record + | undefined = packageJson?.["sls"]?.["dependencies"]; + if (!dependencies) { + throw new Error("package.json does not have an sls block yet?"); + } + + const deps = manifest?.extensions?.["product-dependencies"]; + + for (const dep of deps) { + if (dep.optional) { + throw new Error("No support for optional dependencies"); + } + const key = `${dep["product-group"]}:${dep["product-name"]}`; + const value = { + minVersion: dep["minimum-version"], + maxVersion: dep["maximum-version"], + }; + dependencies[key] = value; + } + + await writeFile(packageJsonFile, JSON.stringify(packageJson, null, 2)); +} diff --git a/packages/gateway/package.json b/packages/gateway/package.json index bc07e38c2..2436d84fe 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -25,6 +25,14 @@ "transpileWatch": "tsup --watch", "typecheck": "tsc-absolute --build" }, + "sls": { + "dependencies": { + "com.palantir.foundry.api:api-gateway": { + "minVersion": "1.763.0", + "maxVersion": "1.x.x" + } + } + }, "dependencies": { "fetch-retry": "^5.0.6", "tiny-invariant": "^1.3.1" diff --git a/packages/gateway/src/generated/openapi/components/DataValue.ts b/packages/gateway/src/generated/openapi/components/DataValue.ts index ec0d78570..99fc4abb0 100644 --- a/packages/gateway/src/generated/openapi/components/DataValue.ts +++ b/packages/gateway/src/generated/openapi/components/DataValue.ts @@ -29,7 +29,7 @@ * | Integer | number | `238940` | * | Long | string | `"58319870951433"` | * | Null | null | `null` | - * | Object Set | string | `ri.object-set.main.versioned-object-set.h13274m8-23f5-431c-8aee-a4554157c57z`| + * | Object Set | string OR the object set definition | `ri.object-set.main.versioned-object-set.h13274m8-23f5-431c-8aee-a4554157c57z`| * | Ontology Object Reference | JSON encoding of the object's primary key | `10033123` or `"EMP1234"` | * | Set | array | `["alpha", "bravo", "charlie"]` | * | Short | number | `8739` | diff --git a/packages/gateway/src/generated/openapi/errors/MarketplaceLinkMappingNotFound.ts b/packages/gateway/src/generated/openapi/errors/MarketplaceLinkMappingNotFound.ts index d8838d333..e30d34521 100644 --- a/packages/gateway/src/generated/openapi/errors/MarketplaceLinkMappingNotFound.ts +++ b/packages/gateway/src/generated/openapi/errors/MarketplaceLinkMappingNotFound.ts @@ -16,7 +16,6 @@ import type { ArtifactRepositoryRid } from "../components/ArtifactRepositoryRid"; import type { LinkTypeApiName } from "../components/LinkTypeApiName"; -import type { ObjectTypeApiName } from "../components/ObjectTypeApiName"; import type { SdkPackageName } from "../components/SdkPackageName"; /** The given link could not be mapped to a Marketplace installation. */ @@ -25,7 +24,6 @@ export interface MarketplaceLinkMappingNotFound { errorName: "MarketplaceLinkMappingNotFound"; errorInstanceId: string; parameters: { - objectType: ObjectTypeApiName; linkType: LinkTypeApiName; artifactRepository: ArtifactRepositoryRid; packageName: SdkPackageName; diff --git a/packages/gateway/src/generated/openapi/errors/ObjectTypeNotSynced.ts b/packages/gateway/src/generated/openapi/errors/ObjectTypeNotSynced.ts index 3eec56a1d..14050b55b 100644 --- a/packages/gateway/src/generated/openapi/errors/ObjectTypeNotSynced.ts +++ b/packages/gateway/src/generated/openapi/errors/ObjectTypeNotSynced.ts @@ -17,7 +17,7 @@ import type { ObjectTypeApiName } from "../components/ObjectTypeApiName"; /** - * The requested object types are not synced into the ontology. Please reach out to your Ontology + * The requested object type is not synced into the ontology. Please reach out to your Ontology * Administrator to re-index the object type in Ontology Management Application. */ export interface ObjectTypeNotSynced { diff --git a/packages/gateway/src/generated/openapi/errors/ObjectTypesNotSynced.ts b/packages/gateway/src/generated/openapi/errors/ObjectTypesNotSynced.ts new file mode 100644 index 000000000..ec7d24c94 --- /dev/null +++ b/packages/gateway/src/generated/openapi/errors/ObjectTypesNotSynced.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { ObjectTypeApiName } from "../components/ObjectTypeApiName"; + +/** + * One or more of the requested object types are not synced into the ontology. Please reach out to your Ontology + * Administrator to re-index the object type(s) in Ontology Management Application. + */ +export interface ObjectTypesNotSynced { + errorCode: "CONFLICT"; + errorName: "ObjectTypesNotSynced"; + errorInstanceId: string; + parameters: { + objectTypes: Array; + }; +} diff --git a/packages/gateway/src/generated/openapi/errors/OntologySyncingObjectTypes.ts b/packages/gateway/src/generated/openapi/errors/OntologySyncingObjectTypes.ts new file mode 100644 index 000000000..e8e96f7e8 --- /dev/null +++ b/packages/gateway/src/generated/openapi/errors/OntologySyncingObjectTypes.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { ObjectTypeApiName } from "../components/ObjectTypeApiName"; + +/** + * One or more requested object types have been changed in the **Ontology Manager** and changes are currently being + * applied. Wait a few seconds and try again. + */ +export interface OntologySyncingObjectTypes { + errorCode: "CONFLICT"; + errorName: "OntologySyncingObjectTypes"; + errorInstanceId: string; + parameters: { + objectTypes: Array; + }; +} diff --git a/packages/gateway/src/generated/openapi/errors/PropertiesHaveDifferentIds.ts b/packages/gateway/src/generated/openapi/errors/PropertiesHaveDifferentIds.ts new file mode 100644 index 000000000..d41d9d976 --- /dev/null +++ b/packages/gateway/src/generated/openapi/errors/PropertiesHaveDifferentIds.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { SharedPropertyTypeApiName } from "../components/SharedPropertyTypeApiName"; + +/** + * Properties used in ordering must have the same ids. Temporary restriction imposed due to OSS limitations. + */ +export interface PropertiesHaveDifferentIds { + errorCode: "INVALID_ARGUMENT"; + errorName: "PropertiesHaveDifferentIds"; + errorInstanceId: string; + parameters: { + properties: Array; + }; +} diff --git a/packages/gateway/src/generated/openapi/errors/SharedPropertiesNotFound.ts b/packages/gateway/src/generated/openapi/errors/SharedPropertiesNotFound.ts new file mode 100644 index 000000000..0cc25fe7b --- /dev/null +++ b/packages/gateway/src/generated/openapi/errors/SharedPropertiesNotFound.ts @@ -0,0 +1,29 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { ObjectTypeApiName } from "../components/ObjectTypeApiName"; +import type { SharedPropertyTypeApiName } from "../components/SharedPropertyTypeApiName"; + +/** The requested shared property types are not present on every object type. */ +export interface SharedPropertiesNotFound { + errorCode: "NOT_FOUND"; + errorName: "SharedPropertiesNotFound"; + errorInstanceId: string; + parameters: { + objectType: Array; + missingSharedProperties: Array; + }; +} diff --git a/packages/gateway/src/generated/openapi/errors/index.ts b/packages/gateway/src/generated/openapi/errors/index.ts index 81fb1e71d..2a888cb19 100644 --- a/packages/gateway/src/generated/openapi/errors/index.ts +++ b/packages/gateway/src/generated/openapi/errors/index.ts @@ -97,9 +97,11 @@ export * from "./ObjectNotFound"; export * from "./ObjectsExceededLimit"; export * from "./ObjectTypeNotFound"; export * from "./ObjectTypeNotSynced"; +export * from "./ObjectTypesNotSynced"; export * from "./OntologyEditsExceededLimit"; export * from "./OntologyNotFound"; export * from "./OntologySyncing"; +export * from "./OntologySyncingObjectTypes"; export * from "./OpenTransactionAlreadyExists"; export * from "./OperationNotFound"; export * from "./ParameterObjectNotFound"; @@ -107,6 +109,7 @@ export * from "./ParameterObjectSetRidNotFound"; export * from "./ParametersNotFound"; export * from "./ParameterTypeNotSupported"; export * from "./ParentAttachmentPermissionDenied"; +export * from "./PropertiesHaveDifferentIds"; export * from "./PropertiesNotFilterable"; export * from "./PropertiesNotFound"; export * from "./PropertiesNotSearchable"; @@ -123,6 +126,7 @@ export * from "./QueryTimeExceededLimit"; export * from "./ReadTablePermissionDenied"; export * from "./ResourceNameAlreadyExists"; export * from "./SchemaNotFound"; +export * from "./SharedPropertiesNotFound"; export * from "./SharedPropertyTypeNotFound"; export * from "./TransactionNotCommitted"; export * from "./TransactionNotFound"; diff --git a/packages/gateway/src/generated/openapi/namespaces/Datasets.ts b/packages/gateway/src/generated/openapi/namespaces/Datasets.ts index 1f1320a46..1c6741d2c 100644 --- a/packages/gateway/src/generated/openapi/namespaces/Datasets.ts +++ b/packages/gateway/src/generated/openapi/namespaces/Datasets.ts @@ -71,14 +71,10 @@ export function getDataset( } /** - * :::callout{theme=warning title=Warning} - * This endpoint is in preview and may be modified or removed at any time. - * To use this endpoint, add `preview=true` to the request query parameters. - * Furthermore, this endpoint currently does not support views (Virtual datasets composed of other datasets). - * ::: - * * Gets the content of a dataset as a table in the specified format. * + * This endpoint currently does not support views (Virtual datasets composed of other datasets). + * * Third-party applications using this endpoint via OAuth2 must request the following operation scope: `api:datasets-read`. */ export function readTable( @@ -91,7 +87,6 @@ export function readTable( format: TableExportFormat; columns: Array; rowLimit?: number; - preview?: PreviewMode; }, ): Promise { return _request( diff --git a/packages/gateway/src/generated/openapi/namespaces/OntologiesV2.ts b/packages/gateway/src/generated/openapi/namespaces/OntologiesV2.ts index e09bdad1e..f8eee1a74 100644 --- a/packages/gateway/src/generated/openapi/namespaces/OntologiesV2.ts +++ b/packages/gateway/src/generated/openapi/namespaces/OntologiesV2.ts @@ -516,7 +516,9 @@ export function getInterfaceType( * To use this endpoint, add `preview=true` to the request query parameters. * ::: * - * Search for objects in the specified ontology and interface type. The following search queries are supported: + * Search for objects in the specified ontology and interface type. Any properties specified in the "where" or + * "orderBy" parameters must be shared property type API names defined on the interface. The following search + * queries are supported: * * | Query type | Description | Supported Types | * |-----------------------------------------|-------------------------------------------------------------------------------------------------------------------|---------------------------------| @@ -563,8 +565,8 @@ export function searchObjectsForInterface( * To use this endpoint, add `preview=true` to the request query parameters. * ::: * - * Perform functions on object fields in the specified ontology and of the specified interface type. Any specified - * properties must be shared property types defined on the interface. + * Perform functions on object fields in the specified ontology and of the specified interface type. Any + * properties specified in the query must be shared property type API names defined on the interface. * * Third-party applications using this endpoint via OAuth2 must request the following operation scope: `api:read-data`. */ diff --git a/packages/legacy-client/src/client/interfaces/aggregations.ts b/packages/legacy-client/src/client/interfaces/aggregations.ts index 45ea556c2..15b11bb3d 100644 --- a/packages/legacy-client/src/client/interfaces/aggregations.ts +++ b/packages/legacy-client/src/client/interfaces/aggregations.ts @@ -14,22 +14,6 @@ * limitations under the License. */ -/* - * Copyright 2023 Palantir Technologies, Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - import type { LocalDate, OntologyObject, Timestamp } from "../baseTypes"; import type { AggregatableProperty, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c571fb42a..bb6f02691 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -318,8 +318,8 @@ importers: specifier: ^3.2.3 version: 3.2.3 find-up: - specifier: ^6.3.0 - version: 6.3.0 + specifier: ^7.0.0 + version: 7.0.0 open: specifier: ^9.1.0 version: 9.1.0 @@ -395,8 +395,8 @@ importers: specifier: ^3.2.3 version: 3.2.3 find-up: - specifier: ^6.3.0 - version: 6.3.0 + specifier: ^7.0.0 + version: 7.0.0 handlebars: specifier: ^4.7.8 version: 4.7.8 @@ -493,9 +493,15 @@ importers: packages/gateway-generator: dependencies: + find-up: + specifier: ^7.0.0 + version: 7.0.0 ts-morph: specifier: ^19.0.0 version: 19.0.0 + yaml: + specifier: ^2.3.4 + version: 2.3.4 yargs: specifier: ^17.7.2 version: 17.7.2 @@ -4251,6 +4257,7 @@ packages: dependencies: locate-path: 7.2.0 path-exists: 5.0.0 + dev: true /find-up@7.0.0: resolution: {integrity: sha512-YyZM99iHrqLKjmt4LJDj58KI+fYyufRLBSYcqycxf//KpBk9FoewoGX0450m9nB44qrZnovzC2oeP5hUibxc/g==} @@ -5795,7 +5802,7 @@ packages: dependencies: lilconfig: 2.1.0 postcss: 8.4.31 - yaml: 2.3.2 + yaml: 2.3.4 dev: true /postcss-nested@6.0.1(postcss@8.4.31): @@ -7392,10 +7399,9 @@ packages: engines: {node: '>= 14'} dev: true - /yaml@2.3.2: - resolution: {integrity: sha512-N/lyzTPaJasoDmfV7YTrYCI0G/3ivm/9wdG0aHuheKowWQwGTsK0Eoiw6utmzAnI6pkJa0DUVygvp3spqqEKXg==} + /yaml@2.3.4: + resolution: {integrity: sha512-8aAvwVUSHpfEqTQ4w/KMlf3HcRdt50E5ODIQJBw1fQ5RL34xabzxtUlzTXVqc4rkZsPbvrXKWnABCD7kWSmocA==} engines: {node: '>= 14'} - dev: true /yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} diff --git a/scripts/generateOpenApi.sh b/scripts/generateOpenApi.sh index 9b2b2db2d..432e84bbf 100755 --- a/scripts/generateOpenApi.sh +++ b/scripts/generateOpenApi.sh @@ -14,6 +14,7 @@ WGET=$(checkCommand "wget" "wget" "Try 'brew install wget'") GATEWAY_GENERATOR="$SCRIPT_DIR/../packages/gateway-generator/bin/gateway-generator.cjs" OPENAPI_IR_JSON="${SCRIPT_DIR}/../tmp/api-gateway-ir/openapi-ir.json" +OPENAPI_MANIFEST_YML="${SCRIPT_DIR}/../tmp/api-gateway-ir/manifest.yml" PACKAGE_PATH="${SCRIPT_DIR}/../packages/gateway" OUT_DIR=$("$REALPATH" --relative-to=. "${PACKAGE_PATH}/src/generated/openapi") @@ -21,6 +22,6 @@ OUT_DIR=$("$REALPATH" --relative-to=. "${PACKAGE_PATH}/src/generated/openapi") rm -rf "$OUT_DIR" # Generate the API bindings echo "Generating gateway bindings" -$GATEWAY_GENERATOR generate --inputFile "${OPENAPI_IR_JSON}" --outputDir "${OUT_DIR}" --generateVisitors false +$GATEWAY_GENERATOR generate --inputFile "${OPENAPI_IR_JSON}" --manifestFile "${OPENAPI_MANIFEST_YML}" --outputDir "${OUT_DIR}" --generateVisitors false formatTypescript "$OUT_DIR" "$PACKAGE_PATH" \ No newline at end of file diff --git a/scripts/getOpenApiIr.sh b/scripts/getOpenApiIr.sh index 57d76f086..3c2ac682c 100755 --- a/scripts/getOpenApiIr.sh +++ b/scripts/getOpenApiIr.sh @@ -21,4 +21,5 @@ mkdir -p "${DOWNLOAD_DIR}" wget -P "${DOWNLOAD_DIR}" "${MAVEN_REPO_PATH}/${API_GATEWAY_VERSION}/${MAVEN_CONJURE_ARTIFACT_ID}-${API_GATEWAY_VERSION}.sls.tgz" mkdir -p "${EXTRACT_DIR}" -tar -xf "${DOWNLOAD_DIR}/api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}.sls.tgz" -C "${EXTRACT_DIR}" --strip-components=4 "api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}/asset/palantir/ir/openapi-ir.json" \ No newline at end of file +tar -xf "${DOWNLOAD_DIR}/api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}.sls.tgz" -C "${EXTRACT_DIR}" --strip-components=4 "api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}/asset/palantir/ir/openapi-ir.json" +tar -xf "${DOWNLOAD_DIR}/api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}.sls.tgz" -C "${EXTRACT_DIR}" --strip-components=2 "api-gateway-rosetta-bundle-${API_GATEWAY_VERSION}/deployment/manifest.yml" \ No newline at end of file From accbb5a29f7eb6a27f0c2baa2555a0ca49174bb0 Mon Sep 17 00:00:00 2001 From: Matt Fedderly Date: Tue, 6 Feb 2024 11:20:31 -0500 Subject: [PATCH 2/5] Fix mrl --- packages/gateway/package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/gateway/package.json b/packages/gateway/package.json index 2436d84fe..923e22fbd 100644 --- a/packages/gateway/package.json +++ b/packages/gateway/package.json @@ -25,14 +25,6 @@ "transpileWatch": "tsup --watch", "typecheck": "tsc-absolute --build" }, - "sls": { - "dependencies": { - "com.palantir.foundry.api:api-gateway": { - "minVersion": "1.763.0", - "maxVersion": "1.x.x" - } - } - }, "dependencies": { "fetch-retry": "^5.0.6", "tiny-invariant": "^1.3.1" @@ -55,5 +47,13 @@ ], "main": "./build/js/index.js", "module": "./build/js/index.mjs", - "types": "./build/types/index.d.ts" + "types": "./build/types/index.d.ts", + "sls": { + "dependencies": { + "com.palantir.foundry.api:api-gateway": { + "minVersion": "1.763.0", + "maxVersion": "1.x.x" + } + } + } } From 9ebb1e1cff0cead8def61da0793d87c9cd0baa20 Mon Sep 17 00:00:00 2001 From: Matt Fedderly Date: Wed, 14 Feb 2024 13:10:01 -0500 Subject: [PATCH 3/5] Upgrade api-gateway types, fix issues with ObjectTypeWithLink -> ObjectTypeFullMetadata and markings property type --- packages/api/src/ontology/ActionDefinition.ts | 1 + .../api/src/ontology/WirePropertyTypes.ts | 1 + .../metadataResolver.test.ts.snap | 6 ++++ .../openapi/components/ActionParameterType.ts | 6 ++++ .../generated/openapi/components/DataValue.ts | 1 + .../{ObjectTypeWithLink.ts => MarkingType.ts} | 7 +--- .../openapi/components/ObjectPropertyType.ts | 6 ++++ .../components/ObjectTypeFullMetadata.ts | 33 +++++++++++++++++++ .../openapi/components/OntologyDataType.ts | 6 ++++ .../components/OntologyFullMetadata.ts | 4 +-- .../generated/openapi/components/ValueType.ts | 1 + .../src/generated/openapi/components/index.ts | 3 +- .../wireActionTypeV2ToSdkActionDefinition.ts | 2 ++ .../wireObjectTypeV2ToSdkObjectConst.ts | 4 +-- .../wireObjectTypeV2ToSdkObjectDefinition.ts | 4 +-- ...PropertyV2ToSdkPrimaryKeyTypeDefinition.ts | 1 + .../wirePropertyV2ToSdkPropertyDefinition.ts | 2 ++ .../src/util/test/TodoWireOntology.ts | 4 +++ .../generator/src/v1.1/generateActions.ts | 2 ++ .../src/v1.1/generateMetadataFile.test.ts | 2 ++ ...ectTypeV2ToV1ObjectInterfaceString.test.ts | 2 ++ ...reObjectTypeV2ToV1ObjectInterfaceString.ts | 6 ++-- .../src/client/OsdkLegacyObject.ts | 1 + .../mapPropertiesToGroupByProperties.ts | 1 + ...opertiesToMultipleAggregationProperties.ts | 1 + .../objectSets/mapPropertiesToSearchFilter.ts | 1 + .../client/objects/convertWireToOsdkObject.ts | 1 + .../src/stubs/objectTypesWithLinkTypes.ts | 31 +++++++++++------ 28 files changed, 115 insertions(+), 25 deletions(-) rename packages/gateway/src/generated/openapi/components/{ObjectTypeWithLink.ts => MarkingType.ts} (75%) create mode 100644 packages/gateway/src/generated/openapi/components/ObjectTypeFullMetadata.ts diff --git a/packages/api/src/ontology/ActionDefinition.ts b/packages/api/src/ontology/ActionDefinition.ts index e15e0e2a1..0f25663aa 100644 --- a/packages/api/src/ontology/ActionDefinition.ts +++ b/packages/api/src/ontology/ActionDefinition.ts @@ -39,6 +39,7 @@ export interface ValidBaseActionParameterTypes { datetime: Date; timestamp: Date; attachment: any; + marking: string; } export interface ObjectActionDataType { diff --git a/packages/api/src/ontology/WirePropertyTypes.ts b/packages/api/src/ontology/WirePropertyTypes.ts index a07c08b62..2297a6918 100644 --- a/packages/api/src/ontology/WirePropertyTypes.ts +++ b/packages/api/src/ontology/WirePropertyTypes.ts @@ -28,6 +28,7 @@ export interface WirePropertyTypes { float: number; decimal: number; byte: number; + marking: string; numericTimeseries: any; stringTimeseries: any; diff --git a/packages/foundry-sdk-generator/src/__e2e_tests__/__snapshots__/metadataResolver.test.ts.snap b/packages/foundry-sdk-generator/src/__e2e_tests__/__snapshots__/metadataResolver.test.ts.snap index 064de2234..b28a5ab82 100644 --- a/packages/foundry-sdk-generator/src/__e2e_tests__/__snapshots__/metadataResolver.test.ts.snap +++ b/packages/foundry-sdk-generator/src/__e2e_tests__/__snapshots__/metadataResolver.test.ts.snap @@ -39,6 +39,7 @@ exports[`Load Ontologies Metadata > Loads object and action types using only spe "interfaceTypes": {}, "objectTypes": { "Employee": { + "implementsInterfaces": [], "linkTypes": [ { "apiName": "peeps", @@ -98,8 +99,10 @@ exports[`Load Ontologies Metadata > Loads object and action types using only spe "rid": "ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44", "status": "ACTIVE", }, + "sharedPropertyTypeMapping": {}, }, "Office": { + "implementsInterfaces": [], "linkTypes": [], "objectType": { "apiName": "Office", @@ -132,6 +135,7 @@ exports[`Load Ontologies Metadata > Loads object and action types using only spe "rid": "ri.ontology.main.object-type.404ac022-89eb-4591-8b7e-1a912b9efb45", "status": "ACTIVE", }, + "sharedPropertyTypeMapping": {}, }, }, "ontology": { @@ -184,6 +188,7 @@ exports[`Load Ontologies Metadata > Loads object and action types without link t "interfaceTypes": {}, "objectTypes": { "Employee": { + "implementsInterfaces": [], "linkTypes": [], "objectType": { "apiName": "Employee", @@ -228,6 +233,7 @@ exports[`Load Ontologies Metadata > Loads object and action types without link t "rid": "ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44", "status": "ACTIVE", }, + "sharedPropertyTypeMapping": {}, }, }, "ontology": { diff --git a/packages/gateway/src/generated/openapi/components/ActionParameterType.ts b/packages/gateway/src/generated/openapi/components/ActionParameterType.ts index 858116080..2269ad17d 100644 --- a/packages/gateway/src/generated/openapi/components/ActionParameterType.ts +++ b/packages/gateway/src/generated/openapi/components/ActionParameterType.ts @@ -21,6 +21,7 @@ import type { DateType } from "./DateType"; import type { DoubleType } from "./DoubleType"; import type { IntegerType } from "./IntegerType"; import type { LongType } from "./LongType"; +import type { MarkingType } from "./MarkingType"; import type { OntologyObjectSetType } from "./OntologyObjectSetType"; import type { OntologyObjectType } from "./OntologyObjectType"; import type { StringType } from "./StringType"; @@ -54,6 +55,10 @@ export interface ActionParameterType_Long extends LongType { type: "long"; } +export interface ActionParameterType_Marking extends MarkingType { + type: "marking"; +} + export interface ActionParameterType_ObjectSet extends OntologyObjectSetType { type: "objectSet"; } @@ -78,6 +83,7 @@ export type ActionParameterType = | ActionParameterType_Double | ActionParameterType_Integer | ActionParameterType_Long + | ActionParameterType_Marking | ActionParameterType_ObjectSet | ActionParameterType_Object | ActionParameterType_String diff --git a/packages/gateway/src/generated/openapi/components/DataValue.ts b/packages/gateway/src/generated/openapi/components/DataValue.ts index 99fc4abb0..099fdd43f 100644 --- a/packages/gateway/src/generated/openapi/components/DataValue.ts +++ b/packages/gateway/src/generated/openapi/components/DataValue.ts @@ -28,6 +28,7 @@ * | Double | number | `3.14159265` | * | Integer | number | `238940` | * | Long | string | `"58319870951433"` | + * | Marking | string | `"MU"` | * | Null | null | `null` | * | Object Set | string OR the object set definition | `ri.object-set.main.versioned-object-set.h13274m8-23f5-431c-8aee-a4554157c57z`| * | Ontology Object Reference | JSON encoding of the object's primary key | `10033123` or `"EMP1234"` | diff --git a/packages/gateway/src/generated/openapi/components/ObjectTypeWithLink.ts b/packages/gateway/src/generated/openapi/components/MarkingType.ts similarity index 75% rename from packages/gateway/src/generated/openapi/components/ObjectTypeWithLink.ts rename to packages/gateway/src/generated/openapi/components/MarkingType.ts index d1c93fac9..a8322bb77 100644 --- a/packages/gateway/src/generated/openapi/components/ObjectTypeWithLink.ts +++ b/packages/gateway/src/generated/openapi/components/MarkingType.ts @@ -14,10 +14,5 @@ * limitations under the License. */ -import type { LinkTypeSideV2 } from "./LinkTypeSideV2"; -import type { ObjectTypeV2 } from "./ObjectTypeV2"; - -export interface ObjectTypeWithLink { - objectType: ObjectTypeV2; - linkTypes: Array; +export interface MarkingType { } diff --git a/packages/gateway/src/generated/openapi/components/ObjectPropertyType.ts b/packages/gateway/src/generated/openapi/components/ObjectPropertyType.ts index 518b36984..f3b824af4 100644 --- a/packages/gateway/src/generated/openapi/components/ObjectPropertyType.ts +++ b/packages/gateway/src/generated/openapi/components/ObjectPropertyType.ts @@ -25,6 +25,7 @@ import type { GeoPointType } from "./GeoPointType"; import type { GeoShapeType } from "./GeoShapeType"; import type { IntegerType } from "./IntegerType"; import type { LongType } from "./LongType"; +import type { MarkingType } from "./MarkingType"; import type { OntologyObjectArrayType } from "./OntologyObjectArrayType"; import type { ShortType } from "./ShortType"; import type { StringType } from "./StringType"; @@ -79,6 +80,10 @@ export interface ObjectPropertyType_Long extends LongType { type: "long"; } +export interface ObjectPropertyType_Marking extends MarkingType { + type: "marking"; +} + export interface ObjectPropertyType_Short extends ShortType { type: "short"; } @@ -108,6 +113,7 @@ export type ObjectPropertyType = | ObjectPropertyType_Geoshape | ObjectPropertyType_Integer | ObjectPropertyType_Long + | ObjectPropertyType_Marking | ObjectPropertyType_Short | ObjectPropertyType_String | ObjectPropertyType_Timestamp diff --git a/packages/gateway/src/generated/openapi/components/ObjectTypeFullMetadata.ts b/packages/gateway/src/generated/openapi/components/ObjectTypeFullMetadata.ts new file mode 100644 index 000000000..1ea5eacff --- /dev/null +++ b/packages/gateway/src/generated/openapi/components/ObjectTypeFullMetadata.ts @@ -0,0 +1,33 @@ +/* + * Copyright 2023 Palantir Technologies, Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type { InterfaceTypeApiName } from "./InterfaceTypeApiName"; +import type { LinkTypeSideV2 } from "./LinkTypeSideV2"; +import type { ObjectTypeV2 } from "./ObjectTypeV2"; +import type { PropertyApiName } from "./PropertyApiName"; +import type { SharedPropertyTypeApiName } from "./SharedPropertyTypeApiName"; + +export interface ObjectTypeFullMetadata { + objectType: ObjectTypeV2; + linkTypes: Array; + /** A list of interfaces that this object type implements. */ + implementsInterfaces: Array; + /** + * A map from shared property type API name to backing local property API name for the shared property types + * present on this object type. + */ + sharedPropertyTypeMapping: Record; +} diff --git a/packages/gateway/src/generated/openapi/components/OntologyDataType.ts b/packages/gateway/src/generated/openapi/components/OntologyDataType.ts index c53016c2e..fbed3adda 100644 --- a/packages/gateway/src/generated/openapi/components/OntologyDataType.ts +++ b/packages/gateway/src/generated/openapi/components/OntologyDataType.ts @@ -24,6 +24,7 @@ import type { DoubleType } from "./DoubleType"; import type { FloatType } from "./FloatType"; import type { IntegerType } from "./IntegerType"; import type { LongType } from "./LongType"; +import type { MarkingType } from "./MarkingType"; import type { OntologyArrayType } from "./OntologyArrayType"; import type { OntologyMapType } from "./OntologyMapType"; import type { OntologyObjectSetType } from "./OntologyObjectSetType"; @@ -75,6 +76,10 @@ export interface OntologyDataType_Long extends LongType { type: "long"; } +export interface OntologyDataType_Marking extends MarkingType { + type: "marking"; +} + export interface OntologyDataType_Short extends ShortType { type: "short"; } @@ -126,6 +131,7 @@ export type OntologyDataType = | OntologyDataType_Float | OntologyDataType_Integer | OntologyDataType_Long + | OntologyDataType_Marking | OntologyDataType_Short | OntologyDataType_String | OntologyDataType_Timestamp diff --git a/packages/gateway/src/generated/openapi/components/OntologyFullMetadata.ts b/packages/gateway/src/generated/openapi/components/OntologyFullMetadata.ts index 50431dcff..5441c1f78 100644 --- a/packages/gateway/src/generated/openapi/components/OntologyFullMetadata.ts +++ b/packages/gateway/src/generated/openapi/components/OntologyFullMetadata.ts @@ -19,7 +19,7 @@ import type { ActionTypeV2 } from "./ActionTypeV2"; import type { InterfaceType } from "./InterfaceType"; import type { InterfaceTypeApiName } from "./InterfaceTypeApiName"; import type { ObjectTypeApiName } from "./ObjectTypeApiName"; -import type { ObjectTypeWithLink } from "./ObjectTypeWithLink"; +import type { ObjectTypeFullMetadata } from "./ObjectTypeFullMetadata"; import type { OntologyV2 } from "./OntologyV2"; import type { QueryApiName } from "./QueryApiName"; import type { QueryTypeV2 } from "./QueryTypeV2"; @@ -28,7 +28,7 @@ import type { SharedPropertyTypeApiName } from "./SharedPropertyTypeApiName"; export interface OntologyFullMetadata { ontology: OntologyV2; - objectTypes: Record; + objectTypes: Record; actionTypes: Record; queryTypes: Record; interfaceTypes: Record; diff --git a/packages/gateway/src/generated/openapi/components/ValueType.ts b/packages/gateway/src/generated/openapi/components/ValueType.ts index 6c5645555..47d9547a7 100644 --- a/packages/gateway/src/generated/openapi/components/ValueType.ts +++ b/packages/gateway/src/generated/openapi/components/ValueType.ts @@ -30,6 +30,7 @@ * | Float | `Float` | * | Integer | `Integer` | * | Long | `Long` | + * | Marking | `Marking` | * | OntologyObject | `OntologyObject` where `T` is the API name of the referenced object type. | * | Short | `Short` | * | String | `String` | diff --git a/packages/gateway/src/generated/openapi/components/index.ts b/packages/gateway/src/generated/openapi/components/index.ts index 058bac2a9..cc4bcc07d 100644 --- a/packages/gateway/src/generated/openapi/components/index.ts +++ b/packages/gateway/src/generated/openapi/components/index.ts @@ -215,6 +215,7 @@ export * from "./LogicRule"; export * from "./LongType"; export * from "./LteQuery"; export * from "./LtQuery"; +export * from "./MarkingType"; export * from "./MaxAggregation"; export * from "./MediaType"; export * from "./MinAggregation"; @@ -253,10 +254,10 @@ export * from "./ObjectSetUnionType"; export * from "./ObjectType"; export * from "./ObjectTypeApiName"; export * from "./ObjectTypeEdits"; +export * from "./ObjectTypeFullMetadata"; export * from "./ObjectTypeRid"; export * from "./ObjectTypeV2"; export * from "./ObjectTypeVisibility"; -export * from "./ObjectTypeWithLink"; export * from "./OneOf"; export * from "./Ontology"; export * from "./OntologyApiName"; diff --git a/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts b/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts index ece2d28d6..58eef7bf2 100644 --- a/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts +++ b/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts @@ -60,6 +60,7 @@ function wireActionParameterV2ToSdkParameterDefinition( case "long": case "objectSet": case "timestamp": + case "marking": return { multiplicity: false, type: actionPropertyToSdkPropertyDefinition(value.dataType), @@ -87,6 +88,7 @@ function actionPropertyToSdkPropertyDefinition( case "integer": case "long": case "timestamp": + case "marking": return parameterType.type; case "date": return "datetime"; diff --git a/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectConst.ts b/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectConst.ts index 433472d1b..037e035b8 100644 --- a/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectConst.ts +++ b/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectConst.ts @@ -14,12 +14,12 @@ * limitations under the License. */ -import type { ObjectTypeWithLink } from "@osdk/gateway/types"; +import type { ObjectTypeFullMetadata } from "@osdk/gateway/types"; import { wireObjectTypeV2ToSdkObjectDefinition } from "./wireObjectTypeV2ToSdkObjectDefinition"; /** @internal */ export function wireObjectTypeV2ToSdkObjectConst( - object: ObjectTypeWithLink, + object: ObjectTypeFullMetadata, v2: boolean = false, ) { const uniqueLinkTargetTypes = new Set( diff --git a/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts b/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts index b8dd7f4e0..2e2d39a3a 100644 --- a/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts +++ b/packages/generator/src/shared/wireObjectTypeV2ToSdkObjectDefinition.ts @@ -15,12 +15,12 @@ */ import type { ObjectTypeDefinition } from "@osdk/api"; -import type { ObjectTypeWithLink } from "@osdk/gateway/types"; +import type { ObjectTypeFullMetadata } from "@osdk/gateway/types"; import { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from "./wirePropertyV2ToSdkPrimaryKeyTypeDefinition"; import { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition"; export function wireObjectTypeV2ToSdkObjectDefinition( - objectTypeWithLink: ObjectTypeWithLink, + objectTypeWithLink: ObjectTypeFullMetadata, v2: boolean, ): ObjectTypeDefinition { if ( diff --git a/packages/generator/src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts b/packages/generator/src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts index 037ca7c13..47c57ab57 100644 --- a/packages/generator/src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts +++ b/packages/generator/src/shared/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts @@ -43,6 +43,7 @@ export function wirePropertyV2ToSdkPrimaryKeyTypeDefinition( } case "timeseries": case "array": + case "marking": throw new Error( `Type not supported for primaryKey: ${input.dataType.type}`, ); diff --git a/packages/generator/src/shared/wirePropertyV2ToSdkPropertyDefinition.ts b/packages/generator/src/shared/wirePropertyV2ToSdkPropertyDefinition.ts index 922caca40..7101e42b9 100644 --- a/packages/generator/src/shared/wirePropertyV2ToSdkPropertyDefinition.ts +++ b/packages/generator/src/shared/wirePropertyV2ToSdkPropertyDefinition.ts @@ -40,6 +40,7 @@ export function wirePropertyV2ToSdkPropertyDefinition( case "geoshape": case "timestamp": case "timeseries": + case "marking": return { multiplicity: false, description: input.description, @@ -79,6 +80,7 @@ function objectPropertyTypeToSdkPropertyDefinition( case "geopoint": case "geoshape": case "timestamp": + case "marking": return propertyType.type; case "date": return "datetime"; diff --git a/packages/generator/src/util/test/TodoWireOntology.ts b/packages/generator/src/util/test/TodoWireOntology.ts index 5de8efd44..6f6a91bca 100644 --- a/packages/generator/src/util/test/TodoWireOntology.ts +++ b/packages/generator/src/util/test/TodoWireOntology.ts @@ -83,6 +83,8 @@ export const TodoWireOntology = { status: "ACTIVE", foreignKeyPropertyApiName: "email", }], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }, Person: { objectType: { @@ -109,6 +111,8 @@ export const TodoWireOntology = { status: "ACTIVE", foreignKeyPropertyApiName: "id", }], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }, }, queryTypes: { diff --git a/packages/generator/src/v1.1/generateActions.ts b/packages/generator/src/v1.1/generateActions.ts index 3fe655637..a40fe6621 100644 --- a/packages/generator/src/v1.1/generateActions.ts +++ b/packages/generator/src/v1.1/generateActions.ts @@ -131,6 +131,8 @@ function getTypeScriptTypeFromDataType( return `number`; case "timestamp": return `Timestamp`; + case "marking": + return "string"; default: const _: never = actionParameter; throw new Error(`Unsupported action parameter type: ${actionParameter}`); diff --git a/packages/generator/src/v1.1/generateMetadataFile.test.ts b/packages/generator/src/v1.1/generateMetadataFile.test.ts index e338ad00f..17fc72545 100644 --- a/packages/generator/src/v1.1/generateMetadataFile.test.ts +++ b/packages/generator/src/v1.1/generateMetadataFile.test.ts @@ -115,6 +115,8 @@ describe(generateMetadataFile, () => { }, }, linkTypes: [], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }, }, actionTypes: { diff --git a/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.ts b/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.ts index 6c036869a..40327a565 100644 --- a/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.ts +++ b/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.ts @@ -69,6 +69,8 @@ describe("wireObjectTypeV2ToObjectInterfaceStringV1", () => { status: "ACTIVE", objectTypeApiName: "Todo", }], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }, ); expect(await formatTs(objectInterface)).toMatchInlineSnapshot(` diff --git a/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts b/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts index 992ff3b89..cd1154b60 100644 --- a/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts +++ b/packages/generator/src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts @@ -16,12 +16,12 @@ import type { ObjectPropertyType, - ObjectTypeWithLink, + ObjectTypeFullMetadata, } from "@osdk/gateway/types"; import { isReservedKeyword } from "../util/reservedKeywords"; export function wireObjectTypeV2ToObjectInterfaceStringV1( - objectTypeWithLinks: ObjectTypeWithLink, + objectTypeWithLinks: ObjectTypeFullMetadata, importExt = "", ) { const uniqueLinkTargets = new Set( @@ -123,6 +123,8 @@ function wirePropertyTypeV2ToTypeScriptType( return property.itemType.type === "string" ? `TimeSeries` : `TimeSeries`; + case "marking": + return "string"; default: const _: never = property; throw new Error(`Unknown property type ${property}`); diff --git a/packages/legacy-client/src/client/OsdkLegacyObject.ts b/packages/legacy-client/src/client/OsdkLegacyObject.ts index 5b579c459..012b1f196 100644 --- a/packages/legacy-client/src/client/OsdkLegacyObject.ts +++ b/packages/legacy-client/src/client/OsdkLegacyObject.ts @@ -49,6 +49,7 @@ export interface ValidLegacyPropertyTypes { float: number; decimal: number; byte: number; + marking: string; attachment: Attachment; geopoint: GeoPoint; diff --git a/packages/legacy-client/src/client/objectSets/mapPropertiesToGroupByProperties.ts b/packages/legacy-client/src/client/objectSets/mapPropertiesToGroupByProperties.ts index 4db8599e7..ed3373c90 100644 --- a/packages/legacy-client/src/client/objectSets/mapPropertiesToGroupByProperties.ts +++ b/packages/legacy-client/src/client/objectSets/mapPropertiesToGroupByProperties.ts @@ -51,6 +51,7 @@ export function mapPropertiesToGroupByProperties< acc[property] = NumericGroupBy(property); break; case "string": + case "marking": acc[property] = StringGroupBy(property); break; case "geopoint": diff --git a/packages/legacy-client/src/client/objectSets/mapPropertiesToMultipleAggregationProperties.ts b/packages/legacy-client/src/client/objectSets/mapPropertiesToMultipleAggregationProperties.ts index e60a03cef..90062c994 100644 --- a/packages/legacy-client/src/client/objectSets/mapPropertiesToMultipleAggregationProperties.ts +++ b/packages/legacy-client/src/client/objectSets/mapPropertiesToMultipleAggregationProperties.ts @@ -55,6 +55,7 @@ export function mapPropertiesToMultipleAggregationProperties< case "geopoint": case "geoshape": case "string": + case "marking": acc[property] = ApproximateDistinctCountAggregatableProperty( property, ); diff --git a/packages/legacy-client/src/client/objectSets/mapPropertiesToSearchFilter.ts b/packages/legacy-client/src/client/objectSets/mapPropertiesToSearchFilter.ts index f103e5d36..4ffd0b87c 100644 --- a/packages/legacy-client/src/client/objectSets/mapPropertiesToSearchFilter.ts +++ b/packages/legacy-client/src/client/objectSets/mapPropertiesToSearchFilter.ts @@ -86,6 +86,7 @@ function mapPropertyTypeToSearchFilter( switch (propertyDefinition.type) { case "string": + case "marking": return StringFilter(propertyApiName); case "boolean": return BooleanFilter(propertyApiName); diff --git a/packages/legacy-client/src/client/objects/convertWireToOsdkObject.ts b/packages/legacy-client/src/client/objects/convertWireToOsdkObject.ts index d68990473..c06708a24 100644 --- a/packages/legacy-client/src/client/objects/convertWireToOsdkObject.ts +++ b/packages/legacy-client/src/client/objects/convertWireToOsdkObject.ts @@ -190,6 +190,7 @@ function setPropertyAccessors< case "float": case "decimal": case "byte": + case "marking": break; default: const _: never = v.type; diff --git a/packages/shared.test/src/stubs/objectTypesWithLinkTypes.ts b/packages/shared.test/src/stubs/objectTypesWithLinkTypes.ts index 4ad0fa37c..9cde9fc40 100644 --- a/packages/shared.test/src/stubs/objectTypesWithLinkTypes.ts +++ b/packages/shared.test/src/stubs/objectTypesWithLinkTypes.ts @@ -14,7 +14,7 @@ * limitations under the License. */ -import type { ObjectTypeWithLink } from "@osdk/gateway/types"; +import type { ObjectTypeFullMetadata } from "@osdk/gateway/types"; import { leadLinkType, occupants, @@ -29,32 +29,43 @@ import { officeObjectType, } from "./objectTypeV2"; -export const employeeObjectWithLinkTypes: ObjectTypeWithLink = { +export const employeeObjectWithLinkTypes: ObjectTypeFullMetadata = { objectType: employeeObjectType, linkTypes: [peepsLinkType, leadLinkType, officeLinkType], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }; -export const officeObjectTypeWithLinkTypes: ObjectTypeWithLink = { +export const officeObjectTypeWithLinkTypes: ObjectTypeFullMetadata = { objectType: officeObjectType, linkTypes: [occupants], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }; -export const objectTypeWithAllPropertyTypesWithLinkTypes: ObjectTypeWithLink = { - objectType: objectTypeWithAllPropertyTypes, - linkTypes: [], -}; +export const objectTypeWithAllPropertyTypesWithLinkTypes: + ObjectTypeFullMetadata = { + objectType: objectTypeWithAllPropertyTypes, + linkTypes: [], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, + }; export const objectTypeWithTimestampPrimaryKeyWithLinkTypes: - ObjectTypeWithLink = { + ObjectTypeFullMetadata = { objectType: objectTypeWithTimestampPrimaryKey, linkTypes: [], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }; -export const equipmentObjectTypeWithLinkTypes: ObjectTypeWithLink = { +export const equipmentObjectTypeWithLinkTypes: ObjectTypeFullMetadata = { objectType: equipmentObjectType, linkTypes: [], + implementsInterfaces: [], + sharedPropertyTypeMapping: {}, }; export const objectTypesWithLinkTypes: { - [objectTypeApiName: string]: ObjectTypeWithLink; + [objectTypeApiName: string]: ObjectTypeFullMetadata; } = { [employeeObjectType.apiName]: employeeObjectWithLinkTypes, [officeObjectType.apiName]: officeObjectTypeWithLinkTypes, From 9bfa98b8820ce5f45e82e40a248d111cdcf28423 Mon Sep 17 00:00:00 2001 From: Matt Fedderly Date: Wed, 14 Feb 2024 13:10:32 -0500 Subject: [PATCH 4/5] v2 action array params were probably broken --- .../src/shared/wireActionTypeV2ToSdkActionDefinition.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts b/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts index 58eef7bf2..c220e0e14 100644 --- a/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts +++ b/packages/generator/src/shared/wireActionTypeV2ToSdkActionDefinition.ts @@ -70,7 +70,7 @@ function wireActionParameterV2ToSdkParameterDefinition( case "array": return { multiplicity: true, - type: actionPropertyToSdkPropertyDefinition(value.dataType), + type: actionPropertyToSdkPropertyDefinition(value.dataType.subType), nullable: value.required ? false : true, description: value.description, }; From 291e79818f8b233d52deaedc5d39ec22d18ae8ea Mon Sep 17 00:00:00 2001 From: svc-changelog Date: Wed, 14 Feb 2024 21:58:26 +0000 Subject: [PATCH 5/5] Add generated changelog entries --- packages/cli/changelog/@unreleased/pr-38.v2.yml | 5 +++++ packages/create-app/changelog/@unreleased/pr-38.v2.yml | 5 +++++ .../gateway-generator/changelog/@unreleased/pr-38.v2.yml | 5 +++++ packages/gateway/changelog/@unreleased/pr-38.v2.yml | 5 +++++ packages/legacy-client/changelog/@unreleased/pr-38.v2.yml | 5 +++++ 5 files changed, 25 insertions(+) create mode 100644 packages/cli/changelog/@unreleased/pr-38.v2.yml create mode 100644 packages/create-app/changelog/@unreleased/pr-38.v2.yml create mode 100644 packages/gateway-generator/changelog/@unreleased/pr-38.v2.yml create mode 100644 packages/gateway/changelog/@unreleased/pr-38.v2.yml create mode 100644 packages/legacy-client/changelog/@unreleased/pr-38.v2.yml diff --git a/packages/cli/changelog/@unreleased/pr-38.v2.yml b/packages/cli/changelog/@unreleased/pr-38.v2.yml new file mode 100644 index 000000000..47bf6f1d5 --- /dev/null +++ b/packages/cli/changelog/@unreleased/pr-38.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Update api-gateway definitions + links: + - https://github.com/palantir/osdk-ts/pull/38 diff --git a/packages/create-app/changelog/@unreleased/pr-38.v2.yml b/packages/create-app/changelog/@unreleased/pr-38.v2.yml new file mode 100644 index 000000000..47bf6f1d5 --- /dev/null +++ b/packages/create-app/changelog/@unreleased/pr-38.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Update api-gateway definitions + links: + - https://github.com/palantir/osdk-ts/pull/38 diff --git a/packages/gateway-generator/changelog/@unreleased/pr-38.v2.yml b/packages/gateway-generator/changelog/@unreleased/pr-38.v2.yml new file mode 100644 index 000000000..47bf6f1d5 --- /dev/null +++ b/packages/gateway-generator/changelog/@unreleased/pr-38.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Update api-gateway definitions + links: + - https://github.com/palantir/osdk-ts/pull/38 diff --git a/packages/gateway/changelog/@unreleased/pr-38.v2.yml b/packages/gateway/changelog/@unreleased/pr-38.v2.yml new file mode 100644 index 000000000..47bf6f1d5 --- /dev/null +++ b/packages/gateway/changelog/@unreleased/pr-38.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Update api-gateway definitions + links: + - https://github.com/palantir/osdk-ts/pull/38 diff --git a/packages/legacy-client/changelog/@unreleased/pr-38.v2.yml b/packages/legacy-client/changelog/@unreleased/pr-38.v2.yml new file mode 100644 index 000000000..47bf6f1d5 --- /dev/null +++ b/packages/legacy-client/changelog/@unreleased/pr-38.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Update api-gateway definitions + links: + - https://github.com/palantir/osdk-ts/pull/38