Skip to content

Commit

Permalink
Update branch with changes from main (#487)
Browse files Browse the repository at this point in the history
* Bump @typescript-eslint/parser from 7.9.0 to 7.16.0 (#445)

* Bump @typescript-eslint/parser from 7.9.0 to 7.16.0

Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 7.9.0 to 7.16.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v7.16.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix example generation and group eslint-parser in the future

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Anderson <[email protected]>

* Bump pino-pretty from 11.0.0 to 11.2.1 (#471)

Bumps [pino-pretty](https://github.com/pinojs/pino-pretty) from 11.0.0 to 11.2.1.
- [Release notes](https://github.com/pinojs/pino-pretty/releases)
- [Commits](pinojs/pino-pretty@v11.0.0...v11.2.1)

---
updated-dependencies:
- dependency-name: pino-pretty
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Version Packages (beta) (#463)

* Add api-extractor, fix turbo, fix refactor (#415)

* Add api-extractor, fix turbo, fix refactor

* Add docs and allow CI to work

* Fix action params issue with objects (#458)

* fix

* added changeset

* Add more logging to legacy-client oauth (#479)

* Change default VSCode formatter back to dprint (#482)

* MRL enforces tilde not caret for internal deps (#464)

* MRL enforces tilde not caret for internal deps

* Cleanup

* Interface inherited properties are now generated (#441)

Fix mrl

* WIP Queries (#379)

* starting queries work

* first pass, no tests

* refactor

* progress

* Get objects working

* object set support

* add obejctset supoprt

* remove console logs

* remove newlines

* remove unsused endpoints file

* add 2d agg input support

* 3d agg test

* a little cleanup

* fix empty index files

* start addressing PR comments

* codegen cleanup

* only use provider for object defs

* clean up bucket types

* a little more codegen cleanup

* nullable checks

* add changeset

* Beta generation initial work (#469)

* Speed up build, fix dts generation for all, primitive --beta

* Add empty changeset

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Eric Anderson <[email protected]>
Co-authored-by: ssanjay1 <[email protected]>
  • Loading branch information
4 people authored Jul 15, 2024
1 parent 353d3ec commit aba07bd
Show file tree
Hide file tree
Showing 176 changed files with 4,299 additions and 930 deletions.
5 changes: 5 additions & 0 deletions .changeset/new-points-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/client": patch
---

Fix action params that take objects to correctly parse out primary key.
5 changes: 5 additions & 0 deletions .changeset/odd-hornets-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/legacy-client": patch
---

Oauth errors should include a cause now on supported platforms
10 changes: 10 additions & 0 deletions .changeset/plenty-berries-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@osdk/legacy-client": minor
"@osdk/shared.test": minor
"@osdk/client.api": minor
"@osdk/generator": minor
"@osdk/client": minor
"@osdk/api": minor
---

Add support for queries in 2.0
10 changes: 9 additions & 1 deletion .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
},
"changesets": [
"calm-pillows-collect",
"chilly-mayflies-vanish",
"chilly-melons-hammer",
"chilly-singers-compare",
"cool-rice-check",
Expand All @@ -71,23 +72,29 @@
"four-ways-add",
"great-geese-fail",
"green-chefs-speak",
"healthy-nails-relax",
"itchy-radios-own",
"khaki-plants-sort",
"large-ads-listen",
"lazy-jobs-attend",
"lovely-mice-beg",
"moody-bats-hear",
"moody-crews-ring",
"nervous-parrots-admire",
"nervous-pets-return",
"ninety-avocados-unite",
"old-kiwis-marry",
"orange-icons-battle",
"pink-insects-itch",
"plenty-peaches-scream",
"pretty-cherries-hunt",
"pretty-dingos-smash",
"purple-cameras-invite",
"purple-pots-fold",
"purple-trainers-laugh",
"rotten-lamps-protect",
"rotten-shirts-cross",
"serious-camels-rest",
"serious-glasses-try",
"sharp-penguins-double",
"shy-cougars-remain",
Expand All @@ -99,6 +106,7 @@
"tough-hats-push",
"unlucky-moose-lay",
"unlucky-wombats-switch",
"wild-plums-yell"
"wild-plums-yell",
"young-fireants-repair"
]
}
2 changes: 2 additions & 0 deletions .changeset/quiet-cars-hear.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
5 changes: 5 additions & 0 deletions .changeset/strange-dots-leave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@osdk/generator": patch
---

Interface inherited properties are now generated
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ updates:
directory: "/"
schedule:
interval: "daily"
groups:
typescript-eslint:
applies-to: version-updates
patterns:
- "typescript-eslint"
- "@typescript-eslint/*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ packages/legacy-client/src/generatedNoCheck
.log
pnpm-publish-summary.json
.npmrc

api-docs/
temp/
67 changes: 63 additions & 4 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import {
alphabeticalDependencies,
alphabeticalScripts,
createRuleFactory,
fileContents,
packageEntry,
packageOrder,
Expand All @@ -34,6 +35,7 @@ const DELETE_SCRIPT_ENTRY = { options: [undefined], fixValue: undefined };
const nonStandardPackages = [
"mytsup",
"tsconfig",
"@osdk/api-extractor",
"@osdk/examples.todoapp",
"@osdk/tests.*",
"@osdk/foundry-sdk-generator",
Expand Down Expand Up @@ -74,6 +76,61 @@ const esmOnlyPackages = [
// "@osdk/examples.*", but they have their own config cause they are nonstandard
];

/**
* We don't want to allow `workspace:^` in our dependencies because our current release branch
* strategy only allows for patch changes in the release branch and minors elsewhere.
*
* If we were to allow `workspace:^`, then the follow scenario causes issues:
* - Suppose we have a Foo and a Bar package and Bar depends on Foo.
* - at T0 we cut a release/1.1.x branch and ship [email protected], [email protected]
* - at T1 we cut a release 1.2.x branch and ship [email protected]
*
* If we have `workspace:^` in our deps, a user that already has `[email protected]` in their package.json
* could update their dependencies without updating Bar (say via pnpm update) and Bar's dependency
* on Foo @ `^1.1.0` would be satisfied by the shipped `[email protected]`.
*
* Using `workspace:~` prevents this as `~` can only resolve patch changes.
*/
const disallowWorkspaceCaret = createRuleFactory({
name: "disallowWorkspaceCaret",
check: async (context) => {
const packageJson = context.getPackageJson();
const packageJsonPath = context.getPackageJsonPath();

for (const d of ["dependencies", "devDependencies", "peerDependencies"]) {
const deps = packageJson[d] ?? {};

for (const [dep, version] of Object.entries(deps)) {
if (version === "workspace:^") {
const message = `'workspace:^' not allowed (${d}['${dep}']).`;
context.addError({
message,
longMessage: `${message} Did you mean 'workspace:~'?`,
file: context.getPackageJsonPath(),
fixer: () => {
// always refetch in fixer since another fixer may have already changed the file
let packageJson = context.getPackageJson();
if (packageJson[d]?.[dep] === "workspace:^") {
packageJson[d] = Object.assign(
{},
packageJson[d],
{ [dep]: "workspace:~" },
);

context.host.writeJson(
context.getPackageJsonPath(),
packageJson,
);
}
},
});
}
}
}
},
validateOptions: () => {}, // no options right now
});

const cache = new Map();

/**
Expand Down Expand Up @@ -156,6 +213,7 @@ function getTsconfigOptions(baseTsconfigPath, opts) {
* skipTsconfigReferences?: boolean
* singlePackageName?: string
* }} options
* @returns {import("@monorepolint/config").RuleModule[]}
*/
function standardPackageRules(shared, options) {
if (options.esmOnly && options.legacy) {
Expand All @@ -170,6 +228,8 @@ function standardPackageRules(shared, options) {
.slice(0, -1); // drop trailing slash

return [
disallowWorkspaceCaret({ ...shared }),

standardTsconfig({
...shared,

Expand Down Expand Up @@ -215,7 +275,6 @@ function standardPackageRules(shared, options) {
...shared,
options: {
scripts: {
"dev:transpile": DELETE_SCRIPT_ENTRY,
clean: "rm -rf lib dist types build tsconfig.tsbuildinfo",
"check-attw":
`${pathToWorkspaceRoot}/scripts/build_common/check-attw.sh ${
Expand All @@ -224,10 +283,10 @@ function standardPackageRules(shared, options) {
lint: "eslint . && dprint check --config $(find-up dprint.json)",
"fix-lint":
"eslint . --fix && dprint fmt --config $(find-up dprint.json)",
prettier: DELETE_SCRIPT_ENTRY,
transpile: "tsup",
transpile:
"find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.js' -or -name '*.js.map' -or -name '*.cjs' -or -name '*.cjs.map' \\) -delete && tsup",
typecheck:
`${pathToWorkspaceRoot}/scripts/build_common/typecheck.sh ${
`find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.ts' -or -name '*.ts.map' -or -name '*.cts' -or -name '*.cts.map' \\) -delete && ${pathToWorkspaceRoot}/scripts/build_common/typecheck.sh ${
options.esmOnly ? "esm" : "both"
}`,
},
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"editor.defaultFormatter": "dprint.dprint"
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
"editor.defaultFormatter": "dprint.dprint"
},
"[json]": {
"editor.defaultFormatter": "dprint.dprint"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
> **Follow semver rules here.**
1. Assuming you've run `pnpm install`, run `changeset` (or `pnpm exec changeset`).
2. The tool will split things into changed vs unchanged packages (which you may need if you decide to add changeset logs in a future PR for past features)
3. Select the packages you want the changeset applied to using the arrow keys (up/down) and spacebar to "select" the package.
3. Select the packages you want the changeset applied to using the arrow keys (up/down) and space-bar to "select" the package.
4. Press enter to continue.
5. The CLI will go through a progression of asking you which pacakges you previously selected need a major bump? Then a minor bump? Patch bumps assumed for remaining packages changed. Arrows and space bar to select. Enter to continue (even if you selected nothing).
5. The CLI will go through a progression of asking you which packages you previously selected need a major bump? Then a minor bump? Patch bumps assumed for remaining packages changed. Arrows and space bar to select. Enter to continue (even if you selected nothing).
6. Enter a change (or press enter on empty to open your editor.)

> Info
>
> Full docs on the `changesets` tool can be found at the [changesets/changests github repo](https://github.com/changesets/changesets).
> Full docs on the `changesets` tool can be found at the [changesets/changesets github repo](https://github.com/changesets/changesets).
7. If you're curious what the final build output might look like you can run `pnpm build` from root.
8. Run all lint rules and tests with `pnpm check` from root.
3 changes: 3 additions & 0 deletions dev-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Developer Docs for Contributing to osdk-ts

If you are looking for documentation on how to use the OSDK, see your developer console on your foundry stack.
14 changes: 14 additions & 0 deletions dev-docs/build-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Build / CI notes for the repo

## api-extractor

Currently, this runs only as part of `@osdk/client.api`, however the goal is to extend this to the entire repo assuming we are satisfied with its output.

While the api-extract can be used for generating rolled up `.d.ts` files, we do not use it for that purpose. Our intention is to use it generate the api report and api documentation. The logic behind the api report is it should make it easier to review the impact of changes to types within the codebase. For example, it can show that we have implicitly created a dependency on a third party library for our own types.

### CI implications

The `api-extractor` has a "local" and a non-local (CI) mode. In the "local" mode, it will automatically update the file we commit for the api report. The intent of the tool is to error in CI if the file that is committed doesn't match the output, however the behavior of the tool is to exit with a non-zero code when there are warnings in the non-local mode. This makes adoption of the tool expensive at best and at worst removes the ability to have granular information.

As such, we run the tool in CI in "local" mode so that we do not get non-zero exits for warnings. Our existing build infrastructure already fails the build if any changes happen to committed files during CI and as such we can rely on that mechanism to be sure that developers have updated the api report that gets committed.

4 changes: 3 additions & 1 deletion dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
".vscode/settings.json",
"examples/",
"examples-extra/**/dist",
"**/tsup.config.bundled_*"
"**/tsup.config.bundled_*",
"**/api-docs/",
"**/*.report.api.md"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.90.4.wasm",
Expand Down
6 changes: 3 additions & 3 deletions examples-extra/basic/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
"transpile": "tsup",
"transpile": "find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.js' -or -name '*.js.map' -or -name '*.cjs' -or -name '*.cjs.map' \\) -delete && tsup",
"transpileWatch": "tsup --watch",
"typecheck": "../../../scripts/build_common/typecheck.sh esm"
"typecheck": "find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.ts' -or -name '*.ts.map' -or -name '*.cts' -or -name '*.cts.map' \\) -delete && ../../../scripts/build_common/typecheck.sh esm"
},
"dependencies": {
"@osdk/api": "workspace:~",
Expand All @@ -35,7 +35,7 @@
"@osdk/internal.foundry": "workspace:~",
"chalk": "^5.3.0",
"pino": "^9.1.0",
"pino-pretty": "^11.0.0",
"pino-pretty": "^11.2.1",
"tiny-invariant": "^1.3.1"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions examples-extra/basic/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
"codegen": "rm -rf src/generatedNoCheck/* && osdk-unstable-typescript generate --outDir src/generatedNoCheck --ontologyPath ontology.json --beta true --packageType module --version dev --internal",
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
"transpile": "tsup",
"transpile": "find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.js' -or -name '*.js.map' -or -name '*.cjs' -or -name '*.cjs.map' \\) -delete && tsup",
"transpileWatch": "tsup --watch",
"typecheck": "../../../scripts/build_common/typecheck.sh esm"
"typecheck": "find . \\( -path build/cjs -or -path build/esm -or -path build/browser \\) -type f \\( -name '*.ts' -or -name '*.ts.map' -or -name '*.cts' -or -name '*.cts.map' \\) -delete && ../../../scripts/build_common/typecheck.sh esm"
},
"dependencies": {
"@osdk/api": "workspace:~",
Expand Down
7 changes: 5 additions & 2 deletions examples-extra/basic/sdk/src/generatedNoCheck/Ontology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { OntologyDefinition } from '@osdk/api';
import * as Actions from './ontology/actions/index.js';
import * as Interfaces from './ontology/interfaces.js';
import * as Objects from './ontology/objects.js';
import * as Queries from './ontology/queries/index.js';
import { OntologyMetadata } from './OntologyMetadata.js';

export interface Ontology
Expand Down Expand Up @@ -32,7 +33,8 @@ export interface Ontology
createTodo: typeof Actions.createTodo;
};
queries: {
// TODO
getTodoCount: typeof Queries.getTodoCount;
queryTakesAllParameterTypes: typeof Queries.queryTakesAllParameterTypes;
};
interfaces: {
FooInterface: Interfaces.FooInterface;
Expand All @@ -57,7 +59,8 @@ export const Ontology: Ontology = {
createTodo: Actions.createTodo,
},
queries: {
// TODO
getTodoCount: Queries.getTodoCount,
queryTakesAllParameterTypes: Queries.queryTakesAllParameterTypes,
},
interfaces: {
FooInterface: Interfaces.FooInterface,
Expand Down
1 change: 1 addition & 0 deletions examples-extra/basic/sdk/src/generatedNoCheck/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { Ontology } from './Ontology.js';
export * from './ontology/actions/index.js';
export * from './ontology/interfaces.js';
export * from './ontology/objects.js';
export * from './ontology/queries/index.js';
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ export interface FooInterface
VersionBound<$ExpectedClientVersion> {
osdkMetadata: typeof $osdkMetadata;
description: 'Its a Foo.';
displayName: 'Foo interface';
links: {};
properties: {
/**
* display name: 'Description',
* description: Description of Description
*/
description: PropertyDef<'string', 'nullable', 'single'>;
/**
* display name: 'Name',
* description: Name of Foo
*/
name: PropertyDef<'string', 'nullable', 'single'>;
};
}
Expand All @@ -18,15 +27,18 @@ export const FooInterface: FooInterface = {
osdkMetadata: $osdkMetadata,
apiName: 'FooInterface',
description: 'Its a Foo.',
displayName: 'Foo interface',
links: {},
properties: {
name: {
displayName: 'Name',
multiplicity: false,
description: 'Name of Foo',
type: 'string',
nullable: true,
},
description: {
displayName: 'Description',
multiplicity: false,
description: 'Description of Description',
type: 'string',
Expand Down
Loading

0 comments on commit aba07bd

Please sign in to comment.