-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update api-gateway definitions #38
Changes from all commits
068f6ee
accbb5a
b13ea10
8995fe4
9ebb1e1
9bfa98b
cb2772a
eb60762
291e798
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Update api-gateway definitions | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/38 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Update api-gateway definitions | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/38 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Update api-gateway definitions | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/38 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<string, { minVersion: string; maxVersion: string }> | ||
| 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)); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
type: improvement | ||
improvement: | ||
description: Update api-gateway definitions | ||
links: | ||
- https://github.com/palantir/osdk-ts/pull/38 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,5 +52,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" | ||
} | ||
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just so i understand, is this so this will propagate to the asset that the generator is included in? apologies i hadn't been following ultra closely There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is halfway to that. Right now we're just adding it to @osdk/gateway so that anyone that depends on that will get it in their package tree so our internal code should pick this up. It doesn't wind up on the package built by foundry-sdk-generator OR the create-osdk-app assets. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok great, thanks for explaining! that's what I was hoping for |
||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<LinkTypeSideV2>; | ||
/** A list of interfaces that this object type implements. */ | ||
implementsInterfaces: Array<InterfaceTypeApiName>; | ||
/** | ||
* 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<SharedPropertyTypeApiName, PropertyApiName>; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ericanderson do we have eslint set up for the copyright header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its in
monorepo/eslint-config-sane/library.cjs
. We should probably split that into its own PR through.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yupyup no worries