Skip to content
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

Reorg examples extra. Fixes #476 #485

Merged
merged 1 commit into from
Jul 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"mode": "pre",
"tag": "beta",
"initialVersions": {
"@osdk/examples.basic.cli": "0.0.0",
"@osdk/examples.basic.sdk": "0.0.0",
"@osdk/e2e.sandbox.catchall": "0.0.0",
"@osdk/e2e.generated.catchall": "0.0.0",
"@osdk/examples.docs.example": "0.0.1",
"@osdk/examples.one.dot.one": "0.0.17",
"@osdk/examples.todoapp": "0.0.10",
"@osdk/e2e.generated.1.1.x": "0.0.17",
"@osdk/e2e.sandbox.todoappapp": "0.0.10",
"@osdk/examples.next-static-export": "0.0.0",
"@osdk/examples.react": "0.0.0",
"@osdk/examples.tutorial-todo-app": "0.0.0",
Expand Down
2 changes: 2 additions & 0 deletions .changeset/weak-dragons-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
8 changes: 6 additions & 2 deletions .lintstagedrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ export default {
"packages/monorepo.*/**/*.{js,jsx,ts,tsx,mjs,cjs}": [
"dprint fmt",
],
"{packages,examples-extra/basic}/**/*.{js,jsx,ts,tsx,mjs,cjs}": (
"packages/**/*.{js,jsx,ts,tsx,mjs,cjs}": (
files,
) => {
const match = micromatch.not(
files,
["**/templates/**/*", "**/generatedNoCheck/**/*"],
[
"**/templates/**/*",
"**/generatedNoCheck/**/*",
"**/generatedNoCheck2/**/*",
],
);
if (match.length === 0) return [];
return [
Expand Down
13 changes: 9 additions & 4 deletions .monorepolint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const nonStandardPackages = [
"@osdk/examples.*",
"@osdk/foundry-sdk-generator",
"@osdk/monorepo.*",
"@osdk/e2e.sandbox.*", // sandboxes for manual e2e testing
"@osdk/e2e.generated.*", // generated sdks for e2e testing
"@osdk/shared.client",
"@osdk/tests.*",
];
Expand Down Expand Up @@ -442,19 +444,22 @@ export default {
),

...standardPackageRules({
includePackages: ["@osdk/examples.basic.**"],
excludePackages: ["@osdk/examples.one.dot.one"],
includePackages: [
"@osdk/e2e.generated.catchall",
"@osdk/e2e.sandbox.catchall",
],
excludePackages: ["@osdk/e2e.generated.1.1.x"],
}, {
esmOnly: true,
legacy: false,
packageDepth: 3,
packageDepth: 2,
type: "example",
}),

// most packages can use the newest typescript, but we enforce that @osdk/example.one.dot.one uses TS4.9
// so that we get build-time checking to make sure we don't regress v1.1 clients using an older Typescript.
...standardPackageRules({
includePackages: ["@osdk/examples.one.dot.one"],
includePackages: ["@osdk/e2e.generated.1.1.x"],
}, {
legacy: false,
packageDepth: 2,
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default tseslint.config(
"**/bin/*.mjs",
"**/bin/*.cjs",
"examples-extra/**/*",
"packages/e2e.sandbox.*/**/*",
],
rules: {
"header/header": "off",
Expand All @@ -120,6 +121,7 @@ export default tseslint.config(
"**/*.test.ts",
"**/test/*",
"examples-extra/**/*",
"packages/e2e.sandbox.*/**/*",
],
rules: {
"no-console": "off",
Expand Down
10 changes: 0 additions & 10 deletions examples-extra/todoapp/src/main.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion examples/example-next-static-export/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"start": "next start"
},
"dependencies": {
"@osdk/examples.one.dot.one": "workspace:*",
"@osdk/e2e.generated.1.1.x": "workspace:*",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-next-static-export/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function Home() {

return (
<div>
<h1>@osdk/examples.one.dot.one</h1>
<h1>@osdk/e2e.generated.1.1.x</h1>
<p>
Welcome to your Ontology SDK! Try using any of the following methods
now.
Expand Down
2 changes: 1 addition & 1 deletion examples/example-next-static-export/src/lib/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FoundryClient, PublicClientAuth } from "@osdk/examples.one.dot.one";
import { FoundryClient, PublicClientAuth } from "@osdk/e2e.generated.1.1.x";

const url = process.env.NEXT_PUBLIC_FOUNDRY_API_URL;
const clientId = process.env.NEXT_PUBLIC_FOUNDRY_CLIENT_ID;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"preview": "vite preview"
},
"dependencies": {
"@osdk/examples.one.dot.one": "workspace:*",
"@osdk/e2e.generated.1.1.x": "workspace:*",
"react": "^18",
"react-dom": "^18",
"react-router-dom": "^6.23.1"
Expand Down
2 changes: 1 addition & 1 deletion examples/example-react/src/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function Home() {

return (
<Layout>
<h1>@osdk/examples.one.dot.one</h1>
<h1>@osdk/e2e.generated.1.1.x</h1>
<p>
Welcome to your Ontology SDK! Try using any of the following methods
now.
Expand Down
2 changes: 1 addition & 1 deletion examples/example-react/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FoundryClient, PublicClientAuth } from "@osdk/examples.one.dot.one";
import { FoundryClient, PublicClientAuth } from "@osdk/e2e.generated.1.1.x";

const url = import.meta.env.VITE_FOUNDRY_API_URL;
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tutorial-todo-aip-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"preview": "vite preview"
},
"dependencies": {
"@osdk/examples.one.dot.one": "workspace:*",
"@osdk/e2e.generated.1.1.x": "workspace:*",
"react": "^18",
"react-dom": "^18",
"react-router-dom": "^6.23.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tutorial-todo-aip-app/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FoundryClient, PublicClientAuth } from "@osdk/examples.one.dot.one";
import { FoundryClient, PublicClientAuth } from "@osdk/e2e.generated.1.1.x";

const url = import.meta.env.VITE_FOUNDRY_API_URL;
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tutorial-todo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"preview": "vite preview"
},
"dependencies": {
"@osdk/examples.one.dot.one": "workspace:*",
"@osdk/e2e.generated.1.1.x": "workspace:*",
"react": "^18",
"react-dom": "^18",
"react-router-dom": "^6.23.1",
Expand Down
2 changes: 1 addition & 1 deletion examples/example-tutorial-todo-app/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FoundryClient, PublicClientAuth } from "@osdk/examples.one.dot.one";
import { FoundryClient, PublicClientAuth } from "@osdk/e2e.generated.1.1.x";

const url = import.meta.env.VITE_FOUNDRY_API_URL;
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
Expand Down
2 changes: 1 addition & 1 deletion examples/example-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"preview": "vite preview"
},
"dependencies": {
"@osdk/examples.one.dot.one": "workspace:*",
"@osdk/e2e.generated.1.1.x": "workspace:*",
"vue": "^3.4.27",
"vue-router": "^4.2.5"
},
Expand Down
2 changes: 1 addition & 1 deletion examples/example-vue/src/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const queryApiNames = Object.keys(client.ontology.queries);
</script>

<template>
<h1>@osdk/examples.one.dot.one</h1>
<h1>@osdk/e2e.generated.1.1.x</h1>
<p>
Welcome to your Ontology SDK! Try using any of the following methods now.
</p>
Expand Down
2 changes: 1 addition & 1 deletion examples/example-vue/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FoundryClient, PublicClientAuth } from "@osdk/examples.one.dot.one";
import { FoundryClient, PublicClientAuth } from "@osdk/e2e.generated.1.1.x";

const url = import.meta.env.VITE_FOUNDRY_API_URL;
const clientId = import.meta.env.VITE_FOUNDRY_CLIENT_ID;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @osdk/examples.one.dot.one
# @osdk/e2e.generated.1.1.x

## 0.0.17

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@osdk/examples.one.dot.one",
"name": "@osdk/e2e.generated.1.1.x",
"private": true,
"version": "0.0.17",
"description": "",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@osdk/examples.basic.sdk",
"name": "@osdk/e2e.generated.catchall",
"private": true,
"version": "0.0.0",
"description": "",
Expand All @@ -19,14 +19,14 @@
}
},
"scripts": {
"check-attw": "../../../scripts/build_common/check-attw.sh esm",
"check-attw": "../../scripts/build_common/check-attw.sh esm",
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
"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": "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": "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"
"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
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { QueryDefinition } from '@osdk/api';

export const getTodoCount = {
apiName: 'getTodoCount',
type: 'query',
version: '0.1.2',
parameters: {},
output: { nullable: false, type: 'integer' },
} satisfies QueryDefinition<'getTodoCount', never>;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './getTodoCount.js';
export * from './queryTakesAllParameterTypes.js';
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import { QueryDefinition } from '@osdk/api';
import { Todo } from '../objects.js';
export const queryTakesAllParameterTypes = {
apiName: 'queryTakesAllParameterTypes',
description: 'description of the query that takes all parameter types',
displayName: 'qTAPT',
type: 'query',
version: 'version',
parameters: {
double: { description: 'a double parameter', nullable: false, type: 'double' },
float: { nullable: false, type: 'float' },
integer: { nullable: false, type: 'integer' },
long: { nullable: false, type: 'long' },
attachment: { nullable: false, type: 'attachment' },
boolean: { nullable: false, type: 'boolean' },
date: { nullable: false, type: 'date' },
string: { nullable: false, type: 'string' },
timestamp: { nullable: false, type: 'timestamp' },
object: {
nullable: false,
object: 'Todo',
type: 'object',

__OsdkTargetType: Todo,
},
objectSet: {
nullable: false,
objectSet: 'Todo',
type: 'objectSet',

__OsdkTargetType: Todo,
},
array: { description: 'an array of strings', multiplicity: true, nullable: false, type: 'string' },
set: {
description: 'a set of strings',
nullable: false,
set: {
type: 'string',
nullable: false,
},
type: 'set',
},
unionNonNullable: {
description: 'a union of strings and integers',
nullable: false,
type: 'union',
union: [
{
type: 'string',
nullable: false,
},
{
type: 'integer',
nullable: false,
},
],
},
unionNullable: {
description: 'a union of strings and integers but its optional',
nullable: true,
type: 'union',
union: [
{
type: 'string',
nullable: false,
},
{
type: 'integer',
nullable: false,
},
],
},
struct: {
description: 'a struct with some fields',
nullable: false,
struct: {
name: {
type: 'string',
nullable: false,
},
id: {
type: 'integer',
nullable: false,
},
},
type: 'struct',
},
twoDimensionalAggregation: {
nullable: false,
twoDimensionalAggregation: {
keyType: 'string',
valueType: 'double',
},
type: 'twoDimensionalAggregation',
},
threeDimensionalAggregation: {
nullable: false,
threeDimensionalAggregation: {
keyType: 'range',
keySubtype: 'date',
valueType: {
keyType: 'range',
keySubtype: 'timestamp',
valueType: 'date',
},
},
type: 'threeDimensionalAggregation',
},
},
output: { nullable: false, type: 'string' },
} satisfies QueryDefinition<'queryTakesAllParameterTypes', 'Todo'>;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "@osdk/examples.basic.cli",
"name": "@osdk/e2e.sandbox.catchall",
"private": true,
"version": "0.0.0",
"license": "Apache-2.0",
Expand All @@ -18,19 +18,19 @@
}
},
"scripts": {
"check-attw": "../../../scripts/build_common/check-attw.sh esm",
"check-attw": "../../scripts/build_common/check-attw.sh esm",
"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": "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": "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"
"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:~",
"@osdk/client": "workspace:~",
"@osdk/client.api": "workspace:*",
"@osdk/examples.basic.sdk": "workspace:~",
"@osdk/e2e.generated.catchall": "workspace:~",
"@osdk/foundry": "workspace:~",
"@osdk/internal.foundry": "workspace:~",
"chalk": "^5.3.0",
Expand Down
Loading