@osdk/generator-converters.preview 0.1.0-beta.0 → 0.1.0-beta.2
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 +27 -0
- package/build/browser/ActionLogicRuleConverter.js +19 -1
- package/build/browser/ActionLogicRuleConverter.js.map +1 -1
- package/build/browser/PreviewOntologyIrConverter.js +15 -28
- package/build/browser/PreviewOntologyIrConverter.js.map +1 -1
- package/build/browser/cli/generate-sdk.js +90 -33
- package/build/browser/cli/generate-sdk.js.map +1 -1
- package/build/browser/ridUtils.js +10 -5
- package/build/browser/ridUtils.js.map +1 -1
- package/build/browser/ridUtils.test.js +5 -4
- package/build/browser/ridUtils.test.js.map +1 -1
- package/build/cjs/index.cjs +21 -30
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +2 -2
- package/build/esm/ActionLogicRuleConverter.js +19 -1
- package/build/esm/ActionLogicRuleConverter.js.map +1 -1
- package/build/esm/PreviewOntologyIrConverter.js +15 -28
- package/build/esm/PreviewOntologyIrConverter.js.map +1 -1
- package/build/esm/cli/generate-sdk.js +90 -33
- package/build/esm/cli/generate-sdk.js.map +1 -1
- package/build/esm/ridUtils.js +10 -5
- package/build/esm/ridUtils.js.map +1 -1
- package/build/esm/ridUtils.test.js +5 -4
- package/build/esm/ridUtils.test.js.map +1 -1
- package/build/types/ActionLogicRuleConverter.d.ts +7 -1
- package/build/types/ActionLogicRuleConverter.d.ts.map +1 -1
- package/build/types/PreviewOntologyIrConverter.d.ts +2 -2
- package/build/types/PreviewOntologyIrConverter.d.ts.map +1 -1
- package/build/types/ridUtils.d.ts +3 -2
- package/build/types/ridUtils.d.ts.map +1 -1
- package/package.json +11 -8
package/build/esm/ridUtils.js
CHANGED
|
@@ -17,12 +17,17 @@
|
|
|
17
17
|
import { createHash } from "node:crypto";
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Generate a deterministic UUID from a string.
|
|
21
|
-
* Uses SHA-256 hash truncated to UUID format
|
|
20
|
+
* Generate a deterministic UUID v5-like identifier from a string.
|
|
21
|
+
* Uses SHA-256 hash truncated to UUID format with version (5) and
|
|
22
|
+
* variant (RFC 4122) bits set for spec compliance.
|
|
22
23
|
*/
|
|
23
24
|
export function toUuid(str) {
|
|
24
|
-
const
|
|
25
|
-
//
|
|
26
|
-
|
|
25
|
+
const hashBytes = createHash("sha256").update(str).digest();
|
|
26
|
+
// Set version to 5 (name-based SHA) in byte 6: clear top nibble, set to 0101
|
|
27
|
+
hashBytes[6] = hashBytes[6] & 0x0f | 0x50;
|
|
28
|
+
// Set variant to RFC 4122 in byte 8: clear top 2 bits, set to 10
|
|
29
|
+
hashBytes[8] = hashBytes[8] & 0x3f | 0x80;
|
|
30
|
+
const hex = hashBytes.subarray(0, 16).toString("hex");
|
|
31
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
|
|
27
32
|
}
|
|
28
33
|
//# sourceMappingURL=ridUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ridUtils.js","names":["createHash","toUuid","str","
|
|
1
|
+
{"version":3,"file":"ridUtils.js","names":["createHash","toUuid","str","hashBytes","update","digest","hex","subarray","toString","slice"],"sources":["ridUtils.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { createHash } from \"node:crypto\";\n\n/**\n * Generate a deterministic UUID v5-like identifier from a string.\n * Uses SHA-256 hash truncated to UUID format with version (5) and\n * variant (RFC 4122) bits set for spec compliance.\n */\nexport function toUuid(str: string): string {\n const hashBytes = createHash(\"sha256\").update(str).digest();\n // Set version to 5 (name-based SHA) in byte 6: clear top nibble, set to 0101\n hashBytes[6] = (hashBytes[6] & 0x0f) | 0x50;\n // Set variant to RFC 4122 in byte 8: clear top 2 bits, set to 10\n hashBytes[8] = (hashBytes[8] & 0x3f) | 0x80;\n\n const hex = hashBytes.subarray(0, 16).toString(\"hex\");\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${\n hex.slice(16, 20)\n }-${hex.slice(20, 32)}`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,aAAa;;AAExC;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,MAAMA,CAACC,GAAW,EAAU;EAC1C,MAAMC,SAAS,GAAGH,UAAU,CAAC,QAAQ,CAAC,CAACI,MAAM,CAACF,GAAG,CAAC,CAACG,MAAM,CAAC,CAAC;EAC3D;EACAF,SAAS,CAAC,CAAC,CAAC,GAAIA,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAI,IAAI;EAC3C;EACAA,SAAS,CAAC,CAAC,CAAC,GAAIA,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAI,IAAI;EAE3C,MAAMG,GAAG,GAAGH,SAAS,CAACI,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAACC,QAAQ,CAAC,KAAK,CAAC;EACrD,OAAO,GAAGF,GAAG,CAACG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAIH,GAAG,CAACG,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAIH,GAAG,CAACG,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAChEH,GAAG,CAACG,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IACfH,GAAG,CAACG,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE;AACzB","ignoreList":[]}
|
|
@@ -18,10 +18,11 @@ import { describe, expect, it } from "vitest";
|
|
|
18
18
|
import { toUuid } from "./ridUtils.js";
|
|
19
19
|
describe("ridUtils", () => {
|
|
20
20
|
describe("toUuid", () => {
|
|
21
|
-
it("returns a valid UUID format", () => {
|
|
21
|
+
it("returns a valid UUID format with correct version and variant bits", () => {
|
|
22
22
|
const result = toUuid("test-string");
|
|
23
|
-
// UUID format: xxxxxxxx-xxxx-
|
|
24
|
-
|
|
23
|
+
// UUID format: xxxxxxxx-xxxx-Vxxx-Nxxx-xxxxxxxxxxxx // cspell:disable-line
|
|
24
|
+
// V = version (5), N = variant (8, 9, a, or b for RFC 4122)
|
|
25
|
+
expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
25
26
|
});
|
|
26
27
|
it("is deterministic - same input produces same output", () => {
|
|
27
28
|
const input = "my-deterministic-input";
|
|
@@ -36,7 +37,7 @@ describe("ridUtils", () => {
|
|
|
36
37
|
});
|
|
37
38
|
it("handles empty string", () => {
|
|
38
39
|
const result = toUuid("");
|
|
39
|
-
expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{
|
|
40
|
+
expect(result).toMatch(/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/);
|
|
40
41
|
});
|
|
41
42
|
});
|
|
42
43
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ridUtils.test.js","names":["describe","expect","it","toUuid","result","toMatch","input","result1","result2","toBe","not"],"sources":["ridUtils.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { toUuid } from \"./ridUtils.js\";\n\ndescribe(\"ridUtils\", () => {\n describe(\"toUuid\", () => {\n it(\"returns a valid UUID format\", () => {\n const result = toUuid(\"test-string\");\n // UUID format: xxxxxxxx-xxxx-
|
|
1
|
+
{"version":3,"file":"ridUtils.test.js","names":["describe","expect","it","toUuid","result","toMatch","input","result1","result2","toBe","not"],"sources":["ridUtils.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { toUuid } from \"./ridUtils.js\";\n\ndescribe(\"ridUtils\", () => {\n describe(\"toUuid\", () => {\n it(\"returns a valid UUID format with correct version and variant bits\", () => {\n const result = toUuid(\"test-string\");\n // UUID format: xxxxxxxx-xxxx-Vxxx-Nxxx-xxxxxxxxxxxx // cspell:disable-line\n // V = version (5), N = variant (8, 9, a, or b for RFC 4122)\n expect(result).toMatch(\n /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,\n );\n });\n\n it(\"is deterministic - same input produces same output\", () => {\n const input = \"my-deterministic-input\";\n const result1 = toUuid(input);\n const result2 = toUuid(input);\n expect(result1).toBe(result2);\n });\n\n it(\"produces different outputs for different inputs\", () => {\n const result1 = toUuid(\"input-1\");\n const result2 = toUuid(\"input-2\");\n expect(result1).not.toBe(result2);\n });\n\n it(\"handles empty string\", () => {\n const result = toUuid(\"\");\n expect(result).toMatch(\n /^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,\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,EAAE,QAAQ,QAAQ;AAC7C,SAASC,MAAM,QAAQ,eAAe;AAEtCH,QAAQ,CAAC,UAAU,EAAE,MAAM;EACzBA,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACvBE,EAAE,CAAC,mEAAmE,EAAE,MAAM;MAC5E,MAAME,MAAM,GAAGD,MAAM,CAAC,aAAa,CAAC;MACpC;MACA;MACAF,MAAM,CAACG,MAAM,CAAC,CAACC,OAAO,CACpB,uEACF,CAAC;IACH,CAAC,CAAC;IAEFH,EAAE,CAAC,oDAAoD,EAAE,MAAM;MAC7D,MAAMI,KAAK,GAAG,wBAAwB;MACtC,MAAMC,OAAO,GAAGJ,MAAM,CAACG,KAAK,CAAC;MAC7B,MAAME,OAAO,GAAGL,MAAM,CAACG,KAAK,CAAC;MAC7BL,MAAM,CAACM,OAAO,CAAC,CAACE,IAAI,CAACD,OAAO,CAAC;IAC/B,CAAC,CAAC;IAEFN,EAAE,CAAC,iDAAiD,EAAE,MAAM;MAC1D,MAAMK,OAAO,GAAGJ,MAAM,CAAC,SAAS,CAAC;MACjC,MAAMK,OAAO,GAAGL,MAAM,CAAC,SAAS,CAAC;MACjCF,MAAM,CAACM,OAAO,CAAC,CAACG,GAAG,CAACD,IAAI,CAACD,OAAO,CAAC;IACnC,CAAC,CAAC;IAEFN,EAAE,CAAC,sBAAsB,EAAE,MAAM;MAC/B,MAAME,MAAM,GAAGD,MAAM,CAAC,EAAE,CAAC;MACzBF,MAAM,CAACG,MAAM,CAAC,CAACC,OAAO,CACpB,uEACF,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { OntologyIrActionTypeBlockDataV2, OntologyIrLogicRule, OntologyIrOntologyBlockDataV2 } from "@osdk/client.unstable";
|
|
2
2
|
import type * as Ontologies from "@osdk/foundry.ontologies";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Build lookups once and convert all logic rules for an action.
|
|
5
|
+
* Avoids rebuilding lookup Maps on every rule.
|
|
6
|
+
*/
|
|
7
|
+
export declare function convertIrLogicRulesToActionLogicRules(rules: OntologyIrLogicRule[], action: OntologyIrActionTypeBlockDataV2, ir?: OntologyIrOntologyBlockDataV2): Ontologies.ActionLogicRule[];
|
|
8
|
+
/**
|
|
9
|
+
* Convert a single OntologyIrLogicRule to ActionLogicRule.
|
|
10
|
+
* Kept as a public API for callers that only need a single rule conversion.
|
|
5
11
|
*/
|
|
6
12
|
export declare function convertIrLogicRuleToActionLogicRule(irRule: OntologyIrLogicRule, action: OntologyIrActionTypeBlockDataV2, ir?: OntologyIrOntologyBlockDataV2): Ontologies.ActionLogicRule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iCACA,qBACA,qCACK,uBAAwB;AAC/B,iBAAiB,gBAAgB,0BAA2B
|
|
1
|
+
{"mappings":"AAgBA,cACE,iCACA,qBACA,qCACK,uBAAwB;AAC/B,iBAAiB,gBAAgB,0BAA2B;;;;;AA+D5D,OAAO,iBAAS,sCACdA,OAAO,uBACPC,QAAQ,iCACRC,KAAK,gCACJ,WAAW;;;;;AAad,OAAO,iBAAS,oCACdC,QAAQ,qBACRF,QAAQ,iCACRC,KAAK,gCACJ,WAAW","names":["rules: OntologyIrLogicRule[]","action: OntologyIrActionTypeBlockDataV2","ir?: OntologyIrOntologyBlockDataV2","irRule: OntologyIrLogicRule"],"sources":["../../src/ActionLogicRuleConverter.ts"],"version":3,"file":"ActionLogicRuleConverter.d.ts"}
|
|
@@ -22,8 +22,8 @@ export declare class PreviewOntologyIrConverter {
|
|
|
22
22
|
private static convertObjectTypesWithUuidRids;
|
|
23
23
|
/**
|
|
24
24
|
* Convert IR action types to ActionTypeFullMetadata format.
|
|
25
|
-
*
|
|
25
|
+
* Reuses base converter for action type conversion, then process
|
|
26
|
+
* RIDs to use UUID-based format and adds fullLogicRules.
|
|
26
27
|
*/
|
|
27
28
|
private static convertActionTypesWithFullLogicRules;
|
|
28
|
-
private static convertActionTypeStatus;
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,
|
|
1
|
+
{"mappings":"AAgBA,cAEE,qCACK,uBAAwB;AAC/B,iBAAiB,gBAAgB,0BAA2B;;;;AAQ5D,iBAAiB,oCACP,KAAK,WAAW,sBAAsB,eAChD;CACE,aAAa,eAAe,WAAW;AACxC;;;;;AAMD,OAAO,cAAM,2BAA2B;;;;;CAKtC,OAAO,6BACLA,IAAI,gCACH;;;;CA8BH,eAAe;;;;;;CAkCf,eAAe;AA8BhB","names":["ir: OntologyIrOntologyBlockDataV2"],"sources":["../../src/PreviewOntologyIrConverter.ts"],"version":3,"file":"PreviewOntologyIrConverter.d.ts"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Generate a deterministic UUID from a string.
|
|
3
|
-
* Uses SHA-256 hash truncated to UUID format
|
|
2
|
+
* Generate a deterministic UUID v5-like identifier from a string.
|
|
3
|
+
* Uses SHA-256 hash truncated to UUID format with version (5) and
|
|
4
|
+
* variant (RFC 4122) bits set for spec compliance.
|
|
4
5
|
*/
|
|
5
6
|
export declare function toUuid(str: string): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;AAuBA,OAAO,iBAAS,OAAOA","names":["str: string"],"sources":["../../src/ridUtils.ts"],"version":3,"file":"ridUtils.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/generator-converters.preview",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
|
+
"description": "OSDK generator with support for Python and TSv2 discovered functions",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
@@ -29,18 +29,21 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@osdk/foundry.ontologies": "2.
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"@osdk/
|
|
32
|
+
"@osdk/foundry.ontologies": "2.50.0",
|
|
33
|
+
"consola": "^3.4.2",
|
|
34
|
+
"yargs": "17.7.2",
|
|
35
|
+
"@osdk/client.unstable": "~2.8.0-beta.14",
|
|
36
|
+
"@osdk/generator": "~2.8.0-beta.14",
|
|
37
|
+
"@osdk/generator-converters.ontologyir": "~2.8.0-beta.14"
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"@types/node": "^24.3.1",
|
|
41
|
+
"@types/yargs": "^17.0.33",
|
|
39
42
|
"ts-expect": "^1.3.0",
|
|
40
43
|
"typescript": "~5.5.4",
|
|
41
44
|
"vitest": "^3.2.4",
|
|
42
|
-
"@osdk/monorepo.
|
|
43
|
-
"@osdk/monorepo.
|
|
45
|
+
"@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
|
|
46
|
+
"@osdk/monorepo.tsconfig": "~0.7.0-beta.1"
|
|
44
47
|
},
|
|
45
48
|
"publishConfig": {
|
|
46
49
|
"access": "public"
|