Skip to content

Commit

Permalink
rename user agents (#292)
Browse files Browse the repository at this point in the history
* rename generators

* add changeset
  • Loading branch information
ssanjay1 authored Jun 17, 2024
1 parent 4b87220 commit b3f64d9
Show file tree
Hide file tree
Showing 15 changed files with 43 additions and 33 deletions.
10 changes: 10 additions & 0 deletions .changeset/fast-panthers-sin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@osdk/foundry-sdk-generator": patch
"@osdk/cli.cmd.typescript": patch
"@osdk/legacy-client": patch
"@osdk/shared.test": patch
"@osdk/generator": patch
"@osdk/client": patch
---

Modify name passed to TS user agent
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { OntologyMetadata as OM } from '@osdk/api';

export type $ExpectedClientVersion = '0.16.0';
export const $osdkMetadata = { extraUserAgent: 'typescript-sdk/dev osdk-cli/dev' };
export const $osdkMetadata = { extraUserAgent: 'typescript-osdk/dev osdk-cli/dev' };

export interface OntologyMetadata extends OM<$ExpectedClientVersion> {}

export const OntologyMetadata: OntologyMetadata = {
expectsClientVersion: '0.16.0',
ontologyRid: 'ri.ontology.main.ontology.a35bb7f9-2c57-4199-a1cd-af461d88bd6e',
ontologyApiName: 'default',
userAgent: 'typescript-sdk/dev osdk-cli/dev',
userAgent: 'typescript-osdk/dev osdk-cli/dev',
};
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { OntologyMetadata as OM } from '@osdk/api';

export type $ExpectedClientVersion = '0.16.0';
export const $osdkMetadata = { extraUserAgent: 'typescript-sdk/dev osdk-cli/dev' };
export const $osdkMetadata = { extraUserAgent: 'typescript-osdk/dev osdk-cli/dev' };

export interface OntologyMetadata extends OM<$ExpectedClientVersion> {}

export const OntologyMetadata: OntologyMetadata = {
expectsClientVersion: '0.16.0',
ontologyRid: 'ri.ontology.main.ontology.a35bb7f9-2c57-4199-a1cd-af461d88bd6e',
ontologyApiName: 'ontology-d097f725-ab77-46cf-83c0-e3cb9186bff1',
userAgent: 'typescript-sdk/dev osdk-cli/dev',
userAgent: 'typescript-osdk/dev osdk-cli/dev',
};
4 changes: 2 additions & 2 deletions examples-extra/one_dot_one/src/generatedNoCheck/Ontology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const Ontology: {
metadata: {
ontologyRid: 'ridHere';
ontologyApiName: 'OntologyApiName';
userAgent: 'typescript-sdk/dev osdk-cli/dev';
userAgent: 'typescript-osdk/dev osdk-cli/dev';
};
objects: {
Todo: typeof Todo;
Expand All @@ -36,7 +36,7 @@ export const Ontology: {
metadata: {
ontologyRid: 'ridHere' as const,
ontologyApiName: 'OntologyApiName' as const,
userAgent: 'typescript-sdk/dev osdk-cli/dev' as const,
userAgent: 'typescript-osdk/dev osdk-cli/dev' as const,
},
objects: {
Todo,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { OntologyMetadata as OM } from '@osdk/api';

export type $ExpectedClientVersion = '0.16.0';
export const $osdkMetadata = { extraUserAgent: 'typescript-sdk/dev osdk-cli/dev' };
export const $osdkMetadata = { extraUserAgent: 'typescript-osdk/dev osdk-cli/dev' };

export interface OntologyMetadata extends OM<$ExpectedClientVersion> {}

export const OntologyMetadata: OntologyMetadata = {
expectsClientVersion: '0.16.0',
ontologyRid: 'ri.ontology.main.ontology.a35bb7f9-2c57-4199-a1cd-af461d88bd6e',
ontologyApiName: 'ontology-d097f725-ab77-46cf-83c0-e3cb9186bff1',
userAgent: 'typescript-sdk/dev osdk-cli/dev',
userAgent: 'typescript-osdk/dev osdk-cli/dev',
};
4 changes: 2 additions & 2 deletions packages/cli.cmd.typescript/src/generate/handleGenerate.mts
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,9 @@ async function generateSourceFiles(
// This makes it so that releases don't force us to have to regenerate the code when the version strings change.
function getUserAgent(version: string) {
if (version === "dev") {
return "typescript-sdk/dev osdk-cli/dev";
return "typescript-osdk/dev osdk-cli/dev";
} else {
return `typescript-sdk/${version} ${USER_AGENT}`;
return `typescript-osdk/${version} ${USER_AGENT}`;
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/client/generateMockOntology.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ delete ontologyWithoutUnsupportedAction.actionTypes["unsupported-action"];

await generateClientSdkVersionTwoPointZero(
ontologyWithoutUnsupportedAction,
"typescript-sdk/dev osdk-cli/dev",
"typescript-osdk/dev osdk-cli/dev",
{
writeFile: (path, contents) => {
return writeFile(path, contents, "utf-8");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export async function generatePackage(
const inMemoryFileSystem: { [fileName: string]: string } = {};
await generateClientSdkVersionOneDotOne(
ontology,
`typescript-sdk/${options.packageVersion} ${USER_AGENT}`,
`typescript-osdk/${options.packageVersion} ${USER_AGENT}`,
{
writeFile: async (path, contents) => {
inMemoryFileSystem[normalize(path)] = contents;
Expand Down
2 changes: 1 addition & 1 deletion packages/foundry-sdk-generator/src/utils/UserAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
*/

export const USER_AGENT =
`typescript-sdk-generator/${process.env.PACKAGE_VERSION}`;
`typescript-osdk-generator/${process.env.PACKAGE_VERSION}`;
2 changes: 1 addition & 1 deletion packages/generator/src/generateClientSdkPackage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export async function generateClientSdkPackage(
? generateClientSdkVersionTwoPointZero
: undefined!)(
ontology,
`typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`,
`typescript-osdk/${packageVersion} osdk-cli/${cliVersion}`,
minimalFs,
outDir,
packageType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("generator", () => {

await generateClientSdkVersionOneDotOne(
TodoWireOntology,
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand Down Expand Up @@ -67,7 +67,7 @@ describe("generator", () => {
expect(async () => {
await expect(generateClientSdkVersionOneDotOne(
TodoWireOntology,
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
)).rejects.toThrow();
Expand All @@ -85,7 +85,7 @@ describe("generator", () => {

await generateClientSdkVersionOneDotOne(
TodoWireOntology,
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand All @@ -101,7 +101,7 @@ describe("generator", () => {
await mkdir(`${__dirname}/generated`, { recursive: true });
await generateClientSdkVersionOneDotOne(
TodoWireOntology,
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
{
writeFile: async (path, contents) => {
await writeFile(path, contents, { flag: "w" });
Expand Down
18 changes: 9 additions & 9 deletions packages/generator/src/v1.1/generateMetadataFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe(generateMetadataFile, () => {

await generateMetadataFile(
TodoWireOntology,
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand All @@ -53,7 +53,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'ridHere';
ontologyApiName: 'OntologyApiName';
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0';
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0';
};
objects: {
Todo: typeof Todo;
Expand All @@ -70,7 +70,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'ridHere' as const,
ontologyApiName: 'OntologyApiName' as const,
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0' as const,
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0' as const,
},
objects: {
Todo,
Expand Down Expand Up @@ -163,7 +163,7 @@ describe(generateMetadataFile, () => {
interfaceTypes: {},
sharedPropertyTypes: {},
},
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand All @@ -190,7 +190,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'rid';
ontologyApiName: 'apiName';
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0';
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0';
};
objects: {
foo: typeof foo;
Expand All @@ -207,7 +207,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'rid' as const,
ontologyApiName: 'apiName' as const,
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0' as const,
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0' as const,
},
objects: {
foo,
Expand Down Expand Up @@ -252,7 +252,7 @@ describe(generateMetadataFile, () => {
interfaceTypes: {},
sharedPropertyTypes: {},
},
"typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0",
"typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand All @@ -274,7 +274,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'rid';
ontologyApiName: 'apiName';
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0';
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0';
};
objects: {};
actions: {};
Expand All @@ -283,7 +283,7 @@ describe(generateMetadataFile, () => {
metadata: {
ontologyRid: 'rid' as const,
ontologyApiName: 'apiName' as const,
userAgent: 'typescript-sdk/0.0.0 typescript-sdk-generator/0.0.0' as const,
userAgent: 'typescript-osdk/0.0.0 typescript-osdk-generator/0.0.0' as const,
},
objects: {},
actions: {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("generator", () => {

await generateClientSdkVersionTwoPointZero(
TodoWireOntology,
"typescript-sdk/0.0.0 osdk-cli/0.0.0",
"typescript-osdk/0.0.0 osdk-cli/0.0.0",
helper.minimalFiles,
BASE_PATH,
);
Expand Down Expand Up @@ -64,7 +64,7 @@ describe("generator", () => {
expect(async () => {
await expect(generateClientSdkVersionTwoPointZero(
TodoWireOntology,
"typescript-sdk/0.0.0 osdk-cli/0.0.0",
"typescript-osdk/0.0.0 osdk-cli/0.0.0",
helper.minimalFiles,
BASE_PATH,
)).rejects.toThrow();
Expand Down Expand Up @@ -94,7 +94,7 @@ describe("generator", () => {
await mkdir(`${__dirname}/generated`, { recursive: true });
await generateClientSdkVersionTwoPointZero(
TodoWireOntology,
"typescript-sdk/0.0.0 osdk-cli/0.0.0",
"typescript-osdk/0.0.0 osdk-cli/0.0.0",
{
writeFile: async (path, contents) => {
await writeFile(path, contents, { flag: "w" });
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-client/generateMockOntology.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ delete ontologyWithoutUnsupportedAction.actionTypes["unsupported-action"];

await generateClientSdkVersionOneDotOne(
ontologyWithoutUnsupportedAction,
"typescript-sdk/dev osdk-cli/dev",
"typescript-osdk/dev osdk-cli/dev",
{
writeFile: (path, contents) => {
return writeFile(path, contents, "utf-8");
Expand Down
4 changes: 2 additions & 2 deletions packages/shared.test/src/mock-ontology/mockOntology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { ObjectTypeWithAllPropertyTypes } from "./ObjectTypeWithAllPropertyTypes
import { ObjectTypeWithReservedNames } from "./ObjectTypeWithReservedNames";

const osdkMetadata = {
extraUserAgent: "typescript-sdk/0.0.0 osdk-cli/0.0.0",
extraUserAgent: "typescript-osdk/0.0.0 osdk-cli/0.0.0",
};

const Task: TaskDef = {
Expand Down Expand Up @@ -166,7 +166,7 @@ export const MockOntology = {
metadata: {
ontologyRid: "",
ontologyApiName: "Ontology",
userAgent: "typescript-sdk/0.0.0 osdk-cli/0.0.0",
userAgent: "typescript-osdk/0.0.0 osdk-cli/0.0.0",
},
objects: {
Task,
Expand Down

0 comments on commit b3f64d9

Please sign in to comment.