@osdk/generator 2.8.0-beta.9 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +245 -0
- package/build/browser/GenerateContext/EnhancedAction.js +13 -0
- package/build/browser/GenerateContext/EnhancedAction.js.map +1 -1
- package/build/browser/GenerateContext/GenerateContext.js.map +1 -1
- package/build/browser/generateClientSdkPackage.js +1 -1
- package/build/browser/generateClientSdkPackage.js.map +1 -1
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/shared/getInterfaceTypesFromQueryDataType.js +4 -0
- package/build/browser/shared/getInterfaceTypesFromQueryDataType.js.map +1 -1
- package/build/browser/shared/getObjectTypesFromQueryDataType.js +4 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/browser/util/test/TodoWireOntology.js +4 -2
- package/build/browser/util/test/TodoWireOntology.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +3 -2
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +1 -4
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.js +2 -6
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +10 -3
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/getDescriptionIfPresent.js +4 -1
- package/build/browser/v2.0/getDescriptionIfPresent.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +9 -2
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/cjs/index.cjs +50 -81
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +12 -1
- package/build/esm/GenerateContext/EnhancedAction.js +13 -0
- package/build/esm/GenerateContext/EnhancedAction.js.map +1 -1
- package/build/esm/GenerateContext/GenerateContext.js.map +1 -1
- package/build/esm/generateClientSdkPackage.js +1 -1
- package/build/esm/generateClientSdkPackage.js.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/shared/getInterfaceTypesFromQueryDataType.js +4 -0
- package/build/esm/shared/getInterfaceTypesFromQueryDataType.js.map +1 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.js +4 -0
- package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/esm/util/test/TodoWireOntology.js +4 -2
- package/build/esm/util/test/TodoWireOntology.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +3 -2
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +1 -4
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +2 -6
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +10 -3
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/getDescriptionIfPresent.js +4 -1
- package/build/esm/v2.0/getDescriptionIfPresent.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +9 -2
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/types/GenerateContext/EnhancedAction.d.ts +2 -0
- package/build/types/GenerateContext/EnhancedAction.d.ts.map +1 -1
- package/build/types/GenerateContext/GenerateContext.d.ts +0 -2
- package/build/types/GenerateContext/GenerateContext.d.ts.map +1 -1
- package/build/types/generateClientSdkPackage.d.ts +11 -0
- package/build/types/generateClientSdkPackage.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/types/v2.0/generatePerActionDataFiles.d.ts +1 -1
- package/build/types/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/package.json +6 -6
- package/build/browser/generateClientSdkPackage.test.js +0 -68
- package/build/browser/generateClientSdkPackage.test.js.map +0 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js +0 -47
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js.map +0 -1
- package/build/browser/shared/sanitizeMetadata.js +0 -42
- package/build/browser/shared/sanitizeMetadata.js.map +0 -1
- package/build/browser/shared/sanitizeMetadata.test.js +0 -46
- package/build/browser/shared/sanitizeMetadata.test.js.map +0 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +0 -473
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +0 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +0 -2616
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +0 -1
- package/build/browser/v2.0/generatePerActionDataFiles.test.js +0 -64
- package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +0 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +0 -519
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +0 -1
- package/build/esm/generateClientSdkPackage.test.js +0 -68
- package/build/esm/generateClientSdkPackage.test.js.map +0 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js +0 -47
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js.map +0 -1
- package/build/esm/shared/sanitizeMetadata.js +0 -42
- package/build/esm/shared/sanitizeMetadata.js.map +0 -1
- package/build/esm/shared/sanitizeMetadata.test.js +0 -46
- package/build/esm/shared/sanitizeMetadata.test.js.map +0 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +0 -473
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +0 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +0 -2616
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +0 -1
- package/build/esm/v2.0/generatePerActionDataFiles.test.js +0 -64
- package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +0 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +0 -519
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +0 -1
- package/build/types/generateClientSdkPackage.test.d.ts +0 -1
- package/build/types/generateClientSdkPackage.test.d.ts.map +0 -1
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -1
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
- package/build/types/shared/sanitizeMetadata.d.ts +0 -1
- package/build/types/shared/sanitizeMetadata.d.ts.map +0 -1
- package/build/types/shared/sanitizeMetadata.test.d.ts +0 -1
- package/build/types/shared/sanitizeMetadata.test.d.ts.map +0 -1
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -1
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -1
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
- package/build/types/v2.0/generatePerActionDataFiles.test.d.ts +0 -1
- package/build/types/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
- package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts +0 -1
- package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/generator",
|
|
3
|
-
"version": "2.8.0
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@osdk/foundry.ontologies": "2.
|
|
32
|
+
"@osdk/foundry.ontologies": "2.57.0",
|
|
33
33
|
"consola": "^3.4.2",
|
|
34
34
|
"fast-deep-equal": "^3.1.3",
|
|
35
35
|
"fetch-retry": "^6.0.0",
|
|
36
36
|
"prettier": "^3.6.2",
|
|
37
37
|
"tiny-invariant": "^1.3.3",
|
|
38
|
-
"@osdk/
|
|
39
|
-
"@osdk/
|
|
38
|
+
"@osdk/api": "~2.8.0",
|
|
39
|
+
"@osdk/generator-converters": "~2.8.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "^18.19.124",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"ts-expect": "^1.3.0",
|
|
45
45
|
"typescript": "~5.5.4",
|
|
46
46
|
"vitest": "^3.2.4",
|
|
47
|
-
"@osdk/monorepo.api-extractor": "~0.7.0
|
|
48
|
-
"@osdk/monorepo.tsconfig": "~0.7.0
|
|
47
|
+
"@osdk/monorepo.api-extractor": "~0.7.0",
|
|
48
|
+
"@osdk/monorepo.tsconfig": "~0.7.0"
|
|
49
49
|
},
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { describe, expect, test } from "vitest";
|
|
18
|
-
import { getPackageJsonContents } from "./generateClientSdkPackage.js";
|
|
19
|
-
describe("generateClientSdkPackage", () => {
|
|
20
|
-
describe(getPackageJsonContents, () => {
|
|
21
|
-
const versions = {
|
|
22
|
-
osdkApiVersion: "^99.9.9",
|
|
23
|
-
osdkClientVersion: "^88.8.8",
|
|
24
|
-
osdkClientApiVersion: "^66.6.6",
|
|
25
|
-
areTheTypesWrongVersion: "^0.15.2",
|
|
26
|
-
tslibVersion: "^2.6.2",
|
|
27
|
-
typescriptVersion: "~5.5.4"
|
|
28
|
-
};
|
|
29
|
-
describe("v2", () => {
|
|
30
|
-
test("returns the package.json contents", async () => {
|
|
31
|
-
expect(getPackageJsonContents("foo", "1.2.3", versions)).toMatchInlineSnapshot(`
|
|
32
|
-
{
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@arethetypeswrong/cli": "^0.15.2",
|
|
35
|
-
"@osdk/api": "^99.9.9",
|
|
36
|
-
"tslib": "^2.6.2",
|
|
37
|
-
"typescript": "~5.5.4",
|
|
38
|
-
},
|
|
39
|
-
"exports": {
|
|
40
|
-
".": {
|
|
41
|
-
"import": "./dist/module/index.js",
|
|
42
|
-
"require": "./dist/commonjs/index.js",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
"files": [
|
|
46
|
-
"**/*.js",
|
|
47
|
-
"**/*.d.ts",
|
|
48
|
-
"dist/**/package.json",
|
|
49
|
-
],
|
|
50
|
-
"main": "./dist/commonjs/index.js",
|
|
51
|
-
"module": "./dist/module/index.js",
|
|
52
|
-
"name": "foo",
|
|
53
|
-
"peerDependencies": {
|
|
54
|
-
"@osdk/api": "^99.9.9",
|
|
55
|
-
"@osdk/client": "^88.8.8",
|
|
56
|
-
},
|
|
57
|
-
"scripts": {
|
|
58
|
-
"check": "npm exec attw $(npm pack)",
|
|
59
|
-
"prepack": "tsc -p ./dist/module/tsconfig.json && tsc -p ./dist/commonjs/tsconfig.json",
|
|
60
|
-
},
|
|
61
|
-
"version": "1.2.3",
|
|
62
|
-
}
|
|
63
|
-
`);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=generateClientSdkPackage.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateClientSdkPackage.test.js","names":["describe","expect","test","getPackageJsonContents","versions","osdkApiVersion","osdkClientVersion","osdkClientApiVersion","areTheTypesWrongVersion","tslibVersion","typescriptVersion","toMatchInlineSnapshot"],"sources":["generateClientSdkPackage.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, test } from \"vitest\";\nimport { getPackageJsonContents } from \"./generateClientSdkPackage.js\";\n\ndescribe(\"generateClientSdkPackage\", () => {\n describe(getPackageJsonContents, () => {\n const versions = {\n osdkApiVersion: \"^99.9.9\",\n osdkClientVersion: \"^88.8.8\",\n osdkClientApiVersion: \"^66.6.6\",\n areTheTypesWrongVersion: \"^0.15.2\",\n tslibVersion: \"^2.6.2\",\n typescriptVersion: \"~5.5.4\",\n } as const;\n\n describe(\"v2\", () => {\n test(\"returns the package.json contents\", async () => {\n expect(getPackageJsonContents(\"foo\", \"1.2.3\", versions))\n .toMatchInlineSnapshot(`\n {\n \"devDependencies\": {\n \"@arethetypeswrong/cli\": \"^0.15.2\",\n \"@osdk/api\": \"^99.9.9\",\n \"tslib\": \"^2.6.2\",\n \"typescript\": \"~5.5.4\",\n },\n \"exports\": {\n \".\": {\n \"import\": \"./dist/module/index.js\",\n \"require\": \"./dist/commonjs/index.js\",\n },\n },\n \"files\": [\n \"**/*.js\",\n \"**/*.d.ts\",\n \"dist/**/package.json\",\n ],\n \"main\": \"./dist/commonjs/index.js\",\n \"module\": \"./dist/module/index.js\",\n \"name\": \"foo\",\n \"peerDependencies\": {\n \"@osdk/api\": \"^99.9.9\",\n \"@osdk/client\": \"^88.8.8\",\n },\n \"scripts\": {\n \"check\": \"npm exec attw $(npm pack)\",\n \"prepack\": \"tsc -p ./dist/module/tsconfig.json && tsc -p ./dist/commonjs/tsconfig.json\",\n },\n \"version\": \"1.2.3\",\n }\n `);\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,QAAQ,QAAQ;AAC/C,SAASC,sBAAsB,QAAQ,+BAA+B;AAEtEH,QAAQ,CAAC,0BAA0B,EAAE,MAAM;EACzCA,QAAQ,CAACG,sBAAsB,EAAE,MAAM;IACrC,MAAMC,QAAQ,GAAG;MACfC,cAAc,EAAE,SAAS;MACzBC,iBAAiB,EAAE,SAAS;MAC5BC,oBAAoB,EAAE,SAAS;MAC/BC,uBAAuB,EAAE,SAAS;MAClCC,YAAY,EAAE,QAAQ;MACtBC,iBAAiB,EAAE;IACrB,CAAU;IAEVV,QAAQ,CAAC,IAAI,EAAE,MAAM;MACnBE,IAAI,CAAC,mCAAmC,EAAE,YAAY;QACpDD,MAAM,CAACE,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAEC,QAAQ,CAAC,CAAC,CACrDO,qBAAqB,CAAC;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,WAAW,CAAC;MACN,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { describe, expect, it } from "vitest";
|
|
18
|
-
import { startsWithApiNamespace } from "./startsWithApiNamespace.js";
|
|
19
|
-
describe(startsWithApiNamespace, () => {
|
|
20
|
-
describe("a name with periods", () => {
|
|
21
|
-
const partialNamespace = "a.b";
|
|
22
|
-
const fullNamespace = `${partialNamespace}.c`;
|
|
23
|
-
const fullApiName = `${fullNamespace}.${"Foo"}`;
|
|
24
|
-
it("returns false if only partial namespace is provided", () => {
|
|
25
|
-
expect(startsWithApiNamespace(fullApiName, partialNamespace)).toBe(false);
|
|
26
|
-
});
|
|
27
|
-
it("returns true if full namespace is provided", () => {
|
|
28
|
-
expect(startsWithApiNamespace(fullApiName, fullNamespace)).toBe(true);
|
|
29
|
-
});
|
|
30
|
-
it("returns false if a wrong namespace is provided", () => {
|
|
31
|
-
expect(startsWithApiNamespace(fullApiName, "incorrect.namespace")).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
it("return false if no namespace is provided", () => {
|
|
34
|
-
expect(startsWithApiNamespace(fullApiName, undefined)).toBe(false);
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe("a name without periods", () => {
|
|
38
|
-
const apiNameOnly = "Foo";
|
|
39
|
-
it("returns false if any namespace is provided", () => {
|
|
40
|
-
expect(startsWithApiNamespace(apiNameOnly, "incorrect.namespace")).toBe(false);
|
|
41
|
-
});
|
|
42
|
-
it("returns true if no namespace is provided", () => {
|
|
43
|
-
expect(startsWithApiNamespace(apiNameOnly, undefined)).toBe(true);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
//# sourceMappingURL=startsWithApiNamespace.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"startsWithApiNamespace.test.js","names":["describe","expect","it","startsWithApiNamespace","partialNamespace","fullNamespace","fullApiName","toBe","undefined","apiNameOnly"],"sources":["startsWithApiNamespace.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { startsWithApiNamespace } from \"./startsWithApiNamespace.js\";\n\ndescribe(startsWithApiNamespace, () => {\n describe(\"a name with periods\", () => {\n const wrongNamespace = \"incorrect.namespace\";\n const partialNamespace = \"a.b\";\n const fullNamespace = `${partialNamespace}.c`;\n const apiNameOnly = \"Foo\";\n const fullApiName = `${fullNamespace}.${apiNameOnly}`;\n\n it(\"returns false if only partial namespace is provided\", () => {\n expect(startsWithApiNamespace(fullApiName, partialNamespace)).toBe(\n false,\n );\n });\n\n it(\"returns true if full namespace is provided\", () => {\n expect(startsWithApiNamespace(fullApiName, fullNamespace)).toBe(true);\n });\n\n it(\"returns false if a wrong namespace is provided\", () => {\n expect(startsWithApiNamespace(fullApiName, wrongNamespace)).toBe(false);\n });\n\n it(\"return false if no namespace is provided\", () => {\n expect(startsWithApiNamespace(fullApiName, undefined)).toBe(false);\n });\n });\n\n describe(\"a name without periods\", () => {\n const wrongNamespace = \"incorrect.namespace\";\n const apiNameOnly = \"Foo\";\n\n it(\"returns false if any namespace is provided\", () => {\n expect(startsWithApiNamespace(apiNameOnly, wrongNamespace)).toBe(\n false,\n );\n });\n\n it(\"returns true if no namespace is provided\", () => {\n expect(startsWithApiNamespace(apiNameOnly, undefined)).toBe(true);\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,sBAAsB,QAAQ,6BAA6B;AAEpEH,QAAQ,CAACG,sBAAsB,EAAE,MAAM;EACrCH,QAAQ,CAAC,qBAAqB,EAAE,MAAM;IAEpC,MAAMI,gBAAgB,GAAG,KAAK;IAC9B,MAAMC,aAAa,GAAG,GAAGD,gBAAgB,IAAI;IAE7C,MAAME,WAAW,GAAG,GAAGD,aAAa,IADhB,KAAK,EAC4B;IAErDH,EAAE,CAAC,qDAAqD,EAAE,MAAM;MAC9DD,MAAM,CAACE,sBAAsB,CAACG,WAAW,EAAEF,gBAAgB,CAAC,CAAC,CAACG,IAAI,CAChE,KACF,CAAC;IACH,CAAC,CAAC;IAEFL,EAAE,CAAC,4CAA4C,EAAE,MAAM;MACrDD,MAAM,CAACE,sBAAsB,CAACG,WAAW,EAAED,aAAa,CAAC,CAAC,CAACE,IAAI,CAAC,IAAI,CAAC;IACvE,CAAC,CAAC;IAEFL,EAAE,CAAC,gDAAgD,EAAE,MAAM;MACzDD,MAAM,CAACE,sBAAsB,CAACG,WAAW,EAjBpB,qBAiBoC,CAAC,CAAC,CAACC,IAAI,CAAC,KAAK,CAAC;IACzE,CAAC,CAAC;IAEFL,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACnDD,MAAM,CAACE,sBAAsB,CAACG,WAAW,EAAEE,SAAS,CAAC,CAAC,CAACD,IAAI,CAAC,KAAK,CAAC;IACpE,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFP,QAAQ,CAAC,wBAAwB,EAAE,MAAM;IAEvC,MAAMS,WAAW,GAAG,KAAK;IAEzBP,EAAE,CAAC,4CAA4C,EAAE,MAAM;MACrDD,MAAM,CAACE,sBAAsB,CAACM,WAAW,EAJpB,qBAIoC,CAAC,CAAC,CAACF,IAAI,CAC9D,KACF,CAAC;IACH,CAAC,CAAC;IAEFL,EAAE,CAAC,0CAA0C,EAAE,MAAM;MACnDD,MAAM,CAACE,sBAAsB,CAACM,WAAW,EAAED,SAAS,CAAC,CAAC,CAACD,IAAI,CAAC,IAAI,CAAC;IACnE,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
export function sanitizeMetadata(ontology) {
|
|
29
|
-
return {
|
|
30
|
-
...ontology,
|
|
31
|
-
actionTypes: Object.fromEntries(Object.values(ontology.actionTypes).map(actionType => {
|
|
32
|
-
return [camelize(actionType.apiName), {
|
|
33
|
-
...actionType,
|
|
34
|
-
apiName: camelize(actionType.apiName)
|
|
35
|
-
}];
|
|
36
|
-
}))
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function camelize(name) {
|
|
40
|
-
return name.replace(/-./g, segment => segment[1].toUpperCase());
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=sanitizeMetadata.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeMetadata.js","names":["sanitizeMetadata","ontology","actionTypes","Object","fromEntries","values","map","actionType","camelize","apiName","name","replace","segment","toUpperCase"],"sources":["sanitizeMetadata.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\n\n/**\n * @internal\n */\nexport function sanitizeMetadata(\n ontology: WireOntologyDefinition,\n): WireOntologyDefinition;\n/**\n * @internal\n */\nexport function sanitizeMetadata(\n ontology: WireOntologyDefinition,\n): WireOntologyDefinition;\n/**\n * @internal\n */\nexport function sanitizeMetadata<\n T extends WireOntologyDefinition | WireOntologyDefinition,\n>(\n ontology: T,\n): T {\n return {\n ...ontology,\n actionTypes: Object.fromEntries(\n Object.values(ontology.actionTypes).map(actionType => {\n return [camelize(actionType.apiName), {\n ...actionType,\n apiName: camelize(actionType.apiName),\n }];\n }),\n ),\n };\n}\nfunction camelize(name: string) {\n return name.replace(/-./g, segment => segment[1]!.toUpperCase());\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;;AAIA;AACA;AACA;AACA,OAAO,SAASA,gBAAgBA,CAG9BC,QAAW,EACR;EACH,OAAO;IACL,GAAGA,QAAQ;IACXC,WAAW,EAAEC,MAAM,CAACC,WAAW,CAC7BD,MAAM,CAACE,MAAM,CAACJ,QAAQ,CAACC,WAAW,CAAC,CAACI,GAAG,CAACC,UAAU,IAAI;MACpD,OAAO,CAACC,QAAQ,CAACD,UAAU,CAACE,OAAO,CAAC,EAAE;QACpC,GAAGF,UAAU;QACbE,OAAO,EAAED,QAAQ,CAACD,UAAU,CAACE,OAAO;MACtC,CAAC,CAAC;IACJ,CAAC,CACH;EACF,CAAC;AACH;AACA,SAASD,QAAQA,CAACE,IAAY,EAAE;EAC9B,OAAOA,IAAI,CAACC,OAAO,CAAC,KAAK,EAAEC,OAAO,IAAIA,OAAO,CAAC,CAAC,CAAC,CAAEC,WAAW,CAAC,CAAC,CAAC;AAClE","ignoreList":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
import { describe, expect, it } from "vitest";
|
|
18
|
-
import { sanitizeMetadata } from "./sanitizeMetadata.js";
|
|
19
|
-
describe(sanitizeMetadata, () => {
|
|
20
|
-
it("sanitized action apiNames", () => {
|
|
21
|
-
const sanitizedOntology = sanitizeMetadata({
|
|
22
|
-
objectTypes: {},
|
|
23
|
-
actionTypes: {
|
|
24
|
-
"kebab-case": {
|
|
25
|
-
apiName: "kebab-case",
|
|
26
|
-
operations: [],
|
|
27
|
-
parameters: {},
|
|
28
|
-
status: "ACTIVE",
|
|
29
|
-
rid: "ri.a.b.c.d"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
ontology: {
|
|
33
|
-
rid: "ri.a.b.c.d",
|
|
34
|
-
apiName: "ontology",
|
|
35
|
-
displayName: "",
|
|
36
|
-
description: ""
|
|
37
|
-
},
|
|
38
|
-
queryTypes: {},
|
|
39
|
-
interfaceTypes: {},
|
|
40
|
-
sharedPropertyTypes: {},
|
|
41
|
-
valueTypes: {}
|
|
42
|
-
});
|
|
43
|
-
expect(sanitizedOntology.actionTypes["kebabCase"].apiName).toEqual("kebabCase");
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
//# sourceMappingURL=sanitizeMetadata.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeMetadata.test.js","names":["describe","expect","it","sanitizeMetadata","sanitizedOntology","objectTypes","actionTypes","apiName","operations","parameters","status","rid","ontology","displayName","description","queryTypes","interfaceTypes","sharedPropertyTypes","valueTypes","toEqual"],"sources":["sanitizeMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { describe, expect, it } from \"vitest\";\nimport { sanitizeMetadata } from \"./sanitizeMetadata.js\";\n\ndescribe(sanitizeMetadata, () => {\n it(\"sanitized action apiNames\", () => {\n const sanitizedOntology = sanitizeMetadata({\n objectTypes: {},\n actionTypes: {\n \"kebab-case\": {\n apiName: \"kebab-case\",\n operations: [],\n parameters: {},\n status: \"ACTIVE\",\n rid: \"ri.a.b.c.d\",\n },\n },\n ontology: {\n rid: \"ri.a.b.c.d\",\n apiName: \"ontology\",\n displayName: \"\",\n description: \"\",\n },\n queryTypes: {},\n interfaceTypes: {},\n sharedPropertyTypes: {},\n valueTypes: {},\n });\n expect(sanitizedOntology.actionTypes[\"kebabCase\"].apiName).toEqual(\n \"kebabCase\",\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,gBAAgB,QAAQ,uBAAuB;AAExDH,QAAQ,CAACG,gBAAgB,EAAE,MAAM;EAC/BD,EAAE,CAAC,2BAA2B,EAAE,MAAM;IACpC,MAAME,iBAAiB,GAAGD,gBAAgB,CAAC;MACzCE,WAAW,EAAE,CAAC,CAAC;MACfC,WAAW,EAAE;QACX,YAAY,EAAE;UACZC,OAAO,EAAE,YAAY;UACrBC,UAAU,EAAE,EAAE;UACdC,UAAU,EAAE,CAAC,CAAC;UACdC,MAAM,EAAE,QAAQ;UAChBC,GAAG,EAAE;QACP;MACF,CAAC;MACDC,QAAQ,EAAE;QACRD,GAAG,EAAE,YAAY;QACjBJ,OAAO,EAAE,UAAU;QACnBM,WAAW,EAAE,EAAE;QACfC,WAAW,EAAE;MACf,CAAC;MACDC,UAAU,EAAE,CAAC,CAAC;MACdC,cAAc,EAAE,CAAC,CAAC;MAClBC,mBAAmB,EAAE,CAAC,CAAC;MACvBC,UAAU,EAAE,CAAC;IACf,CAAC,CAAC;IACFjB,MAAM,CAACG,iBAAiB,CAACE,WAAW,CAAC,WAAW,CAAC,CAACC,OAAO,CAAC,CAACY,OAAO,CAChE,WACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|