Skip to content

Commit

Permalink
Merge pull request #273 from palantir/ea.omni-v2
Browse files Browse the repository at this point in the history
Generate omni api v2
  • Loading branch information
ericanderson authored May 6, 2024
2 parents faababc + 9721a84 commit 59efc05
Show file tree
Hide file tree
Showing 105 changed files with 3,264 additions and 112 deletions.
5 changes: 2 additions & 3 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const legacyPackages = [
];

const esmOnlyPackages = [
"@osdk/foundry",
"@osdk/internal.foundry",
"@osdk/foundry-generator",
"@osdk/client",
"@osdk/cli.*",
Expand Down Expand Up @@ -348,8 +348,7 @@ export default {
includePackages: ["@osdk/internal.*"],
options: {
file: "README.md",
template: `
# WARNING
template: `# WARNING
This is an internal only package.
Expand Down
3 changes: 2 additions & 1 deletion examples-extra/basic/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@
"@osdk/api": "workspace:^",
"@osdk/client": "workspace:^",
"@osdk/examples.basic.sdk": "workspace:^",
"@osdk/foundry": "workspace:^",
"@osdk/internal.foundry": "workspace:^",
"pino": "^8.20.0",
"tiny-invariant": "^1.3.1"
},
"devDependencies": {
"@osdk/cli": "workspace:^",
"@osdk/foundry": "workspace:^",
"@types/node": "^18.0.0",
"ts-expect": "^1.3.0"
},
Expand Down
8 changes: 7 additions & 1 deletion examples-extra/basic/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import {
Venture,
WeatherStation,
} from "@osdk/examples.basic.sdk";
import * as LanguageModel from "@osdk/foundry/Models_LanguageModel";
import * as Foundry from "@osdk/foundry";
import * as LanguageModel from "@osdk/internal.foundry/Models_LanguageModel";
import { pino } from "pino";
import invariant from "tiny-invariant";
import type { TypeOf } from "ts-expect";
Expand Down Expand Up @@ -57,6 +58,11 @@ const testSubscriptions = true;

async function runTests() {
try {
const myUser = await Foundry.Security.User.meUsers(client.ctx as any, {
preview: true,
});
console.log("User", myUser!.email);

if (runOld) {
await fetchEmployeePage(client);
await fetchEmployeePageByAdUsername(client, "fish");
Expand Down
4 changes: 2 additions & 2 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
"ws": "^8.16.0"
},
"devDependencies": {
"@osdk/foundry": "workspace:^",
"@osdk/generator": "workspace:^",
"@osdk/internal.foundry": "workspace:^",
"@osdk/shared.test": "workspace:^",
"@types/geojson": "^7946.0.14",
"@types/ws": "^8.5.10",
Expand Down Expand Up @@ -76,7 +76,7 @@
"sls": {
"dependencies": {
"com.palantir.foundry.api:api-gateway": {
"minVersion": "1.804.0",
"minVersion": "1.824.0",
"maxVersion": "1.x.x"
}
}
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/actions/Actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ import type {
ObjectSetActionDataType,
OntologyDefinition,
} from "@osdk/api";
import type { ActionResults, ValidateActionResponseV2 } from "@osdk/foundry";
import type {
ActionResults,
ValidateActionResponseV2,
} from "@osdk/internal.foundry";
import type { ObjectSet } from "../index.js";
import type { DataValueClientToWire } from "../mapping/DataValueMapping.js";
import type { Osdk, OsdkObjectPrimaryKeyType } from "../OsdkObjectFrom.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/actions/applyAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import type { ActionDefinition } from "@osdk/api";
import type { DataValue } from "@osdk/foundry";
import { applyActionV2 } from "@osdk/foundry/OntologiesV2_Action";
import type { DataValue } from "@osdk/internal.foundry";
import { applyActionV2 } from "@osdk/internal.foundry/OntologiesV2_Action";
import type { MinimalClient } from "../MinimalClientContext.js";
import { addUserAgent } from "../util/addUserAgent.js";
import { toDataValue } from "../util/toDataValue.js";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { AggregateObjectsResponseV2 } from "@osdk/foundry";
import type { AggregateObjectsResponseV2 } from "@osdk/internal.foundry";
import invariant from "tiny-invariant";
import type {
AggregationClause,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { AggregationV2 } from "@osdk/foundry";
import type { AggregationV2 } from "@osdk/internal.foundry";
import type { AggregationClause } from "../../query/index.js";

export function modernToLegacyAggregationClause<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
* limitations under the License.
*/

import type { AggregationGroupByV2, AggregationRangeV2 } from "@osdk/foundry";
import type {
AggregationGroupByV2,
AggregationRangeV2,
} from "@osdk/internal.foundry";
import {
DurationMapping,
type GroupByRange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ObjectOrInterfaceDefinition } from "@osdk/api";
import type { SearchJsonQueryV2 } from "@osdk/foundry";
import type { SearchJsonQueryV2 } from "@osdk/internal.foundry";
import type { BBox, Position } from "geojson";
import invariant from "tiny-invariant";
import type {
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/object/aggregate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ObjectTypeDefinition, OntologyDefinition } from "@osdk/api";
import type { AggregateObjectsResponseV2 } from "@osdk/foundry";
import type { AggregateObjectsResponseV2 } from "@osdk/internal.foundry";
import type { TypeOf } from "ts-expect";
import { expectType } from "ts-expect";
import { describe, expectTypeOf, it, type Mock, vi } from "vitest";
Expand Down Expand Up @@ -138,6 +138,7 @@ describe("aggregate", () => {
const mockFetch: Mock = vi.fn();

const aggregationResponse: AggregateObjectsResponseV2 = {
accuracy: "APPROXIMATE",
data: [
{
group: {
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/object/aggregate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import type {
AggregateObjectsRequestV2,
AggregateObjectsResponseV2,
ObjectSet,
} from "@osdk/foundry";
import { aggregateObjectSetV2 } from "@osdk/foundry/OntologiesV2_OntologyObjectSet";
} from "@osdk/internal.foundry";
import { aggregateObjectSetV2 } from "@osdk/internal.foundry/OntologiesV2_OntologyObjectSet";
import invariant from "tiny-invariant";
import {
legacyToModernSingleAggregationResult,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/object/convertWireToOsdkObjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type {
ObjectOrInterfaceDefinition,
ObjectTypeDefinition,
} from "@osdk/api";
import type { OntologyObjectV2 } from "@osdk/foundry";
import type { OntologyObjectV2 } from "@osdk/internal.foundry";
import invariant from "tiny-invariant";
import type { MinimalClient } from "../MinimalClientContext.js";
import { getWireObjectSet } from "../objectSet/createObjectSet.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/object/fetchPage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ObjectTypeDefinition } from "@osdk/api";
import type { SearchJsonQueryV2 } from "@osdk/foundry";
import type { SearchJsonQueryV2 } from "@osdk/internal.foundry";
import { describe, expect, expectTypeOf, it } from "vitest";
import { createMinimalClient } from "../createMinimalClient.js";
import type { FooInterface } from "../generatedNoCheck/index.js";
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/object/fetchPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ import type {
SearchJsonQueryV2,
SearchObjectsForInterfaceRequest,
SearchOrderByV2,
} from "@osdk/foundry";
import { loadObjectSetV2 } from "@osdk/foundry/OntologiesV2_OntologyObjectSet";
} from "@osdk/internal.foundry";
import { loadObjectSetV2 } from "@osdk/internal.foundry/OntologiesV2_OntologyObjectSet";
import {
searchObjectsForInterface,
} from "@osdk/foundry/OntologiesV2_OntologyObjectV2";
} from "@osdk/internal.foundry/OntologiesV2_OntologyObjectV2";
import type { DefaultToFalse } from "../definitions/LinkDefinitions.js";
import type { MinimalClient } from "../MinimalClientContext.js";
import type { Osdk } from "../OsdkObjectFrom.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/object/fetchSingle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import type { ObjectOrInterfaceDefinition } from "@osdk/api";
import type { ObjectSet } from "@osdk/foundry/types";
import type { ObjectSet } from "@osdk/internal.foundry/types";
import { PalantirApiError } from "@osdk/shared.net";
import type { Osdk } from "../index.js";
import type { MinimalClient } from "../MinimalClientContext.js";
Expand Down
4 changes: 2 additions & 2 deletions packages/client/src/objectSet/ObjectSetListenerWebsocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import type {
ObjectTypeKeysFrom,
OntologyDefinition,
} from "@osdk/api";
import { getObjectTypeV2 } from "@osdk/foundry/OntologiesV2_ObjectTypeV2";
import type { ObjectSet, OntologyObjectV2 } from "@osdk/foundry/types";
import { getObjectTypeV2 } from "@osdk/internal.foundry/OntologiesV2_ObjectTypeV2";
import type { ObjectSet, OntologyObjectV2 } from "@osdk/internal.foundry/types";
import type { ConjureContext } from "conjure-lite";
import WebSocket from "isomorphic-ws";
import type { Logger } from "pino";
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/objectSet/createObjectSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
ObjectOrInterfaceDefinition,
ObjectTypeDefinition,
} from "@osdk/api";
import type { ObjectSet as WireObjectSet } from "@osdk/foundry";
import type { ObjectSet as WireObjectSet } from "@osdk/internal.foundry";
import { modernToLegacyWhereClause } from "../internal/conversions/index.js";
import type { PropertyValueClientToWire } from "../mapping/PropertyValueMapping.js";
import type { MinimalClient } from "../MinimalClientContext.js";
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/objectSet/toConjureObjectSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
*/

import type { ObjectTypeKeysFrom, OntologyDefinition } from "@osdk/api";
import type { ObjectSet, SearchJsonQueryV2 } from "@osdk/foundry/types";
import type {
ObjectSet,
SearchJsonQueryV2,
} from "@osdk/internal.foundry/types";
import type {
ObjectSet as OssObjectSet,
ObjectSetFilter,
Expand Down
12 changes: 6 additions & 6 deletions packages/client/src/ontology/StandardOntologyProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ import type {
ObjectOrInterfaceDefinition,
ObjectTypeDefinition,
} from "@osdk/api";
import { listInterfaceTypes } from "@osdk/foundry/OntologiesV2_OntologyObjectV2";
import { getOntologyFullMetadata } from "@osdk/foundry/OntologiesV2_OntologyV2";
import type {
ListInterfaceTypesResponse,
OntologyFullMetadata,
} from "@osdk/foundry/types";
import {
__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition,
wireObjectTypeFullMetadataToSdkObjectTypeDefinition,
} from "@osdk/generator-converters";
import { listInterfaceTypes } from "@osdk/internal.foundry/OntologiesV2_OntologyObjectV2";
import { getOntologyFullMetadata } from "@osdk/internal.foundry/OntologiesV2_OntologyV2";
import type {
ListInterfaceTypesResponse,
OntologyFullMetadata,
} from "@osdk/internal.foundry/types";
import deepEqual from "fast-deep-equal";
import type { MinimalClient } from "../MinimalClientContext.js";
import { createAsyncCache } from "../object/Cache.js";
Expand Down
9 changes: 5 additions & 4 deletions packages/client/src/ontology/loadFullObjectMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
*/

import type { ObjectTypeDefinition } from "@osdk/api";
import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "@osdk/generator-converters";
import {
getObjectTypeV2,
listOutgoingLinkTypesV2,
} from "@osdk/foundry/OntologiesV2_ObjectTypeV2";
import { listInterfaceTypes } from "@osdk/foundry/OntologiesV2_OntologyObjectV2";
} from "@osdk/internal.foundry/OntologiesV2_ObjectTypeV2";
import { listInterfaceTypes } from "@osdk/internal.foundry/OntologiesV2_OntologyObjectV2";
import type {
LinkTypeSideV2,
ListOutgoingLinkTypesResponseV2,
ObjectTypeFullMetadata,
} from "@osdk/foundry/types";
import { wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from "@osdk/generator-converters";
} from "@osdk/internal.foundry/types";
import type { ConjureContext } from "conjure-lite";
import invariant from "tiny-invariant";
import type { LoadAllOntologiesResponse } from "../generated/ontology-metadata/api/LoadAllOntologiesResponse.js";
Expand Down Expand Up @@ -99,6 +99,7 @@ export async function loadFullObjectMetadata(

const full: ObjectTypeFullMetadata = {
implementsInterfaces: interfaceTypes.data.map(i => i.apiName),
implementsInterfaces2: {}, // FIXME(interfaces)
linkTypes,
objectType,
sharedPropertyTypeMapping,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/ontology/loadInterfaceDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
*/

import type { InterfaceDefinition } from "@osdk/api";
import { getInterfaceType } from "@osdk/foundry/OntologiesV2_OntologyObjectV2";
import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
import { getInterfaceType } from "@osdk/internal.foundry/OntologiesV2_OntologyObjectV2";
import type { MinimalClient } from "../MinimalClientContext.js";

export async function loadInterfaceDefinition(
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/query/WhereClause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type {
ObjectOrInterfaceDefinition,
ObjectTypePropertyDefinition,
} from "@osdk/api";
import type { DistanceUnit } from "@osdk/foundry/types";
import type { DistanceUnit } from "@osdk/internal.foundry/types";

export type PossibleWhereClauseFilters =
| "$gt"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/util/WireObjectSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { ObjectSet as WireObjectSet } from "@osdk/foundry/types";
import type { ObjectSet as WireObjectSet } from "@osdk/internal.foundry/types";

const WIRE_OBJECT_SET_TYPES = new Set([
"base",
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/util/isOntologyObjectV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { OntologyObjectV2 } from "@osdk/foundry/types";
import type { OntologyObjectV2 } from "@osdk/internal.foundry/types";

export function isOntologyObjectV2(o: any): o is OntologyObjectV2 {
return o && typeof o === "object" && typeof o.__apiName === "string"
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/util/toDataValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import type { DataValue } from "@osdk/foundry/types";
import type { DataValue } from "@osdk/internal.foundry/types";
import { isAttachment } from "../object/Attachment.js";
import { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
import { isOntologyObjectV2 } from "./isOntologyObjectV2.js";
Expand Down
33 changes: 33 additions & 0 deletions packages/foundry-generator/src/addPackagesToPackageJson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright 2024 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 fs from "node:fs/promises";

export async function addPackagesToPackageJson(
packageJsonPath: string,
packagesToAdd: string[],
section: "dependencies" | "devDependencies" = "dependencies",
) {
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
Object.assign(
packageJson[section],
Object.fromEntries(packagesToAdd.map(a => [a, "workspace:*"])),
);
await fs.writeFile(
packageJsonPath,
JSON.stringify(packageJson, undefined, 2),
);
}
Loading

0 comments on commit 59efc05

Please sign in to comment.