diff --git a/package-lock.json b/package-lock.json index 3c437438..0449ad0f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1684,6 +1684,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/json-bigint": { + "version": "1.0.4", + "resolved": "https://npm-proxy.dev.databricks.com/@types/json-bigint/-/json-bigint-1.0.4.tgz", + "integrity": "sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/node": { "version": "22.19.12", "dev": true, @@ -2175,6 +2182,15 @@ "node": "18 || 20 || >=22" } }, + "node_modules/bignumber.js": { + "version": "9.3.1", + "resolved": "https://npm-proxy.dev.databricks.com/bignumber.js/-/bignumber.js-9.3.1.tgz", + "integrity": "sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==", + "license": "MIT", + "engines": { + "node": "*" + } + }, "node_modules/brace-expansion": { "version": "5.0.6", "dev": true, @@ -2968,6 +2984,15 @@ "version": "4.3.2", "license": "Apache-2.0" }, + "node_modules/json-bigint": { + "version": "1.0.0", + "resolved": "https://npm-proxy.dev.databricks.com/json-bigint/-/json-bigint-1.0.0.tgz", + "integrity": "sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==", + "license": "MIT", + "dependencies": { + "bignumber.js": "^9.0.0" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "dev": true, @@ -3868,6 +3893,7 @@ "os": [ "aix" ], + "peer": true, "engines": { "node": ">=18" } @@ -3885,6 +3911,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3902,6 +3929,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3919,6 +3947,7 @@ "os": [ "android" ], + "peer": true, "engines": { "node": ">=18" } @@ -3936,6 +3965,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=18" } @@ -3953,6 +3983,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": ">=18" } @@ -3970,6 +4001,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -3987,6 +4019,7 @@ "os": [ "freebsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -4004,6 +4037,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4021,6 +4055,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4038,6 +4073,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4055,6 +4091,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4072,6 +4109,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4089,6 +4127,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4106,6 +4145,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4123,6 +4163,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4138,6 +4179,7 @@ "os": [ "linux" ], + "peer": true, "engines": { "node": ">=18" } @@ -4155,6 +4197,7 @@ "os": [ "netbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -4172,6 +4215,7 @@ "os": [ "netbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -4189,6 +4233,7 @@ "os": [ "openbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -4206,6 +4251,7 @@ "os": [ "openbsd" ], + "peer": true, "engines": { "node": ">=18" } @@ -4223,6 +4269,7 @@ "os": [ "openharmony" ], + "peer": true, "engines": { "node": ">=18" } @@ -4240,6 +4287,7 @@ "os": [ "sunos" ], + "peer": true, "engines": { "node": ">=18" } @@ -4257,6 +4305,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -4274,6 +4323,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -4291,6 +4341,7 @@ "os": [ "win32" ], + "peer": true, "engines": { "node": ">=18" } @@ -4346,6 +4397,7 @@ "os": [ "darwin" ], + "peer": true, "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } @@ -4769,6 +4821,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4784,6 +4837,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4815,6 +4869,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4830,6 +4885,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4845,6 +4901,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4871,6 +4928,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4886,6 +4944,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4901,6 +4960,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4916,6 +4976,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4931,6 +4992,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4946,6 +5008,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4961,6 +5024,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4976,6 +5040,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -4991,6 +5056,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5006,6 +5072,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5021,6 +5088,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5036,6 +5104,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5047,8 +5116,12 @@ "version": "0.1.0-dev.1", "license": "Apache-2.0", "dependencies": { + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, + "devDependencies": { + "@types/json-bigint": "^1.0.4" + }, "engines": { "node": ">=22.0.0" } @@ -5062,6 +5135,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5077,6 +5151,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5092,6 +5167,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5122,6 +5198,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5137,6 +5214,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5152,6 +5230,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5167,6 +5246,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5182,6 +5262,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5208,6 +5289,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5223,6 +5305,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5238,6 +5321,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5253,6 +5337,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5268,6 +5353,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5283,6 +5369,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5298,6 +5385,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5313,6 +5401,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5328,6 +5417,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5343,6 +5433,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5358,6 +5449,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5373,6 +5465,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5388,6 +5481,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5418,6 +5512,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5433,6 +5528,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5448,6 +5544,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5463,6 +5560,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5478,6 +5576,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5493,6 +5592,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5508,6 +5608,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5523,6 +5624,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5554,6 +5656,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5569,6 +5672,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5584,6 +5688,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5631,6 +5736,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5646,6 +5752,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5661,6 +5768,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5676,6 +5784,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5691,6 +5800,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5718,6 +5828,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5733,6 +5844,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5748,6 +5860,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5795,6 +5908,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5826,6 +5940,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5841,6 +5956,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5856,6 +5972,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5871,6 +5988,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5886,6 +6004,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5901,6 +6020,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5916,6 +6036,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5931,6 +6052,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5946,6 +6068,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5961,6 +6084,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5976,6 +6100,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -5991,6 +6116,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6006,6 +6132,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6021,6 +6148,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6036,6 +6164,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6051,6 +6180,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6066,6 +6196,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6081,6 +6212,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6096,6 +6228,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6111,6 +6244,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6126,6 +6260,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6141,6 +6276,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6156,6 +6292,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6171,6 +6308,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6186,6 +6324,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6201,6 +6340,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6216,6 +6356,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6247,6 +6388,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { @@ -6262,6 +6404,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/abacpolicies/package.json b/packages/abacpolicies/package.json index 015eddac..3b01df14 100644 --- a/packages/abacpolicies/package.json +++ b/packages/abacpolicies/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/abacpolicies/src/v1/client.ts b/packages/abacpolicies/src/v1/client.ts index 5a5055e7..8395d1e2 100644 --- a/packages/abacpolicies/src/v1/client.ts +++ b/packages/abacpolicies/src/v1/client.ts @@ -36,7 +36,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -63,7 +63,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/abacpolicies/src/v1/model.ts b/packages/abacpolicies/src/v1/model.ts index e9ec6448..5250fe12 100644 --- a/packages/abacpolicies/src/v1/model.ts +++ b/packages/abacpolicies/src/v1/model.ts @@ -203,11 +203,11 @@ export interface PolicyInfo { */ matchColumns?: MatchColumn[] | undefined; /** Time at which the policy was created, in epoch milliseconds. Output only. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of the user who created the policy. Output only. */ createdBy?: string | undefined; /** Time at which the policy was last modified, in epoch milliseconds. Output only. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of the user who last modified the policy. Output only. */ updatedBy?: string | undefined; } @@ -318,9 +318,15 @@ export const unmarshalPolicyInfoSchema: z.ZodType = z row_filter: z.lazy(() => unmarshalRowFilterOptionsSchema).optional(), column_mask: z.lazy(() => unmarshalColumnMaskOptionsSchema).optional(), match_columns: z.array(z.lazy(() => unmarshalMatchColumnSchema)).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), }) .transform(d => ({ @@ -418,9 +424,9 @@ export const marshalPolicyInfoSchema: z.ZodType = z ]) .optional(), matchColumns: z.array(z.lazy(() => marshalMatchColumnSchema)).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), }) .transform(d => ({ diff --git a/packages/abacpolicies/src/v1/utils.ts b/packages/abacpolicies/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/abacpolicies/src/v1/utils.ts +++ b/packages/abacpolicies/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/accessmanagement/package.json b/packages/accessmanagement/package.json index 845b1fdf..5d301679 100644 --- a/packages/accessmanagement/package.json +++ b/packages/accessmanagement/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/accessmanagement/src/v1/client.ts b/packages/accessmanagement/src/v1/client.ts index 32111250..ef9f0c9b 100644 --- a/packages/accessmanagement/src/v1/client.ts +++ b/packages/accessmanagement/src/v1/client.ts @@ -62,7 +62,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -93,7 +93,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/accessmanagement/src/v1/model.ts b/packages/accessmanagement/src/v1/model.ts index dff9bdbd..13b47fa2 100644 --- a/packages/accessmanagement/src/v1/model.ts +++ b/packages/accessmanagement/src/v1/model.ts @@ -93,7 +93,7 @@ export interface AccessControlResponse { * group can be a principal of a permission set assignment but an actor is always a user or a service principal */ export interface Actor { - kind?: {$case: 'actorId'; actorId: number} | undefined; + kind?: {$case: 'actorId'; actorId: bigint} | undefined; } export interface CheckPolicyRequest { @@ -123,9 +123,9 @@ export interface DeleteWorkspacePermissionAssignmentRequest { /** The account ID. */ accountId?: string | undefined; /** The workspace ID for the account. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The ID of the user, service principal, or group. */ - principalId?: number | undefined; + principalId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. @@ -204,7 +204,7 @@ export interface GetWorkspacePermissionAssignmentsRequest { /** The account ID. */ accountId?: string | undefined; /** The workspace ID for the account. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -232,7 +232,7 @@ export interface ListWorkspacePermissionsRequest { /** The account ID. */ accountId?: string | undefined; /** The workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -284,7 +284,7 @@ export interface PrincipalOutput { } | undefined; /** The unique, opaque id of the principal. */ - principalId?: number | undefined; + principalId?: bigint | undefined; /** The display name of the principal. */ displayName?: string | undefined; } @@ -363,9 +363,9 @@ export interface UpdateWorkspacePermissionAssignmentRequest { /** The account ID. */ accountId?: string | undefined; /** The workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The ID of the user, service principal, or group. */ - principalId?: number | undefined; + principalId?: bigint | undefined; /** * Array of permissions assignments to update on the workspace. * Valid values are "USER" and "ADMIN" (case-sensitive). @@ -549,7 +549,10 @@ export const unmarshalPrincipalOutputSchema: z.ZodType = z user_name: z.string().optional(), group_name: z.string().optional(), service_principal_name: z.string().optional(), - principal_id: z.number().optional(), + principal_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), display_name: z.string().optional(), }) .transform(d => ({ @@ -632,7 +635,7 @@ export const marshalActorSchema: z.ZodType = z .object({ kind: z .discriminatedUnion('$case', [ - z.object({$case: z.literal('actorId'), actorId: z.number()}), + z.object({$case: z.literal('actorId'), actorId: z.bigint()}), ]) .optional(), }) @@ -726,8 +729,8 @@ export const marshalUpdateWorkspacePermissionAssignmentRequestSchema: z.ZodType z .object({ accountId: z.string().optional(), - workspaceId: z.number().optional(), - principalId: z.number().optional(), + workspaceId: z.bigint().optional(), + principalId: z.bigint().optional(), permissions: z.array(z.enum(WorkspacePermission)).optional(), }) .transform(d => ({ diff --git a/packages/accessmanagement/src/v1/utils.ts b/packages/accessmanagement/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/accessmanagement/src/v1/utils.ts +++ b/packages/accessmanagement/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/alerts/package.json b/packages/alerts/package.json index 2e873697..51dc1ecd 100644 --- a/packages/alerts/package.json +++ b/packages/alerts/package.json @@ -36,6 +36,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/alerts/src/v1/client.ts b/packages/alerts/src/v1/client.ts index 460c3a62..22c2049a 100644 --- a/packages/alerts/src/v1/client.ts +++ b/packages/alerts/src/v1/client.ts @@ -38,7 +38,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/alerts/src/v1/utils.ts b/packages/alerts/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/alerts/src/v1/utils.ts +++ b/packages/alerts/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/alerts/src/v2/client.ts b/packages/alerts/src/v2/client.ts index 56fc6346..4fc38772 100644 --- a/packages/alerts/src/v2/client.ts +++ b/packages/alerts/src/v2/client.ts @@ -36,7 +36,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -63,7 +63,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/alerts/src/v2/utils.ts b/packages/alerts/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/alerts/src/v2/utils.ts +++ b/packages/alerts/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/apps/package.json b/packages/apps/package.json index eb8d9b7e..d631b99f 100644 --- a/packages/apps/package.json +++ b/packages/apps/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/apps/src/v1/client.ts b/packages/apps/src/v1/client.ts index 116b07dc..183c05e0 100644 --- a/packages/apps/src/v1/client.ts +++ b/packages/apps/src/v1/client.ts @@ -86,7 +86,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -115,7 +115,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/apps/src/v1/model.ts b/packages/apps/src/v1/model.ts index c16ad90e..73b5330f 100644 --- a/packages/apps/src/v1/model.ts +++ b/packages/apps/src/v1/model.ts @@ -741,7 +741,7 @@ export interface App { pendingDeployment?: AppDeployment | undefined; /** Resources for the app. */ resources?: AppResource[] | undefined; - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; servicePrincipalName?: string | undefined; /** * The default workspace file system path of the source code from which app deployment are @@ -1338,7 +1338,7 @@ export interface Space { /** The effective api scopes granted to the user access token. */ effectiveUserApiScopes?: string[] | undefined; /** The service principal ID for the app space. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The service principal name for the app space. */ servicePrincipalName?: string | undefined; /** The service principal client ID for the app space. */ @@ -1437,7 +1437,10 @@ export const unmarshalAppSchema: z.ZodType = z updater: z.string().optional(), pending_deployment: z.lazy(() => unmarshalAppDeploymentSchema).optional(), resources: z.array(z.lazy(() => unmarshalAppResourceSchema)).optional(), - service_principal_id: z.number().optional(), + service_principal_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), service_principal_name: z.string().optional(), default_source_code_path: z.string().optional(), budget_policy_id: z.string().optional(), @@ -2120,7 +2123,10 @@ export const unmarshalSpaceSchema: z.ZodType = z resources: z.array(z.lazy(() => unmarshalAppResourceSchema)).optional(), user_api_scopes: z.array(z.string()).optional(), effective_user_api_scopes: z.array(z.string()).optional(), - service_principal_id: z.number().optional(), + service_principal_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), service_principal_name: z.string().optional(), service_principal_client_id: z.string().optional(), usage_policy_id: z.string().optional(), @@ -2225,7 +2231,7 @@ export const marshalAppSchema: z.ZodType = z updater: z.string().optional(), pendingDeployment: z.lazy(() => marshalAppDeploymentSchema).optional(), resources: z.array(z.lazy(() => marshalAppResourceSchema)).optional(), - servicePrincipalId: z.number().optional(), + servicePrincipalId: z.bigint().optional(), servicePrincipalName: z.string().optional(), defaultSourceCodePath: z.string().optional(), budgetPolicyId: z.string().optional(), @@ -2818,7 +2824,7 @@ export const marshalSpaceSchema: z.ZodType = z resources: z.array(z.lazy(() => marshalAppResourceSchema)).optional(), userApiScopes: z.array(z.string()).optional(), effectiveUserApiScopes: z.array(z.string()).optional(), - servicePrincipalId: z.number().optional(), + servicePrincipalId: z.bigint().optional(), servicePrincipalName: z.string().optional(), servicePrincipalClientId: z.string().optional(), usagePolicyId: z.string().optional(), diff --git a/packages/apps/src/v1/utils.ts b/packages/apps/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/apps/src/v1/utils.ts +++ b/packages/apps/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/artifactallowlists/package.json b/packages/artifactallowlists/package.json index edd50ab6..09e4aa8f 100644 --- a/packages/artifactallowlists/package.json +++ b/packages/artifactallowlists/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/artifactallowlists/src/v1/client.ts b/packages/artifactallowlists/src/v1/client.ts index 4a955f2a..b3bcd2dd 100644 --- a/packages/artifactallowlists/src/v1/client.ts +++ b/packages/artifactallowlists/src/v1/client.ts @@ -29,7 +29,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -56,7 +56,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/artifactallowlists/src/v1/model.ts b/packages/artifactallowlists/src/v1/model.ts index 5fdd58f3..5cf3c4ce 100644 --- a/packages/artifactallowlists/src/v1/model.ts +++ b/packages/artifactallowlists/src/v1/model.ts @@ -26,7 +26,7 @@ export interface ArtifactAllowlistInfo { /** Username of the user who set the artifact allowlist. */ createdBy?: string | undefined; /** Time at which this artifact allowlist was set, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; } export interface ArtifactMatcher { @@ -51,7 +51,7 @@ export interface SetArtifactAllowlistRequest { /** Username of the user who set the artifact allowlist. */ createdBy?: string | undefined; /** Time at which this artifact allowlist was set, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; } export const unmarshalArtifactAllowlistInfoSchema: z.ZodType = @@ -62,7 +62,10 @@ export const unmarshalArtifactAllowlistInfoSchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ artifactMatchers: d.artifact_matchers, @@ -99,7 +102,7 @@ export const marshalSetArtifactAllowlistRequestSchema: z.ZodType = z .optional(), metastoreId: z.string().optional(), createdBy: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), }) .transform(d => ({ artifact_type: d.artifactType, diff --git a/packages/artifactallowlists/src/v1/utils.ts b/packages/artifactallowlists/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/artifactallowlists/src/v1/utils.ts +++ b/packages/artifactallowlists/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/authentication/package.json b/packages/authentication/package.json index 9fe73f1b..8d364b72 100644 --- a/packages/authentication/package.json +++ b/packages/authentication/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/authentication/src/v1/client.ts b/packages/authentication/src/v1/client.ts index 49f1c28f..cb58de1d 100644 --- a/packages/authentication/src/v1/client.ts +++ b/packages/authentication/src/v1/client.ts @@ -50,7 +50,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -76,7 +76,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/authentication/src/v1/model.ts b/packages/authentication/src/v1/model.ts index 15860f3b..05767381 100644 --- a/packages/authentication/src/v1/model.ts +++ b/packages/authentication/src/v1/model.ts @@ -9,7 +9,7 @@ export interface CreateAccountFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** * The identifier for the federation policy. The identifier must contain only lowercase * alphanumeric characters, numbers, hyphens, and slashes. If unspecified, the id will be @@ -23,7 +23,7 @@ export interface CreateServicePrincipalFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** * The identifier for the federation policy. The identifier must contain only lowercase * alphanumeric characters, numbers, hyphens, and slashes. If unspecified, the id will be @@ -63,7 +63,7 @@ export interface DeleteAccountFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; } @@ -72,7 +72,7 @@ export interface DeleteServicePrincipalFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; } @@ -109,7 +109,7 @@ export interface FederationPolicy { /** Unique, immutable id of the federation policy. */ uid?: string | undefined; /** The service principal ID that this federation policy applies to. Output only. Only set for service principal federation policies. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The ID of the federation policy. Output only. */ policyId?: string | undefined; } @@ -118,7 +118,7 @@ export interface GetAccountFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; } @@ -127,7 +127,7 @@ export interface GetServicePrincipalFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; } @@ -136,7 +136,7 @@ export interface ListAccountFederationPoliciesRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; pageSize?: number | undefined; pageToken?: string | undefined; } @@ -150,7 +150,7 @@ export interface ListServicePrincipalFederationPoliciesRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; pageSize?: number | undefined; pageToken?: string | undefined; } @@ -240,7 +240,7 @@ export interface UpdateAccountFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; policy?: FederationPolicy | undefined; @@ -258,7 +258,7 @@ export interface UpdateServicePrincipalFederationPolicyRequest { /** The account id for the federation policy. */ accountId?: string | undefined; /** The service principal id for the federation policy. */ - servicePrincipalId?: number | undefined; + servicePrincipalId?: bigint | undefined; /** The identifier for the federation policy. */ policyId?: string | undefined; policy?: FederationPolicy | undefined; @@ -314,7 +314,10 @@ export const unmarshalFederationPolicySchema: z.ZodType = z .transform(s => Temporal.Instant.from(s)) .optional(), uid: z.string().optional(), - service_principal_id: z.number().optional(), + service_principal_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), policy_id: z.string().optional(), }) .transform(d => ({ @@ -437,7 +440,7 @@ export const marshalFederationPolicySchema: z.ZodType = z .transform((d: Temporal.Instant) => d.toString()) .optional(), uid: z.string().optional(), - servicePrincipalId: z.number().optional(), + servicePrincipalId: z.bigint().optional(), policyId: z.string().optional(), }) .transform(d => ({ diff --git a/packages/authentication/src/v1/utils.ts b/packages/authentication/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/authentication/src/v1/utils.ts +++ b/packages/authentication/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/billableusagedownload/package.json b/packages/billableusagedownload/package.json index a496c298..f6cda542 100644 --- a/packages/billableusagedownload/package.json +++ b/packages/billableusagedownload/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/billableusagedownload/src/v1/client.ts b/packages/billableusagedownload/src/v1/client.ts index 24107315..4a088038 100644 --- a/packages/billableusagedownload/src/v1/client.ts +++ b/packages/billableusagedownload/src/v1/client.ts @@ -15,7 +15,7 @@ import type {DownloadRequest, DownloadResponse} from './model'; // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -41,7 +41,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/billableusagedownload/src/v1/utils.ts b/packages/billableusagedownload/src/v1/utils.ts index f5464ff7..5d8bed31 100644 --- a/packages/billableusagedownload/src/v1/utils.ts +++ b/packages/billableusagedownload/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/budgetpolicy/package.json b/packages/budgetpolicy/package.json index ce98f251..c3964dfa 100644 --- a/packages/budgetpolicy/package.json +++ b/packages/budgetpolicy/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/budgetpolicy/src/v1/client.ts b/packages/budgetpolicy/src/v1/client.ts index 69b0b297..ce142eda 100644 --- a/packages/budgetpolicy/src/v1/client.ts +++ b/packages/budgetpolicy/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/budgetpolicy/src/v1/model.ts b/packages/budgetpolicy/src/v1/model.ts index face6920..7de76f8b 100644 --- a/packages/budgetpolicy/src/v1/model.ts +++ b/packages/budgetpolicy/src/v1/model.ts @@ -27,7 +27,7 @@ export interface BudgetPolicy { * List of workspaces that this budget policy will be exclusively bound to. * An empty binding implies that this budget policy is open to any workspace in the account. */ - bindingWorkspaceIds?: number[] | undefined; + bindingWorkspaceIds?: bigint[] | undefined; } /** A request to create a BudgetPolicy. */ @@ -82,7 +82,7 @@ export interface Filter { * The policy creator user id to be filtered on. * If unspecified, all policies will be returned. */ - creatorUserId?: number | undefined; + creatorUserId?: bigint | undefined; /** * The policy creator user name to be filtered on. * If unspecified, all policies will be returned. @@ -172,7 +172,9 @@ export const unmarshalBudgetPolicySchema: z.ZodType = z custom_tags: z .array(z.lazy(() => unmarshalCustomPolicyTagSchema)) .optional(), - binding_workspace_ids: z.array(z.number()).optional(), + binding_workspace_ids: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ policyId: d.policy_id, @@ -209,7 +211,7 @@ export const marshalBudgetPolicySchema: z.ZodType = z policyId: z.string().optional(), policyName: z.string().optional(), customTags: z.array(z.lazy(() => marshalCustomPolicyTagSchema)).optional(), - bindingWorkspaceIds: z.array(z.number()).optional(), + bindingWorkspaceIds: z.array(z.bigint()).optional(), }) .transform(d => ({ policy_id: d.policyId, @@ -243,7 +245,7 @@ export const marshalCustomPolicyTagSchema: z.ZodType = z export const marshalFilterSchema: z.ZodType = z .object({ policyName: z.string().optional(), - creatorUserId: z.number().optional(), + creatorUserId: z.bigint().optional(), creatorUserName: z.string().optional(), }) .transform(d => ({ diff --git a/packages/budgetpolicy/src/v1/utils.ts b/packages/budgetpolicy/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/budgetpolicy/src/v1/utils.ts +++ b/packages/budgetpolicy/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/budgets/package.json b/packages/budgets/package.json index 249539f5..cc518a68 100644 --- a/packages/budgets/package.json +++ b/packages/budgets/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/budgets/src/v1/client.ts b/packages/budgets/src/v1/client.ts index 7924338a..cbab991e 100644 --- a/packages/budgets/src/v1/client.ts +++ b/packages/budgets/src/v1/client.ts @@ -42,7 +42,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -68,7 +68,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/budgets/src/v1/model.ts b/packages/budgets/src/v1/model.ts index 6094e92a..78b08935 100644 --- a/packages/budgets/src/v1/model.ts +++ b/packages/budgets/src/v1/model.ts @@ -54,9 +54,9 @@ export interface BudgetConfiguration { /** account ID. */ accountId?: string | undefined; /** Creation time of this budget configuration. */ - createTime?: number | undefined; + createTime?: bigint | undefined; /** Update time of this budget configuration. */ - updateTime?: number | undefined; + updateTime?: bigint | undefined; /** Alerts to configure when this budget is in a triggered state. Budgets must have exactly one alert configuration. */ alertConfigurations?: AlertConfiguration[] | undefined; /** @@ -93,7 +93,7 @@ export interface BudgetConfigurationFilter_TagClause { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface BudgetConfigurationFilter_WorkspaceIdClause { operator?: BudgetConfigurationFilter_Operator | undefined; - values?: number[] | undefined; + values?: bigint[] | undefined; } export interface CreateBudgetConfigurationBudget { @@ -102,9 +102,9 @@ export interface CreateBudgetConfigurationBudget { /** account ID. */ accountId?: string | undefined; /** Creation time of this budget configuration. */ - createTime?: number | undefined; + createTime?: bigint | undefined; /** Update time of this budget configuration. */ - updateTime?: number | undefined; + updateTime?: bigint | undefined; /** Alerts to configure when this budget is in a triggered state. Budgets must have exactly one alert configuration. */ alertConfigurations?: AlertConfiguration[] | undefined; /** @@ -179,9 +179,9 @@ export interface UpdateBudgetConfigurationBudget { /** account ID. */ accountId?: string | undefined; /** Creation time of this budget configuration. */ - createTime?: number | undefined; + createTime?: bigint | undefined; /** Update time of this budget configuration. */ - updateTime?: number | undefined; + updateTime?: bigint | undefined; /** Alerts to configure when this budget is in a triggered state. Budgets must have exactly one alert configuration. */ alertConfigurations?: AlertConfiguration[] | undefined; /** @@ -245,8 +245,14 @@ export const unmarshalBudgetConfigurationSchema: z.ZodType .object({ budget_configuration_id: z.string().optional(), account_id: z.string().optional(), - create_time: z.number().optional(), - update_time: z.number().optional(), + create_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + update_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), alert_configurations: z .array(z.lazy(() => unmarshalAlertConfigurationSchema)) .optional(), @@ -309,7 +315,9 @@ export const unmarshalBudgetConfigurationFilter_WorkspaceIdClauseSchema: z.ZodTy z .object({ operator: z.enum(BudgetConfigurationFilter_Operator).optional(), - values: z.array(z.number()).optional(), + values: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ operator: d.operator, @@ -439,7 +447,7 @@ export const marshalBudgetConfigurationFilter_WorkspaceIdClauseSchema: z.ZodType z .object({ operator: z.enum(BudgetConfigurationFilter_Operator).optional(), - values: z.array(z.number()).optional(), + values: z.array(z.bigint()).optional(), }) .transform(d => ({ operator: d.operator, @@ -450,8 +458,8 @@ export const marshalCreateBudgetConfigurationBudgetSchema: z.ZodType = z .object({ budgetConfigurationId: z.string().optional(), accountId: z.string().optional(), - createTime: z.number().optional(), - updateTime: z.number().optional(), + createTime: z.bigint().optional(), + updateTime: z.bigint().optional(), alertConfigurations: z .array(z.lazy(() => marshalAlertConfigurationSchema)) .optional(), @@ -482,8 +490,8 @@ export const marshalUpdateBudgetConfigurationBudgetSchema: z.ZodType = z .object({ budgetConfigurationId: z.string().optional(), accountId: z.string().optional(), - createTime: z.number().optional(), - updateTime: z.number().optional(), + createTime: z.bigint().optional(), + updateTime: z.bigint().optional(), alertConfigurations: z .array(z.lazy(() => marshalAlertConfigurationSchema)) .optional(), diff --git a/packages/budgets/src/v1/utils.ts b/packages/budgets/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/budgets/src/v1/utils.ts +++ b/packages/budgets/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/bundle/package.json b/packages/bundle/package.json index 049629bf..60e11baf 100644 --- a/packages/bundle/package.json +++ b/packages/bundle/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/bundle/src/v1/client.ts b/packages/bundle/src/v1/client.ts index 4cb01f72..aa99db85 100644 --- a/packages/bundle/src/v1/client.ts +++ b/packages/bundle/src/v1/client.ts @@ -61,7 +61,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -88,7 +88,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/bundle/src/v1/utils.ts b/packages/bundle/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/bundle/src/v1/utils.ts +++ b/packages/bundle/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/catalogs/package.json b/packages/catalogs/package.json index debe7803..40ec6d08 100644 --- a/packages/catalogs/package.json +++ b/packages/catalogs/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/catalogs/src/v1/client.ts b/packages/catalogs/src/v1/client.ts index 07f1265f..9d71a6d8 100644 --- a/packages/catalogs/src/v1/client.ts +++ b/packages/catalogs/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/catalogs/src/v1/model.ts b/packages/catalogs/src/v1/model.ts index 46a07fcc..3c5fb133 100644 --- a/packages/catalogs/src/v1/model.ts +++ b/packages/catalogs/src/v1/model.ts @@ -81,11 +81,11 @@ export interface CatalogInfo { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this catalog was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of catalog creator. */ createdBy?: string | undefined; /** Time at which this catalog was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified catalog. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for managed tables within catalog. */ @@ -146,11 +146,11 @@ export interface CreateCatalogRequest { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this catalog was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of catalog creator. */ createdBy?: string | undefined; /** Time at which this catalog was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified catalog. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for managed tables within catalog. */ @@ -293,11 +293,11 @@ export interface UpdateCatalogRequest { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this catalog was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of catalog creator. */ createdBy?: string | undefined; /** Time at which this catalog was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified catalog. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for managed tables within catalog. */ @@ -358,9 +358,15 @@ export const unmarshalCatalogInfoSchema: z.ZodType = z share_name: z.string().optional(), connection_name: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), storage_location: z.string().optional(), isolation_mode: z.enum(CatalogIsolationMode).optional(), @@ -481,9 +487,9 @@ export const marshalCreateCatalogRequestSchema: z.ZodType = z shareName: z.string().optional(), connectionName: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageLocation: z.string().optional(), isolationMode: z.enum(CatalogIsolationMode).optional(), @@ -576,9 +582,9 @@ export const marshalUpdateCatalogRequestSchema: z.ZodType = z shareName: z.string().optional(), connectionName: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageLocation: z.string().optional(), isolationMode: z.enum(CatalogIsolationMode).optional(), diff --git a/packages/catalogs/src/v1/utils.ts b/packages/catalogs/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/catalogs/src/v1/utils.ts +++ b/packages/catalogs/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/cleanrooms/package.json b/packages/cleanrooms/package.json index 10a42af7..2f37c045 100644 --- a/packages/cleanrooms/package.json +++ b/packages/cleanrooms/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/cleanrooms/src/v1/client.ts b/packages/cleanrooms/src/v1/client.ts index 575bc2a1..2cd377aa 100644 --- a/packages/cleanrooms/src/v1/client.ts +++ b/packages/cleanrooms/src/v1/client.ts @@ -76,7 +76,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -105,7 +105,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/cleanrooms/src/v1/model.ts b/packages/cleanrooms/src/v1/model.ts index 831328ff..2c63b3b9 100644 --- a/packages/cleanrooms/src/v1/model.ts +++ b/packages/cleanrooms/src/v1/model.ts @@ -255,9 +255,9 @@ export interface CleanRoom { owner?: string | undefined; comment?: string | undefined; /** When the clean room was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** When the clean room was last updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Clean room status. */ status?: CleanRoom_Status_Enum | undefined; /** The alias of the collaborator tied to the local clean room. */ @@ -295,7 +295,7 @@ export interface CleanRoomAsset { /** The type of the asset. */ assetType?: CleanRoomAsset_AssetType | undefined; /** When the asset is added to the clean room, in epoch milliseconds. */ - addedAt?: number | undefined; + addedAt?: bigint | undefined; /** Status of the asset */ status?: CleanRoomAsset_Status_Enum | undefined; /** The alias of the collaborator who owns this asset */ @@ -483,7 +483,7 @@ export interface CleanRoomAutoApprovalRule { } | undefined; /** Timestamp of when the rule was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; } /** Publicly visible clean room collaborator. */ @@ -500,7 +500,7 @@ export interface CleanRoomCollaborator { * invite_recipient_email is specified. * It should be empty when the collaborator is the creator of the clean room. */ - inviteRecipientWorkspaceId?: number | undefined; + inviteRecipientWorkspaceId?: bigint | undefined; /** * Email of the user who is receiving the clean room "invitation". It should be empty * for the creator of the clean room, and non-empty for the invitees of the clean room. @@ -525,7 +525,7 @@ export interface CleanRoomNotebookReview { /** Collaborator alias of the reviewer */ reviewerCollaboratorAlias?: string | undefined; /** When the review was submitted, in epoch milliseconds */ - createdAtMillis?: number | undefined; + createdAtMillis?: bigint | undefined; /** Review outcome */ reviewState?: CleanRoomNotebookReview_NotebookReviewState | undefined; /** Review comment */ @@ -539,9 +539,9 @@ export interface CleanRoomNotebookTaskRun { /** Asset name of the notebook executed in this task run. */ notebookName?: string | undefined; /** When the task run started, in epoch milliseconds. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** Duration of the task run, in milliseconds. */ - runDuration?: number | undefined; + runDuration?: bigint | undefined; /** State of the task run. */ notebookJobRunState?: CleanRoomTaskRunState | undefined; /** @@ -554,11 +554,11 @@ export interface CleanRoomNotebookTaskRun { /** Name of the output schema associated with the clean rooms notebook task run. */ outputSchemaName?: string | undefined; /** Expiration time of the output schema of the task run (if any), in epoch milliseconds. */ - outputSchemaExpirationTime?: number | undefined; + outputSchemaExpirationTime?: bigint | undefined; /** Etag of the notebook executed in this task run, used to identify the notebook version. */ notebookEtag?: string | undefined; /** The timestamp of when the notebook was last updated. */ - notebookUpdatedAt?: number | undefined; + notebookUpdatedAt?: bigint | undefined; } export interface CleanRoomOutputCatalog { @@ -605,13 +605,13 @@ export interface CleanRoomTaskRunState { export interface CollaboratorJobRunInfo { /** Job ID of the task run in the collaborator's workspace. */ - collaboratorJobId?: number | undefined; + collaboratorJobId?: bigint | undefined; /** Job run ID of the task run in the collaborator's workspace. */ - collaboratorJobRunId?: number | undefined; + collaboratorJobRunId?: bigint | undefined; /** Task run ID of the task run in the collaborator's workspace. */ - collaboratorTaskRunId?: number | undefined; + collaboratorTaskRunId?: bigint | undefined; /** ID of the collaborator's workspace that triggered the task run. */ - collaboratorWorkspaceId?: number | undefined; + collaboratorWorkspaceId?: bigint | undefined; /** Alias of the collaborator that triggered the task run. */ collaboratorAlias?: string | undefined; } @@ -1018,8 +1018,14 @@ export const unmarshalCleanRoomSchema: z.ZodType = z .optional(), owner: z.string().optional(), comment: z.string().optional(), - created_at: z.number().optional(), - updated_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), status: z.enum(CleanRoom_Status_Enum).optional(), local_collaborator_alias: z.string().optional(), output_catalog: z @@ -1045,7 +1051,10 @@ export const unmarshalCleanRoomAssetSchema: z.ZodType = z clean_room_name: z.string().optional(), name: z.string().optional(), asset_type: z.enum(CleanRoomAsset_AssetType).optional(), - added_at: z.number().optional(), + added_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), status: z.enum(CleanRoomAsset_Status_Enum).optional(), owner_collaborator_alias: z.string().optional(), table_local_details: z @@ -1213,7 +1222,10 @@ export const unmarshalCleanRoomAutoApprovalRuleSchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ cleanRoomName: d.clean_room_name, @@ -1243,7 +1255,10 @@ export const unmarshalCleanRoomCollaboratorSchema: z.ZodType BigInt(v)) + .optional(), invite_recipient_email: z.string().optional(), collaborator_alias: z.string().optional(), display_name: z.string().optional(), @@ -1261,7 +1276,10 @@ export const unmarshalCleanRoomNotebookReviewSchema: z.ZodType BigInt(v)) + .optional(), review_state: z .enum(CleanRoomNotebookReview_NotebookReviewState) .optional(), @@ -1282,8 +1300,14 @@ export const unmarshalCleanRoomNotebookTaskRunSchema: z.ZodType BigInt(v)) + .optional(), + run_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), notebook_job_run_state: z .lazy(() => unmarshalCleanRoomTaskRunStateSchema) .optional(), @@ -1291,9 +1315,15 @@ export const unmarshalCleanRoomNotebookTaskRunSchema: z.ZodType unmarshalCollaboratorJobRunInfoSchema) .optional(), output_schema_name: z.string().optional(), - output_schema_expiration_time: z.number().optional(), + output_schema_expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), notebook_etag: z.string().optional(), - notebook_updated_at: z.number().optional(), + notebook_updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ notebookName: d.notebook_name, @@ -1359,10 +1389,22 @@ export const unmarshalCleanRoomTaskRunStateSchema: z.ZodType = z .object({ - collaborator_job_id: z.number().optional(), - collaborator_job_run_id: z.number().optional(), - collaborator_task_run_id: z.number().optional(), - collaborator_workspace_id: z.number().optional(), + collaborator_job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + collaborator_job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + collaborator_task_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + collaborator_workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), collaborator_alias: z.string().optional(), }) .transform(d => ({ @@ -1701,8 +1743,8 @@ export const marshalCleanRoomSchema: z.ZodType = z .optional(), owner: z.string().optional(), comment: z.string().optional(), - createdAt: z.number().optional(), - updatedAt: z.number().optional(), + createdAt: z.bigint().optional(), + updatedAt: z.bigint().optional(), status: z.enum(CleanRoom_Status_Enum).optional(), localCollaboratorAlias: z.string().optional(), outputCatalog: z.lazy(() => marshalCleanRoomOutputCatalogSchema).optional(), @@ -1726,7 +1768,7 @@ export const marshalCleanRoomAssetSchema: z.ZodType = z cleanRoomName: z.string().optional(), name: z.string().optional(), assetType: z.enum(CleanRoomAsset_AssetType).optional(), - addedAt: z.number().optional(), + addedAt: z.bigint().optional(), status: z.enum(CleanRoomAsset_Status_Enum).optional(), ownerCollaboratorAlias: z.string().optional(), localDetails: z @@ -1916,7 +1958,7 @@ export const marshalCleanRoomAutoApprovalRuleSchema: z.ZodType = z }), ]) .optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), }) .transform(d => ({ clean_room_name: d.cleanRoomName, @@ -1938,7 +1980,7 @@ export const marshalCleanRoomCollaboratorSchema: z.ZodType = z .object({ globalMetastoreId: z.string().optional(), organizationName: z.string().optional(), - inviteRecipientWorkspaceId: z.number().optional(), + inviteRecipientWorkspaceId: z.bigint().optional(), inviteRecipientEmail: z.string().optional(), collaboratorAlias: z.string().optional(), displayName: z.string().optional(), @@ -1955,7 +1997,7 @@ export const marshalCleanRoomCollaboratorSchema: z.ZodType = z export const marshalCleanRoomNotebookReviewSchema: z.ZodType = z .object({ reviewerCollaboratorAlias: z.string().optional(), - createdAtMillis: z.number().optional(), + createdAtMillis: z.bigint().optional(), reviewState: z.enum(CleanRoomNotebookReview_NotebookReviewState).optional(), comment: z.string().optional(), reviewSubReason: z diff --git a/packages/cleanrooms/src/v1/utils.ts b/packages/cleanrooms/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/cleanrooms/src/v1/utils.ts +++ b/packages/cleanrooms/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/clusterlibraries/package.json b/packages/clusterlibraries/package.json index f0e7b5e0..3f27e91b 100644 --- a/packages/clusterlibraries/package.json +++ b/packages/clusterlibraries/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/clusterlibraries/src/v2/client.ts b/packages/clusterlibraries/src/v2/client.ts index 954c5c09..6ba0edcf 100644 --- a/packages/clusterlibraries/src/v2/client.ts +++ b/packages/clusterlibraries/src/v2/client.ts @@ -38,7 +38,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/clusterlibraries/src/v2/utils.ts b/packages/clusterlibraries/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/clusterlibraries/src/v2/utils.ts +++ b/packages/clusterlibraries/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/clusterpolicies/package.json b/packages/clusterpolicies/package.json index 528ed556..933ae526 100644 --- a/packages/clusterpolicies/package.json +++ b/packages/clusterpolicies/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/clusterpolicies/src/v2/client.ts b/packages/clusterpolicies/src/v2/client.ts index d1eb8b72..b0d0b440 100644 --- a/packages/clusterpolicies/src/v2/client.ts +++ b/packages/clusterpolicies/src/v2/client.ts @@ -42,7 +42,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -69,7 +69,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/clusterpolicies/src/v2/model.ts b/packages/clusterpolicies/src/v2/model.ts index 7289bd09..0c95f073 100644 --- a/packages/clusterpolicies/src/v2/model.ts +++ b/packages/clusterpolicies/src/v2/model.ts @@ -41,7 +41,7 @@ export interface CreatePolicyRequest { */ policyFamilyDefinitionOverrides?: string | undefined; /** Max number of clusters per user that can be active using this policy. If not present, there is no max limit. */ - maxClustersPerUser?: number | undefined; + maxClustersPerUser?: bigint | undefined; /** A list of libraries to be installed on the next cluster restart that uses this policy. The maximum number of libraries is 500. */ libraries?: Library[] | undefined; } @@ -89,7 +89,7 @@ export interface EditPolicyRequest { */ policyFamilyDefinitionOverrides?: string | undefined; /** Max number of clusters per user that can be active using this policy. If not present, there is no max limit. */ - maxClustersPerUser?: number | undefined; + maxClustersPerUser?: bigint | undefined; /** A list of libraries to be installed on the next cluster restart that uses this policy. The maximum number of libraries is 500. */ libraries?: Library[] | undefined; } @@ -211,7 +211,7 @@ export interface Policy { */ creatorUserName?: string | undefined; /** Creation time. The timestamp (in millisecond) when this Cluster Policy was created. */ - createdAtTimestamp?: number | undefined; + createdAtTimestamp?: bigint | undefined; /** * If true, policy is a default policy created and managed by . * Default policies cannot be deleted, and their policy families cannot be changed. @@ -243,7 +243,7 @@ export interface Policy { */ policyFamilyDefinitionOverrides?: string | undefined; /** Max number of clusters per user that can be active using this policy. If not present, there is no max limit. */ - maxClustersPerUser?: number | undefined; + maxClustersPerUser?: bigint | undefined; /** A list of libraries to be installed on the next cluster restart that uses this policy. The maximum number of libraries is 500. */ libraries?: Library[] | undefined; } @@ -344,14 +344,20 @@ export const unmarshalPolicySchema: z.ZodType = z .object({ policy_id: z.string().optional(), creator_user_name: z.string().optional(), - created_at_timestamp: z.number().optional(), + created_at_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), is_default: z.boolean().optional(), name: z.string().optional(), definition: z.string().optional(), description: z.string().optional(), policy_family_id: z.string().optional(), policy_family_definition_overrides: z.string().optional(), - max_clusters_per_user: z.number().optional(), + max_clusters_per_user: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), libraries: z.array(z.lazy(() => unmarshalLibrarySchema)).optional(), }) .transform(d => ({ @@ -395,7 +401,7 @@ export const marshalCreatePolicyRequestSchema: z.ZodType = z description: z.string().optional(), policyFamilyId: z.string().optional(), policyFamilyDefinitionOverrides: z.string().optional(), - maxClustersPerUser: z.number().optional(), + maxClustersPerUser: z.bigint().optional(), libraries: z.array(z.lazy(() => marshalLibrarySchema)).optional(), }) .transform(d => ({ @@ -424,7 +430,7 @@ export const marshalEditPolicyRequestSchema: z.ZodType = z description: z.string().optional(), policyFamilyId: z.string().optional(), policyFamilyDefinitionOverrides: z.string().optional(), - maxClustersPerUser: z.number().optional(), + maxClustersPerUser: z.bigint().optional(), libraries: z.array(z.lazy(() => marshalLibrarySchema)).optional(), }) .transform(d => ({ diff --git a/packages/clusterpolicies/src/v2/utils.ts b/packages/clusterpolicies/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/clusterpolicies/src/v2/utils.ts +++ b/packages/clusterpolicies/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/clusters/package.json b/packages/clusters/package.json index b19335be..9810e107 100644 --- a/packages/clusters/package.json +++ b/packages/clusters/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/clusters/src/v2/client.ts b/packages/clusters/src/v2/client.ts index 76a8337a..c2619ade 100644 --- a/packages/clusters/src/v2/client.ts +++ b/packages/clusters/src/v2/client.ts @@ -101,7 +101,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -130,7 +130,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/clusters/src/v2/model.ts b/packages/clusters/src/v2/model.ts index 69c478f9..1f28425e 100644 --- a/packages/clusters/src/v2/model.ts +++ b/packages/clusters/src/v2/model.ts @@ -1276,7 +1276,7 @@ export interface ClusterEvent { * The timestamp when the event occurred, stored as the number of milliseconds since * the Unix epoch. If not provided, this will be assigned by the Timeline service. */ - timestamp?: number | undefined; + timestamp?: bigint | undefined; type?: ClusterEventType_ClusterEventType | undefined; details?: EventDetails | undefined; dataPlaneEventDetails?: DataPlaneEventDetails | undefined; @@ -1305,7 +1305,7 @@ export interface ClusterInfo { */ stateMessage?: string | undefined; /** Total amount of cluster memory, in megabytes */ - clusterMemoryMb?: number | undefined; + clusterMemoryMb?: bigint | undefined; /** * Number of CPU cores available for this cluster. * Note that this can be fractional, e.g. 7.5 cores, since certain node types are configured to @@ -1350,7 +1350,7 @@ export interface ClusterInfo { * The pair `(cluster_id, spark_context_id)` is a globally unique identifier over all Spark * contexts. */ - sparkContextId?: number | undefined; + sparkContextId?: bigint | undefined; /** * Port on which Spark JDBC server is listening, in the driver nod. No service will be listeningon * on this port in executor nodes. @@ -1513,13 +1513,13 @@ export interface ClusterInfo { * Time (in epoch milliseconds) when the cluster creation request was received (when the cluster * entered a `PENDING` state). */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** Time (in epoch milliseconds) when the cluster was terminated, if applicable. */ - terminatedTime?: number | undefined; + terminatedTime?: bigint | undefined; /** Time when the cluster driver last lost its state (due to a restart or driver failure). */ - lastStateLossTime?: number | undefined; + lastStateLossTime?: bigint | undefined; /** the timestamp that the cluster was started/restarted */ - lastRestartedTime?: number | undefined; + lastRestartedTime?: bigint | undefined; size?: | { $case: 'numWorkers'; @@ -2092,7 +2092,7 @@ export interface CreateClusterRequest_SparkEnvVarsEntry { export interface DataPlaneEventDetails { eventType?: DataPlaneClusterEventType | undefined; - timestamp?: number | undefined; + timestamp?: bigint | undefined; hostId?: string | undefined; executorFailures?: number | undefined; } @@ -2424,10 +2424,10 @@ export interface EventDetails { /** The user that caused the event to occur. (Empty if it was done by the control plane.) */ user?: string | undefined; /** Previous disk size in bytes */ - previousDiskSize?: number | undefined; + previousDiskSize?: bigint | undefined; /** Current disk size in bytes */ - diskSize?: number | undefined; - freeSpace?: number | undefined; + diskSize?: bigint | undefined; + freeSpace?: bigint | undefined; /** Instance Id where the event originated from */ instanceId?: string | undefined; didNotExpandReason?: string | undefined; @@ -2523,12 +2523,12 @@ export interface GetEvents { * The start time in epoch milliseconds. * If empty, returns events starting from the beginning of time. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** * The end time in epoch milliseconds. * If empty, returns events up to the current time. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** The order to list events in; either "ASC" or "DESC". Defaults to "DESC". */ order?: GetEventsOrder | undefined; /** @@ -2542,14 +2542,14 @@ export interface GetEvents { * The offset in the result set. Defaults to 0 (no offset). When an offset is specified * and the results are requested in descending order, the end_time field is required. */ - offset?: number | undefined; + offset?: bigint | undefined; /** * Deprecated: use page_token in combination with page_size instead. * * The maximum number of events to include in a page of events. * Defaults to 50, and maximum allowed value is 500. */ - limit?: number | undefined; + limit?: bigint | undefined; /** * Use next_page_token or prev_page_token returned from the previous request to list the next or previous page of events respectively. * If page_token is empty, the first page is returned. @@ -2579,7 +2579,7 @@ export interface GetEvents_Response { * * The total number of events filtered by the start_time, end_time, and event_types. */ - totalCount?: number | undefined; + totalCount?: bigint | undefined; /** * This field represents the pagination token to retrieve the next page of results. * If the value is "", it means no further results for the request. @@ -2888,7 +2888,7 @@ export interface LogSyncStatus { * The timestamp of last attempt. If the last attempt fails, `last_exception` will contain the * exception in the last attempt. */ - lastAttempted?: number | undefined; + lastAttempted?: bigint | undefined; /** * The exception thrown in the last attempt, it would be null (omitted in the response) if * there is no exception in last attempted. @@ -3106,7 +3106,7 @@ export interface SparkInfo_SparkNode { /** Globally unique identifier for the host instance from the cloud provider. */ instanceId?: string | undefined; /** The timestamp (in millisecond) when the Spark node is launched. */ - startTimestamp?: number | undefined; + startTimestamp?: bigint | undefined; /** Attributes specific to AWS for a Spark node. */ nodeAwsAttributes?: SparkInfo_SparkNode_SparkNodeAwsAttributes | undefined; /** The private IP address of the host instance. */ @@ -3578,7 +3578,10 @@ export const unmarshalClusterComplianceSchema: z.ZodType = z export const unmarshalClusterEventSchema: z.ZodType = z .object({ cluster_id: z.string().optional(), - timestamp: z.number().optional(), + timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), type: z.enum(ClusterEventType_ClusterEventType).optional(), details: z.lazy(() => unmarshalEventDetailsSchema).optional(), data_plane_event_details: z @@ -3599,7 +3602,10 @@ export const unmarshalClusterInfoSchema: z.ZodType = z creator_user_name: z.string().optional(), state: z.enum(ClusterState_ClusterState).optional(), state_message: z.string().optional(), - cluster_memory_mb: z.number().optional(), + cluster_memory_mb: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), cluster_cores: z.number().optional(), default_tags: z.record(z.string(), z.string()).optional(), cluster_log_status: z.lazy(() => unmarshalLogSyncStatusSchema).optional(), @@ -3611,7 +3617,10 @@ export const unmarshalClusterInfoSchema: z.ZodType = z executors: z .array(z.lazy(() => unmarshalSparkInfo_SparkNodeSchema)) .optional(), - spark_context_id: z.number().optional(), + spark_context_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), jdbc_port: z.number().optional(), cluster_name: z.string().optional(), spark_version: z.string().optional(), @@ -3650,10 +3659,22 @@ export const unmarshalClusterInfoSchema: z.ZodType = z is_single_node: z.boolean().optional(), remote_disk_throughput: z.number().optional(), total_initial_remote_disk_size: z.number().optional(), - start_time: z.number().optional(), - terminated_time: z.number().optional(), - last_state_loss_time: z.number().optional(), - last_restarted_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + terminated_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_state_loss_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_restarted_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), num_workers: z.number().optional(), autoscale: z.lazy(() => unmarshalAutoScaleSchema).optional(), }) @@ -3846,7 +3867,10 @@ export const unmarshalDataPlaneEventDetailsSchema: z.ZodType BigInt(v)) + .optional(), host_id: z.string().optional(), executor_failures: z.number().optional(), }) @@ -3942,9 +3966,18 @@ export const unmarshalEventDetailsSchema: z.ZodType = z cause: z.enum(ResizeCause_ResizeCause).optional(), reason: z.lazy(() => unmarshalTerminationReasonSchema).optional(), user: z.string().optional(), - previous_disk_size: z.number().optional(), - disk_size: z.number().optional(), - free_space: z.number().optional(), + previous_disk_size: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + disk_size: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + free_space: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), instance_id: z.string().optional(), did_not_expand_reason: z.string().optional(), driver_state_message: z.string().optional(), @@ -4013,12 +4046,24 @@ export const unmarshalGcsStorageInfoSchema: z.ZodType = z export const unmarshalGetEventsSchema: z.ZodType = z .object({ cluster_id: z.string().optional(), - start_time: z.number().optional(), - end_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), order: z.enum(GetEventsOrder).optional(), event_types: z.array(z.enum(ClusterEventType_ClusterEventType)).optional(), - offset: z.number().optional(), - limit: z.number().optional(), + offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + limit: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), page_token: z.string().optional(), page_size: z.number().optional(), }) @@ -4040,7 +4085,10 @@ export const unmarshalGetEvents_ResponseSchema: z.ZodType = .object({ events: z.array(z.lazy(() => unmarshalClusterEventSchema)).optional(), next_page: z.lazy(() => unmarshalGetEventsSchema).optional(), - total_count: z.number().optional(), + total_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_page_token: z.string().optional(), prev_page_token: z.string().optional(), }) @@ -4243,7 +4291,10 @@ export const unmarshalLogAnalyticsInfoSchema: z.ZodType = z export const unmarshalLogSyncStatusSchema: z.ZodType = z .object({ - last_attempted: z.number().optional(), + last_attempted: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), last_exception: z.string().optional(), }) .transform(d => ({ @@ -4368,7 +4419,10 @@ export const unmarshalSparkInfo_SparkNodeSchema: z.ZodType public_dns: z.string().optional(), node_id: z.string().optional(), instance_id: z.string().optional(), - start_timestamp: z.number().optional(), + start_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), node_aws_attributes: z .lazy(() => unmarshalSparkInfo_SparkNode_SparkNodeAwsAttributesSchema) .optional(), @@ -4830,12 +4884,12 @@ export const marshalGcsStorageInfoSchema: z.ZodType = z export const marshalGetEventsSchema: z.ZodType = z .object({ clusterId: z.string().optional(), - startTime: z.number().optional(), - endTime: z.number().optional(), + startTime: z.bigint().optional(), + endTime: z.bigint().optional(), order: z.enum(GetEventsOrder).optional(), eventTypes: z.array(z.enum(ClusterEventType_ClusterEventType)).optional(), - offset: z.number().optional(), - limit: z.number().optional(), + offset: z.bigint().optional(), + limit: z.bigint().optional(), pageToken: z.string().optional(), pageSize: z.number().optional(), }) diff --git a/packages/clusters/src/v2/utils.ts b/packages/clusters/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/clusters/src/v2/utils.ts +++ b/packages/clusters/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/commandexecution/package.json b/packages/commandexecution/package.json index 336b7456..2f7d456d 100644 --- a/packages/commandexecution/package.json +++ b/packages/commandexecution/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/commandexecution/src/v2/client.ts b/packages/commandexecution/src/v2/client.ts index 28b49a94..f0ff514b 100644 --- a/packages/commandexecution/src/v2/client.ts +++ b/packages/commandexecution/src/v2/client.ts @@ -47,7 +47,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -76,7 +76,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/commandexecution/src/v2/utils.ts b/packages/commandexecution/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/commandexecution/src/v2/utils.ts +++ b/packages/commandexecution/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/connections/package.json b/packages/connections/package.json index 00c8c8fa..bc30814d 100644 --- a/packages/connections/package.json +++ b/packages/connections/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/connections/src/v1/client.ts b/packages/connections/src/v1/client.ts index 00e4ee08..b6998dd5 100644 --- a/packages/connections/src/v1/client.ts +++ b/packages/connections/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/connections/src/v1/model.ts b/packages/connections/src/v1/model.ts index 2e6b9a3c..5d787e1b 100644 --- a/packages/connections/src/v1/model.ts +++ b/packages/connections/src/v1/model.ts @@ -108,11 +108,11 @@ export interface ConnectionInfo { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this connection was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of connection creator. */ createdBy?: string | undefined; /** Time at which this connection was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified connection. */ updatedBy?: string | undefined; securableType?: SecurableType | undefined; @@ -157,11 +157,11 @@ export interface CreateConnectionRequest { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this connection was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of connection creator. */ createdBy?: string | undefined; /** Time at which this connection was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified connection. */ updatedBy?: string | undefined; securableType?: SecurableType | undefined; @@ -253,11 +253,11 @@ export interface UpdateConnectionRequest { /** Unique identifier of parent metastore. */ metastoreId?: string | undefined; /** Time at which this connection was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of connection creator. */ createdBy?: string | undefined; /** Time at which this connection was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified connection. */ updatedBy?: string | undefined; securableType?: SecurableType | undefined; @@ -292,9 +292,15 @@ export const unmarshalConnectionInfoSchema: z.ZodType = z credential_type: z.enum(CredentialType).optional(), connection_id: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), securable_type: z.enum(SecurableType).optional(), provisioning_info: z.lazy(() => unmarshalProvisioningInfoSchema).optional(), @@ -360,9 +366,9 @@ export const marshalCreateConnectionRequestSchema: z.ZodType = z credentialType: z.enum(CredentialType).optional(), connectionId: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), securableType: z.enum(SecurableType).optional(), provisioningInfo: z.lazy(() => marshalProvisioningInfoSchema).optional(), @@ -412,9 +418,9 @@ export const marshalUpdateConnectionRequestSchema: z.ZodType = z credentialType: z.enum(CredentialType).optional(), connectionId: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), securableType: z.enum(SecurableType).optional(), provisioningInfo: z.lazy(() => marshalProvisioningInfoSchema).optional(), diff --git a/packages/connections/src/v1/utils.ts b/packages/connections/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/connections/src/v1/utils.ts +++ b/packages/connections/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/core/package.json b/packages/core/package.json index f4eaa8d8..58f8009e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -79,6 +79,10 @@ "node": ">=22.0.0" }, "dependencies": { + "json-bigint": "^1.0.0", "zod": "^4.3.6" + }, + "devDependencies": { + "@types/json-bigint": "^1.0.4" } } diff --git a/packages/core/tests/wkt/int64-schema.test.ts b/packages/core/tests/wkt/int64-schema.test.ts new file mode 100644 index 00000000..b6f07f31 --- /dev/null +++ b/packages/core/tests/wkt/int64-schema.test.ts @@ -0,0 +1,100 @@ +import {describe, it, expect} from 'vitest'; +import JSONBig from 'json-bigint'; +import {z} from 'zod'; + +// Replicas of the marshal / unmarshal schemas the generator emits for any +// proto int64 field. If the generator's template changes, these need to +// change in lockstep — that's intentional: this test exists to catch a +// drift between the codec config and the schema shape. +const marshalInt64Schema = z.bigint(); +const unmarshalInt64Schema = z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)); + +// The exact json-bigint configuration the generator emits in utils.ts. +const jsonBigint = JSONBig({useNativeBigInt: true}); + +// Marshals through the same pipeline as the generated marshalRequest: +// schema.parse(data) → jsonBigint.stringify +function marshalBody(value: bigint): string { + return jsonBigint.stringify({v: marshalInt64Schema.parse(value)}); +} + +// Unmarshals through the same pipeline as the generated parseResponse: +// jsonBigint.parse → schema.parse +function unmarshalBody(json: string): bigint { + const parsed = jsonBigint.parse(json) as {v: unknown}; + return unmarshalInt64Schema.parse(parsed.v); +} + +describe('int64 marshal schema (generator-emitted shape)', () => { + it('accepts a bigint and emits a raw JSON number on the wire', () => { + expect(marshalBody(42n)).toBe('{"v":42}'); + expect(marshalBody(9007199254740993n)).toBe('{"v":9007199254740993}'); + expect(marshalBody(9223372036854775807n)).toBe( + '{"v":9223372036854775807}', + ); + expect(marshalBody(-9223372036854775808n)).toBe( + '{"v":-9223372036854775808}', + ); + }); + + it('rejects a JS number (caller must pass bigint)', () => { + expect(() => marshalInt64Schema.parse(42)).toThrow(); + }); + + it('rejects a string', () => { + expect(() => marshalInt64Schema.parse('42')).toThrow(); + }); +}); + +describe('int64 unmarshal schema (generator-emitted shape)', () => { + it('accepts a small JSON number and normalises to bigint', () => { + expect(unmarshalBody('{"v":42}')).toBe(42n); + }); + + it('accepts a JSON number that json-bigint already upgraded to bigint', () => { + expect(unmarshalBody('{"v":9007199254740993}')).toBe(9007199254740993n); + }); + + it('preserves int64 max', () => { + expect(unmarshalBody('{"v":9223372036854775807}')).toBe( + 9223372036854775807n, + ); + }); + + it('preserves int64 min', () => { + expect(unmarshalBody('{"v":-9223372036854775808}')).toBe( + -9223372036854775808n, + ); + }); + + it('rejects a string on the wire', () => { + // The unmarshal union is z.number() | z.bigint() — string is not + // permitted. If any service ever does emit int64 as a JSON string + // we will see this failure in a test like this one. + expect(() => unmarshalBody('{"v":"42"}')).toThrow(); + }); +}); + +describe('round-trip via marshal → wire bytes → unmarshal', () => { + const cases: bigint[] = [ + 0n, + 1n, + -1n, + 9007199254740991n, // Number.MAX_SAFE_INTEGER + 9007199254740992n, // 2^53 + 9007199254740993n, // 2^53 + 1, JS Number precision break + 9223372036854775806n, + 9223372036854775807n, // int64 max + -9223372036854775807n, + -9223372036854775808n, // int64 min + 833780805664346n, // representative real workspace/job id + ]; + + it.each(cases)('preserves %s through marshal → unmarshal', value => { + const wire = marshalBody(value); + const back = unmarshalBody(wire); + expect(back).toBe(value); + }); +}); diff --git a/packages/core/tests/wkt/json-bigint.test.ts b/packages/core/tests/wkt/json-bigint.test.ts new file mode 100644 index 00000000..1732bf66 --- /dev/null +++ b/packages/core/tests/wkt/json-bigint.test.ts @@ -0,0 +1,112 @@ +import {describe, it, expect} from 'vitest'; +import JSONBig from 'json-bigint'; + +// Mirror of the json-bigint config the generator emits in every package's +// utils.ts. Pinned here so a regression in either the dependency or our +// configuration breaks this test. +const jsonBigint = JSONBig({useNativeBigInt: true}); + +describe('json-bigint codec used by generated utils.ts', () => { + describe('parse', () => { + it('keeps small integers as JS number', () => { + const result = jsonBigint.parse('{"x":42}') as {x: unknown}; + expect(typeof result.x).toBe('number'); + expect(result.x).toBe(42); + }); + + it('keeps comfortably-small integers as JS number', () => { + // 833780805664346 is a real Databricks job id (~2^50); well under + // Number.MAX_SAFE_INTEGER and parsed without precision loss. + const result = jsonBigint.parse('{"x":833780805664346}') as {x: unknown}; + expect(typeof result.x).toBe('number'); + expect(result.x).toBe(833780805664346); + }); + + it('upgrades integers near Number.MAX_SAFE_INTEGER to bigint', () => { + // json-bigint conservatively switches to bigint as values approach + // 2^53. The exact threshold is library-defined; we only care that + // anything that *could* lose precision comes back as bigint. + const result = jsonBigint.parse('{"x":9007199254740993}') as {x: unknown}; + expect(typeof result.x).toBe('bigint'); + expect(result.x).toBe(9007199254740993n); + }); + + it('preserves the full int64 positive range', () => { + const result = jsonBigint.parse('{"x":9223372036854775807}') as { + x: unknown; + }; + expect(result.x).toBe(9223372036854775807n); + }); + + it('preserves the full int64 negative range', () => { + const result = jsonBigint.parse('{"x":-9223372036854775808}') as { + x: unknown; + }; + expect(result.x).toBe(-9223372036854775808n); + }); + + it('leaves floats as JS number', () => { + const result = jsonBigint.parse('{"x":1.5}') as {x: unknown}; + expect(typeof result.x).toBe('number'); + expect(result.x).toBe(1.5); + }); + + it('does not touch string fields', () => { + const result = jsonBigint.parse('{"x":"hello"}') as {x: unknown}; + expect(result.x).toBe('hello'); + }); + }); + + describe('stringify', () => { + it('emits a small bigint as a raw JSON number (no quotes)', () => { + expect(jsonBigint.stringify({x: 42n})).toBe('{"x":42}'); + }); + + it('emits a bigint > Number.MAX_SAFE_INTEGER as a raw JSON number', () => { + expect(jsonBigint.stringify({x: 9007199254740993n})).toBe( + '{"x":9007199254740993}', + ); + }); + + it('emits the full positive int64 range', () => { + expect(jsonBigint.stringify({x: 9223372036854775807n})).toBe( + '{"x":9223372036854775807}', + ); + }); + + it('emits the full negative int64 range', () => { + expect(jsonBigint.stringify({x: -9223372036854775808n})).toBe( + '{"x":-9223372036854775808}', + ); + }); + + it('handles JS numbers alongside bigints', () => { + expect(jsonBigint.stringify({a: 1, b: 2n, c: 'x'})).toBe( + '{"a":1,"b":2,"c":"x"}', + ); + }); + }); + + describe('round-trip', () => { + const cases: bigint[] = [ + 0n, + 1n, + -1n, + BigInt(Number.MAX_SAFE_INTEGER) - 1n, + BigInt(Number.MAX_SAFE_INTEGER), + BigInt(Number.MAX_SAFE_INTEGER) + 1n, + BigInt(Number.MAX_SAFE_INTEGER) + 2n, + 9223372036854775806n, + 9223372036854775807n, // 2^63 - 1 + -9223372036854775807n, + -9223372036854775808n, // -2^63 + ]; + + it.each(cases)('preserves %s through stringify → parse', value => { + const json = jsonBigint.stringify({v: value}); + const back = jsonBigint.parse(json) as {v: bigint | number}; + // Small magnitudes come back as number, larger as bigint — normalise. + expect(BigInt(back.v)).toBe(value); + }); + }); +}); diff --git a/packages/credentials/package.json b/packages/credentials/package.json index 23a24baf..884b18ef 100644 --- a/packages/credentials/package.json +++ b/packages/credentials/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/credentials/src/v1/client.ts b/packages/credentials/src/v1/client.ts index 103b2c9b..769d3779 100644 --- a/packages/credentials/src/v1/client.ts +++ b/packages/credentials/src/v1/client.ts @@ -99,7 +99,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -130,7 +130,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/credentials/src/v1/model.ts b/packages/credentials/src/v1/model.ts index 07347b52..54ed9e4c 100644 --- a/packages/credentials/src/v1/model.ts +++ b/packages/credentials/src/v1/model.ts @@ -272,11 +272,11 @@ export interface CreateAccountsStorageCredential { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -354,11 +354,11 @@ export interface CreateCredentialRequest { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -439,11 +439,11 @@ export interface CreateStorageCredentialRequest { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -512,11 +512,11 @@ export interface CredentialInfo { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -545,7 +545,7 @@ export interface Credentials { /** The human-readable name of the credential configuration object. */ credentialsName?: string | undefined; /** Time in epoch milliseconds when the credential was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; } /** @@ -646,7 +646,7 @@ export interface GenerateTemporaryPathCredentialRequest_Response { * Server time when the credential will expire, in epoch milliseconds. * The API client is advised to cache the credential given this expiration time. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** The URL of the storage path accessible by the temporary credential. */ url?: string | undefined; } @@ -714,7 +714,7 @@ export interface GenerateTemporaryTableCredentialRequest_Response { * Server time when the credential will expire, in epoch milliseconds. * The API client is advised to cache the credential given this expiration time. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** The URL of the storage path accessible by the temporary credential. */ url?: string | undefined; } @@ -747,7 +747,7 @@ export interface GenerateTemporaryVolumeCredentialRequest_Response { * Server time when the credential will expire, in epoch milliseconds. * The API client is advised to cache the credential given this expiration time. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** The URL of the storage path accessible by the temporary credential. */ url?: string | undefined; } @@ -919,11 +919,11 @@ export interface StorageCredentialInfo { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -974,7 +974,7 @@ export interface TemporaryCredentials { * Server time when the credential will expire, in epoch milliseconds. * The API client is advised to cache the credential given this expiration time. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** The URL of the storage path accessible by the temporary credential. */ url?: string | undefined; } @@ -1031,11 +1031,11 @@ export interface UpdateAccountsStorageCredential { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -1116,11 +1116,11 @@ export interface UpdateCredentialRequest { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -1200,11 +1200,11 @@ export interface UpdateStorageCredentialRequest { /** Unique identifier of the parent metastore. */ metastoreId?: string | undefined; /** Time at which this credential was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of credential creator. */ createdBy?: string | undefined; /** Time at which this credential was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the credential. */ updatedBy?: string | undefined; /** @@ -1508,9 +1508,15 @@ export const unmarshalCredentialInfoSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), used_for_managed_storage: z.boolean().optional(), full_name: z.string().optional(), @@ -1568,7 +1574,10 @@ export const unmarshalCredentialsSchema: z.ZodType = z account_id: z.string().optional(), aws_credentials: z.lazy(() => unmarshalAwsCredentialsSchema).optional(), credentials_name: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ credentialsId: d.credentials_id, @@ -1640,7 +1649,10 @@ export const unmarshalGenerateTemporaryPathCredentialRequest_ResponseSchema: z.Z r2_temp_credentials: z .lazy(() => unmarshalR2CredentialsSchema) .optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), url: z.string().optional(), }) .transform(d => ({ @@ -1689,7 +1701,10 @@ export const unmarshalGenerateTemporaryTableCredentialRequest_ResponseSchema: z. r2_temp_credentials: z .lazy(() => unmarshalR2CredentialsSchema) .optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), url: z.string().optional(), }) .transform(d => ({ @@ -1738,7 +1753,10 @@ export const unmarshalGenerateTemporaryVolumeCredentialRequest_ResponseSchema: z r2_temp_credentials: z .lazy(() => unmarshalR2CredentialsSchema) .optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), url: z.string().optional(), }) .transform(d => ({ @@ -1835,9 +1853,15 @@ export const unmarshalStorageCredentialInfoSchema: z.ZodType BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), used_for_managed_storage: z.boolean().optional(), full_name: z.string().optional(), @@ -1920,7 +1944,10 @@ export const unmarshalTemporaryCredentialsSchema: z.ZodType unmarshalR2CredentialsSchema) .optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), url: z.string().optional(), }) .transform(d => ({ @@ -2148,9 +2175,9 @@ export const marshalCreateAccountsStorageCredentialSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), @@ -2246,9 +2273,9 @@ export const marshalCreateCredentialRequestSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), @@ -2353,9 +2380,9 @@ export const marshalCreateStorageCredentialRequestSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), @@ -2546,9 +2573,9 @@ export const marshalUpdateAccountsStorageCredentialSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), @@ -2632,9 +2659,9 @@ export const marshalUpdateCredentialRequestSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), @@ -2722,9 +2749,9 @@ export const marshalUpdateStorageCredentialRequestSchema: z.ZodType = z owner: z.string().optional(), id: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), usedForManagedStorage: z.boolean().optional(), fullName: z.string().optional(), diff --git a/packages/credentials/src/v1/utils.ts b/packages/credentials/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/credentials/src/v1/utils.ts +++ b/packages/credentials/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/customllms/package.json b/packages/customllms/package.json index 354f3664..fd55e61a 100644 --- a/packages/customllms/package.json +++ b/packages/customllms/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/customllms/src/v1/client.ts b/packages/customllms/src/v1/client.ts index f33a7446..91987f9a 100644 --- a/packages/customllms/src/v1/client.ts +++ b/packages/customllms/src/v1/client.ts @@ -36,7 +36,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -63,7 +63,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/customllms/src/v1/utils.ts b/packages/customllms/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/customllms/src/v1/utils.ts +++ b/packages/customllms/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/database/package.json b/packages/database/package.json index 033e2a2c..828742f9 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/database/src/v1/client.ts b/packages/database/src/v1/client.ts index 7dba4b4f..ffe2586c 100644 --- a/packages/database/src/v1/client.ts +++ b/packages/database/src/v1/client.ts @@ -76,7 +76,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -105,7 +105,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/database/src/v1/model.ts b/packages/database/src/v1/model.ts index 4765765b..fe9c73d1 100644 --- a/packages/database/src/v1/model.ts +++ b/packages/database/src/v1/model.ts @@ -435,7 +435,7 @@ export interface DeleteSyncedDatabaseTableRequest { export interface DeltaTableSyncInfo { /** The Delta Lake commit version that was last successfully synced. */ - deltaCommitVersion?: number | undefined; + deltaCommitVersion?: bigint | undefined; /** * The timestamp when the above Delta version was committed in the source Delta table. * Note: This is the Delta commit time, not the time the data was written to the synced table. @@ -640,7 +640,7 @@ export interface SyncedDatabaseTable { */ export interface SyncedTableContinuousUpdateStatus { /** The last source table Delta version that was successfully synced to the synced table. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The end timestamp of the last time any data was synchronized from the source table to the synced * table. This is when the data is available in the synced table. @@ -661,7 +661,7 @@ export interface SyncedTableFailedStatus { * Only populated if the table is still * synced and available for serving. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The end timestamp of the last time any data was synchronized from the source table to the synced * table. Only populated if the table is still synced and available for serving. @@ -675,11 +675,11 @@ export interface SyncedTablePipelineProgress { * The source table Delta version that was last processed by the pipeline. The pipeline may not * have completely processed this version yet. */ - latestVersionCurrentlyProcessing?: number | undefined; + latestVersionCurrentlyProcessing?: bigint | undefined; /** The number of rows that have been synced in this update. */ - syncedRowCount?: number | undefined; + syncedRowCount?: bigint | undefined; /** The total number of rows that need to be synced in this update. This number may be an estimate. */ - totalRowCount?: number | undefined; + totalRowCount?: bigint | undefined; /** The completion ratio of this update. This is a number between 0 and 1. */ syncProgressCompletion?: number | undefined; /** The estimated time remaining to complete this update in seconds. */ @@ -801,7 +801,7 @@ export interface SyncedTableStatus { */ export interface SyncedTableTriggeredUpdateStatus { /** The last source table Delta version that was successfully synced to the synced table. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The end timestamp of the last time any data was synchronized from the source table to the synced * table. This is when the data is available in the synced table. @@ -1013,7 +1013,10 @@ export const unmarshalDatabaseTableSchema: z.ZodType = z export const unmarshalDeltaTableSyncInfoSchema: z.ZodType = z .object({ - delta_commit_version: z.number().optional(), + delta_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), delta_commit_timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -1118,7 +1121,10 @@ export const unmarshalSyncedDatabaseTableSchema: z.ZodType export const unmarshalSyncedTableContinuousUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -1136,7 +1142,10 @@ export const unmarshalSyncedTableContinuousUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -1150,9 +1159,18 @@ export const unmarshalSyncedTableFailedStatusSchema: z.ZodType = z .object({ - latest_version_currently_processing: z.number().optional(), - synced_row_count: z.number().optional(), - total_row_count: z.number().optional(), + latest_version_currently_processing: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + synced_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + total_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), sync_progress_completion: z.number().optional(), estimated_completion_time_seconds: z.number().optional(), provisioning_phase: z.enum(ProvisioningPhase).optional(), @@ -1272,7 +1290,10 @@ export const unmarshalSyncedTableStatusSchema: z.ZodType = z export const unmarshalSyncedTableTriggeredUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -1448,7 +1469,7 @@ export const marshalDatabaseTableSchema: z.ZodType = z export const marshalDeltaTableSyncInfoSchema: z.ZodType = z .object({ - deltaCommitVersion: z.number().optional(), + deltaCommitVersion: z.bigint().optional(), deltaCommitTimestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -1540,7 +1561,7 @@ export const marshalSyncedDatabaseTableSchema: z.ZodType = z export const marshalSyncedTableContinuousUpdateStatusSchema: z.ZodType = z .object({ - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), timestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -1557,7 +1578,7 @@ export const marshalSyncedTableContinuousUpdateStatusSchema: z.ZodType = z export const marshalSyncedTableFailedStatusSchema: z.ZodType = z .object({ - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), timestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -1570,9 +1591,9 @@ export const marshalSyncedTableFailedStatusSchema: z.ZodType = z export const marshalSyncedTablePipelineProgressSchema: z.ZodType = z .object({ - latestVersionCurrentlyProcessing: z.number().optional(), - syncedRowCount: z.number().optional(), - totalRowCount: z.number().optional(), + latestVersionCurrentlyProcessing: z.bigint().optional(), + syncedRowCount: z.bigint().optional(), + totalRowCount: z.bigint().optional(), syncProgressCompletion: z.number().optional(), estimatedCompletionTimeSeconds: z.number().optional(), provisioningPhase: z.enum(ProvisioningPhase).optional(), @@ -1697,7 +1718,7 @@ export const marshalSyncedTableStatusSchema: z.ZodType = z export const marshalSyncedTableTriggeredUpdateStatusSchema: z.ZodType = z .object({ - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), timestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) diff --git a/packages/database/src/v1/utils.ts b/packages/database/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/database/src/v1/utils.ts +++ b/packages/database/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/dataclassification/package.json b/packages/dataclassification/package.json index 0245f224..2e4caa5b 100644 --- a/packages/dataclassification/package.json +++ b/packages/dataclassification/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/dataclassification/src/v1/client.ts b/packages/dataclassification/src/v1/client.ts index c6e2f078..7dcbb05f 100644 --- a/packages/dataclassification/src/v1/client.ts +++ b/packages/dataclassification/src/v1/client.ts @@ -31,7 +31,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -58,7 +58,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/dataclassification/src/v1/utils.ts b/packages/dataclassification/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/dataclassification/src/v1/utils.ts +++ b/packages/dataclassification/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/dataquality/package.json b/packages/dataquality/package.json index 7b13fecd..65bf43c8 100644 --- a/packages/dataquality/package.json +++ b/packages/dataquality/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/dataquality/src/v1/client.ts b/packages/dataquality/src/v1/client.ts index 2b70acc6..199fcab0 100644 --- a/packages/dataquality/src/v1/client.ts +++ b/packages/dataquality/src/v1/client.ts @@ -48,7 +48,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -75,7 +75,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/dataquality/src/v1/model.ts b/packages/dataquality/src/v1/model.ts index 560fd190..7bd034ca 100644 --- a/packages/dataquality/src/v1/model.ts +++ b/packages/dataquality/src/v1/model.ts @@ -117,7 +117,7 @@ export interface CancelRefreshRequest { */ objectId?: string | undefined; /** Unique id of the refresh operation. */ - refreshId?: number | undefined; + refreshId?: bigint | undefined; } /** Response to cancelling a refresh. */ @@ -227,7 +227,7 @@ export interface DataProfilingConfig { * numeric fashion (1,2,3...). The field has flexibility to take on negative values, which can indicate corrupted * monitor_version numbers. */ - monitorVersion?: number | undefined; + monitorVersion?: bigint | undefined; /** The warehouse for dashboard creation */ effectiveWarehouseId?: string | undefined; } @@ -284,7 +284,7 @@ export interface DeleteRefreshRequest { */ objectId?: string | undefined; /** Unique id of the refresh operation. */ - refreshId?: number | undefined; + refreshId?: bigint | undefined; } /** Request to get a Monitor. */ @@ -322,7 +322,7 @@ export interface GetRefreshRequest { */ objectId?: string | undefined; /** Unique id of the refresh operation. */ - refreshId?: number | undefined; + refreshId?: bigint | undefined; } /** Inference log configuration. */ @@ -433,15 +433,15 @@ export interface Refresh { */ objectId?: string | undefined; /** Unique id of the refresh operation. */ - refreshId?: number | undefined; + refreshId?: bigint | undefined; /** The current state of the refresh. */ state?: RefreshState | undefined; /** An optional message to give insight into the current state of the refresh (e.g. FAILURE messages). */ message?: string | undefined; /** Time when the refresh started (milliseconds since 1/1/1970 UTC). */ - startTimeMs?: number | undefined; + startTimeMs?: bigint | undefined; /** Time when the refresh ended (milliseconds since 1/1/1970 UTC). */ - endTimeMs?: number | undefined; + endTimeMs?: bigint | undefined; /** What triggered the refresh. */ trigger?: RefreshTrigger | undefined; } @@ -500,7 +500,7 @@ export interface UpdateRefreshRequest { */ objectId?: string | undefined; /** Unique id of the refresh operation. */ - refreshId?: number | undefined; + refreshId?: bigint | undefined; /** The refresh to update. */ refresh?: Refresh | undefined; /** The field mask to specify which fields to update. */ @@ -562,7 +562,10 @@ export const unmarshalDataProfilingConfigSchema: z.ZodType profile_metrics_table_name: z.string().optional(), drift_metrics_table_name: z.string().optional(), dashboard_id: z.string().optional(), - monitor_version: z.number().optional(), + monitor_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), effective_warehouse_id: z.string().optional(), }) .transform(d => ({ @@ -693,11 +696,20 @@ export const unmarshalRefreshSchema: z.ZodType = z .object({ object_type: z.string().optional(), object_id: z.string().optional(), - refresh_id: z.number().optional(), + refresh_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.enum(RefreshState).optional(), message: z.string().optional(), - start_time_ms: z.number().optional(), - end_time_ms: z.number().optional(), + start_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), trigger: z.enum(RefreshTrigger).optional(), }) .transform(d => ({ @@ -736,7 +748,7 @@ export const marshalCancelRefreshRequestSchema: z.ZodType = z .object({ objectType: z.string().optional(), objectId: z.string().optional(), - refreshId: z.number().optional(), + refreshId: z.bigint().optional(), }) .transform(d => ({ object_type: d.objectType, @@ -793,7 +805,7 @@ export const marshalDataProfilingConfigSchema: z.ZodType = z profileMetricsTableName: z.string().optional(), driftMetricsTableName: z.string().optional(), dashboardId: z.string().optional(), - monitorVersion: z.number().optional(), + monitorVersion: z.bigint().optional(), effectiveWarehouseId: z.string().optional(), }) .transform(d => ({ @@ -897,11 +909,11 @@ export const marshalRefreshSchema: z.ZodType = z .object({ objectType: z.string().optional(), objectId: z.string().optional(), - refreshId: z.number().optional(), + refreshId: z.bigint().optional(), state: z.enum(RefreshState).optional(), message: z.string().optional(), - startTimeMs: z.number().optional(), - endTimeMs: z.number().optional(), + startTimeMs: z.bigint().optional(), + endTimeMs: z.bigint().optional(), trigger: z.enum(RefreshTrigger).optional(), }) .transform(d => ({ diff --git a/packages/dataquality/src/v1/utils.ts b/packages/dataquality/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/dataquality/src/v1/utils.ts +++ b/packages/dataquality/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/disasterrecovery/package.json b/packages/disasterrecovery/package.json index 496fe598..ffe0f3d9 100644 --- a/packages/disasterrecovery/package.json +++ b/packages/disasterrecovery/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/disasterrecovery/src/v1/client.ts b/packages/disasterrecovery/src/v1/client.ts index 5049895c..918f8c1f 100644 --- a/packages/disasterrecovery/src/v1/client.ts +++ b/packages/disasterrecovery/src/v1/client.ts @@ -45,7 +45,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -72,7 +72,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/disasterrecovery/src/v1/utils.ts b/packages/disasterrecovery/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/disasterrecovery/src/v1/utils.ts +++ b/packages/disasterrecovery/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/entitytagassignments/package.json b/packages/entitytagassignments/package.json index 457e6dc6..c40ea92b 100644 --- a/packages/entitytagassignments/package.json +++ b/packages/entitytagassignments/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/entitytagassignments/src/v1/client.ts b/packages/entitytagassignments/src/v1/client.ts index 944a62de..549f0061 100644 --- a/packages/entitytagassignments/src/v1/client.ts +++ b/packages/entitytagassignments/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/entitytagassignments/src/v1/utils.ts b/packages/entitytagassignments/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/entitytagassignments/src/v1/utils.ts +++ b/packages/entitytagassignments/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/environments/package.json b/packages/environments/package.json index 79501b41..4a825d4c 100644 --- a/packages/environments/package.json +++ b/packages/environments/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/environments/src/v1/client.ts b/packages/environments/src/v1/client.ts index 6c2a12b5..c6c72bf4 100644 --- a/packages/environments/src/v1/client.ts +++ b/packages/environments/src/v1/client.ts @@ -48,7 +48,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -75,7 +75,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/environments/src/v1/utils.ts b/packages/environments/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/environments/src/v1/utils.ts +++ b/packages/environments/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/examples/package.json b/packages/examples/package.json index 1c8da2e4..e5b15634 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -6,6 +6,7 @@ "type": "module", "scripts": { "auth-and-errors": "node --import tsx/esm src/auth-and-errors.ts", + "int64-e2e": "node --import tsx/esm src/int64-e2e.ts", "build": "echo 'nothing to build'", "lint": "echo 'skipped'", "lint:fix": "echo 'skipped'", diff --git a/packages/examples/src/int64-e2e.ts b/packages/examples/src/int64-e2e.ts new file mode 100644 index 00000000..36f0131a --- /dev/null +++ b/packages/examples/src/int64-e2e.ts @@ -0,0 +1,181 @@ +/** + * End-to-end check: int64 round-trip with the regenerated sdk-js using the + * `demo` profile from ~/.databrickscfg. Tests both directions and overflow. + */ + +import {execFileSync} from 'node:child_process'; +import {newPatCredentials} from '@databricks/sdk-auth/credentials'; +import {resolve} from '@databricks/sdk-core/profiles'; +import {ApiError} from '@databricks/sdk-core/apierror'; +import {codeToString} from '@databricks/sdk-core/apierror/codes'; +import {newFetchHttpClient} from '@databricks/sdk-core/http'; +import type { + HttpClient, + HttpRequest, + HttpResponse, +} from '@databricks/sdk-core/http'; +import {Client as JobsClient} from '@databricks/sdk-jobs/v2'; +import JSONBig from 'json-bigint'; +import {z} from 'zod'; + +// Mirrors the unmarshal schema the generator now emits for an int64 field: +// json-bigint hands us number for small values, bigint for values that +// wouldn't fit, so the schema accepts either and normalizes to bigint. +const int64Schema = z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)); + +// Same json-bigint config the generated utils.ts uses. +const jsonBigint = JSONBig({useNativeBigInt: true}); + +// Captures the most recent request body so we can assert exactly what shape +// the SDK marshaled. Adds Authorization manually (the SDK won't wire its own +// auth when a custom httpClient is supplied). +class CapturingHttpClient implements HttpClient { + lastBody: string | undefined; + lastUrl: string | undefined; + lastMethod: string | undefined; + private readonly inner = newFetchHttpClient(); + constructor(private readonly token: string) {} + + async send(request: HttpRequest): Promise { + this.lastMethod = request.method; + this.lastUrl = request.url; + this.lastBody = + typeof request.body === 'string' ? request.body : undefined; + const headers = new Headers(request.headers); + headers.set('Authorization', `Bearer ${this.token}`); + return this.inner.send({...request, headers}); + } +} + +async function main(): Promise { + const profile = await resolve({profile: 'demo'}); + if (profile.host === undefined) { + throw new Error('demo profile must declare host'); + } + const host = profile.host; + // The demo profile uses databricks-cli OAuth — sdk-js auth only ships + // PAT/M2M today. Mint a short-lived access token through the CLI so this + // script can use the standard PAT credentials path. + const cliOut = execFileSync( + 'databricks', + ['--profile', 'demo', 'auth', 'token'], + {encoding: 'utf8'}, + ); + const token = (JSON.parse(cliOut) as {access_token: string}).access_token; + const httpClient = new CapturingHttpClient(token); + const client = new JobsClient({host, httpClient}); + + // ----- 1. server → client: real response unmarshal ----- + console.log('=== 1. Real server response (jobs.list) ==='); + const list = await client.listJobs({limit: 5n}); + const jobs = list.jobs ?? []; + if (jobs.length === 0) throw new Error('no jobs returned'); + const job = jobs[0]!; + console.log(' jobId =', job.jobId, '(', typeof job.jobId, ')'); + console.log(' createdTime =', job.createdTime, '(', typeof job.createdTime, ')'); + if (typeof job.jobId !== 'bigint') throw new Error('jobId not bigint'); + console.log(' ✓ bigint type\n'); + + // ----- 2. client → server (URL query) ----- + console.log('=== 2. URL query marshal (jobs.get) ==='); + const got = await client.getJob({jobId: job.jobId}); + if (got.jobId !== job.jobId) throw new Error('mismatch'); + console.log(' ✓ round-trip via URL\n'); + + // ----- 3. server → client overflow, JSON number > 2^53 ----- + // The SDK's parseResponse uses json-bigint, which preserves large integers + // as bigint instead of rounding to JS Number. Simulate that path here. + console.log('=== 3. Synthetic inbound JSON NUMBER > 2^53 ==='); + const overflowNumberJson = '{"job_id":9007199254740993}'; + const parsedNum = (jsonBigint.parse(overflowNumberJson) as {job_id: unknown}) + .job_id; + console.log(' jsonBigint.parse job_id:', parsedNum, '(', typeof parsedNum, ')'); + const fromNum = int64Schema.parse(parsedNum); + console.log(' unmarshaled:', fromNum); + if (fromNum !== 9007199254740993n) { + throw new Error('inbound JSON number > 2^53 lost precision'); + } + console.log(' ✓ full precision preserved through json-bigint\n'); + + // ----- 4. server → client, max int64 ----- + console.log('=== 4. Synthetic inbound JSON NUMBER at int64 max ==='); + const maxJson = '{"job_id":9223372036854775807}'; + const parsedMax = (jsonBigint.parse(maxJson) as {job_id: unknown}).job_id; + console.log(' jsonBigint.parse job_id:', parsedMax, '(', typeof parsedMax, ')'); + const fromMax = int64Schema.parse(parsedMax); + if (fromMax !== 9223372036854775807n) { + throw new Error('inbound int64 max did not round-trip'); + } + console.log(' ✓ int64 max preserved\n'); + + // ----- 5/6. wire format experiments ----- + console.log('=== 5/6. Body wire format: does server accept string AND number? ==='); + const nonExistentId = '999999999999'; + await testWire(host, token, 'JSON string', `{"job_id":"${nonExistentId}"}`); + await testWire(host, token, 'JSON number', `{"job_id":${nonExistentId}}`); + console.log(); + + // ----- 7. outbound overflow via SDK ----- + console.log('=== 7. SDK marshal of bigint > 2^53 (deleteJob with huge id) ==='); + const big = 2n ** 53n + 1n; + console.log(' big =', big, '(>', BigInt(Number.MAX_SAFE_INTEGER), ')'); + try { + await client.deleteJob({jobId: big}); + console.log(' unexpectedly succeeded'); + } catch (e) { + if (e instanceof ApiError) { + console.log( + ' SDK sent: ' + (httpClient.lastMethod ?? '?') + ' ' + + (httpClient.lastUrl ?? '?'), + ); + console.log(' body sent:', httpClient.lastBody); + console.log(' server code:', codeToString(e.code), '/ HTTP', e.httpStatusCode); + console.log(' server message:', e.message); + // Two things to verify here: + // (a) the body was emitted as a raw JSON number, not a string — + // e.g. {"job_id":9007199254740993} with no quotes around the + // digits; + // (b) the server received the full value (its message echoes the + // id, which proves no precision loss in transit). + const bodyHasQuotedNumber = httpClient.lastBody?.includes( + '"' + big.toString() + '"', + ); + const bodyHasRawNumber = httpClient.lastBody?.includes( + ':' + big.toString(), + ); + if (bodyHasQuotedNumber) { + console.log(' ✗ body emitted as JSON string — that\'s wrong'); + } else if (!bodyHasRawNumber) { + console.log(' ⚠ body shape unexpected; check it'); + } else { + console.log(' ✓ body emitted as raw JSON number'); + } + if (e.message.includes(big.toString())) { + console.log( + ' ✓ server received the full int64 value (no precision loss)', + ); + } else { + console.log(' ⚠ server may have garbled the value; check message'); + } + } else { + throw e; + } + } + + console.log('\nDONE.'); +} + +async function testWire(host: string, token: string, label: string, body: string): Promise { + const resp = await fetch(`${host}/api/2.2/jobs/delete`, { + method: 'POST', + headers: {'Content-Type': 'application/json', Authorization: `Bearer ${token}`}, + body, + }); + const text = await resp.text(); + console.log(` [${label.padEnd(11)}] body=${body}`); + console.log(` -> HTTP ${resp.status}: ${text.slice(0, 160).trim()}`); +} + +await main(); diff --git a/packages/experiments/package.json b/packages/experiments/package.json index 52193ec6..c05b6172 100644 --- a/packages/experiments/package.json +++ b/packages/experiments/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/experiments/src/v1/client.ts b/packages/experiments/src/v1/client.ts index 860b1e76..cf4f182d 100644 --- a/packages/experiments/src/v1/client.ts +++ b/packages/experiments/src/v1/client.ts @@ -159,7 +159,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -186,7 +186,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/experiments/src/v1/model.ts b/packages/experiments/src/v1/model.ts index 78696755..c1c9cbd4 100644 --- a/packages/experiments/src/v1/model.ts +++ b/packages/experiments/src/v1/model.ts @@ -102,7 +102,7 @@ export interface CreateRunRequest { /** The name of the run. */ runName?: string | undefined; /** Unix timestamp in milliseconds of when the run started. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** Additional metadata for run. */ tags?: RunTag[] | undefined; } @@ -191,7 +191,7 @@ export interface DeleteRunsRequest { * The maximum creation timestamp in milliseconds since the UNIX epoch for deleting runs. Only runs created prior to * or at this timestamp are deleted. */ - maxTimestampMillis?: number | undefined; + maxTimestampMillis?: bigint | undefined; /** * An optional positive integer indicating the maximum number of runs to delete. The maximum allowed value for * max_runs is 10000. @@ -229,9 +229,9 @@ export interface Experiment { */ lifecycleStage?: string | undefined; /** Last update time */ - lastUpdateTime?: number | undefined; + lastUpdateTime?: bigint | undefined; /** Creation time */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Tags: Additional metadata key-value pairs. */ tags?: ExperimentTag[] | undefined; } @@ -251,7 +251,7 @@ export interface FileInfo { /** Whether the path is a directory. */ isDir?: boolean | undefined; /** The size in bytes of the file. Unset for directories. */ - fileSize?: number | undefined; + fileSize?: bigint | undefined; } export interface FinalizeLoggedModelRequest { @@ -410,7 +410,7 @@ export interface ListExperimentsRequest { * Callers of this endpoint are encouraged to pass max_results explicitly and leverage * page_token to iterate through experiments. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** Token indicating the page of experiments to fetch */ pageToken?: string | undefined; } @@ -484,9 +484,9 @@ export interface LogMetricRequest { /** Double value of the metric being logged. */ value?: number | undefined; /** Unix timestamp in milliseconds at the time metric was logged. */ - timestamp?: number | undefined; + timestamp?: bigint | undefined; /** Step at which to log the metric */ - step?: number | undefined; + step?: bigint | undefined; /** ID of the logged model associated with the metric, if applicable */ modelId?: string | undefined; /** @@ -573,15 +573,15 @@ export interface LoggedModelInfo { /** The name of the model. */ name?: string | undefined; /** The timestamp when the model was created in milliseconds since the UNIX epoch. */ - creationTimestampMs?: number | undefined; + creationTimestampMs?: bigint | undefined; /** The timestamp when the model was last updated in milliseconds since the UNIX epoch. */ - lastUpdatedTimestampMs?: number | undefined; + lastUpdatedTimestampMs?: bigint | undefined; /** The URI of the directory where model artifacts are stored. */ artifactUri?: string | undefined; /** The status of whether or not the model is ready for use. */ status?: LoggedModelStatus | undefined; /** The ID of the user or principal that created the model. */ - creatorId?: number | undefined; + creatorId?: bigint | undefined; /** The type of model, such as ``"Agent"``, ``"Classifier"``, ``"LLM"``. */ modelType?: string | undefined; /** The ID of the run that created the model. */ @@ -615,9 +615,9 @@ export interface Metric { /** The value of the metric. */ value?: number | undefined; /** The timestamp at which the metric was recorded. */ - timestamp?: number | undefined; + timestamp?: bigint | undefined; /** The step at which the metric was logged. */ - step?: number | undefined; + step?: bigint | undefined; /** * The name of the dataset associated with the metric. * E.g. “my.uc.table@2” “nyc-taxi-dataset”, “fantastic-elk-3” @@ -649,7 +649,7 @@ export interface ModelOutput { /** The unique identifier of the model. */ modelId?: string | undefined; /** The step at which the model was produced. */ - step?: number | undefined; + step?: bigint | undefined; } /** Param associated with a run. */ @@ -683,7 +683,7 @@ export interface RestoreRunsRequest { * The minimum deletion timestamp in milliseconds since the UNIX epoch for restoring runs. Only runs deleted no * earlier than this timestamp are restored. */ - minTimestampMillis?: number | undefined; + minTimestampMillis?: bigint | undefined; /** * An optional positive integer indicating the maximum number of runs to restore. The maximum allowed value for * max_runs is 10000. @@ -739,9 +739,9 @@ export interface RunInfo { /** Current status of the run. */ status?: RunStatus | undefined; /** Unix timestamp of when the run started in milliseconds. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** Unix timestamp of when the run ended in milliseconds. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** * URI of the directory where artifacts should be uploaded. * This can be a local path (starting with "/"), or a distributed file system (DFS) @@ -771,7 +771,7 @@ export interface RunTag { export interface SearchExperimentsRequest { /** Maximum number of experiments desired. Max threshold is 3000. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** Token indicating the page of experiments to fetch */ pageToken?: string | undefined; /** String representing a SQL filter condition (e.g. "name ILIKE 'my-experiment%'") */ @@ -966,7 +966,7 @@ export interface UpdateRunRequest { /** Updated status of the run. */ status?: RunStatus | undefined; /** Unix timestamp in milliseconds of when the run ended. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** Updated name of the run. */ runName?: string | undefined; } @@ -1071,8 +1071,14 @@ export const unmarshalExperimentSchema: z.ZodType = z name: z.string().optional(), artifact_location: z.string().optional(), lifecycle_stage: z.string().optional(), - last_update_time: z.number().optional(), - creation_time: z.number().optional(), + last_update_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), tags: z.array(z.lazy(() => unmarshalExperimentTagSchema)).optional(), }) .transform(d => ({ @@ -1099,7 +1105,10 @@ export const unmarshalFileInfoSchema: z.ZodType = z .object({ path: z.string().optional(), is_dir: z.boolean().optional(), - file_size: z.number().optional(), + file_size: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ path: d.path, @@ -1262,11 +1271,20 @@ export const unmarshalLoggedModelInfoSchema: z.ZodType = z model_id: z.string().optional(), experiment_id: z.string().optional(), name: z.string().optional(), - creation_timestamp_ms: z.number().optional(), - last_updated_timestamp_ms: z.number().optional(), + creation_timestamp_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), artifact_uri: z.string().optional(), status: z.enum(LoggedModelStatus).optional(), - creator_id: z.number().optional(), + creator_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), model_type: z.string().optional(), source_run_id: z.string().optional(), status_message: z.string().optional(), @@ -1312,8 +1330,14 @@ export const unmarshalMetricSchema: z.ZodType = z .object({ key: z.string().optional(), value: z.number().optional(), - timestamp: z.number().optional(), - step: z.number().optional(), + timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + step: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), dataset_name: z.string().optional(), dataset_digest: z.string().optional(), model_id: z.string().optional(), @@ -1398,8 +1422,14 @@ export const unmarshalRunInfoSchema: z.ZodType = z run_name: z.string().optional(), user_id: z.string().optional(), status: z.enum(RunStatus).optional(), - start_time: z.number().optional(), - end_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), artifact_uri: z.string().optional(), lifecycle_stage: z.string().optional(), }) @@ -1535,7 +1565,7 @@ export const marshalCreateRunRequestSchema: z.ZodType = z experimentId: z.string().optional(), userId: z.string().optional(), runName: z.string().optional(), - startTime: z.number().optional(), + startTime: z.bigint().optional(), tags: z.array(z.lazy(() => marshalRunTagSchema)).optional(), }) .transform(d => ({ @@ -1593,7 +1623,7 @@ export const marshalDeleteRunRequestSchema: z.ZodType = z export const marshalDeleteRunsRequestSchema: z.ZodType = z .object({ experimentId: z.string().optional(), - maxTimestampMillis: z.number().optional(), + maxTimestampMillis: z.bigint().optional(), maxRuns: z.number().optional(), }) .transform(d => ({ @@ -1684,8 +1714,8 @@ export const marshalLogMetricRequestSchema: z.ZodType = z runUuid: z.string().optional(), key: z.string().optional(), value: z.number().optional(), - timestamp: z.number().optional(), - step: z.number().optional(), + timestamp: z.bigint().optional(), + step: z.bigint().optional(), modelId: z.string().optional(), datasetName: z.string().optional(), datasetDigest: z.string().optional(), @@ -1760,8 +1790,8 @@ export const marshalMetricSchema: z.ZodType = z .object({ key: z.string().optional(), value: z.number().optional(), - timestamp: z.number().optional(), - step: z.number().optional(), + timestamp: z.bigint().optional(), + step: z.bigint().optional(), datasetName: z.string().optional(), datasetDigest: z.string().optional(), modelId: z.string().optional(), @@ -1789,7 +1819,7 @@ export const marshalModelInputSchema: z.ZodType = z export const marshalModelOutputSchema: z.ZodType = z .object({ modelId: z.string().optional(), - step: z.number().optional(), + step: z.bigint().optional(), }) .transform(d => ({ model_id: d.modelId, @@ -1825,7 +1855,7 @@ export const marshalRestoreRunRequestSchema: z.ZodType = z export const marshalRestoreRunsRequestSchema: z.ZodType = z .object({ experimentId: z.string().optional(), - minTimestampMillis: z.number().optional(), + minTimestampMillis: z.bigint().optional(), maxRuns: z.number().optional(), }) .transform(d => ({ @@ -1846,7 +1876,7 @@ export const marshalRunTagSchema: z.ZodType = z export const marshalSearchExperimentsRequestSchema: z.ZodType = z .object({ - maxResults: z.number().optional(), + maxResults: z.bigint().optional(), pageToken: z.string().optional(), filter: z.string().optional(), orderBy: z.array(z.string()).optional(), @@ -1977,7 +2007,7 @@ export const marshalUpdateRunRequestSchema: z.ZodType = z runId: z.string().optional(), runUuid: z.string().optional(), status: z.enum(RunStatus).optional(), - endTime: z.number().optional(), + endTime: z.bigint().optional(), runName: z.string().optional(), }) .transform(d => ({ diff --git a/packages/experiments/src/v1/utils.ts b/packages/experiments/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/experiments/src/v1/utils.ts +++ b/packages/experiments/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/externallineage/package.json b/packages/externallineage/package.json index d22ba8fe..4a3cd5e1 100644 --- a/packages/externallineage/package.json +++ b/packages/externallineage/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/externallineage/src/v1/client.ts b/packages/externallineage/src/v1/client.ts index 5ce66e07..f55f3b9a 100644 --- a/packages/externallineage/src/v1/client.ts +++ b/packages/externallineage/src/v1/client.ts @@ -38,7 +38,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/externallineage/src/v1/model.ts b/packages/externallineage/src/v1/model.ts index 6da983a9..7542b723 100644 --- a/packages/externallineage/src/v1/model.ts +++ b/packages/externallineage/src/v1/model.ts @@ -190,7 +190,7 @@ export interface LineageModelVersionInfo { /** Name of the model. */ modelName?: string | undefined; /** Version number of the model. */ - version?: number | undefined; + version?: bigint | undefined; /** Timestamp of the lineage event. */ eventTime?: Temporal.Instant | undefined; } @@ -422,7 +422,10 @@ export const unmarshalLineageModelVersionInfoSchema: z.ZodType BigInt(v)) + .optional(), event_time: z .string() .transform(s => Temporal.Instant.from(s)) diff --git a/packages/externallineage/src/v1/utils.ts b/packages/externallineage/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/externallineage/src/v1/utils.ts +++ b/packages/externallineage/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/externallocations/package.json b/packages/externallocations/package.json index 9ba7fcff..1c693e8e 100644 --- a/packages/externallocations/package.json +++ b/packages/externallocations/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/externallocations/src/v1/client.ts b/packages/externallocations/src/v1/client.ts index 6990bb32..06b3bf93 100644 --- a/packages/externallocations/src/v1/client.ts +++ b/packages/externallocations/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/externallocations/src/v1/model.ts b/packages/externallocations/src/v1/model.ts index 7a551a8d..532a8f5d 100644 --- a/packages/externallocations/src/v1/model.ts +++ b/packages/externallocations/src/v1/model.ts @@ -74,11 +74,11 @@ export interface CreateExternalLocationRequest { /** Unique ID of the location's storage credential. */ credentialId?: string | undefined; /** Time at which this external location was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of external location creator. */ createdBy?: string | undefined; /** Time at which external location this was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the external location. */ updatedBy?: string | undefined; /** Indicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request. */ @@ -144,11 +144,11 @@ export interface ExternalLocationInfo { /** Unique ID of the location's storage credential. */ credentialId?: string | undefined; /** Time at which this external location was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of external location creator. */ createdBy?: string | undefined; /** Time at which external location this was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the external location. */ updatedBy?: string | undefined; /** Indicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request. */ @@ -273,11 +273,11 @@ export interface UpdateExternalLocationRequest { /** Unique ID of the location's storage credential. */ credentialId?: string | undefined; /** Time at which this external location was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of external location creator. */ createdBy?: string | undefined; /** Time at which external location this was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the external location. */ updatedBy?: string | undefined; /** Indicates whether the principal is limited to retrieving metadata for the associated object through the BROWSE privilege when include_browse is enabled in the request. */ @@ -356,9 +356,15 @@ export const unmarshalExternalLocationInfoSchema: z.ZodType BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), browse_only: z.boolean().optional(), isolation_mode: z.enum(IsolationMode).optional(), @@ -495,9 +501,9 @@ export const marshalCreateExternalLocationRequestSchema: z.ZodType = z encryptionDetails: z.lazy(() => marshalEncryptionDetailsSchema).optional(), metastoreId: z.string().optional(), credentialId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), browseOnly: z.boolean().optional(), isolationMode: z.enum(IsolationMode).optional(), @@ -641,9 +647,9 @@ export const marshalUpdateExternalLocationRequestSchema: z.ZodType = z encryptionDetails: z.lazy(() => marshalEncryptionDetailsSchema).optional(), metastoreId: z.string().optional(), credentialId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), browseOnly: z.boolean().optional(), isolationMode: z.enum(IsolationMode).optional(), diff --git a/packages/externallocations/src/v1/utils.ts b/packages/externallocations/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/externallocations/src/v1/utils.ts +++ b/packages/externallocations/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/externalmetadata/package.json b/packages/externalmetadata/package.json index 48ae557c..96541f4c 100644 --- a/packages/externalmetadata/package.json +++ b/packages/externalmetadata/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/externalmetadata/src/v1/client.ts b/packages/externalmetadata/src/v1/client.ts index 99ecc8fb..a7369622 100644 --- a/packages/externalmetadata/src/v1/client.ts +++ b/packages/externalmetadata/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/externalmetadata/src/v1/utils.ts b/packages/externalmetadata/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/externalmetadata/src/v1/utils.ts +++ b/packages/externalmetadata/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/features/package.json b/packages/features/package.json index fd9a4255..e27db62e 100644 --- a/packages/features/package.json +++ b/packages/features/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/features/src/v1/client.ts b/packages/features/src/v1/client.ts index be4631e9..6ae9f52e 100644 --- a/packages/features/src/v1/client.ts +++ b/packages/features/src/v1/client.ts @@ -58,7 +58,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -85,7 +85,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/features/src/v1/model.ts b/packages/features/src/v1/model.ts index 3c8ffd94..1fef3a6e 100644 --- a/packages/features/src/v1/model.ts +++ b/packages/features/src/v1/model.ts @@ -112,7 +112,7 @@ export interface ApproxPercentileFunction { /** The percentile value to compute (between 0 and 1). */ percentile?: number | undefined; /** The accuracy parameter (higher is more accurate but slower). */ - accuracy?: number | undefined; + accuracy?: bigint | undefined; } export interface AuthConfig { @@ -432,9 +432,9 @@ export interface GetMaterializedFeatureRequest { export interface JobContext { /** The job ID where this API invoked. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The job run ID where this API was invoked. */ - jobRunId?: number | undefined; + jobRunId?: bigint | undefined; } export interface KafkaConfig { @@ -495,7 +495,7 @@ export interface LastFunction { /** Lineage context information for tracking where an API was invoked. This will allow us to track lineage, which currently uses caller entity information for use across the Lineage Client and Observability in Lumberjack. */ export interface LineageContext { /** The notebook ID where this API was invoked. */ - notebookId?: number | undefined; + notebookId?: bigint | undefined; /** Job context information including job ID and run ID. */ jobContext?: JobContext | undefined; } @@ -967,7 +967,10 @@ export const unmarshalApproxPercentileFunctionSchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ input: d.input, @@ -1236,8 +1239,14 @@ export const unmarshalFunction_ExtraParameterSchema: z.ZodType = z .object({ - job_id: z.number().optional(), - job_run_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ jobId: d.job_id, @@ -1294,7 +1303,10 @@ export const unmarshalLastFunctionSchema: z.ZodType = z export const unmarshalLineageContextSchema: z.ZodType = z .object({ - notebook_id: z.number().optional(), + notebook_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), job_context: z.lazy(() => unmarshalJobContextSchema).optional(), }) .transform(d => ({ @@ -1749,7 +1761,7 @@ export const marshalApproxPercentileFunctionSchema: z.ZodType = z .object({ input: z.string().optional(), percentile: z.number().optional(), - accuracy: z.number().optional(), + accuracy: z.bigint().optional(), }) .transform(d => ({ input: d.input, @@ -2046,8 +2058,8 @@ export const marshalFunction_ExtraParameterSchema: z.ZodType = z export const marshalJobContextSchema: z.ZodType = z .object({ - jobId: z.number().optional(), - jobRunId: z.number().optional(), + jobId: z.bigint().optional(), + jobRunId: z.bigint().optional(), }) .transform(d => ({ job_id: d.jobId, @@ -2104,7 +2116,7 @@ export const marshalLastFunctionSchema: z.ZodType = z export const marshalLineageContextSchema: z.ZodType = z .object({ - notebookId: z.number().optional(), + notebookId: z.bigint().optional(), jobContext: z.lazy(() => marshalJobContextSchema).optional(), }) .transform(d => ({ diff --git a/packages/features/src/v1/utils.ts b/packages/features/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/features/src/v1/utils.ts +++ b/packages/features/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/featurestore/package.json b/packages/featurestore/package.json index 15269855..1f1d989b 100644 --- a/packages/featurestore/package.json +++ b/packages/featurestore/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/featurestore/src/v1/client.ts b/packages/featurestore/src/v1/client.ts index 30ca09a7..8bbc2ac5 100644 --- a/packages/featurestore/src/v1/client.ts +++ b/packages/featurestore/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -66,7 +66,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/featurestore/src/v1/utils.ts b/packages/featurestore/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/featurestore/src/v1/utils.ts +++ b/packages/featurestore/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/files/package.json b/packages/files/package.json index 95ed3574..f8752dd7 100644 --- a/packages/files/package.json +++ b/packages/files/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/files/src/v2/client.ts b/packages/files/src/v2/client.ts index f881e415..18dcd35c 100644 --- a/packages/files/src/v2/client.ts +++ b/packages/files/src/v2/client.ts @@ -87,7 +87,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -114,7 +114,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); @@ -632,7 +632,7 @@ export class Client { resp = { contentLength: contentLengthHeader !== null - ? Number(contentLengthHeader) + ? BigInt(contentLengthHeader) : undefined, contentType: httpResp.headers.get('content-type') ?? undefined, lastModified: httpResp.headers.get('last-modified') ?? undefined, diff --git a/packages/files/src/v2/model.ts b/packages/files/src/v2/model.ts index b7b37e74..02b9c6ae 100644 --- a/packages/files/src/v2/model.ts +++ b/packages/files/src/v2/model.ts @@ -4,7 +4,7 @@ import {z} from 'zod'; export interface AddBlockRequest { /** The handle on an open stream. */ - handle?: number | undefined; + handle?: bigint | undefined; /** The base64-encoded data to append to the stream. This has a limit of 1 MB. */ data?: Uint8Array | undefined; } @@ -14,7 +14,7 @@ export interface AddBlockRequest_Response {} export interface CloseRequest { /** The handle on an open stream. */ - handle?: number | undefined; + handle?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. @@ -39,7 +39,7 @@ export interface CreateRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface CreateRequest_Response { /** Handle which should subsequently be passed into the AddBlock and Close calls when writing to a file through a stream. */ - handle?: number | undefined; + handle?: bigint | undefined; } /** Delete a directory */ @@ -103,7 +103,7 @@ export interface DownloadFileRequest { export interface DownloadFileResponse { /** The length of the HTTP response body in bytes. */ - contentLength?: number | undefined; + contentLength?: bigint | undefined; contentType?: string | undefined; contents?: ReadableStream | undefined; /** The last modified time of the file in HTTP-date (RFC 7231) format. */ @@ -117,9 +117,9 @@ export interface FileInfo { /** True if the path is a directory. */ isDir?: boolean | undefined; /** The length of the file in bytes. This field is omitted for directories. */ - fileSize?: number | undefined; + fileSize?: bigint | undefined; /** Last modification time of given file in milliseconds since epoch. */ - modificationTime?: number | undefined; + modificationTime?: bigint | undefined; } /** Get directory metadata */ @@ -151,7 +151,7 @@ export interface GetFileMetadataRequest { export interface GetFileMetadataResponse { /** The length of the HTTP response body in bytes. */ - contentLength?: number | undefined; + contentLength?: bigint | undefined; contentType?: string | undefined; /** The last modified time of the file in HTTP-date (RFC 7231) format. */ lastModified?: string | undefined; @@ -169,9 +169,9 @@ export interface GetStatusRequest_Response { /** True if the path is a directory. */ isDir?: boolean | undefined; /** The length of the file in bytes. This field is omitted for directories. */ - fileSize?: number | undefined; + fileSize?: bigint | undefined; /** Last modification time of given file in milliseconds since epoch. */ - modificationTime?: number | undefined; + modificationTime?: bigint | undefined; } /** List directory contents */ @@ -189,7 +189,7 @@ export interface ListDirectoryContentsRequest { * If unspecified, at most 1000 directory entries will be returned. * The maximum value is 1000. Values above 1000 will be coerced to 1000. */ - pageSize?: number | undefined; + pageSize?: bigint | undefined; /** * An opaque page token which was the `next_page_token` in the response of the previous * request to list the contents of this directory. Provide this token to retrieve the @@ -255,12 +255,12 @@ export interface ReadRequest { /** The path of the file to read. The path should be the absolute DBFS path. */ path?: string | undefined; /** The offset to read from in bytes. */ - offset?: number | undefined; + offset?: bigint | undefined; /** * The number of bytes to read starting from the offset. This has a limit of 1 MB, and a default * value of 0.5 MB. */ - length?: number | undefined; + length?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -269,7 +269,7 @@ export interface ReadRequest_Response { * The number of bytes read (could be less than ``length`` if we hit end of file). This refers to * number of bytes read in unencoded version (response data is base64-encoded). */ - bytesRead?: number | undefined; + bytesRead?: bigint | undefined; /** The base64-encoded contents of the file read. */ data?: Uint8Array | undefined; } @@ -301,7 +301,10 @@ export const unmarshalCreateDirectoryResponseSchema: z.ZodType = z .object({ - handle: z.number().optional(), + handle: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ handle: d.handle, @@ -337,8 +340,14 @@ export const unmarshalFileInfoSchema: z.ZodType = z .object({ path: z.string().optional(), is_dir: z.boolean().optional(), - file_size: z.number().optional(), - modification_time: z.number().optional(), + file_size: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + modification_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ path: d.path, @@ -353,7 +362,10 @@ export const unmarshalGetDirectoryMetadataResponseSchema: z.ZodType = z .object({ - 'content-length': z.number().optional(), + 'content-length': z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), 'content-type': z.string().optional(), 'last-modified': z.string().optional(), }) @@ -369,8 +381,14 @@ export const unmarshalGetStatusRequest_ResponseSchema: z.ZodType BigInt(v)) + .optional(), + modification_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ path: d.path, @@ -416,7 +434,10 @@ export const unmarshalPutRequest_ResponseSchema: z.ZodType export const unmarshalReadRequest_ResponseSchema: z.ZodType = z .object({ - bytes_read: z.number().optional(), + bytes_read: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), data: z .string() .transform(s => Uint8Array.from(atob(s), c => c.charCodeAt(0))) @@ -432,7 +453,7 @@ export const unmarshalUploadFileResponseSchema: z.ZodType = export const marshalAddBlockRequestSchema: z.ZodType = z .object({ - handle: z.number().optional(), + handle: z.bigint().optional(), data: z .any() .transform((d: Uint8Array) => @@ -447,7 +468,7 @@ export const marshalAddBlockRequestSchema: z.ZodType = z export const marshalCloseRequestSchema: z.ZodType = z .object({ - handle: z.number().optional(), + handle: z.bigint().optional(), }) .transform(d => ({ handle: d.handle, diff --git a/packages/files/src/v2/utils.ts b/packages/files/src/v2/utils.ts index 9b9a799a..85e4413a 100644 --- a/packages/files/src/v2/utils.ts +++ b/packages/files/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/forecasting/package.json b/packages/forecasting/package.json index f8070853..165d9a5b 100644 --- a/packages/forecasting/package.json +++ b/packages/forecasting/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/forecasting/src/v1/client.ts b/packages/forecasting/src/v1/client.ts index 1d2a0ca2..8662320f 100644 --- a/packages/forecasting/src/v1/client.ts +++ b/packages/forecasting/src/v1/client.ts @@ -33,7 +33,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -62,7 +62,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/forecasting/src/v1/model.ts b/packages/forecasting/src/v1/model.ts index 2e1397c8..37f8d3d0 100644 --- a/packages/forecasting/src/v1/model.ts +++ b/packages/forecasting/src/v1/model.ts @@ -29,7 +29,7 @@ export interface CreateForecastingExperimentRequest { */ forecastGranularity?: string | undefined; /** The number of time steps into the future to make predictions, calculated as a multiple of forecast_granularity. This value represents how far ahead the model should forecast. */ - forecastHorizon?: number | undefined; + forecastHorizon?: bigint | undefined; /** The evaluation metric used to optimize the forecasting model. */ primaryMetric?: string | undefined; /** List of frameworks to include for model tuning. Possible values are 'Prophet', 'ARIMA', 'DeepAR'. An empty list includes all supported frameworks. */ @@ -37,7 +37,7 @@ export interface CreateForecastingExperimentRequest { /** The path in the workspace to store the created experiment. */ experimentPath?: string | undefined; /** The maximum duration for the experiment in minutes. The experiment stops automatically if it exceeds this limit. */ - maxRuntime?: number | undefined; + maxRuntime?: bigint | undefined; /** // The column in the training table used for custom data splits. Values must be 'train', 'validate', or 'test'. */ splitColumn?: string | undefined; /** The column in the training table used to customize weights for each time series. */ @@ -111,11 +111,11 @@ export const marshalCreateForecastingExperimentRequestSchema: z.ZodType = z targetColumn: z.string().optional(), timeColumn: z.string().optional(), forecastGranularity: z.string().optional(), - forecastHorizon: z.number().optional(), + forecastHorizon: z.bigint().optional(), primaryMetric: z.string().optional(), trainingFrameworks: z.array(z.string()).optional(), experimentPath: z.string().optional(), - maxRuntime: z.number().optional(), + maxRuntime: z.bigint().optional(), splitColumn: z.string().optional(), customWeightsColumn: z.string().optional(), registerTo: z.string().optional(), diff --git a/packages/forecasting/src/v1/utils.ts b/packages/forecasting/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/forecasting/src/v1/utils.ts +++ b/packages/forecasting/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/functions/package.json b/packages/functions/package.json index c5965c74..8fad60d6 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/functions/src/v1/client.ts b/packages/functions/src/v1/client.ts index ea406e5e..dc57a384 100644 --- a/packages/functions/src/v1/client.ts +++ b/packages/functions/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/functions/src/v1/model.ts b/packages/functions/src/v1/model.ts index 7c34e703..408fd639 100644 --- a/packages/functions/src/v1/model.ts +++ b/packages/functions/src/v1/model.ts @@ -123,11 +123,11 @@ export interface CreateFunction { /** Full name of Function, in form of **catalog_name**.**schema_name**.**function_name** */ fullName?: string | undefined; /** Time at which this function was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of function creator. */ createdBy?: string | undefined; /** Time at which this function was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the function. */ updatedBy?: string | undefined; /** Id of Function, relative to parent schema. */ @@ -232,11 +232,11 @@ export interface FunctionInfo { /** Full name of Function, in form of **catalog_name**.**schema_name**.**function_name** */ fullName?: string | undefined; /** Time at which this function was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of function creator. */ createdBy?: string | undefined; /** Time at which this function was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the function. */ updatedBy?: string | undefined; /** Id of Function, relative to parent schema. */ @@ -371,11 +371,11 @@ export interface UpdateFunctionRequest { /** Full name of Function, in form of **catalog_name**.**schema_name**.**function_name** */ fullName?: string | undefined; /** Time at which this function was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of function creator. */ createdBy?: string | undefined; /** Time at which this function was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the function. */ updatedBy?: string | undefined; /** Id of Function, relative to parent schema. */ @@ -475,9 +475,15 @@ export const unmarshalFunctionInfoSchema: z.ZodType = z .optional(), metastore_id: z.string().optional(), full_name: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), function_id: z.string().optional(), browse_only: z.boolean().optional(), @@ -611,9 +617,9 @@ export const marshalCreateFunctionSchema: z.ZodType = z routineDependencies: z.lazy(() => marshalDependencyListSchema).optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), functionId: z.string().optional(), browseOnly: z.boolean().optional(), @@ -788,9 +794,9 @@ export const marshalUpdateFunctionRequestSchema: z.ZodType = z routineDependencies: z.lazy(() => marshalDependencyListSchema).optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), functionId: z.string().optional(), browseOnly: z.boolean().optional(), diff --git a/packages/functions/src/v1/utils.ts b/packages/functions/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/functions/src/v1/utils.ts +++ b/packages/functions/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/genie/package.json b/packages/genie/package.json index b245dde4..f24ee5d7 100644 --- a/packages/genie/package.json +++ b/packages/genie/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/genie/src/v1/client.ts b/packages/genie/src/v1/client.ts index 63dc6146..b6103a31 100644 --- a/packages/genie/src/v1/client.ts +++ b/packages/genie/src/v1/client.ts @@ -96,7 +96,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -125,7 +125,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/genie/src/v1/model.ts b/packages/genie/src/v1/model.ts index ae303ee5..ec021cf3 100644 --- a/packages/genie/src/v1/model.ts +++ b/packages/genie/src/v1/model.ts @@ -755,14 +755,14 @@ export interface ChunkInfo { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -855,14 +855,14 @@ export interface ExternalLink { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -918,11 +918,11 @@ export interface GenieConversation { /** Genie space ID */ spaceId?: string | undefined; /** ID of the user who created the conversation */ - userId?: number | undefined; + userId?: bigint | undefined; /** Timestamp when the message was created */ - createdTimestamp?: number | undefined; + createdTimestamp?: bigint | undefined; /** Timestamp when the message was last updated */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** Conversation title */ title?: string | undefined; /** Conversation ID */ @@ -932,7 +932,7 @@ export interface GenieConversation { export interface GenieConversationSummary { conversationId?: string | undefined; title?: string | undefined; - createdTimestamp?: number | undefined; + createdTimestamp?: bigint | undefined; } export interface GenieCreateConversationMessageRequest { @@ -1022,7 +1022,7 @@ export interface GenieEvalResult { /** Stored snapshot of original benchmark answer text. */ benchmarkAnswer?: string | undefined; /** User ID who created evaluation result. */ - createdByUser?: number | undefined; + createdByUser?: bigint | undefined; } /** Shows detailed information for an evaluation result. */ @@ -1088,19 +1088,19 @@ export interface GenieEvalRunResponse { /** Current status of the evaluation run. */ evalRunStatus?: EvaluationStatusType | undefined; /** User ID who initiated the evaluation run. */ - runByUser?: number | undefined; + runByUser?: bigint | undefined; /** Timestamp when the evaluation run was created (milliseconds since epoch). */ - createdTimestamp?: number | undefined; + createdTimestamp?: bigint | undefined; /** Total number of questions in the evaluation run. */ - numQuestions?: number | undefined; + numQuestions?: bigint | undefined; /** Number of questions answered correctly. */ - numCorrect?: number | undefined; + numCorrect?: bigint | undefined; /** Number of questions that need manual review. */ - numNeedsReview?: number | undefined; + numNeedsReview?: bigint | undefined; /** Number of questions that have been completed. */ - numDone?: number | undefined; + numDone?: bigint | undefined; /** Timestamp when the evaluation run was last updated (milliseconds since epoch). */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; } export interface GenieExecuteMessageAttachmentQueryRequest { @@ -1375,11 +1375,11 @@ export interface GenieMessage { /** Conversation ID */ conversationId?: string | undefined; /** ID of the user who created the message */ - userId?: number | undefined; + userId?: bigint | undefined; /** Timestamp when the message was created */ - createdTimestamp?: number | undefined; + createdTimestamp?: bigint | undefined; /** Timestamp when the message was last updated */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; status?: MessageStatus_MessageStatus | undefined; /** User message content */ content?: string | undefined; @@ -1409,11 +1409,11 @@ export interface GenieMessageComment { /** Comment ID */ messageCommentId?: string | undefined; /** ID of the user who created the comment */ - userId?: number | undefined; + userId?: bigint | undefined; /** Comment text content */ content?: string | undefined; /** Timestamp when the comment was created */ - createdTimestamp?: number | undefined; + createdTimestamp?: bigint | undefined; } export interface GenieQueryAttachment { @@ -1424,7 +1424,7 @@ export interface GenieQueryAttachment { /** Description of the query */ description?: string | undefined; /** Time when the user updated the query last */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; parameters?: QueryAttachmentParameter[] | undefined; id?: string | undefined; /** Statement Execution API statement id. Use [Get status, manifest, and result first chunk](:method:statementexecution/getstatement) to get the full result data. */ @@ -1437,7 +1437,7 @@ export interface GenieQueryAttachment { export interface GenieResultMetadata { /** The number of rows in the result set. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** Indicates whether the result set is truncated. */ isTruncated?: boolean | undefined; } @@ -1590,7 +1590,7 @@ export interface Result { /** Statement Execution API statement id. Use [Get status, manifest, and result first chunk](:method:statementexecution/getstatement) to get the full result data. */ statementId?: string | undefined; /** Row count of the result */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** If result is truncated */ isTruncated?: boolean | undefined; /** JWT corresponding to the statement contained in this result */ @@ -1615,14 +1615,14 @@ export interface ResultData { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -1646,12 +1646,12 @@ export interface ResultManifest { /** Array of result set chunk metadata. */ chunks?: ChunkInfo[] | undefined; /** The total number of rows in the result set. */ - totalRowCount?: number | undefined; + totalRowCount?: bigint | undefined; /** * The total number of bytes in the result set. This field is not available when using `INLINE` * disposition. */ - totalByteCount?: number | undefined; + totalByteCount?: bigint | undefined; /** Indicates whether the result is truncated due to `row_limit` or `byte_limit`. */ truncated?: boolean | undefined; } @@ -1783,9 +1783,18 @@ export interface Value { export const unmarshalChunkInfoSchema: z.ZodType = z .object({ chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -1861,9 +1870,18 @@ export const unmarshalExternalLinkSchema: z.ZodType = z expiration: z.string().optional(), http_headers: z.record(z.string(), z.string()).optional(), chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -1907,9 +1925,18 @@ export const unmarshalGenieConversationSchema: z.ZodType = z .object({ id: z.string().optional(), space_id: z.string().optional(), - user_id: z.number().optional(), - created_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + created_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), title: z.string().optional(), conversation_id: z.string().optional(), }) @@ -1928,7 +1955,10 @@ export const unmarshalGenieConversationSummarySchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ conversationId: d.conversation_id, @@ -1958,7 +1988,10 @@ export const unmarshalGenieEvalResultSchema: z.ZodType = z status: z.enum(EvaluationStatusType).optional(), question: z.string().optional(), benchmark_answer: z.string().optional(), - created_by_user: z.number().optional(), + created_by_user: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ resultId: d.result_id, @@ -2004,13 +2037,34 @@ export const unmarshalGenieEvalRunResponseSchema: z.ZodType BigInt(v)) + .optional(), + created_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + num_questions: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + num_correct: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + num_needs_review: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + num_done: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ evalRunId: d.eval_run_id, @@ -2159,9 +2213,18 @@ export const unmarshalGenieMessageSchema: z.ZodType = z id: z.string().optional(), space_id: z.string().optional(), conversation_id: z.string().optional(), - user_id: z.number().optional(), - created_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + created_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), status: z.enum(MessageStatus_MessageStatus).optional(), content: z.string().optional(), attachments: z @@ -2195,9 +2258,15 @@ export const unmarshalGenieMessageCommentSchema: z.ZodType conversation_id: z.string().optional(), message_id: z.string().optional(), message_comment_id: z.string().optional(), - user_id: z.number().optional(), + user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), content: z.string().optional(), - created_timestamp: z.number().optional(), + created_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ spaceId: d.space_id, @@ -2215,7 +2284,10 @@ export const unmarshalGenieQueryAttachmentSchema: z.ZodType BigInt(v)) + .optional(), parameters: z .array(z.lazy(() => unmarshalQueryAttachmentParameterSchema)) .optional(), @@ -2241,7 +2313,10 @@ export const unmarshalGenieQueryAttachmentSchema: z.ZodType = z .object({ - row_count: z.number().optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), is_truncated: z.boolean().optional(), }) .transform(d => ({ @@ -2353,7 +2428,10 @@ export const unmarshalQueryAttachmentParameterSchema: z.ZodType = z .object({ statement_id: z.string().optional(), - row_count: z.number().optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), is_truncated: z.boolean().optional(), statement_id_signature: z.string().optional(), }) @@ -2371,9 +2449,18 @@ export const unmarshalResultDataSchema: z.ZodType = z .optional(), data_array: z.array(z.lazy(() => unmarshalListValueSchema)).optional(), chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -2394,8 +2481,14 @@ export const unmarshalResultManifestSchema: z.ZodType = z schema: z.lazy(() => unmarshalSchemaSchema).optional(), total_chunk_count: z.number().optional(), chunks: z.array(z.lazy(() => unmarshalChunkInfoSchema)).optional(), - total_row_count: z.number().optional(), - total_byte_count: z.number().optional(), + total_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + total_byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), truncated: z.boolean().optional(), }) .transform(d => ({ diff --git a/packages/genie/src/v1/utils.ts b/packages/genie/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/genie/src/v1/utils.ts +++ b/packages/genie/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/gitcredentials/package.json b/packages/gitcredentials/package.json index 1f225946..b5b7d708 100644 --- a/packages/gitcredentials/package.json +++ b/packages/gitcredentials/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/gitcredentials/src/v1/client.ts b/packages/gitcredentials/src/v1/client.ts index 6ec31455..8ef303e3 100644 --- a/packages/gitcredentials/src/v1/client.ts +++ b/packages/gitcredentials/src/v1/client.ts @@ -41,7 +41,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -68,7 +68,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/gitcredentials/src/v1/model.ts b/packages/gitcredentials/src/v1/model.ts index 06f1e732..3b7d6d39 100644 --- a/packages/gitcredentials/src/v1/model.ts +++ b/packages/gitcredentials/src/v1/model.ts @@ -25,7 +25,7 @@ export interface CreateCredentialsRequest { */ personalAccessToken?: string | undefined; /** The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action. */ - principalId?: number | undefined; + principalId?: bigint | undefined; /** the name of the git credential, used for identification and ease of lookup */ name?: string | undefined; /** if the credential is the default for the given provider */ @@ -42,7 +42,7 @@ export interface CreateCredentialsRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface CreateCredentialsRequest_Response { /** ID of the credential object in the workspace. */ - credentialId?: number | undefined; + credentialId?: bigint | undefined; /** The Git provider associated with the credential. */ gitProvider?: string | undefined; /** @@ -67,7 +67,7 @@ export interface CreateCredentialsRequest_Response { export interface Credential { /** ID of the credential object in the workspace. */ - credentialId?: number | undefined; + credentialId?: bigint | undefined; /** * The Git provider associated with the credential. One of `gitHub`, `bitbucketCloud`, * `gitLab`, `azureDevOpsServices` (Azure DevOps Services, including Microsoft Entra ID @@ -97,9 +97,9 @@ export interface Credential { export interface DeleteCredentialsRequest { /** The ID for the corresponding credential to access. */ - id?: number | undefined; + id?: bigint | undefined; /** The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action. */ - principalId?: number | undefined; + principalId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. @@ -107,15 +107,15 @@ export interface DeleteCredentialsRequest_Response {} export interface GetCredentialsRequest { /** The ID for the corresponding credential to access. */ - id?: number | undefined; + id?: bigint | undefined; /** The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action. */ - principalId?: number | undefined; + principalId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface GetCredentialsRequest_Response { /** ID of the credential object in the workspace. */ - credentialId?: number | undefined; + credentialId?: bigint | undefined; /** The Git provider associated with the credential. */ gitProvider?: string | undefined; /** @@ -140,7 +140,7 @@ export interface GetCredentialsRequest_Response { export interface ListCredentialsRequest { /** The ID of the service principal whose credentials will be listed. Only service principal managers can perform this action. */ - principalId?: number | undefined; + principalId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -151,7 +151,7 @@ export interface ListCredentialsRequest_Response { export interface UpdateCredentialsRequest { /** The ID for the corresponding credential to access. */ - id?: number | undefined; + id?: bigint | undefined; /** * The personal access token used to authenticate to the corresponding Git provider. * For certain providers, support may exist for other types of scoped access tokens. @@ -174,7 +174,7 @@ export interface UpdateCredentialsRequest { */ gitUsername?: string | undefined; /** The ID of the service principal whose credentials will be modified. Only service principal managers can perform this action. */ - principalId?: number | undefined; + principalId?: bigint | undefined; /** the name of the git credential, used for identification and ease of lookup */ name?: string | undefined; /** if the credential is the default for the given provider */ @@ -195,7 +195,10 @@ export interface UpdateCredentialsRequest_Response {} export const unmarshalCreateCredentialsRequest_ResponseSchema: z.ZodType = z .object({ - credential_id: z.number().optional(), + credential_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), git_provider: z.string().optional(), git_username: z.string().optional(), name: z.string().optional(), @@ -213,7 +216,10 @@ export const unmarshalCreateCredentialsRequest_ResponseSchema: z.ZodType = z .object({ - credential_id: z.number().optional(), + credential_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), git_provider: z.string().optional(), git_username: z.string().optional(), name: z.string().optional(), @@ -237,7 +243,10 @@ export const unmarshalDeleteCredentialsRequest_ResponseSchema: z.ZodType = z .object({ - credential_id: z.number().optional(), + credential_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), git_provider: z.string().optional(), git_username: z.string().optional(), name: z.string().optional(), @@ -272,7 +281,7 @@ export const marshalCreateCredentialsRequestSchema: z.ZodType = z gitProvider: z.string().optional(), gitUsername: z.string().optional(), personalAccessToken: z.string().optional(), - principalId: z.number().optional(), + principalId: z.bigint().optional(), name: z.string().optional(), isDefaultForProvider: z.boolean().optional(), gitEmail: z.string().optional(), @@ -289,11 +298,11 @@ export const marshalCreateCredentialsRequestSchema: z.ZodType = z export const marshalUpdateCredentialsRequestSchema: z.ZodType = z .object({ - id: z.number().optional(), + id: z.bigint().optional(), personalAccessToken: z.string().optional(), gitProvider: z.string().optional(), gitUsername: z.string().optional(), - principalId: z.number().optional(), + principalId: z.bigint().optional(), name: z.string().optional(), isDefaultForProvider: z.boolean().optional(), gitEmail: z.string().optional(), diff --git a/packages/gitcredentials/src/v1/utils.ts b/packages/gitcredentials/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/gitcredentials/src/v1/utils.ts +++ b/packages/gitcredentials/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/globalinitscripts/package.json b/packages/globalinitscripts/package.json index b4251f29..c0f91969 100644 --- a/packages/globalinitscripts/package.json +++ b/packages/globalinitscripts/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/globalinitscripts/src/v2/client.ts b/packages/globalinitscripts/src/v2/client.ts index 0be95222..b44a9067 100644 --- a/packages/globalinitscripts/src/v2/client.ts +++ b/packages/globalinitscripts/src/v2/client.ts @@ -41,7 +41,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -68,7 +68,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/globalinitscripts/src/v2/model.ts b/packages/globalinitscripts/src/v2/model.ts index 0a817650..902f1153 100644 --- a/packages/globalinitscripts/src/v2/model.ts +++ b/packages/globalinitscripts/src/v2/model.ts @@ -50,11 +50,11 @@ export interface GlobalInitScriptDetails { /** The username of the user who created the script. */ createdBy?: string | undefined; /** Time when the script was created, represented as a Unix timestamp in milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The username of the user who last updated the script */ updatedBy?: string | undefined; /** Time when the script was updated, represented as a Unix timestamp in milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/no-empty-object-type @@ -116,9 +116,15 @@ export const unmarshalGlobalInitScriptDetailsSchema: z.ZodType BigInt(v)) + .optional(), updated_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ scriptId: d.script_id, diff --git a/packages/globalinitscripts/src/v2/utils.ts b/packages/globalinitscripts/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/globalinitscripts/src/v2/utils.ts +++ b/packages/globalinitscripts/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/grants/package.json b/packages/grants/package.json index cd68777a..8f1a2406 100644 --- a/packages/grants/package.json +++ b/packages/grants/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/grants/src/v1/client.ts b/packages/grants/src/v1/client.ts index 3afdc50b..b010b997 100644 --- a/packages/grants/src/v1/client.ts +++ b/packages/grants/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/grants/src/v1/utils.ts b/packages/grants/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/grants/src/v1/utils.ts +++ b/packages/grants/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/instancepools/package.json b/packages/instancepools/package.json index 83e4d2f5..8c4033ec 100644 --- a/packages/instancepools/package.json +++ b/packages/instancepools/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/instancepools/src/v2/client.ts b/packages/instancepools/src/v2/client.ts index 59ea30f3..5f5373d8 100644 --- a/packages/instancepools/src/v2/client.ts +++ b/packages/instancepools/src/v2/client.ts @@ -42,7 +42,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -69,7 +69,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/instancepools/src/v2/utils.ts b/packages/instancepools/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/instancepools/src/v2/utils.ts +++ b/packages/instancepools/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/instanceprofiles/package.json b/packages/instanceprofiles/package.json index c5ece23e..cd3c7523 100644 --- a/packages/instanceprofiles/package.json +++ b/packages/instanceprofiles/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/instanceprofiles/src/v2/client.ts b/packages/instanceprofiles/src/v2/client.ts index 9800eb03..aef9c073 100644 --- a/packages/instanceprofiles/src/v2/client.ts +++ b/packages/instanceprofiles/src/v2/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -66,7 +66,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/instanceprofiles/src/v2/utils.ts b/packages/instanceprofiles/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/instanceprofiles/src/v2/utils.ts +++ b/packages/instanceprofiles/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/jobs/package.json b/packages/jobs/package.json index 2e27967b..51a2289a 100644 --- a/packages/jobs/package.json +++ b/packages/jobs/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/jobs/src/v2/client.ts b/packages/jobs/src/v2/client.ts index 73229797..361e28a2 100644 --- a/packages/jobs/src/v2/client.ts +++ b/packages/jobs/src/v2/client.ts @@ -97,7 +97,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -126,7 +126,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); @@ -971,7 +971,7 @@ export class Client { export class CancelRunWaiter { constructor( private readonly client: Client, - readonly runId: number + readonly runId: bigint ) {} /** @@ -1051,7 +1051,7 @@ export class CancelRunWaiter { export class RepairWaiter { constructor( private readonly client: Client, - readonly runId: number + readonly runId: bigint ) {} /** @@ -1131,7 +1131,7 @@ export class RepairWaiter { export class RunNowWaiter { constructor( private readonly client: Client, - readonly runId: number + readonly runId: bigint ) {} /** @@ -1211,7 +1211,7 @@ export class RunNowWaiter { export class SubmitRunWaiter { constructor( private readonly client: Client, - readonly runId: number + readonly runId: bigint ) {} /** diff --git a/packages/jobs/src/v2/model.ts b/packages/jobs/src/v2/model.ts index 5dcae615..2b8fb478 100644 --- a/packages/jobs/src/v2/model.ts +++ b/packages/jobs/src/v2/model.ts @@ -873,7 +873,7 @@ export interface AzureAttributes { export interface BaseJob { /** The canonical identifier for this job. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The creator user name. This field won’t be included in the response if the user has already been deleted. */ creatorUserName?: string | undefined; /** @@ -885,7 +885,7 @@ export interface BaseJob { /** Settings for this job and all of its runs. These settings can be updated using the `resetJob` method. */ settings?: JobSettings | undefined; /** The time at which this job was created in epoch milliseconds (milliseconds since 1/1/1970 UTC). */ - createdTime?: number | undefined; + createdTime?: bigint | undefined; /** State of the trigger associated with the job. */ triggerState?: TriggerState | undefined; /** @@ -907,15 +907,15 @@ export interface BaseJob { export interface BaseRun { /** The canonical identifier of the job that contains this run. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The canonical identifier of the run. This ID is unique across all runs of all jobs. */ - runId?: number | undefined; + runId?: bigint | undefined; /** The creator user name. This field won’t be included in the response if the user has already been deleted. */ creatorUserName?: string | undefined; /** A unique identifier for this job run. This is set to the same value as `run_id`. */ - numberInJob?: number | undefined; + numberInJob?: bigint | undefined; /** If this run is a retry of a prior run attempt, this field contains the run_id of the original attempt; otherwise, it is the same as the run_id. */ - originalAttemptRunId?: number | undefined; + originalAttemptRunId?: bigint | undefined; /** Deprecated. Please use the `status` field instead. */ state?: RunState | undefined; /** The cron schedule that triggered this run if it was triggered by the periodic scheduler. */ @@ -965,7 +965,7 @@ export interface BaseRun { * For legacy and single-task job runs the field is populated with the job run ID. * For task runs, the field is populated with the ID of the job run that the task run belongs to. */ - jobRunId?: number | undefined; + jobRunId?: bigint | undefined; /** * Indicates if the run has more array properties (`tasks`, `job_clusters`) that are not shown. They can be accessed via :method:jobs/getrun endpoint. * It is only relevant for API 2.2 :method:jobs/listruns requests with `expand_tasks=true`. @@ -981,24 +981,24 @@ export interface BaseRun { /** The id of the usage policy used by this run for cost attribution purposes. */ effectiveUsagePolicyId?: string | undefined; /** The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). This may not be the time when the job task starts executing, for example, if the job is scheduled to run on a new cluster, this is the time the cluster creation call is issued. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** The time in milliseconds it took to set up the cluster. For runs that run on new clusters this is the cluster creation time, for runs that run on existing clusters this time should be very short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - setupDuration?: number | undefined; + setupDuration?: bigint | undefined; /** The time in milliseconds it took to execute the commands in the JAR or notebook until they completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - executionDuration?: number | undefined; + executionDuration?: bigint | undefined; /** The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - cleanupDuration?: number | undefined; + cleanupDuration?: bigint | undefined; /** The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This field is set to 0 if the job is still running. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** The time in milliseconds it took the job run and all of its repairs to finish. */ - runDuration?: number | undefined; + runDuration?: bigint | undefined; /** The time in milliseconds that the run has spent in the queue. */ - queueDuration?: number | undefined; + queueDuration?: bigint | undefined; } export interface CancelAllRunsRequest { /** The canonical identifier of the job to cancel all runs of. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** Optional boolean parameter to cancel all queued runs. If no job_id is provided, all queued runs in the workspace are canceled. */ allQueuedRuns?: boolean | undefined; } @@ -1009,7 +1009,7 @@ export interface CancelAllRunsRequest_Response {} export interface CancelRunRequest { /** This field is required. */ - runId?: number | undefined; + runId?: bigint | undefined; } /** Run was cancelled successfully. */ @@ -1509,7 +1509,7 @@ export interface CreateJobRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface CreateJobRequest_Response { /** The canonical identifier for the newly created job. */ - jobId?: number | undefined; + jobId?: bigint | undefined; } /** @@ -1594,7 +1594,7 @@ export interface DbtCloudJobRunStep { /** Deprecated in favor of DbtPlatformTask */ export interface DbtCloudTask { /** Id of the dbt Cloud job to be triggered */ - dbtCloudJobId?: number | undefined; + dbtCloudJobId?: bigint | undefined; /** The resource name of the UC connection that authenticates the dbt Cloud for this task */ connectionResourceName?: string | undefined; } @@ -1602,7 +1602,7 @@ export interface DbtCloudTask { /** Deprecated in favor of DbtPlatformTaskOutput */ export interface DbtCloudTaskOutput { /** Id of the job run in dbt Cloud */ - dbtCloudJobRunId?: number | undefined; + dbtCloudJobRunId?: bigint | undefined; /** Url where full run details can be viewed */ dbtCloudJobRunUrl?: string | undefined; /** Steps of the job run as received from dbt Cloud */ @@ -1686,7 +1686,7 @@ export interface DbtTask_DbtTaskOutput_ArtifactsHeadersEntry { export interface DeleteJobRequest { /** The canonical identifier of the job to delete. This field is required. */ - jobId?: number | undefined; + jobId?: bigint | undefined; } /** Job was deleted successfully. */ @@ -1695,7 +1695,7 @@ export interface DeleteJobRequest_Response {} export interface DeleteRunRequest { /** ID of the run to delete. */ - runId?: number | undefined; + runId?: bigint | undefined; } /** Run was deleted successfully. */ @@ -1723,7 +1723,7 @@ export interface DockerImage { export interface EnforcePolicyComplianceForJob { /** The ID of the job you want to enforce policy compliance on. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** * If set, previews changes made to the job to comply with its policy, but * does not update the job. @@ -1818,7 +1818,7 @@ export interface Environment { /** Retrieves the export of a job run task. */ export interface ExportRunRequest { /** The canonical identifier for the run. This field is required. */ - runId?: number | undefined; + runId?: bigint | undefined; /** Which views to export (CODE, DASHBOARDS, or ALL). Defaults to CODE. */ viewsToExport?: ViewsToExport | undefined; } @@ -1961,7 +1961,7 @@ export interface GenAiComputeTask { /** Retrieves information about a single job. */ export interface GetJobRequest { /** The canonical identifier of the job to retrieve information about. This field is required. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** Flag that indicates that trigger state should be included in the response. */ includeTriggerState?: boolean | undefined; /** Use `next_page_token` returned from the previous GetJob response to request the next page of the job's array properties. */ @@ -1974,7 +1974,7 @@ export interface GetJobRequest_Response { /** A token that can be used to list the next page of array properties. */ nextPageToken?: string | undefined; /** The canonical identifier for this job. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The creator user name. This field won’t be included in the response if the user has already been deleted. */ creatorUserName?: string | undefined; /** @@ -1986,7 +1986,7 @@ export interface GetJobRequest_Response { /** Settings for this job and all of its runs. These settings can be updated using the `resetJob` method. */ settings?: JobSettings | undefined; /** The time at which this job was created in epoch milliseconds (milliseconds since 1/1/1970 UTC). */ - createdTime?: number | undefined; + createdTime?: bigint | undefined; /** State of the trigger associated with the job. */ triggerState?: TriggerState | undefined; /** @@ -2008,7 +2008,7 @@ export interface GetJobRequest_Response { export interface GetPolicyComplianceForJob { /** The ID of the job whose compliance status you are requesting. */ - jobId?: number | undefined; + jobId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -2040,7 +2040,7 @@ export interface GetPolicyComplianceForJob_Response_ViolationsEntry { /** Retrieves both the output and the metadata of a run. */ export interface GetRunOutputRequest { /** The canonical identifier for the run. */ - runId?: number | undefined; + runId?: bigint | undefined; } /** Run output was retrieved successfully. */ @@ -2120,7 +2120,7 @@ export interface GetRunRequest { * The canonical identifier of the run for which to retrieve the metadata. * This field is required. */ - runId?: number | undefined; + runId?: bigint | undefined; /** Whether to include the repair history in the response. */ includeHistory?: boolean | undefined; /** Whether to include resolved parameter values in the response. */ @@ -2135,15 +2135,15 @@ export interface GetRunRequest_Response { /** A token that can be used to list the next page of array properties. */ nextPageToken?: string | undefined; /** The canonical identifier of the job that contains this run. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The canonical identifier of the run. This ID is unique across all runs of all jobs. */ - runId?: number | undefined; + runId?: bigint | undefined; /** The creator user name. This field won’t be included in the response if the user has already been deleted. */ creatorUserName?: string | undefined; /** A unique identifier for this job run. This is set to the same value as `run_id`. */ - numberInJob?: number | undefined; + numberInJob?: bigint | undefined; /** If this run is a retry of a prior run attempt, this field contains the run_id of the original attempt; otherwise, it is the same as the run_id. */ - originalAttemptRunId?: number | undefined; + originalAttemptRunId?: bigint | undefined; /** Deprecated. Please use the `status` field instead. */ state?: RunState | undefined; /** The cron schedule that triggered this run if it was triggered by the periodic scheduler. */ @@ -2193,7 +2193,7 @@ export interface GetRunRequest_Response { * For legacy and single-task job runs the field is populated with the job run ID. * For task runs, the field is populated with the ID of the job run that the task run belongs to. */ - jobRunId?: number | undefined; + jobRunId?: bigint | undefined; /** * Indicates if the run has more array properties (`tasks`, `job_clusters`) that are not shown. They can be accessed via :method:jobs/getrun endpoint. * It is only relevant for API 2.2 :method:jobs/listruns requests with `expand_tasks=true`. @@ -2209,19 +2209,19 @@ export interface GetRunRequest_Response { /** The id of the usage policy used by this run for cost attribution purposes. */ effectiveUsagePolicyId?: string | undefined; /** The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). This may not be the time when the job task starts executing, for example, if the job is scheduled to run on a new cluster, this is the time the cluster creation call is issued. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** The time in milliseconds it took to set up the cluster. For runs that run on new clusters this is the cluster creation time, for runs that run on existing clusters this time should be very short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - setupDuration?: number | undefined; + setupDuration?: bigint | undefined; /** The time in milliseconds it took to execute the commands in the JAR or notebook until they completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - executionDuration?: number | undefined; + executionDuration?: bigint | undefined; /** The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - cleanupDuration?: number | undefined; + cleanupDuration?: bigint | undefined; /** The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This field is set to 0 if the job is still running. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** The time in milliseconds it took the job run and all of its repairs to finish. */ - runDuration?: number | undefined; + runDuration?: bigint | undefined; /** The time in milliseconds that the run has spent in the queue. */ - queueDuration?: number | undefined; + queueDuration?: bigint | undefined; } /** Read-only state of the remote repository at the time the job was run. This field is only included on job runs. */ @@ -2557,7 +2557,7 @@ export interface JobsHealthRule { metric?: JobsHealthMetric | undefined; op?: JobsHealthOperator | undefined; /** Specifies the threshold value that the health metric should obey to satisfy the health rule. */ - value?: number | undefined; + value?: bigint | undefined; } /** An optional set of health rules that can be defined for this job. */ @@ -2645,7 +2645,7 @@ export interface ListJobComplianceForPolicy { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface ListJobComplianceForPolicy_JobCompliance { /** Canonical unique identifier for a job. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** Whether this job is in compliance with the latest version of its policy. */ isCompliant?: boolean | undefined; /** @@ -2717,7 +2717,7 @@ export interface ListJobsRequest_Response { /** Lists runs from most recently started to least. */ export interface ListRunsRequest { /** The job for which to list runs. If omitted, the Jobs service lists runs from all jobs. */ - jobId?: number | undefined; + jobId?: bigint | undefined; stateConstraint?: | { $case: 'activeOnly'; @@ -2760,12 +2760,12 @@ export interface ListRunsRequest { * Show runs that started _at or after_ this value. The value must be a UTC timestamp * in milliseconds. Can be combined with _start_time_to_ to filter by a time range. */ - startTimeFrom?: number | undefined; + startTimeFrom?: bigint | undefined; /** * Show runs that started _at or before_ this value. The value must be a UTC timestamp * in milliseconds. Can be combined with _start_time_from_ to filter by a time range. */ - startTimeTo?: number | undefined; + startTimeTo?: bigint | undefined; /** Use `next_page_token` or `prev_page_token` returned from the previous request to list the next or previous page of runs respectively. */ pageToken?: string | undefined; } @@ -2909,7 +2909,7 @@ export interface OutputSchemaInfo { catalogName?: string | undefined; schemaName?: string | undefined; /** The expiration time for the output schema as a Unix timestamp in milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/no-empty-object-type @@ -3083,15 +3083,15 @@ export interface Repair { /** The repair history item type. Indicates whether a run is the original run or a repair run. */ type?: RepairType | undefined; /** The start time of the (repaired) run. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** The end time of the (repaired) run. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** Deprecated. Please use the `status` field instead. */ state?: RunState | undefined; /** The ID of the repair. Only returned for the items that represent a repair in `repair_history`. */ - id?: number | undefined; + id?: bigint | undefined; /** The run IDs of the task runs that ran as part of this repair history item. */ - taskRunIds?: number[] | undefined; + taskRunIds?: bigint[] | undefined; status?: RunStatus | undefined; /** * The actual performance target used by the serverless run during execution. This can differ from the client-set performance target on the request depending on whether the performance mode is supported by the job type. @@ -3104,9 +3104,9 @@ export interface Repair { export interface RepairRunRequest { /** The job run ID of the run to repair. The run must not be in progress. */ - runId?: number | undefined; + runId?: bigint | undefined; /** The ID of the latest repair. This parameter is not required when repairing a run for the first time, but must be provided on subsequent requests to repair the same run. */ - latestRepairId?: number | undefined; + latestRepairId?: bigint | undefined; /** The task keys of the task runs to repair. */ rerunTasks?: string[] | undefined; /** Job-level parameters used in the run. for example `"param": "overriding_val"` */ @@ -3218,7 +3218,7 @@ export interface RepairRunRequest_PythonNamedParamsEntry { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface RepairRunRequest_Response { /** The ID of the repair. Must be provided in subsequent repairs using the `latest_repair_id` field to ensure sequential repairs. */ - repairId?: number | undefined; + repairId?: bigint | undefined; } /** Name-based parameters for jobs running notebook tasks. */ @@ -3231,7 +3231,7 @@ export interface RepairRunRequest_SqlParamsEntry { export interface ResetJobRequest { /** The canonical identifier of the job to reset. This field is required. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** * The new settings of the job. These settings completely replace the old settings. * @@ -3398,15 +3398,15 @@ export interface ResolvedValues_SqlTaskResolvedValues_ParametersEntry { export interface Run { /** The canonical identifier of the job that contains this run. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** The canonical identifier of the run. This ID is unique across all runs of all jobs. */ - runId?: number | undefined; + runId?: bigint | undefined; /** The creator user name. This field won’t be included in the response if the user has already been deleted. */ creatorUserName?: string | undefined; /** A unique identifier for this job run. This is set to the same value as `run_id`. */ - numberInJob?: number | undefined; + numberInJob?: bigint | undefined; /** If this run is a retry of a prior run attempt, this field contains the run_id of the original attempt; otherwise, it is the same as the run_id. */ - originalAttemptRunId?: number | undefined; + originalAttemptRunId?: bigint | undefined; /** Deprecated. Please use the `status` field instead. */ state?: RunState | undefined; /** The cron schedule that triggered this run if it was triggered by the periodic scheduler. */ @@ -3456,7 +3456,7 @@ export interface Run { * For legacy and single-task job runs the field is populated with the job run ID. * For task runs, the field is populated with the ID of the job run that the task run belongs to. */ - jobRunId?: number | undefined; + jobRunId?: bigint | undefined; /** * Indicates if the run has more array properties (`tasks`, `job_clusters`) that are not shown. They can be accessed via :method:jobs/getrun endpoint. * It is only relevant for API 2.2 :method:jobs/listruns requests with `expand_tasks=true`. @@ -3472,19 +3472,19 @@ export interface Run { /** The id of the usage policy used by this run for cost attribution purposes. */ effectiveUsagePolicyId?: string | undefined; /** The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). This may not be the time when the job task starts executing, for example, if the job is scheduled to run on a new cluster, this is the time the cluster creation call is issued. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** The time in milliseconds it took to set up the cluster. For runs that run on new clusters this is the cluster creation time, for runs that run on existing clusters this time should be very short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - setupDuration?: number | undefined; + setupDuration?: bigint | undefined; /** The time in milliseconds it took to execute the commands in the JAR or notebook until they completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - executionDuration?: number | undefined; + executionDuration?: bigint | undefined; /** The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - cleanupDuration?: number | undefined; + cleanupDuration?: bigint | undefined; /** The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This field is set to 0 if the job is still running. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** The time in milliseconds it took the job run and all of its repairs to finish. */ - runDuration?: number | undefined; + runDuration?: bigint | undefined; /** The time in milliseconds that the run has spent in the queue. */ - queueDuration?: number | undefined; + queueDuration?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -3499,7 +3499,7 @@ export interface Run_JobLevelParameters { export interface RunJobTask { /** ID of the job to trigger. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** Job-level parameters used to trigger the job. */ jobParameters?: Record | undefined; /** Controls whether the pipeline should perform a full refresh */ @@ -3597,7 +3597,7 @@ export interface RunJobTask_PythonNamedParamsEntry { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface RunJobTask_RunJobTaskOutput { /** The run id of the triggered job run */ - runId?: number | undefined; + runId?: bigint | undefined; } /** Name-based parameters for jobs running notebook tasks. */ @@ -3616,7 +3616,7 @@ export interface RunLifecycleStateV2 {} export interface RunNowRequest { /** The ID of the job to be executed */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** Job-level parameters used in the run. for example `"param": "overriding_val"` */ jobParameters?: Record | undefined; /** @@ -3739,9 +3739,9 @@ export interface RunNowRequest_PythonNamedParamsEntry { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface RunNowRequest_Response { /** The globally unique ID of the newly triggered run. */ - runId?: number | undefined; + runId?: bigint | undefined; /** A unique identifier for this job run. This is set to the same value as `run_id`. */ - numberInJob?: number | undefined; + numberInJob?: bigint | undefined; } /** Name-based parameters for jobs running notebook tasks. */ @@ -3874,7 +3874,7 @@ export interface RunStatus { /** Used when outputting a child run, in GetRun or ListRuns. */ export interface RunTask { /** The ID of the task run. */ - runId?: number | undefined; + runId?: bigint | undefined; /** Deprecated. Please use the `status` field instead. */ state?: RunState | undefined; runPageUrl?: string | undefined; @@ -4067,19 +4067,19 @@ export interface RunTask { /** An option to disable auto optimization in serverless */ disableAutoOptimization?: boolean | undefined; /** The time at which this run was started in epoch milliseconds (milliseconds since 1/1/1970 UTC). This may not be the time when the job task starts executing, for example, if the job is scheduled to run on a new cluster, this is the time the cluster creation call is issued. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** The time in milliseconds it took to set up the cluster. For runs that run on new clusters this is the cluster creation time, for runs that run on existing clusters this time should be very short. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `setup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - setupDuration?: number | undefined; + setupDuration?: bigint | undefined; /** The time in milliseconds it took to execute the commands in the JAR or notebook until they completed, failed, timed out, were cancelled, or encountered an unexpected error. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `execution_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - executionDuration?: number | undefined; + executionDuration?: bigint | undefined; /** The time in milliseconds it took to terminate the cluster and clean up any associated artifacts. The duration of a task run is the sum of the `setup_duration`, `execution_duration`, and the `cleanup_duration`. The `cleanup_duration` field is set to 0 for multitask job runs. The total duration of a multitask job run is the value of the `run_duration` field. */ - cleanupDuration?: number | undefined; + cleanupDuration?: bigint | undefined; /** The time at which this run ended in epoch milliseconds (milliseconds since 1/1/1970 UTC). This field is set to 0 if the job is still running. */ - endTime?: number | undefined; + endTime?: bigint | undefined; /** The time in milliseconds it took the job run and all of its repairs to finish. */ - runDuration?: number | undefined; + runDuration?: bigint | undefined; /** The time in milliseconds that the run has spent in the queue. */ - queueDuration?: number | undefined; + queueDuration?: bigint | undefined; } export interface RunTaskSettings { @@ -4260,7 +4260,7 @@ export interface RunTaskSettings { /** Additional details about what triggered the run */ export interface RunTriggerInfo { /** The run id of the Run Job task run */ - runId?: number | undefined; + runId?: bigint | undefined; } /** A storage location in Amazon S3 */ @@ -4433,9 +4433,9 @@ export interface SqlTask_SqlDashboardWidgetOutput { /** The information about the error when execution fails. */ error?: SqlTask_SqlOutputError | undefined; /** Time (in epoch milliseconds) when execution of the SQL widget starts. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** Time (in epoch milliseconds) when execution of the SQL widget ends. */ - endTime?: number | undefined; + endTime?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -4601,7 +4601,7 @@ export interface SubmitRunRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface SubmitRunRequest_Response { /** The canonical identifier for the newly submitted run. */ - runId?: number | undefined; + runId?: bigint | undefined; } export interface Subscription { @@ -4898,7 +4898,7 @@ export interface TriggerState { export interface UpdateJobRequest { /** The canonical identifier of the job to update. This field is required. */ - jobId?: number | undefined; + jobId?: bigint | undefined; /** * The new settings for the job. * @@ -5082,11 +5082,17 @@ export const unmarshalAzureAttributesSchema: z.ZodType = z export const unmarshalBaseJobSchema: z.ZodType = z .object({ - job_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), creator_user_name: z.string().optional(), run_as_user_name: z.string().optional(), settings: z.lazy(() => unmarshalJobSettingsSchema).optional(), - created_time: z.number().optional(), + created_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), trigger_state: z.lazy(() => unmarshalTriggerStateSchema).optional(), has_more: z.boolean().optional(), effective_budget_policy_id: z.string().optional(), @@ -5106,11 +5112,23 @@ export const unmarshalBaseJobSchema: z.ZodType = z export const unmarshalBaseRunSchema: z.ZodType = z .object({ - job_id: z.number().optional(), - run_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), creator_user_name: z.string().optional(), - number_in_job: z.number().optional(), - original_attempt_run_id: z.number().optional(), + number_in_job: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + original_attempt_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalRunStateSchema).optional(), schedule: z.lazy(() => unmarshalCronScheduleSchema).optional(), cluster_spec: z.lazy(() => unmarshalClusterSpecSchema).optional(), @@ -5133,19 +5151,43 @@ export const unmarshalBaseRunSchema: z.ZodType = z git_source: z.lazy(() => unmarshalGitSourceSchema).optional(), repair_history: z.array(z.lazy(() => unmarshalRepairSchema)).optional(), status: z.lazy(() => unmarshalRunStatusSchema).optional(), - job_run_id: z.number().optional(), + job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), has_more: z.boolean().optional(), effective_performance_target: z .enum(PerformanceTarget_PerformanceTarget) .optional(), effective_usage_policy_id: z.string().optional(), - start_time: z.number().optional(), - setup_duration: z.number().optional(), - execution_duration: z.number().optional(), - cleanup_duration: z.number().optional(), - end_time: z.number().optional(), - run_duration: z.number().optional(), - queue_duration: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + setup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + cleanup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + queue_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ jobId: d.job_id, @@ -5429,7 +5471,10 @@ export const unmarshalContinuousSettingsSchema: z.ZodType = export const unmarshalCreateJobRequest_ResponseSchema: z.ZodType = z .object({ - job_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ jobId: d.job_id, @@ -5510,7 +5555,10 @@ export const unmarshalDbtCloudJobRunStepSchema: z.ZodType = export const unmarshalDbtCloudTaskSchema: z.ZodType = z .object({ - dbt_cloud_job_id: z.number().optional(), + dbt_cloud_job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), connection_resource_name: z.string().optional(), }) .transform(d => ({ @@ -5521,7 +5569,10 @@ export const unmarshalDbtCloudTaskSchema: z.ZodType = z export const unmarshalDbtCloudTaskOutputSchema: z.ZodType = z .object({ - dbt_cloud_job_run_id: z.number().optional(), + dbt_cloud_job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), dbt_cloud_job_run_url: z.string().optional(), dbt_cloud_job_run_output: z .array(z.lazy(() => unmarshalDbtCloudJobRunStepSchema)) @@ -5794,11 +5845,17 @@ export const unmarshalGetJobRequest_ResponseSchema: z.ZodType BigInt(v)) + .optional(), creator_user_name: z.string().optional(), run_as_user_name: z.string().optional(), settings: z.lazy(() => unmarshalJobSettingsSchema).optional(), - created_time: z.number().optional(), + created_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), trigger_state: z.lazy(() => unmarshalTriggerStateSchema).optional(), has_more: z.boolean().optional(), effective_budget_policy_id: z.string().optional(), @@ -5919,11 +5976,23 @@ export const unmarshalGetRunRequest_ResponseSchema: z.ZodType BigInt(v)) + .optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), creator_user_name: z.string().optional(), - number_in_job: z.number().optional(), - original_attempt_run_id: z.number().optional(), + number_in_job: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + original_attempt_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalRunStateSchema).optional(), schedule: z.lazy(() => unmarshalCronScheduleSchema).optional(), cluster_spec: z.lazy(() => unmarshalClusterSpecSchema).optional(), @@ -5946,19 +6015,43 @@ export const unmarshalGetRunRequest_ResponseSchema: z.ZodType unmarshalGitSourceSchema).optional(), repair_history: z.array(z.lazy(() => unmarshalRepairSchema)).optional(), status: z.lazy(() => unmarshalRunStatusSchema).optional(), - job_run_id: z.number().optional(), + job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), has_more: z.boolean().optional(), effective_performance_target: z .enum(PerformanceTarget_PerformanceTarget) .optional(), effective_usage_policy_id: z.string().optional(), - start_time: z.number().optional(), - setup_duration: z.number().optional(), - execution_duration: z.number().optional(), - cleanup_duration: z.number().optional(), - end_time: z.number().optional(), - run_duration: z.number().optional(), - queue_duration: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + setup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + cleanup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + queue_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ nextPageToken: d.next_page_token, @@ -6239,7 +6332,10 @@ export const unmarshalJobsHealthRuleSchema: z.ZodType = z .object({ metric: z.enum(JobsHealthMetric).optional(), op: z.enum(JobsHealthOperator).optional(), - value: z.number().optional(), + value: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ metric: d.metric, @@ -6291,7 +6387,10 @@ export const unmarshalLibrarySchema: z.ZodType = z export const unmarshalListJobComplianceForPolicy_JobComplianceSchema: z.ZodType = z .object({ - job_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), is_compliant: z.boolean().optional(), violations: z.record(z.string(), z.string()).optional(), }) @@ -6452,7 +6551,10 @@ export const unmarshalOutputSchemaInfoSchema: z.ZodType = z .object({ catalog_name: z.string().optional(), schema_name: z.string().optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ catalogName: d.catalog_name, @@ -6634,11 +6736,22 @@ export const unmarshalRCranLibrarySchema: z.ZodType = z export const unmarshalRepairSchema: z.ZodType = z .object({ type: z.enum(RepairType).optional(), - start_time: z.number().optional(), - end_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalRunStateSchema).optional(), - id: z.number().optional(), - task_run_ids: z.array(z.number()).optional(), + id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + task_run_ids: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), status: z.lazy(() => unmarshalRunStatusSchema).optional(), effective_performance_target: z .enum(PerformanceTarget_PerformanceTarget) @@ -6659,7 +6772,10 @@ export const unmarshalRepairSchema: z.ZodType = z export const unmarshalRepairRunRequest_ResponseSchema: z.ZodType = z .object({ - repair_id: z.number().optional(), + repair_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ repairId: d.repair_id, @@ -6859,11 +6975,23 @@ export const unmarshalResolvedValues_SqlTaskResolvedValuesSchema: z.ZodType = z .object({ - job_id: z.number().optional(), - run_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), creator_user_name: z.string().optional(), - number_in_job: z.number().optional(), - original_attempt_run_id: z.number().optional(), + number_in_job: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + original_attempt_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalRunStateSchema).optional(), schedule: z.lazy(() => unmarshalCronScheduleSchema).optional(), cluster_spec: z.lazy(() => unmarshalClusterSpecSchema).optional(), @@ -6886,19 +7014,43 @@ export const unmarshalRunSchema: z.ZodType = z git_source: z.lazy(() => unmarshalGitSourceSchema).optional(), repair_history: z.array(z.lazy(() => unmarshalRepairSchema)).optional(), status: z.lazy(() => unmarshalRunStatusSchema).optional(), - job_run_id: z.number().optional(), + job_run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), has_more: z.boolean().optional(), effective_performance_target: z .enum(PerformanceTarget_PerformanceTarget) .optional(), effective_usage_policy_id: z.string().optional(), - start_time: z.number().optional(), - setup_duration: z.number().optional(), - execution_duration: z.number().optional(), - cleanup_duration: z.number().optional(), - end_time: z.number().optional(), - run_duration: z.number().optional(), - queue_duration: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + setup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + cleanup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + queue_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ jobId: d.job_id, @@ -6953,7 +7105,10 @@ export const unmarshalRun_JobLevelParametersSchema: z.ZodType = z .object({ - job_id: z.number().optional(), + job_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), job_parameters: z.record(z.string(), z.string()).optional(), pipeline_params: z.lazy(() => unmarshalPipelineParametersSchema).optional(), jar_params: z.array(z.string()).optional(), @@ -6981,7 +7136,10 @@ export const unmarshalRunJobTaskSchema: z.ZodType = z export const unmarshalRunJobTask_RunJobTaskOutputSchema: z.ZodType = z .object({ - run_id: z.number().optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ runId: d.run_id, @@ -6991,8 +7149,14 @@ export const unmarshalRunJobTask_RunJobTaskOutputSchema: z.ZodType = z .object({ - run_id: z.number().optional(), - number_in_job: z.number().optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + number_in_job: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ runId: d.run_id, @@ -7053,7 +7217,10 @@ export const unmarshalRunStatusSchema: z.ZodType = z export const unmarshalRunTaskSchema: z.ZodType = z .object({ - run_id: z.number().optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalRunStateSchema).optional(), run_page_url: z.string().optional(), cluster_instance: z.lazy(() => unmarshalClusterInstanceSchema).optional(), @@ -7115,13 +7282,34 @@ export const unmarshalRunTaskSchema: z.ZodType = z min_retry_interval_millis: z.number().optional(), retry_on_timeout: z.boolean().optional(), disable_auto_optimization: z.boolean().optional(), - start_time: z.number().optional(), - setup_duration: z.number().optional(), - execution_duration: z.number().optional(), - cleanup_duration: z.number().optional(), - end_time: z.number().optional(), - run_duration: z.number().optional(), - queue_duration: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + setup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + cleanup_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + run_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + queue_duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ runId: d.run_id, @@ -7267,7 +7455,10 @@ export const unmarshalRunTaskSchema: z.ZodType = z export const unmarshalRunTriggerInfoSchema: z.ZodType = z .object({ - run_id: z.number().optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ runId: d.run_id, @@ -7402,8 +7593,14 @@ export const unmarshalSqlTask_SqlDashboardWidgetOutputSchema: z.ZodType unmarshalSqlTask_SqlOutputErrorSchema).optional(), - start_time: z.number().optional(), - end_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + end_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ widgetId: d.widget_id, @@ -7552,7 +7749,10 @@ export const unmarshalSqlTaskSubscriptionSchema: z.ZodType export const unmarshalSubmitRunRequest_ResponseSchema: z.ZodType = z .object({ - run_id: z.number().optional(), + run_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ runId: d.run_id, @@ -8088,7 +8288,7 @@ export const marshalAzureAttributesSchema: z.ZodType = z export const marshalCancelAllRunsRequestSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), allQueuedRuns: z.boolean().optional(), }) .transform(d => ({ @@ -8098,7 +8298,7 @@ export const marshalCancelAllRunsRequestSchema: z.ZodType = z export const marshalCancelRunRequestSchema: z.ZodType = z .object({ - runId: z.number().optional(), + runId: z.bigint().optional(), }) .transform(d => ({ run_id: d.runId, @@ -8385,7 +8585,7 @@ export const marshalDbfsStorageInfoSchema: z.ZodType = z export const marshalDbtCloudTaskSchema: z.ZodType = z .object({ - dbtCloudJobId: z.number().optional(), + dbtCloudJobId: z.bigint().optional(), connectionResourceName: z.string().optional(), }) .transform(d => ({ @@ -8425,7 +8625,7 @@ export const marshalDbtTaskSchema: z.ZodType = z export const marshalDeleteJobRequestSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), }) .transform(d => ({ job_id: d.jobId, @@ -8433,7 +8633,7 @@ export const marshalDeleteJobRequestSchema: z.ZodType = z export const marshalDeleteRunRequestSchema: z.ZodType = z .object({ - runId: z.number().optional(), + runId: z.bigint().optional(), }) .transform(d => ({ run_id: d.runId, @@ -8470,7 +8670,7 @@ export const marshalDockerImageSchema: z.ZodType = z export const marshalEnforcePolicyComplianceForJobSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), validateOnly: z.boolean().optional(), }) .transform(d => ({ @@ -8834,7 +9034,7 @@ export const marshalJobsHealthRuleSchema: z.ZodType = z .object({ metric: z.enum(JobsHealthMetric).optional(), op: z.enum(JobsHealthOperator).optional(), - value: z.number().optional(), + value: z.bigint().optional(), }) .transform(d => ({ metric: d.metric, @@ -9124,8 +9324,8 @@ export const marshalRCranLibrarySchema: z.ZodType = z export const marshalRepairRunRequestSchema: z.ZodType = z .object({ - runId: z.number().optional(), - latestRepairId: z.number().optional(), + runId: z.bigint().optional(), + latestRepairId: z.bigint().optional(), rerunTasks: z.array(z.string()).optional(), jobParameters: z.record(z.string(), z.string()).optional(), rerunAllFailedTasks: z.boolean().optional(), @@ -9160,7 +9360,7 @@ export const marshalRepairRunRequestSchema: z.ZodType = z export const marshalResetJobRequestSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), newSettings: z.lazy(() => marshalJobSettingsSchema).optional(), }) .transform(d => ({ @@ -9170,7 +9370,7 @@ export const marshalResetJobRequestSchema: z.ZodType = z export const marshalRunJobTaskSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), jobParameters: z.record(z.string(), z.string()).optional(), pipelineParams: z.lazy(() => marshalPipelineParametersSchema).optional(), jarParams: z.array(z.string()).optional(), @@ -9196,7 +9396,7 @@ export const marshalRunJobTaskSchema: z.ZodType = z export const marshalRunNowRequestSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), jobParameters: z.record(z.string(), z.string()).optional(), idempotencyToken: z.string().optional(), queue: z.lazy(() => marshalQueueSettingsSchema).optional(), @@ -9955,7 +10155,7 @@ export const marshalTriggerSettingsSchema: z.ZodType = z export const marshalUpdateJobRequestSchema: z.ZodType = z .object({ - jobId: z.number().optional(), + jobId: z.bigint().optional(), newSettings: z.lazy(() => marshalJobSettingsSchema).optional(), fieldsToRemove: z.array(z.string()).optional(), }) diff --git a/packages/jobs/src/v2/utils.ts b/packages/jobs/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/jobs/src/v2/utils.ts +++ b/packages/jobs/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/keyconfigurations/package.json b/packages/keyconfigurations/package.json index 9d2d347d..12107fe5 100644 --- a/packages/keyconfigurations/package.json +++ b/packages/keyconfigurations/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/keyconfigurations/src/v1/client.ts b/packages/keyconfigurations/src/v1/client.ts index 24161b4c..c939870e 100644 --- a/packages/keyconfigurations/src/v1/client.ts +++ b/packages/keyconfigurations/src/v1/client.ts @@ -33,7 +33,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -59,7 +59,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/keyconfigurations/src/v1/model.ts b/packages/keyconfigurations/src/v1/model.ts index c12cd768..e5846093 100644 --- a/packages/keyconfigurations/src/v1/model.ts +++ b/packages/keyconfigurations/src/v1/model.ts @@ -117,7 +117,7 @@ export interface CustomerManagedKey { /** ID of the encryption key configuration object. */ customerManagedKeyId?: string | undefined; /** Time in epoch milliseconds when the customer key was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** The account ID that holds the customer-managed key. */ accountId?: string | undefined; /** @@ -219,7 +219,10 @@ export const unmarshalCustomerManagedKeySchema: z.ZodType = z .object({ customer_managed_key_id: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), account_id: z.string().optional(), aws_key_info: z.lazy(() => unmarshalAwsKeyInfoSchema).optional(), azure_key_info: z.lazy(() => unmarshalAzureKeyInfoSchema).optional(), diff --git a/packages/keyconfigurations/src/v1/utils.ts b/packages/keyconfigurations/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/keyconfigurations/src/v1/utils.ts +++ b/packages/keyconfigurations/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/knowledgeassistants/package.json b/packages/knowledgeassistants/package.json index 65325160..49d595d5 100644 --- a/packages/knowledgeassistants/package.json +++ b/packages/knowledgeassistants/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/knowledgeassistants/src/v1/client.ts b/packages/knowledgeassistants/src/v1/client.ts index 0f81d5a0..a26a7e04 100644 --- a/packages/knowledgeassistants/src/v1/client.ts +++ b/packages/knowledgeassistants/src/v1/client.ts @@ -56,7 +56,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -83,7 +83,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/knowledgeassistants/src/v1/utils.ts b/packages/knowledgeassistants/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/knowledgeassistants/src/v1/utils.ts +++ b/packages/knowledgeassistants/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/lakeview/package.json b/packages/lakeview/package.json index 0d87dbb9..573e0d38 100644 --- a/packages/lakeview/package.json +++ b/packages/lakeview/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/lakeview/src/v1/client.ts b/packages/lakeview/src/v1/client.ts index 2bb6495d..6ba6d199 100644 --- a/packages/lakeview/src/v1/client.ts +++ b/packages/lakeview/src/v1/client.ts @@ -72,7 +72,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -99,7 +99,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/lakeview/src/v1/model.ts b/packages/lakeview/src/v1/model.ts index fdf5a3a0..2eeefafe 100644 --- a/packages/lakeview/src/v1/model.ts +++ b/packages/lakeview/src/v1/model.ts @@ -375,7 +375,7 @@ export interface Subscription { /** Subscriber details for users and destinations to be added as subscribers to the schedule. */ subscriber?: Subscription_Subscriber | undefined; /** UserId of the user who adds subscribers (users or notification destinations) to the dashboard's schedule. */ - createdByUserId?: number | undefined; + createdByUserId?: bigint | undefined; /** * The etag for the subscription. Must be left empty on create, can be optionally provided on delete * to ensure that the subscription has not been deleted since the last read. @@ -415,7 +415,7 @@ export interface Subscription_Subscriber_Destination { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface Subscription_Subscriber_User { /** UserId of the subscriber. */ - userId?: number | undefined; + userId?: bigint | undefined; } export interface TrashDashboardRequest { @@ -637,7 +637,10 @@ export const unmarshalSubscriptionSchema: z.ZodType = z schedule_id: z.string().optional(), dashboard_id: z.string().optional(), subscriber: z.lazy(() => unmarshalSubscription_SubscriberSchema).optional(), - created_by_user_id: z.number().optional(), + created_by_user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), etag: z.string().optional(), create_time: z .string() @@ -691,7 +694,10 @@ export const unmarshalSubscription_Subscriber_DestinationSchema: z.ZodType = z .object({ - user_id: z.number().optional(), + user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ userId: d.user_id, @@ -817,7 +823,7 @@ export const marshalSubscriptionSchema: z.ZodType = z scheduleId: z.string().optional(), dashboardId: z.string().optional(), subscriber: z.lazy(() => marshalSubscription_SubscriberSchema).optional(), - createdByUserId: z.number().optional(), + createdByUserId: z.bigint().optional(), etag: z.string().optional(), createTime: z .any() @@ -868,7 +874,7 @@ export const marshalSubscription_Subscriber_DestinationSchema: z.ZodType = z // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export const marshalSubscription_Subscriber_UserSchema: z.ZodType = z .object({ - userId: z.number().optional(), + userId: z.bigint().optional(), }) .transform(d => ({ user_id: d.userId, diff --git a/packages/lakeview/src/v1/utils.ts b/packages/lakeview/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/lakeview/src/v1/utils.ts +++ b/packages/lakeview/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/logdelivery/package.json b/packages/logdelivery/package.json index cbee424d..aa935a80 100644 --- a/packages/logdelivery/package.json +++ b/packages/logdelivery/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/logdelivery/src/v1/client.ts b/packages/logdelivery/src/v1/client.ts index c2719ee7..d4dc28f8 100644 --- a/packages/logdelivery/src/v1/client.ts +++ b/packages/logdelivery/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/logdelivery/src/v1/model.ts b/packages/logdelivery/src/v1/model.ts index 645313df..b959eefb 100644 --- a/packages/logdelivery/src/v1/model.ts +++ b/packages/logdelivery/src/v1/model.ts @@ -88,7 +88,7 @@ export interface CreateLogDeliveryConfigurationParams { /** The ID for a method:storage/create that represents the S3 bucket with bucket policy as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */ storageConfigurationId?: string | undefined; /** Optional filter that specifies workspace IDs to deliver logs for. By default the workspace filter is empty and log delivery applies at the account level, delivering workspace-level logs for all workspaces in your account, plus account level logs. You can optionally set this field to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in which case only workspace-level logs relating to the specified workspaces are delivered. If you plan to use different log delivery configurations for different workspaces, set this field explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to new workspaces created in the future, and delivery won't include account level logs. For some types of deployments there is only one workspace per account ID, so this field is unnecessary. */ - workspaceIdsFilter?: number[] | undefined; + workspaceIdsFilter?: bigint[] | undefined; /** The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not start or end with a slash character. */ deliveryPathPrefix?: string | undefined; /** This field applies only if log_type is BILLABLE_USAGE. This is the optional start month and year for delivery, specified in YYYY-MM format. Defaults to current year and month. BILLABLE_USAGE logs are not available for usage before March 2019 (2019-03). */ @@ -96,9 +96,9 @@ export interface CreateLogDeliveryConfigurationParams { /** Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed. */ status?: LogDeliveryConfigStatus | undefined; /** Time in epoch milliseconds when the log delivery configuration was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when the log delivery configuration was updated. */ - updateTime?: number | undefined; + updateTime?: bigint | undefined; /** The LogDeliveryStatus of this log delivery configuration */ logDeliveryStatus?: LogDeliveryStatus | undefined; } @@ -190,7 +190,7 @@ export interface LogDeliveryConfiguration { /** The ID for a method:storage/create that represents the S3 bucket with bucket policy as described in the main billable usage documentation page. See [Configure billable usage delivery](https://docs.databricks.com/administration-guide/account-settings/billable-usage-delivery.html). */ storageConfigurationId?: string | undefined; /** Optional filter that specifies workspace IDs to deliver logs for. By default the workspace filter is empty and log delivery applies at the account level, delivering workspace-level logs for all workspaces in your account, plus account level logs. You can optionally set this field to an array of workspace IDs (each one is an `int64`) to which log delivery should apply, in which case only workspace-level logs relating to the specified workspaces are delivered. If you plan to use different log delivery configurations for different workspaces, set this field explicitly. Be aware that delivery configurations mentioning specific workspaces won't apply to new workspaces created in the future, and delivery won't include account level logs. For some types of deployments there is only one workspace per account ID, so this field is unnecessary. */ - workspaceIdsFilter?: number[] | undefined; + workspaceIdsFilter?: bigint[] | undefined; /** The optional delivery path prefix within Amazon S3 storage. Defaults to empty, which means that logs are delivered to the root of the bucket. This must be a valid S3 object key. This must not start or end with a slash character. */ deliveryPathPrefix?: string | undefined; /** This field applies only if log_type is BILLABLE_USAGE. This is the optional start month and year for delivery, specified in YYYY-MM format. Defaults to current year and month. BILLABLE_USAGE logs are not available for usage before March 2019 (2019-03). */ @@ -198,9 +198,9 @@ export interface LogDeliveryConfiguration { /** Status of log delivery configuration. Set to `ENABLED` (enabled) or `DISABLED` (disabled). Defaults to `ENABLED`. You can [enable or disable the configuration](#operation/patch-log-delivery-config-status) later. Deletion of a configuration is not supported, so disable a log delivery configuration that is no longer needed. */ status?: LogDeliveryConfigStatus | undefined; /** Time in epoch milliseconds when the log delivery configuration was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when the log delivery configuration was updated. */ - updateTime?: number | undefined; + updateTime?: bigint | undefined; /** The LogDeliveryStatus of this log delivery configuration */ logDeliveryStatus?: LogDeliveryStatus | undefined; } @@ -287,12 +287,20 @@ export const unmarshalLogDeliveryConfigurationSchema: z.ZodType BigInt(v))) + .optional(), delivery_path_prefix: z.string().optional(), delivery_start_time: z.string().optional(), status: z.enum(LogDeliveryConfigStatus).optional(), - creation_time: z.number().optional(), - update_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + update_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), log_delivery_status: z .lazy(() => unmarshalLogDeliveryStatusSchema) .optional(), @@ -341,12 +349,12 @@ export const marshalCreateLogDeliveryConfigurationParamsSchema: z.ZodType = z accountId: z.string().optional(), credentialsId: z.string().optional(), storageConfigurationId: z.string().optional(), - workspaceIdsFilter: z.array(z.number()).optional(), + workspaceIdsFilter: z.array(z.bigint()).optional(), deliveryPathPrefix: z.string().optional(), deliveryStartTime: z.string().optional(), status: z.enum(LogDeliveryConfigStatus).optional(), - creationTime: z.number().optional(), - updateTime: z.number().optional(), + creationTime: z.bigint().optional(), + updateTime: z.bigint().optional(), logDeliveryStatus: z.lazy(() => marshalLogDeliveryStatusSchema).optional(), }) .transform(d => ({ diff --git a/packages/logdelivery/src/v1/utils.ts b/packages/logdelivery/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/logdelivery/src/v1/utils.ts +++ b/packages/logdelivery/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/marketplaces/package.json b/packages/marketplaces/package.json index 1bc248f0..77c18e3e 100644 --- a/packages/marketplaces/package.json +++ b/packages/marketplaces/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/marketplaces/src/v1/client.ts b/packages/marketplaces/src/v1/client.ts index 57c33425..5b26b88f 100644 --- a/packages/marketplaces/src/v1/client.ts +++ b/packages/marketplaces/src/v1/client.ts @@ -203,7 +203,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -230,7 +230,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/marketplaces/src/v1/model.ts b/packages/marketplaces/src/v1/model.ts index 855b3964..822dd2d3 100644 --- a/packages/marketplaces/src/v1/model.ts +++ b/packages/marketplaces/src/v1/model.ts @@ -254,7 +254,7 @@ export interface CreateProviderRequest_Response { } export interface DataRefreshInfo { - interval?: number | undefined; + interval?: bigint | undefined; unit?: DataRefresh | undefined; } @@ -298,9 +298,9 @@ export interface Exchange { name?: string | undefined; comment?: string | undefined; filters?: ExchangeFilter[] | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; updatedBy?: string | undefined; linkedListings?: ExchangeListing[] | undefined; } @@ -310,9 +310,9 @@ export interface ExchangeFilter { exchangeId?: string | undefined; filterValue?: string | undefined; name?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; updatedBy?: string | undefined; filterType?: ExchangeFilterType | undefined; } @@ -323,7 +323,7 @@ export interface ExchangeListing { exchangeName?: string | undefined; listingId?: string | undefined; listingName?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; createdBy?: string | undefined; } @@ -333,8 +333,8 @@ export interface FileInfo { fileParent?: FileParent | undefined; mimeType?: string | undefined; downloadLink?: string | undefined; - createdAt?: number | undefined; - updatedAt?: number | undefined; + createdAt?: bigint | undefined; + updatedAt?: bigint | undefined; /** Name displayed to users for applicable files, e.g. embedded notebooks */ displayName?: string | undefined; status?: FileStatus | undefined; @@ -409,7 +409,7 @@ export interface GetLatestVersionProviderAnalyticsDashboardRequest {} // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface GetLatestVersionProviderAnalyticsDashboardRequest_Response { /** version here is latest logical version of the dashboard template */ - version?: number | undefined; + version?: bigint | undefined; } export interface GetListingContent { @@ -549,7 +549,7 @@ export interface InstallationDetail { listingId?: string | undefined; shareName?: string | undefined; catalogName?: string | undefined; - installedOn?: number | undefined; + installedOn?: bigint | undefined; status?: InstallationStatus | undefined; errorMessage?: string | undefined; listingName?: string | undefined; @@ -621,7 +621,7 @@ export interface ListProviderAnalyticsDashboardRequest {} // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface ListProviderAnalyticsDashboardRequest_Response { id?: string | undefined; - version?: number | undefined; + version?: bigint | undefined; /** dashboard_id will be used to open Lakeview dashboard. */ dashboardId?: string | undefined; } @@ -677,9 +677,9 @@ export interface ListingDetail { /** Smallest unit of time in the dataset */ collectionGranularity?: DataRefreshInfo | undefined; /** The starting date timestamp for when the data spans */ - collectionDateStart?: number | undefined; + collectionDateStart?: bigint | undefined; /** The ending date timestamp for when the data spans */ - collectionDateEnd?: number | undefined; + collectionDateEnd?: bigint | undefined; /** Where/how the data is sourced */ dataSource?: string | undefined; /** size of the dataset in GB */ @@ -723,16 +723,16 @@ export interface ListingSummary { share?: ShareInfo | undefined; providerRegion?: RegionInfo | undefined; setting?: ListingSetting | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; updatedBy?: string | undefined; - publishedAt?: number | undefined; + publishedAt?: bigint | undefined; publishedBy?: string | undefined; categories?: Category[] | undefined; listingType?: ListingType | undefined; - createdById?: number | undefined; - updatedById?: number | undefined; + createdById?: bigint | undefined; + updatedById?: bigint | undefined; providerId?: string | undefined; exchangeIds?: string[] | undefined; /** if a git repo is being created, a listing will be initialized with this field as opposed to a share */ @@ -759,9 +759,9 @@ export interface PersonalizationRequest { * but should be empty/ignored for non-data listings (MCP and App). */ share?: ShareInfo | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; listingId?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; metastoreId?: string | undefined; listingName?: string | undefined; isFromLighthouse?: boolean | undefined; @@ -863,7 +863,7 @@ export interface TokenInfo { /** Unique id of the Recipient Token. */ id?: string | undefined; /** Time at which this Recipient Token was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of Recipient Token creator. */ createdBy?: string | undefined; /** @@ -872,9 +872,9 @@ export interface TokenInfo { */ activationUrl?: string | undefined; /** Expiration timestamp of the token in epoch milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** Time at which this Recipient Token was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of Recipient Token updater. */ updatedBy?: string | undefined; } @@ -947,14 +947,14 @@ export interface UpdateProviderAnalyticsDashboardRequest { * this is the version of the dashboard template we want to update our user to * current expectation is that it should be equal to latest version of the dashboard template */ - version?: number | undefined; + version?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface UpdateProviderAnalyticsDashboardRequest_Response { /** id & version should be the same as the request */ id?: string | undefined; - version?: number | undefined; + version?: bigint | undefined; /** this is newly created Lakeview dashboard for the user */ dashboardId?: string | undefined; } @@ -1084,7 +1084,10 @@ export const unmarshalCreateProviderRequest_ResponseSchema: z.ZodType = z .object({ - interval: z.number().optional(), + interval: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), unit: z.enum(DataRefresh).optional(), }) .transform(d => ({ @@ -1116,9 +1119,15 @@ export const unmarshalExchangeSchema: z.ZodType = z name: z.string().optional(), comment: z.string().optional(), filters: z.array(z.lazy(() => unmarshalExchangeFilterSchema)).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), linked_listings: z .array(z.lazy(() => unmarshalExchangeListingSchema)) @@ -1142,9 +1151,15 @@ export const unmarshalExchangeFilterSchema: z.ZodType = z exchange_id: z.string().optional(), filter_value: z.string().optional(), name: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), filter_type: z.enum(ExchangeFilterType).optional(), }) @@ -1167,7 +1182,10 @@ export const unmarshalExchangeListingSchema: z.ZodType = z exchange_name: z.string().optional(), listing_id: z.string().optional(), listing_name: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), }) .transform(d => ({ @@ -1187,8 +1205,14 @@ export const unmarshalFileInfoSchema: z.ZodType = z file_parent: z.lazy(() => unmarshalFileParentSchema).optional(), mime_type: z.string().optional(), download_link: z.string().optional(), - created_at: z.number().optional(), - updated_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), display_name: z.string().optional(), status: z.enum(FileStatus).optional(), status_message: z.string().optional(), @@ -1281,7 +1305,10 @@ export const unmarshalGetInstallationDetails_ResponseSchema: z.ZodType = z .object({ - version: z.number().optional(), + version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ version: d.version, @@ -1422,7 +1449,10 @@ export const unmarshalInstallationDetailSchema: z.ZodType = listing_id: z.string().optional(), share_name: z.string().optional(), catalog_name: z.string().optional(), - installed_on: z.number().optional(), + installed_on: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), status: z.enum(InstallationStatus).optional(), error_message: z.string().optional(), listing_name: z.string().optional(), @@ -1513,7 +1543,10 @@ export const unmarshalListProviderAnalyticsDashboardRequest_ResponseSchema: z.Zo z .object({ id: z.string().optional(), - version: z.number().optional(), + version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), dashboard_id: z.string().optional(), }) .transform(d => ({ @@ -1576,8 +1609,14 @@ export const unmarshalListingDetailSchema: z.ZodType = z collection_granularity: z .lazy(() => unmarshalDataRefreshInfoSchema) .optional(), - collection_date_start: z.number().optional(), - collection_date_end: z.number().optional(), + collection_date_start: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + collection_date_end: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), data_source: z.string().optional(), size: z.number().optional(), assets: z.array(z.enum(AssetType)).optional(), @@ -1639,16 +1678,31 @@ export const unmarshalListingSummarySchema: z.ZodType = z share: z.lazy(() => unmarshalShareInfoSchema).optional(), provider_region: z.lazy(() => unmarshalRegionInfoSchema).optional(), setting: z.lazy(() => unmarshalListingSettingSchema).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), - published_at: z.number().optional(), + published_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), published_by: z.string().optional(), categories: z.array(z.enum(Category)).optional(), listingType: z.enum(ListingType).optional(), - created_by_id: z.number().optional(), - updated_by_id: z.number().optional(), + created_by_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_by_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), provider_id: z.string().optional(), exchange_ids: z.array(z.string()).optional(), git_repo: z.lazy(() => unmarshalRepoInfoSchema).optional(), @@ -1696,9 +1750,15 @@ export const unmarshalPersonalizationRequestSchema: z.ZodType unmarshalShareInfoSchema).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), listing_id: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), metastore_id: z.string().optional(), listing_name: z.string().optional(), is_from_lighthouse: z.boolean().optional(), @@ -1828,11 +1888,20 @@ export const unmarshalTokenDetailSchema: z.ZodType = z export const unmarshalTokenInfoSchema: z.ZodType = z .object({ id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), activation_url: z.string().optional(), - expiration_time: z.number().optional(), - updated_at: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), }) .transform(d => ({ @@ -1902,7 +1971,10 @@ export const unmarshalUpdateProviderAnalyticsDashboardRequest_ResponseSchema: z. z .object({ id: z.string().optional(), - version: z.number().optional(), + version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), dashboard_id: z.string().optional(), }) .transform(d => ({ @@ -2014,7 +2086,7 @@ export const marshalCreateProviderRequestSchema: z.ZodType = z export const marshalDataRefreshInfoSchema: z.ZodType = z .object({ - interval: z.number().optional(), + interval: z.bigint().optional(), unit: z.enum(DataRefresh).optional(), }) .transform(d => ({ @@ -2028,9 +2100,9 @@ export const marshalExchangeSchema: z.ZodType = z name: z.string().optional(), comment: z.string().optional(), filters: z.array(z.lazy(() => marshalExchangeFilterSchema)).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), linkedListings: z .array(z.lazy(() => marshalExchangeListingSchema)) @@ -2054,9 +2126,9 @@ export const marshalExchangeFilterSchema: z.ZodType = z exchangeId: z.string().optional(), filterValue: z.string().optional(), name: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), filterType: z.enum(ExchangeFilterType).optional(), }) @@ -2079,7 +2151,7 @@ export const marshalExchangeListingSchema: z.ZodType = z exchangeName: z.string().optional(), listingId: z.string().optional(), listingName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), }) .transform(d => ({ @@ -2099,8 +2171,8 @@ export const marshalFileInfoSchema: z.ZodType = z fileParent: z.lazy(() => marshalFileParentSchema).optional(), mimeType: z.string().optional(), downloadLink: z.string().optional(), - createdAt: z.number().optional(), - updatedAt: z.number().optional(), + createdAt: z.bigint().optional(), + updatedAt: z.bigint().optional(), displayName: z.string().optional(), status: z.enum(FileStatus).optional(), statusMessage: z.string().optional(), @@ -2152,7 +2224,7 @@ export const marshalInstallationDetailSchema: z.ZodType = z listingId: z.string().optional(), shareName: z.string().optional(), catalogName: z.string().optional(), - installedOn: z.number().optional(), + installedOn: z.bigint().optional(), status: z.enum(InstallationStatus).optional(), errorMessage: z.string().optional(), listingName: z.string().optional(), @@ -2208,8 +2280,8 @@ export const marshalListingDetailSchema: z.ZodType = z collectionGranularity: z .lazy(() => marshalDataRefreshInfoSchema) .optional(), - collectionDateStart: z.number().optional(), - collectionDateEnd: z.number().optional(), + collectionDateStart: z.bigint().optional(), + collectionDateEnd: z.bigint().optional(), dataSource: z.string().optional(), size: z.number().optional(), assets: z.array(z.enum(AssetType)).optional(), @@ -2254,16 +2326,16 @@ export const marshalListingSummarySchema: z.ZodType = z share: z.lazy(() => marshalShareInfoSchema).optional(), providerRegion: z.lazy(() => marshalRegionInfoSchema).optional(), setting: z.lazy(() => marshalListingSettingSchema).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), - publishedAt: z.number().optional(), + publishedAt: z.bigint().optional(), publishedBy: z.string().optional(), categories: z.array(z.enum(Category)).optional(), listingType: z.enum(ListingType).optional(), - createdById: z.number().optional(), - updatedById: z.number().optional(), + createdById: z.bigint().optional(), + updatedById: z.bigint().optional(), providerId: z.string().optional(), exchangeIds: z.array(z.string()).optional(), gitRepo: z.lazy(() => marshalRepoInfoSchema).optional(), @@ -2389,11 +2461,11 @@ export const marshalTokenDetailSchema: z.ZodType = z export const marshalTokenInfoSchema: z.ZodType = z .object({ id: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), activationUrl: z.string().optional(), - expirationTime: z.number().optional(), - updatedAt: z.number().optional(), + expirationTime: z.bigint().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), }) .transform(d => ({ @@ -2470,7 +2542,7 @@ export const marshalUpdatePersonalizationRequestStatusRequestSchema: z.ZodType = export const marshalUpdateProviderAnalyticsDashboardRequestSchema: z.ZodType = z .object({ id: z.string().optional(), - version: z.number().optional(), + version: z.bigint().optional(), }) .transform(d => ({ id: d.id, diff --git a/packages/marketplaces/src/v1/utils.ts b/packages/marketplaces/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/marketplaces/src/v1/utils.ts +++ b/packages/marketplaces/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/metastores/package.json b/packages/metastores/package.json index 8e879207..0c627210 100644 --- a/packages/metastores/package.json +++ b/packages/metastores/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/metastores/src/v1/client.ts b/packages/metastores/src/v1/client.ts index 26a5aff7..d8f185f7 100644 --- a/packages/metastores/src/v1/client.ts +++ b/packages/metastores/src/v1/client.ts @@ -88,7 +88,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -119,7 +119,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/metastores/src/v1/model.ts b/packages/metastores/src/v1/model.ts index f8cb6531..d3f92677 100644 --- a/packages/metastores/src/v1/model.ts +++ b/packages/metastores/src/v1/model.ts @@ -22,7 +22,7 @@ export interface AccountsCreateMetastoreAssignmentRequest { /** account ID of any type. For non-E2 account types, get your account ID from the [Accounts Console](https://docs.databricks.com/administration-guide/account-settings/usage.html) */ accountId?: string | undefined; /** Workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** Unity Catalog metastore ID */ metastoreId?: string | undefined; metastoreAssignment?: MetastoreAssignment | undefined; @@ -49,7 +49,7 @@ export interface AccountsDeleteMetastoreAssignmentRequest { /** account ID of any type. For non-E2 account types, get your account ID from the [Accounts Console](https://docs.databricks.com/administration-guide/account-settings/usage.html) */ accountId?: string | undefined; /** Workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** Unity Catalog metastore ID */ metastoreId?: string | undefined; } @@ -77,7 +77,7 @@ export interface AccountsGetMetastoreAssignmentRequest { /** account ID of any type. For non-E2 account types, get your account ID from the [Accounts Console](https://docs.databricks.com/administration-guide/account-settings/usage.html) */ accountId?: string | undefined; /** Workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; } /** The workspace metastore assignment was successfully returned. */ @@ -124,7 +124,7 @@ export interface AccountsListWorkspaceIdsForMetastoreRequest { /** The metastore assignments were successfully returned. */ // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface AccountsListWorkspaceIdsForMetastoreRequest_Response { - workspaceIds?: number[] | undefined; + workspaceIds?: bigint[] | undefined; } /** The metastore assignment to update. */ @@ -132,7 +132,7 @@ export interface AccountsUpdateMetastoreAssignmentRequest { /** account ID of any type. For non-E2 account types, get your account ID from the [Accounts Console](https://docs.databricks.com/administration-guide/account-settings/usage.html) */ accountId?: string | undefined; /** Workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** Unity Catalog metastore ID */ metastoreId?: string | undefined; metastoreAssignment?: MetastoreAssignment | undefined; @@ -170,7 +170,7 @@ export interface CreateAccountsMetastore { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The owner of the metastore. */ @@ -182,11 +182,11 @@ export interface CreateAccountsMetastore { /** Unique identifier of metastore. */ metastoreId?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Name of the storage credential to access the metastore storage_root. */ @@ -201,7 +201,7 @@ export interface CreateAccountsMetastore { export interface CreateMetastoreAssignmentRequest { /** A workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The unique ID of the metastore. */ metastoreId?: string | undefined; /** @@ -227,7 +227,7 @@ export interface CreateMetastoreRequest { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The owner of the metastore. */ @@ -239,11 +239,11 @@ export interface CreateMetastoreRequest { /** Unique identifier of metastore. */ metastoreId?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Name of the storage credential to access the metastore storage_root. */ @@ -258,7 +258,7 @@ export interface CreateMetastoreRequest { export interface DeleteMetastoreAssignmentRequest { /** A workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** Query for the ID of the metastore to delete. */ metastoreId?: string | undefined; } @@ -313,7 +313,7 @@ export interface GetMetastoreSummaryRequest_Response { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The storage root URL for metastore */ @@ -321,11 +321,11 @@ export interface GetMetastoreSummaryRequest_Response { /** The owner of the metastore. */ owner?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Whether to allow non-DBR clients to directly access entities under the metastore. */ @@ -360,7 +360,7 @@ export interface ListMetastoresRequest_Response { export interface MetastoreAssignment { /** The unique ID of the workspace. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The unique ID of the metastore. */ metastoreId?: string | undefined; /** @@ -382,7 +382,7 @@ export interface MetastoreInfo { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The owner of the metastore. */ @@ -394,11 +394,11 @@ export interface MetastoreInfo { /** Unique identifier of metastore. */ metastoreId?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Name of the storage credential to access the metastore storage_root. */ @@ -423,7 +423,7 @@ export interface UpdateAccountsMetastore { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The owner of the metastore. */ @@ -435,11 +435,11 @@ export interface UpdateAccountsMetastore { /** Unique identifier of metastore. */ metastoreId?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Name of the storage credential to access the metastore storage_root. */ @@ -454,7 +454,7 @@ export interface UpdateAccountsMetastore { export interface UpdateMetastoreAssignmentRequest { /** A workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The unique ID of the metastore. */ metastoreId?: string | undefined; /** @@ -484,7 +484,7 @@ export interface UpdateMetastoreRequest { /** The scope of Delta Sharing enabled for the metastore. */ deltaSharingScope?: DeltaSharingScope_Enum | undefined; /** The lifetime of delta sharing recipient token in seconds. */ - deltaSharingRecipientTokenLifetimeInSeconds?: number | undefined; + deltaSharingRecipientTokenLifetimeInSeconds?: bigint | undefined; /** The organization name of a Delta Sharing entity, to be used in Databricks-to-Databricks Delta Sharing as the official name. */ deltaSharingOrganizationName?: string | undefined; /** The owner of the metastore. */ @@ -496,11 +496,11 @@ export interface UpdateMetastoreRequest { /** Unique identifier of metastore. */ metastoreId?: string | undefined; /** Time at which this metastore was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of metastore creator. */ createdBy?: string | undefined; /** Time at which the metastore was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the metastore. */ updatedBy?: string | undefined; /** Name of the storage credential to access the metastore storage_root. */ @@ -573,7 +573,9 @@ export const unmarshalAccountsListMetastoresRequest_ResponseSchema: z.ZodType = z .object({ - workspace_ids: z.array(z.number()).optional(), + workspace_ids: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ workspaceIds: d.workspace_ids, @@ -619,13 +621,22 @@ export const unmarshalGetMetastoreSummaryRequest_ResponseSchema: z.ZodType BigInt(v)) + .optional(), delta_sharing_organization_name: z.string().optional(), storage_root: z.string().optional(), owner: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), external_access_enabled: z.boolean().optional(), }) @@ -669,7 +680,10 @@ export const unmarshalListMetastoresRequest_ResponseSchema: z.ZodType = z .object({ - workspace_id: z.number().optional(), + workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), metastore_id: z.string().optional(), default_catalog_name: z.string().optional(), }) @@ -686,15 +700,24 @@ export const unmarshalMetastoreInfoSchema: z.ZodType = z default_data_access_config_id: z.string().optional(), storage_root_credential_id: z.string().optional(), delta_sharing_scope: z.enum(DeltaSharingScope_Enum).optional(), - delta_sharing_recipient_token_lifetime_in_seconds: z.number().optional(), + delta_sharing_recipient_token_lifetime_in_seconds: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), delta_sharing_organization_name: z.string().optional(), owner: z.string().optional(), privilege_model_version: z.string().optional(), region: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), storage_root_credential_name: z.string().optional(), cloud: z.string().optional(), @@ -732,7 +755,7 @@ export const marshalAccountsCreateMetastoreAssignmentRequestSchema: z.ZodType = z .object({ accountId: z.string().optional(), - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), metastoreId: z.string().optional(), metastoreAssignment: z .lazy(() => marshalMetastoreAssignmentSchema) @@ -761,7 +784,7 @@ export const marshalAccountsUpdateMetastoreAssignmentRequestSchema: z.ZodType = z .object({ accountId: z.string().optional(), - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), metastoreId: z.string().optional(), metastoreAssignment: z .lazy(() => marshalMetastoreAssignmentSchema) @@ -795,15 +818,15 @@ export const marshalCreateAccountsMetastoreSchema: z.ZodType = z defaultDataAccessConfigId: z.string().optional(), storageRootCredentialId: z.string().optional(), deltaSharingScope: z.enum(DeltaSharingScope_Enum).optional(), - deltaSharingRecipientTokenLifetimeInSeconds: z.number().optional(), + deltaSharingRecipientTokenLifetimeInSeconds: z.bigint().optional(), deltaSharingOrganizationName: z.string().optional(), owner: z.string().optional(), privilegeModelVersion: z.string().optional(), region: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageRootCredentialName: z.string().optional(), cloud: z.string().optional(), @@ -835,7 +858,7 @@ export const marshalCreateAccountsMetastoreSchema: z.ZodType = z export const marshalCreateMetastoreAssignmentRequestSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), metastoreId: z.string().optional(), defaultCatalogName: z.string().optional(), }) @@ -852,15 +875,15 @@ export const marshalCreateMetastoreRequestSchema: z.ZodType = z defaultDataAccessConfigId: z.string().optional(), storageRootCredentialId: z.string().optional(), deltaSharingScope: z.enum(DeltaSharingScope_Enum).optional(), - deltaSharingRecipientTokenLifetimeInSeconds: z.number().optional(), + deltaSharingRecipientTokenLifetimeInSeconds: z.bigint().optional(), deltaSharingOrganizationName: z.string().optional(), owner: z.string().optional(), privilegeModelVersion: z.string().optional(), region: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageRootCredentialName: z.string().optional(), cloud: z.string().optional(), @@ -892,7 +915,7 @@ export const marshalCreateMetastoreRequestSchema: z.ZodType = z export const marshalMetastoreAssignmentSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), metastoreId: z.string().optional(), defaultCatalogName: z.string().optional(), }) @@ -909,15 +932,15 @@ export const marshalUpdateAccountsMetastoreSchema: z.ZodType = z defaultDataAccessConfigId: z.string().optional(), storageRootCredentialId: z.string().optional(), deltaSharingScope: z.enum(DeltaSharingScope_Enum).optional(), - deltaSharingRecipientTokenLifetimeInSeconds: z.number().optional(), + deltaSharingRecipientTokenLifetimeInSeconds: z.bigint().optional(), deltaSharingOrganizationName: z.string().optional(), owner: z.string().optional(), privilegeModelVersion: z.string().optional(), region: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageRootCredentialName: z.string().optional(), cloud: z.string().optional(), @@ -949,7 +972,7 @@ export const marshalUpdateAccountsMetastoreSchema: z.ZodType = z export const marshalUpdateMetastoreAssignmentRequestSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), metastoreId: z.string().optional(), defaultCatalogName: z.string().optional(), }) @@ -968,15 +991,15 @@ export const marshalUpdateMetastoreRequestSchema: z.ZodType = z defaultDataAccessConfigId: z.string().optional(), storageRootCredentialId: z.string().optional(), deltaSharingScope: z.enum(DeltaSharingScope_Enum).optional(), - deltaSharingRecipientTokenLifetimeInSeconds: z.number().optional(), + deltaSharingRecipientTokenLifetimeInSeconds: z.bigint().optional(), deltaSharingOrganizationName: z.string().optional(), owner: z.string().optional(), privilegeModelVersion: z.string().optional(), region: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageRootCredentialName: z.string().optional(), cloud: z.string().optional(), diff --git a/packages/metastores/src/v1/utils.ts b/packages/metastores/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/metastores/src/v1/utils.ts +++ b/packages/metastores/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/modelregistry/package.json b/packages/modelregistry/package.json index 14a57da1..1056a029 100644 --- a/packages/modelregistry/package.json +++ b/packages/modelregistry/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/modelregistry/src/v1/client.ts b/packages/modelregistry/src/v1/client.ts index 6fe46894..f3e81824 100644 --- a/packages/modelregistry/src/v1/client.ts +++ b/packages/modelregistry/src/v1/client.ts @@ -140,7 +140,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -167,7 +167,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/modelregistry/src/v1/model.ts b/packages/modelregistry/src/v1/model.ts index c16155fb..5ef84ec9 100644 --- a/packages/modelregistry/src/v1/model.ts +++ b/packages/modelregistry/src/v1/model.ts @@ -149,14 +149,14 @@ export enum RegistryWebhookStatus { */ export interface Activity { /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** The username of the user that created the object. */ userId?: string | undefined; activityType?: ActivityType | undefined; /** User-provided comment associated with the activity, comment, or transition request. */ comment?: string | undefined; /** Time of the object at last update, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** * Source stage of the transition (if the activity is stage transition related). Valid values are: * @@ -226,14 +226,14 @@ export interface ApproveTransitionRequest_Response { */ export interface CommentObject { /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** The username of the user that created the object. */ userId?: string | undefined; activityType?: ActivityType | undefined; /** User-provided comment associated with the activity, comment, or transition request. */ comment?: string | undefined; /** Time of the object at last update, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** * Source stage of the transition (if the activity is stage transition related). Valid values are: * @@ -581,7 +581,7 @@ export interface LinkedFeature { export interface ListRegisteredModelsRequest { /** Maximum number of registered models desired. Max threshold is 1000. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** Pagination token to go to the next page based on a previous query. */ pageToken?: string | undefined; } @@ -631,7 +631,7 @@ export interface ListRegistryWebhooksRequest { events?: RegistryWebhookEvent[] | undefined; /** Token indicating the page of artifact results to fetch */ pageToken?: string | undefined; - maxResults?: number | undefined; + maxResults?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -661,9 +661,9 @@ export interface ModelVersion { /** Model's version number. */ version?: string | undefined; /** Timestamp recorded when this `model_version` was created. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Timestamp recorded when metadata for this `model_version` was last updated. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** User that created this `model_version`. */ userId?: string | undefined; /** Current stage for this `model_version`. */ @@ -693,9 +693,9 @@ export interface ModelVersionDatabricks { /** Version of the model. */ version?: string | undefined; /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Time of the object at last update, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** The username of the user that created the object. */ userId?: string | undefined; currentStage?: string | undefined; @@ -739,9 +739,9 @@ export interface RegisteredModel { /** Unique name for the model. */ name?: string | undefined; /** Timestamp recorded when this `registered_model` was created. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Timestamp recorded when metadata for this `registered_model` was last updated. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** User that created this `registered_model` */ userId?: string | undefined; /** Description of this `registered_model`. */ @@ -759,9 +759,9 @@ export interface RegisteredModelDatabricks { /** Name of the model. */ name?: string | undefined; /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Last update time of the object, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** The username of the user that created the object. */ userId?: string | undefined; /** User-specified description for the object. */ @@ -815,9 +815,9 @@ export interface RegistryWebhook { */ events?: RegistryWebhookEvent[] | undefined; /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Time of the object at last update, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** User-specified description for the webhook. */ description?: string | undefined; status?: RegistryWebhookStatus | undefined; @@ -874,7 +874,7 @@ export interface SearchModelVersionsRequest { */ filter?: string | undefined; /** Maximum number of models desired. Max threshold is 10K. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** * List of columns to be ordered by including model name, version, stage with an * optional "DESC" or "ASC" annotation, where "ASC" is the default. @@ -902,7 +902,7 @@ export interface SearchRegisteredModelsRequest { */ filter?: string | undefined; /** Maximum number of models desired. Default is 100. Max threshold is 1000. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** * List of columns for ordering search results, which can include model name and last updated * timestamp with an optional "DESC" or "ASC" annotation, where "ASC" is the default. @@ -1014,14 +1014,14 @@ export interface TransitionModelVersionStageDatabricksRequest_Response { */ export interface TransitionRequest { /** Creation time of the object, as a Unix timestamp in milliseconds. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** The username of the user that created the object. */ userId?: string | undefined; activityType?: ActivityType | undefined; /** User-provided comment associated with the activity, comment, or transition request. */ comment?: string | undefined; /** Time of the object at last update, as a Unix timestamp in milliseconds. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** * Source stage of the transition (if the activity is stage transition related). Valid values are: * @@ -1140,11 +1140,17 @@ export interface UpdateRegistryWebhookRequest_Response { export const unmarshalActivitySchema: z.ZodType = z .object({ - creation_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), activity_type: z.enum(ActivityType).optional(), comment: z.string().optional(), - last_updated_timestamp: z.number().optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), from_stage: z.string().optional(), to_stage: z.string().optional(), system_comment: z.string().optional(), @@ -1176,11 +1182,17 @@ export const unmarshalApproveTransitionRequest_ResponseSchema: z.ZodType = z .object({ - creation_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), activity_type: z.enum(ActivityType).optional(), comment: z.string().optional(), - last_updated_timestamp: z.number().optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), from_stage: z.string().optional(), to_stage: z.string().optional(), system_comment: z.string().optional(), @@ -1416,8 +1428,14 @@ export const unmarshalModelVersionSchema: z.ZodType = z .object({ name: z.string().optional(), version: z.string().optional(), - creation_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), current_stage: z.string().optional(), description: z.string().optional(), @@ -1449,8 +1467,14 @@ export const unmarshalModelVersionDatabricksSchema: z.ZodType BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), current_stage: z.string().optional(), description: z.string().optional(), @@ -1500,8 +1524,14 @@ export const unmarshalModelVersionTagSchema: z.ZodType = z export const unmarshalRegisteredModelSchema: z.ZodType = z .object({ name: z.string().optional(), - creation_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), description: z.string().optional(), latest_versions: z @@ -1523,8 +1553,14 @@ export const unmarshalRegisteredModelDatabricksSchema: z.ZodType BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), description: z.string().optional(), latest_versions: z @@ -1561,8 +1597,14 @@ export const unmarshalRegistryWebhookSchema: z.ZodType = z .object({ id: z.string().optional(), events: z.array(z.enum(RegistryWebhookEvent)).optional(), - creation_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), description: z.string().optional(), status: z.enum(RegistryWebhookStatus).optional(), http_url_spec: z.lazy(() => unmarshalHttpUrlSpecSchema).optional(), @@ -1663,11 +1705,17 @@ export const unmarshalTransitionModelVersionStageDatabricksRequest_ResponseSchem export const unmarshalTransitionRequestSchema: z.ZodType = z .object({ - creation_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_id: z.string().optional(), activity_type: z.enum(ActivityType).optional(), comment: z.string().optional(), - last_updated_timestamp: z.number().optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), from_stage: z.string().optional(), to_stage: z.string().optional(), system_comment: z.string().optional(), diff --git a/packages/modelregistry/src/v1/utils.ts b/packages/modelregistry/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/modelregistry/src/v1/utils.ts +++ b/packages/modelregistry/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/modelserving/package.json b/packages/modelserving/package.json index 34dad3cb..7d86c7cb 100644 --- a/packages/modelserving/package.json +++ b/packages/modelserving/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/modelserving/src/v1/client.ts b/packages/modelserving/src/v1/client.ts index 060fb6d1..045574fd 100644 --- a/packages/modelserving/src/v1/client.ts +++ b/packages/modelserving/src/v1/client.ts @@ -73,7 +73,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -102,7 +102,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/modelserving/src/v1/model.ts b/packages/modelserving/src/v1/model.ts index 4a6345b1..11ce2771 100644 --- a/packages/modelserving/src/v1/model.ts +++ b/packages/modelserving/src/v1/model.ts @@ -92,7 +92,7 @@ export interface AiGatewayConfig { export interface AiGatewayRateLimit { /** Used to specify how many calls are allowed for a key within the renewal_period. */ - calls?: number | undefined; + calls?: bigint | undefined; /** * Key field for a rate limit. Currently, 'user', 'user_group, 'service_principal', and 'endpoint' are supported, * with 'endpoint' being the default if not specified. @@ -103,7 +103,7 @@ export interface AiGatewayRateLimit { /** Principal field for a user, user group, or service principal to apply rate limiting to. Accepts a user email, group name, or service principal application ID. */ principal?: string | undefined; /** Used to specify how many tokens are allowed for a key within the renewal_period. */ - tokens?: number | undefined; + tokens?: bigint | undefined; } export interface AiGuardrailParameters { @@ -391,7 +391,7 @@ export interface EndpointCoreConfig { export interface EndpointCoreConfigOutput { /** The config version that the serving endpoint is currently serving. */ - configVersion?: number | undefined; + configVersion?: bigint | undefined; /** The list of served entities under the serving endpoint config. */ servedEntities?: ServedModel[] | undefined; /** (Deprecated, use served_entities instead) The list of served models under the serving endpoint config. */ @@ -627,9 +627,9 @@ export interface InferenceEndpoint { /** The email of the user who created the serving endpoint. */ creator?: string | undefined; /** The timestamp when the endpoint was created in Unix time. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** The timestamp when the endpoint was last updated by a user in Unix time. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** Information corresponding to the state of the serving endpoint. */ state?: InferenceEndpointState | undefined; /** The config that is currently being served by the endpoint. */ @@ -656,9 +656,9 @@ export interface InferenceEndpointDetailed { /** The email of the user who created the serving endpoint. */ creator?: string | undefined; /** The timestamp when the endpoint was created in Unix time. */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** The timestamp when the endpoint was last updated by a user in Unix time. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** Information corresponding to the state of the serving endpoint. */ state?: InferenceEndpointState | undefined; /** The config that is currently being served by the endpoint. */ @@ -863,7 +863,7 @@ export interface PendingConfig { /** The config version that the serving endpoint is currently serving. */ configVersion?: number | undefined; /** The timestamp when the update to the pending config started. */ - startTime?: number | undefined; + startTime?: bigint | undefined; /** * Configuration for legacy Inference Tables which automatically log requests and responses to Unity * Catalog. @@ -891,7 +891,7 @@ export interface PtServedModel { entityName?: string | undefined; entityVersion?: string | undefined; /** The number of model units to be provisioned. */ - provisionedModelUnits?: number | undefined; + provisionedModelUnits?: bigint | undefined; /** * Whether burst scaling is enabled. When enabled (default), the endpoint can automatically * scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint @@ -986,7 +986,7 @@ export interface PutPtEndpointConfigRequest { export interface RateLimit { /** Used to specify how many calls are allowed for a key within the renewal_period. */ - calls?: number | undefined; + calls?: bigint | undefined; /** Key field for a serving endpoint rate limit. Currently, only 'user' and 'endpoint' are supported, with 'endpoint' being the default if not specified. */ key?: string | undefined; /** Renewal period field for a serving endpoint rate limit. Currently, only 'minute' is supported. */ @@ -1020,7 +1020,7 @@ export interface ServedModel { /** The workload size of the served entity. The workload size corresponds to a range of provisioned concurrency that the compute autoscales between. A single unit of provisioned concurrency can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned concurrency). Additional custom workload sizes can also be used when available in the workspace. If scale-to-zero is enabled, the lower bound of the provisioned concurrency for each workload size is 0. Do not use if min_provisioned_concurrency and max_provisioned_concurrency are specified. */ workloadSize?: string | undefined; /** The number of model units provisioned. */ - provisionedModelUnits?: number | undefined; + provisionedModelUnits?: bigint | undefined; /** * Whether burst scaling is enabled. When enabled (default), the endpoint can automatically * scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint @@ -1038,7 +1038,7 @@ export interface ServedModel { foundationModel?: FoundationModel | undefined; state?: ServedModelState | undefined; creator?: string | undefined; - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -1129,11 +1129,17 @@ export const unmarshalAiGatewayConfigSchema: z.ZodType = z export const unmarshalAiGatewayRateLimitSchema: z.ZodType = z .object({ - calls: z.number().optional(), + calls: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), key: z.string().optional(), renewal_period: z.string().optional(), principal: z.string().optional(), - tokens: z.number().optional(), + tokens: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ calls: d.calls, @@ -1313,7 +1319,10 @@ export const unmarshalEmailNotificationsSchema: z.ZodType = export const unmarshalEndpointCoreConfigOutputSchema: z.ZodType = z .object({ - config_version: z.number().optional(), + config_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), served_entities: z .array(z.lazy(() => unmarshalServedModelSchema)) .optional(), @@ -1490,8 +1499,14 @@ export const unmarshalInferenceEndpointSchema: z.ZodType = z .object({ name: z.string().optional(), creator: z.string().optional(), - creation_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalInferenceEndpointStateSchema).optional(), config: z.lazy(() => unmarshalEndpointCoreConfigSummarySchema).optional(), tags: z.array(z.lazy(() => unmarshalEndpointTagSchema)).optional(), @@ -1523,8 +1538,14 @@ export const unmarshalInferenceEndpointDetailedSchema: z.ZodType BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.lazy(() => unmarshalInferenceEndpointStateSchema).optional(), config: z.lazy(() => unmarshalEndpointCoreConfigOutputSchema).optional(), pending_config: z.lazy(() => unmarshalPendingConfigSchema).optional(), @@ -1685,7 +1706,10 @@ export const unmarshalPendingConfigSchema: z.ZodType = z served_models: z.array(z.lazy(() => unmarshalServedModelSchema)).optional(), traffic_config: z.lazy(() => unmarshalTrafficConfigSchema).optional(), config_version: z.number().optional(), - start_time: z.number().optional(), + start_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), auto_capture_config: z .lazy(() => unmarshalAutoCaptureConfigSchema) .optional(), @@ -1743,7 +1767,10 @@ export const unmarshalPutInferenceEndpointRateLimitsRequest_ResponseSchema: z.Zo export const unmarshalRateLimitSchema: z.ZodType = z .object({ - calls: z.number().optional(), + calls: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), key: z.string().optional(), renewal_period: z.string().optional(), }) @@ -1776,7 +1803,10 @@ export const unmarshalServedModelSchema: z.ZodType = z min_provisioned_concurrency: z.number().optional(), max_provisioned_concurrency: z.number().optional(), workload_size: z.string().optional(), - provisioned_model_units: z.number().optional(), + provisioned_model_units: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), burst_scaling_enabled: z.boolean().optional(), scale_to_zero_enabled: z.boolean().optional(), model_name: z.string().optional(), @@ -1786,7 +1816,10 @@ export const unmarshalServedModelSchema: z.ZodType = z foundation_model: z.lazy(() => unmarshalFoundationModelSchema).optional(), state: z.lazy(() => unmarshalServedModelStateSchema).optional(), creator: z.string().optional(), - creation_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ name: d.name, @@ -1906,11 +1939,11 @@ export const marshalAiGatewayConfigSchema: z.ZodType = z export const marshalAiGatewayRateLimitSchema: z.ZodType = z .object({ - calls: z.number().optional(), + calls: z.bigint().optional(), key: z.string().optional(), renewalPeriod: z.string().optional(), principal: z.string().optional(), - tokens: z.number().optional(), + tokens: z.bigint().optional(), }) .transform(d => ({ calls: d.calls, @@ -2375,7 +2408,7 @@ export const marshalPtServedModelSchema: z.ZodType = z name: z.string().optional(), entityName: z.string().optional(), entityVersion: z.string().optional(), - provisionedModelUnits: z.number().optional(), + provisionedModelUnits: z.bigint().optional(), burstScalingEnabled: z.boolean().optional(), }) .transform(d => ({ @@ -2448,7 +2481,7 @@ export const marshalPutPtEndpointConfigRequestSchema: z.ZodType = z export const marshalRateLimitSchema: z.ZodType = z .object({ - calls: z.number().optional(), + calls: z.bigint().optional(), key: z.string().optional(), renewalPeriod: z.string().optional(), }) @@ -2481,7 +2514,7 @@ export const marshalServedModelSchema: z.ZodType = z minProvisionedConcurrency: z.number().optional(), maxProvisionedConcurrency: z.number().optional(), workloadSize: z.string().optional(), - provisionedModelUnits: z.number().optional(), + provisionedModelUnits: z.bigint().optional(), burstScalingEnabled: z.boolean().optional(), scaleToZeroEnabled: z.boolean().optional(), modelName: z.string().optional(), @@ -2491,7 +2524,7 @@ export const marshalServedModelSchema: z.ZodType = z foundationModel: z.lazy(() => marshalFoundationModelSchema).optional(), state: z.lazy(() => marshalServedModelStateSchema).optional(), creator: z.string().optional(), - creationTimestamp: z.number().optional(), + creationTimestamp: z.bigint().optional(), }) .transform(d => ({ name: d.name, diff --git a/packages/modelserving/src/v1/utils.ts b/packages/modelserving/src/v1/utils.ts index f5464ff7..5d8bed31 100644 --- a/packages/modelserving/src/v1/utils.ts +++ b/packages/modelserving/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/modelservingquery/package.json b/packages/modelservingquery/package.json index c22f5620..d11af8ac 100644 --- a/packages/modelservingquery/package.json +++ b/packages/modelservingquery/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/modelservingquery/src/v1/client.ts b/packages/modelservingquery/src/v1/client.ts index e87c0b21..944e53c0 100644 --- a/packages/modelservingquery/src/v1/client.ts +++ b/packages/modelservingquery/src/v1/client.ts @@ -25,7 +25,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -52,7 +52,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/modelservingquery/src/v1/model.ts b/packages/modelservingquery/src/v1/model.ts index 8c9b632a..219a0223 100644 --- a/packages/modelservingquery/src/v1/model.ts +++ b/packages/modelservingquery/src/v1/model.ts @@ -168,7 +168,7 @@ export interface QueryEndpointResponse { /** The ID of the query that may be returned by a __completions or chat external/foundation model__ serving endpoint. */ id?: string | undefined; /** The timestamp in seconds when the query was created in Unix time returned by a __completions or chat external/foundation model__ serving endpoint. */ - created?: number | undefined; + created?: bigint | undefined; /** * The type of object returned by the __external/foundation model__ serving endpoint, one of * [text_completion, chat.completion, list (of embeddings)]. @@ -245,7 +245,10 @@ export const unmarshalQueryEndpointResponseSchema: z.ZodType unmarshalExternalModelUsageElementSchema).optional(), id: z.string().optional(), - created: z.number().optional(), + created: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), object: z.enum(QueryEndpointResponseObject).optional(), predictions: z.array(jsonValueSchema).optional(), outputs: z.array(jsonValueSchema).optional(), diff --git a/packages/modelservingquery/src/v1/utils.ts b/packages/modelservingquery/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/modelservingquery/src/v1/utils.ts +++ b/packages/modelservingquery/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/networking/package.json b/packages/networking/package.json index 4ecc277b..275b680a 100644 --- a/packages/networking/package.json +++ b/packages/networking/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/networking/src/v1/client.ts b/packages/networking/src/v1/client.ts index e9d28eb8..85af1a24 100644 --- a/packages/networking/src/v1/client.ts +++ b/packages/networking/src/v1/client.ts @@ -137,7 +137,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -168,7 +168,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/networking/src/v1/model.ts b/packages/networking/src/v1/model.ts index 6b3e6271..7cb6ed27 100644 --- a/packages/networking/src/v1/model.ts +++ b/packages/networking/src/v1/model.ts @@ -256,13 +256,13 @@ export interface AccountIpAccessList { addressCount?: number | undefined; listType?: AccountIpAccessListType_IpAccessListType | undefined; /** Creation timestamp in milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The ID of the user that created this list. */ - createdBy?: number | undefined; + createdBy?: bigint | undefined; /** Update timestamp in milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The ID of the user that last updated this list. */ - updatedBy?: number | undefined; + updatedBy?: bigint | undefined; /** Specifies whether this IP access list is enabled. */ enabled?: boolean | undefined; } @@ -378,9 +378,9 @@ export interface CreateNetworkConnectivityConfiguration { | CustomerFacingNetworkConnectivityConfigEgressConfig | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; } export interface CreateNetworkPolicyRequest { @@ -459,13 +459,13 @@ export interface CreatePrivateEndpointRule { */ domainNames?: string[] | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Whether this private endpoint is deactivated. */ deactivated?: boolean | undefined; /** Time in epoch milliseconds when this object was deactivated. */ - deactivatedAt?: number | undefined; + deactivatedAt?: bigint | undefined; errorMessage?: string | undefined; /** The Azure resource ID of the target resource. */ resourceId?: string | undefined; @@ -590,7 +590,7 @@ export interface CustomerFacingIngressNetworkPolicy_AuthenticationIdentity { principalType?: | CustomerFacingIngressNetworkPolicy_AuthenticationIdentity_PrincipalType | undefined; - principalId?: number | undefined; + principalId?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -785,7 +785,7 @@ export interface CustomerFacingIngressNetworkPolicy_WorkspaceApiDestination { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface CustomerFacingIngressNetworkPolicy_WorkspaceIdList { - workspaceIds?: number[] | undefined; + workspaceIds?: bigint[] | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -816,9 +816,9 @@ export interface CustomerFacingNetworkConnectivityConfig { | CustomerFacingNetworkConnectivityConfigEgressConfig | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; } /** @@ -868,13 +868,13 @@ export interface CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule { | CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule_PrivateLinkConnectionState | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Whether this private endpoint is deactivated. */ deactivated?: boolean | undefined; /** Time in epoch milliseconds when this object was deactivated. */ - deactivatedAt?: number | undefined; + deactivatedAt?: bigint | undefined; /** * Only used by private endpoints towards an AWS S3 service. * @@ -920,13 +920,13 @@ export interface CustomerFacingNetworkConnectivityConfigAzurePrivateEndpointRule | CustomerFacingNetworkConnectivityConfigAzurePrivateEndpointRule_PrivateLinkConnectionState | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Whether this private endpoint is deactivated. */ deactivated?: boolean | undefined; /** Time in epoch milliseconds when this object was deactivated. */ - deactivatedAt?: number | undefined; + deactivatedAt?: bigint | undefined; /** * Not used by customer-managed private endpoint services. * @@ -1334,7 +1334,7 @@ export interface GetWorkspaceNetworkOptionRequest { /** Your account ID. You can find your account ID in your accounts console. */ accountId?: string | undefined; /** The workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; } /** Definition of an IP Access list */ @@ -1348,13 +1348,13 @@ export interface IpAccessList { addressCount?: number | undefined; listType?: IpAccessListType | undefined; /** Creation timestamp in milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** User ID of the user who created this list. */ - createdBy?: number | undefined; + createdBy?: bigint | undefined; /** Update timestamp in milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** User ID of the user who updated this list. */ - updatedBy?: number | undefined; + updatedBy?: bigint | undefined; /** Specifies whether this IP access list is enabled. */ enabled?: boolean | undefined; } @@ -1496,13 +1496,13 @@ export interface NccPrivateEndpointRule { */ domainNames?: string[] | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Whether this private endpoint is deactivated. */ deactivated?: boolean | undefined; /** Time in epoch milliseconds when this object was deactivated. */ - deactivatedAt?: number | undefined; + deactivatedAt?: bigint | undefined; errorMessage?: string | undefined; /** The Azure resource ID of the target resource. */ resourceId?: string | undefined; @@ -1544,7 +1544,7 @@ export interface Network { /** The account ID associated with this network configuration. */ accountId?: string | undefined; /** Workspace ID associated with this network configuration. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The ID of the VPC associated with this network configuration. VPC IDs can be used in multiple networks. */ vpcId?: string | undefined; /** IDs of at least two subnets associated with this network. Subnet IDs **cannot** be used in multiple network configurations. */ @@ -1557,7 +1557,7 @@ export interface Network { /** The human-readable name of the network configuration. */ networkName?: string | undefined; /** Time in epoch milliseconds when the network was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Array of warning messages about the network configuration. */ warningMessages?: NetworkWarning[] | undefined; vpcEndpoints?: NetworkVpcEndpoints | undefined; @@ -1759,13 +1759,13 @@ export interface UpdatePrivateEndpointRule { */ domainNames?: string[] | undefined; /** Time in epoch milliseconds when this object was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Time in epoch milliseconds when this object was updated. */ - updatedTime?: number | undefined; + updatedTime?: bigint | undefined; /** Whether this private endpoint is deactivated. */ deactivated?: boolean | undefined; /** Time in epoch milliseconds when this object was deactivated. */ - deactivatedAt?: number | undefined; + deactivatedAt?: bigint | undefined; errorMessage?: string | undefined; /** The Azure resource ID of the target resource. */ resourceId?: string | undefined; @@ -1805,7 +1805,7 @@ export interface UpdateWorkspaceNetworkOptionRequest { /** Your account ID. You can find your account ID in your accounts console. */ accountId?: string | undefined; /** The workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The network option details for the workspace. */ workspaceNetworkOption?: WorkspaceNetworkOption | undefined; } @@ -1819,7 +1819,7 @@ export interface WorkspaceNetworkOption { */ networkPolicyId?: string | undefined; /** The workspace ID. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; } export const unmarshalAccountIpAccessListSchema: z.ZodType = @@ -1830,10 +1830,22 @@ export const unmarshalAccountIpAccessListSchema: z.ZodType ip_addresses: z.array(z.string()).optional(), address_count: z.number().optional(), list_type: z.enum(AccountIpAccessListType_IpAccessListType).optional(), - created_at: z.number().optional(), - created_by: z.number().optional(), - updated_at: z.number().optional(), - updated_by: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + created_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), enabled: z.boolean().optional(), }) .transform(d => ({ @@ -2024,7 +2036,10 @@ export const unmarshalCustomerFacingIngressNetworkPolicy_AuthenticationIdentityS CustomerFacingIngressNetworkPolicy_AuthenticationIdentity_PrincipalType ) .optional(), - principal_id: z.number().optional(), + principal_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ principalType: d.principal_type, @@ -2409,7 +2424,9 @@ export const unmarshalCustomerFacingIngressNetworkPolicy_WorkspaceApiDestination export const unmarshalCustomerFacingIngressNetworkPolicy_WorkspaceIdListSchema: z.ZodType = z .object({ - workspace_ids: z.array(z.number()).optional(), + workspace_ids: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ workspaceIds: d.workspace_ids, @@ -2438,8 +2455,14 @@ export const unmarshalCustomerFacingNetworkConnectivityConfigSchema: z.ZodType BigInt(v)) + .optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ networkConnectivityConfigId: d.network_connectivity_config_id, @@ -2466,10 +2489,19 @@ export const unmarshalCustomerFacingNetworkConnectivityConfigAwsPrivateEndpointR CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule_PrivateLinkConnectionState ) .optional(), - creation_time: z.number().optional(), - updated_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), deactivated: z.boolean().optional(), - deactivated_at: z.number().optional(), + deactivated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), enabled: z.boolean().optional(), error_message: z.string().optional(), }) @@ -2503,10 +2535,19 @@ export const unmarshalCustomerFacingNetworkConnectivityConfigAzurePrivateEndpoin CustomerFacingNetworkConnectivityConfigAzurePrivateEndpointRule_PrivateLinkConnectionState ) .optional(), - creation_time: z.number().optional(), - updated_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), deactivated: z.boolean().optional(), - deactivated_at: z.number().optional(), + deactivated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), domain_names: z.array(z.string()).optional(), error_message: z.string().optional(), }) @@ -2850,10 +2891,22 @@ export const unmarshalIpAccessListSchema: z.ZodType = z ip_addresses: z.array(z.string()).optional(), address_count: z.number().optional(), list_type: z.enum(IpAccessListType).optional(), - created_at: z.number().optional(), - created_by: z.number().optional(), - updated_at: z.number().optional(), - updated_by: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + created_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), enabled: z.boolean().optional(), }) .transform(d => ({ @@ -2954,10 +3007,19 @@ export const unmarshalNccPrivateEndpointRuleSchema: z.ZodType BigInt(v)) + .optional(), + updated_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), deactivated: z.boolean().optional(), - deactivated_at: z.number().optional(), + deactivated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), error_message: z.string().optional(), resource_id: z.string().optional(), group_id: z.string().optional(), @@ -2997,7 +3059,10 @@ export const unmarshalNetworkSchema: z.ZodType = z .object({ network_id: z.string().optional(), account_id: z.string().optional(), - workspace_id: z.number().optional(), + workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), vpc_id: z.string().optional(), subnet_ids: z.array(z.string()).optional(), security_group_ids: z.array(z.string()).optional(), @@ -3006,7 +3071,10 @@ export const unmarshalNetworkSchema: z.ZodType = z .array(z.lazy(() => unmarshalNetworkHealthSchema)) .optional(), network_name: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), warning_messages: z .array(z.lazy(() => unmarshalNetworkWarningSchema)) .optional(), @@ -3157,7 +3225,10 @@ export const unmarshalWorkspaceNetworkOptionSchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ networkPolicyId: d.network_policy_id, @@ -3235,8 +3306,8 @@ export const marshalCreateNetworkConnectivityConfigurationSchema: z.ZodType = z () => marshalCustomerFacingNetworkConnectivityConfigEgressConfigSchema ) .optional(), - updatedTime: z.number().optional(), - creationTime: z.number().optional(), + updatedTime: z.bigint().optional(), + creationTime: z.bigint().optional(), }) .transform(d => ({ network_connectivity_config_id: d.networkConnectivityConfigId, @@ -3294,10 +3365,10 @@ export const marshalCreatePrivateEndpointRuleSchema: z.ZodType = z .enum(NccPrivateEndpointRule_PrivateLinkConnectionState) .optional(), domainNames: z.array(z.string()).optional(), - creationTime: z.number().optional(), - updatedTime: z.number().optional(), + creationTime: z.bigint().optional(), + updatedTime: z.bigint().optional(), deactivated: z.boolean().optional(), - deactivatedAt: z.number().optional(), + deactivatedAt: z.bigint().optional(), errorMessage: z.string().optional(), resourceId: z.string().optional(), groupId: z.string().optional(), @@ -3477,7 +3548,7 @@ export const marshalCustomerFacingIngressNetworkPolicy_AuthenticationIdentitySch CustomerFacingIngressNetworkPolicy_AuthenticationIdentity_PrincipalType ) .optional(), - principalId: z.number().optional(), + principalId: z.bigint().optional(), }) .transform(d => ({ principal_type: d.principalType, @@ -3876,7 +3947,7 @@ export const marshalCustomerFacingIngressNetworkPolicy_WorkspaceApiDestinationSc export const marshalCustomerFacingIngressNetworkPolicy_WorkspaceIdListSchema: z.ZodType = z .object({ - workspaceIds: z.array(z.number()).optional(), + workspaceIds: z.array(z.bigint()).optional(), }) .transform(d => ({ workspace_ids: d.workspaceIds, @@ -3907,10 +3978,10 @@ export const marshalCustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRul CustomerFacingNetworkConnectivityConfigAwsPrivateEndpointRule_PrivateLinkConnectionState ) .optional(), - creationTime: z.number().optional(), - updatedTime: z.number().optional(), + creationTime: z.bigint().optional(), + updatedTime: z.bigint().optional(), deactivated: z.boolean().optional(), - deactivatedAt: z.number().optional(), + deactivatedAt: z.bigint().optional(), enabled: z.boolean().optional(), errorMessage: z.string().optional(), }) @@ -3944,10 +4015,10 @@ export const marshalCustomerFacingNetworkConnectivityConfigAzurePrivateEndpointR CustomerFacingNetworkConnectivityConfigAzurePrivateEndpointRule_PrivateLinkConnectionState ) .optional(), - creationTime: z.number().optional(), - updatedTime: z.number().optional(), + creationTime: z.bigint().optional(), + updatedTime: z.bigint().optional(), deactivated: z.boolean().optional(), - deactivatedAt: z.number().optional(), + deactivatedAt: z.bigint().optional(), domainNames: z.array(z.string()).optional(), errorMessage: z.string().optional(), }) @@ -4354,10 +4425,10 @@ export const marshalUpdatePrivateEndpointRuleSchema: z.ZodType = z .enum(NccPrivateEndpointRule_PrivateLinkConnectionState) .optional(), domainNames: z.array(z.string()).optional(), - creationTime: z.number().optional(), - updatedTime: z.number().optional(), + creationTime: z.bigint().optional(), + updatedTime: z.bigint().optional(), deactivated: z.boolean().optional(), - deactivatedAt: z.number().optional(), + deactivatedAt: z.bigint().optional(), errorMessage: z.string().optional(), resourceId: z.string().optional(), groupId: z.string().optional(), @@ -4402,7 +4473,7 @@ export const marshalUpdatePrivateEndpointRuleSchema: z.ZodType = z export const marshalWorkspaceNetworkOptionSchema: z.ZodType = z .object({ networkPolicyId: z.string().optional(), - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), }) .transform(d => ({ network_policy_id: d.networkPolicyId, diff --git a/packages/networking/src/v1/utils.ts b/packages/networking/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/networking/src/v1/utils.ts +++ b/packages/networking/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/notificationdestinations/package.json b/packages/notificationdestinations/package.json index 72dcd331..b40ad317 100644 --- a/packages/notificationdestinations/package.json +++ b/packages/notificationdestinations/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/notificationdestinations/src/v1/client.ts b/packages/notificationdestinations/src/v1/client.ts index ae243ff3..f1b3f540 100644 --- a/packages/notificationdestinations/src/v1/client.ts +++ b/packages/notificationdestinations/src/v1/client.ts @@ -38,7 +38,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/notificationdestinations/src/v1/model.ts b/packages/notificationdestinations/src/v1/model.ts index dafabde9..495b7688 100644 --- a/packages/notificationdestinations/src/v1/model.ts +++ b/packages/notificationdestinations/src/v1/model.ts @@ -60,7 +60,7 @@ export interface GetNotificationDestinationRequest { export interface ListNotificationDestinationsRequest { pageToken?: string | undefined; - pageSize?: number | undefined; + pageSize?: bigint | undefined; } export interface ListNotificationDestinationsResponse { diff --git a/packages/notificationdestinations/src/v1/utils.ts b/packages/notificationdestinations/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/notificationdestinations/src/v1/utils.ts +++ b/packages/notificationdestinations/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/oauth/package.json b/packages/oauth/package.json index b0c1b66e..ffb7044e 100644 --- a/packages/oauth/package.json +++ b/packages/oauth/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/oauth/src/v1/client.ts b/packages/oauth/src/v1/client.ts index d2441083..df31b2f6 100644 --- a/packages/oauth/src/v1/client.ts +++ b/packages/oauth/src/v1/client.ts @@ -62,7 +62,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -88,7 +88,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/oauth/src/v1/model.ts b/packages/oauth/src/v1/model.ts index 5ae05168..e9408b11 100644 --- a/packages/oauth/src/v1/model.ts +++ b/packages/oauth/src/v1/model.ts @@ -56,7 +56,7 @@ export interface CustomOAuthAppIntegration { /** Token access policy */ tokenAccessPolicy?: TokenAccessPolicy | undefined; scopes?: string[] | undefined; - createdBy?: number | undefined; + createdBy?: bigint | undefined; createTime?: string | undefined; creatorUsername?: string | undefined; /** @@ -177,7 +177,7 @@ export interface PublishedOAuthAppIntegration { name?: string | undefined; /** Token access policy */ tokenAccessPolicy?: TokenAccessPolicy | undefined; - createdBy?: number | undefined; + createdBy?: bigint | undefined; createTime?: string | undefined; } @@ -261,7 +261,10 @@ export const unmarshalCustomOAuthAppIntegrationSchema: z.ZodType unmarshalTokenAccessPolicySchema) .optional(), scopes: z.array(z.string()).optional(), - created_by: z.number().optional(), + created_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), create_time: z.string().optional(), creator_username: z.string().optional(), user_authorized_scopes: z.array(z.string()).optional(), @@ -370,7 +373,10 @@ export const unmarshalPublishedOAuthAppIntegrationSchema: z.ZodType unmarshalTokenAccessPolicySchema) .optional(), - created_by: z.number().optional(), + created_by: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), create_time: z.string().optional(), }) .transform(d => ({ diff --git a/packages/oauth/src/v1/utils.ts b/packages/oauth/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/oauth/src/v1/utils.ts +++ b/packages/oauth/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/onlinetables/package.json b/packages/onlinetables/package.json index 3266b6c1..38c90b47 100644 --- a/packages/onlinetables/package.json +++ b/packages/onlinetables/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/onlinetables/src/v1/client.ts b/packages/onlinetables/src/v1/client.ts index dc3f610b..20a2f1a3 100644 --- a/packages/onlinetables/src/v1/client.ts +++ b/packages/onlinetables/src/v1/client.ts @@ -32,7 +32,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/onlinetables/src/v1/model.ts b/packages/onlinetables/src/v1/model.ts index 5a2bd5b6..45b26450 100644 --- a/packages/onlinetables/src/v1/model.ts +++ b/packages/onlinetables/src/v1/model.ts @@ -73,7 +73,7 @@ export interface ContinuousUpdateStatus { * The last source table Delta version that was synced to the online table. Note that this Delta * version may not be completely synced to the online table yet. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The timestamp of the last time any data was synchronized from the source table to the online * table. @@ -105,7 +105,7 @@ export interface FailedStatus { * version may only be partially synced to the online table. Only populated if the table is still * online and available for serving. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The timestamp of the last time any data was synchronized from the source table to the online * table. Only populated if the table is still online and available for serving. @@ -204,11 +204,11 @@ export interface PipelineProgress { * The source table Delta version that was last processed by the pipeline. The pipeline may not * have completely processed this version yet. */ - latestVersionCurrentlyProcessing?: number | undefined; + latestVersionCurrentlyProcessing?: bigint | undefined; /** The number of rows that have been synced in this update. */ - syncedRowCount?: number | undefined; + syncedRowCount?: bigint | undefined; /** The total number of rows that need to be synced in this update. This number may be an estimate. */ - totalRowCount?: number | undefined; + totalRowCount?: bigint | undefined; /** The completion ratio of this update. This is a number between 0 and 1. */ syncProgressCompletion?: number | undefined; /** The estimated time remaining to complete this update in seconds. */ @@ -240,7 +240,7 @@ export interface TriggeredUpdateStatus { * The last source table Delta version that was synced to the online table. Note that this Delta * version may not be completely synced to the online table yet. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The timestamp of the last time any data was synchronized from the source table to the online * table. @@ -253,7 +253,10 @@ export interface TriggeredUpdateStatus { export const unmarshalContinuousUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -270,7 +273,10 @@ export const unmarshalContinuousUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -377,9 +383,18 @@ export const unmarshalOnlineTableStatusSchema: z.ZodType = z export const unmarshalPipelineProgressSchema: z.ZodType = z .object({ - latest_version_currently_processing: z.number().optional(), - synced_row_count: z.number().optional(), - total_row_count: z.number().optional(), + latest_version_currently_processing: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + synced_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + total_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), sync_progress_completion: z.number().optional(), estimated_completion_time_seconds: z.number().optional(), }) @@ -405,7 +420,10 @@ export const unmarshalProvisioningStatusSchema: z.ZodType = export const unmarshalTriggeredUpdateStatusSchema: z.ZodType = z .object({ - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), timestamp: z .string() .transform(s => Temporal.Instant.from(s)) @@ -422,7 +440,7 @@ export const unmarshalTriggeredUpdateStatusSchema: z.ZodType d.toString()) @@ -439,7 +457,7 @@ export const marshalContinuousUpdateStatusSchema: z.ZodType = z export const marshalFailedStatusSchema: z.ZodType = z .object({ - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), timestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -560,9 +578,9 @@ export const marshalOnlineTableStatusSchema: z.ZodType = z export const marshalPipelineProgressSchema: z.ZodType = z .object({ - latestVersionCurrentlyProcessing: z.number().optional(), - syncedRowCount: z.number().optional(), - totalRowCount: z.number().optional(), + latestVersionCurrentlyProcessing: z.bigint().optional(), + syncedRowCount: z.bigint().optional(), + totalRowCount: z.bigint().optional(), syncProgressCompletion: z.number().optional(), estimatedCompletionTimeSeconds: z.number().optional(), }) @@ -586,7 +604,7 @@ export const marshalProvisioningStatusSchema: z.ZodType = z export const marshalTriggeredUpdateStatusSchema: z.ZodType = z .object({ - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), timestamp: z .any() .transform((d: Temporal.Instant) => d.toString()) diff --git a/packages/onlinetables/src/v1/utils.ts b/packages/onlinetables/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/onlinetables/src/v1/utils.ts +++ b/packages/onlinetables/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/pipelines/package.json b/packages/pipelines/package.json index 7b8207fa..a45a829e 100644 --- a/packages/pipelines/package.json +++ b/packages/pipelines/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/pipelines/src/v2/client.ts b/packages/pipelines/src/v2/client.ts index 5c0f2c89..58746633 100644 --- a/packages/pipelines/src/v2/client.ts +++ b/packages/pipelines/src/v2/client.ts @@ -70,7 +70,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -99,7 +99,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/pipelines/src/v2/model.ts b/packages/pipelines/src/v2/model.ts index 64262784..e51ba356 100644 --- a/packages/pipelines/src/v2/model.ts +++ b/packages/pipelines/src/v2/model.ts @@ -341,7 +341,7 @@ export interface ClonePipelineRequest { * If the settings were modified after that time, then the request will fail with * a conflict. */ - expectedLastModified?: number | undefined; + expectedLastModified?: bigint | undefined; /** If false, deployment will fail if name conflicts with that of another pipeline. */ allowDuplicateNames?: boolean | undefined; /** Unique identifier for this pipeline. */ @@ -594,7 +594,7 @@ export interface DataPlaneId { /** The instance name of the data plane emitting an event. */ instance?: string | undefined; /** A sequence number, unique and increasing within the data plane instance. */ - seqNo?: number | undefined; + seqNo?: bigint | undefined; } /** Location of staged data storage */ @@ -640,7 +640,7 @@ export interface EditPipelineRequest { * If the settings were modified after that time, then the request will fail with * a conflict. */ - expectedLastModified?: number | undefined; + expectedLastModified?: bigint | undefined; runAs?: PipelinesJobRunAs | undefined; /** * Key/value map of default parameters to use for pipeline execution. @@ -859,7 +859,7 @@ export interface GetPipelineRequest_Response { /** Status of the latest updates for the pipeline. Ordered with the newest update first. */ latestUpdates?: UpdateStateInfo[] | undefined; /** The last time the pipeline settings were modified or created. */ - lastModified?: number | undefined; + lastModified?: bigint | undefined; /** Username of the user that the pipeline will run on behalf of. */ runAsUserName?: string | undefined; /** Serverless budget policy ID of this pipeline. */ @@ -1196,7 +1196,7 @@ export interface IngestionPipelineDefinition_TableSpecificConfig_QueryBasedConne * If not set, hard deletion synchronization via snapshots is disabled. * This field is mutable and can be updated without triggering a full snapshot. */ - hardDeletionSyncMinIntervalInSeconds?: number | undefined; + hardDeletionSyncMinIntervalInSeconds?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -1293,7 +1293,7 @@ export interface KafkaOptions { */ startingOffset?: string | undefined; /** Internal option to control the maximum number of offsets to process per trigger. */ - maxOffsetsPerTrigger?: number | undefined; + maxOffsetsPerTrigger?: bigint | undefined; /** * Undocumented backdoor mechanism for overriding parameters * to pass to the Kafka client. @@ -1498,7 +1498,7 @@ export interface Origin { /** The cloud region. */ region?: string | undefined; /** The org id of the user. Unique within a cloud. */ - orgId?: number | undefined; + orgId?: bigint | undefined; /** The id of the pipeline. Globally unique. */ pipelineId?: string | undefined; /** The name of the pipeline. Not unique. */ @@ -1521,7 +1521,7 @@ export interface Origin { /** The name of the flow. Not unique. */ flowName?: string | undefined; /** The id of a batch. Unique within a flow. */ - batchId?: number | undefined; + batchId?: bigint | undefined; /** The id of the request that caused an update. */ requestId?: string | undefined; /** The Unity Catalog id of the MV or ST being updated. */ @@ -2324,7 +2324,7 @@ export interface Sequencing { /** the ID assigned by the data plane. */ dataPlaneId?: DataPlaneId | undefined; /** A sequence number, unique and increasing per pipeline. */ - controlPlaneSeqNo?: number | undefined; + controlPlaneSeqNo?: bigint | undefined; } export interface SerializedException { @@ -2547,7 +2547,7 @@ export interface UpdateInfo { /** The ID of the cluster that the update is running on. */ clusterId?: string | undefined; /** The time when this update was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** If true, this update will reset all tables before running. */ fullRefresh?: boolean | undefined; /** @@ -2745,7 +2745,10 @@ export const unmarshalCronTriggerSchema: z.ZodType = z export const unmarshalDataPlaneIdSchema: z.ZodType = z .object({ instance: z.string().optional(), - seq_no: z.number().optional(), + seq_no: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ instance: d.instance, @@ -2873,7 +2876,10 @@ export const unmarshalGetPipelineRequest_ResponseSchema: z.ZodType unmarshalUpdateStateInfoSchema)) .optional(), - last_modified: z.number().optional(), + last_modified: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), run_as_user_name: z.string().optional(), effective_budget_policy_id: z.string().optional(), effective_publishing_mode: z.enum(PublishingMode).optional(), @@ -3172,7 +3178,10 @@ export const unmarshalIngestionPipelineDefinition_TableSpecificConfig_QueryBased .object({ cursor_columns: z.array(z.string()).optional(), deletion_condition: z.string().optional(), - hard_deletion_sync_min_interval_in_seconds: z.number().optional(), + hard_deletion_sync_min_interval_in_seconds: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ cursorColumns: d.cursor_columns, @@ -3249,7 +3258,10 @@ export const unmarshalKafkaOptionsSchema: z.ZodType = z key_transformer: z.lazy(() => unmarshalTransformerSchema).optional(), value_transformer: z.lazy(() => unmarshalTransformerSchema).optional(), starting_offset: z.string().optional(), - max_offsets_per_trigger: z.number().optional(), + max_offsets_per_trigger: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), client_config: z.record(z.string(), z.string()).optional(), }) .transform(d => ({ @@ -3366,7 +3378,10 @@ export const unmarshalOriginSchema: z.ZodType = z .object({ cloud: z.string().optional(), region: z.string().optional(), - org_id: z.number().optional(), + org_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), pipeline_id: z.string().optional(), pipeline_name: z.string().optional(), cluster_id: z.string().optional(), @@ -3376,7 +3391,10 @@ export const unmarshalOriginSchema: z.ZodType = z dataset_name: z.string().optional(), flow_id: z.string().optional(), flow_name: z.string().optional(), - batch_id: z.number().optional(), + batch_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), request_id: z.string().optional(), uc_resource_id: z.string().optional(), host: z.string().optional(), @@ -3876,7 +3894,10 @@ export const unmarshalRestartWindowSchema: z.ZodType = z export const unmarshalSequencingSchema: z.ZodType = z .object({ data_plane_id: z.lazy(() => unmarshalDataPlaneIdSchema).optional(), - control_plane_seq_no: z.number().optional(), + control_plane_seq_no: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ dataPlaneId: d.data_plane_id, @@ -4039,7 +4060,10 @@ export const unmarshalUpdateInfoSchema: z.ZodType = z cause: z.enum(UpdateCause).optional(), state: z.enum(UpdateState).optional(), cluster_id: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), full_refresh: z.boolean().optional(), refresh_selection: z.array(z.string()).optional(), full_refresh_selection: z.array(z.string()).optional(), @@ -4103,7 +4127,7 @@ export const marshalAutoFullRefreshPolicySchema: z.ZodType = z export const marshalClonePipelineRequestSchema: z.ZodType = z .object({ pipelineId: z.string().optional(), - expectedLastModified: z.number().optional(), + expectedLastModified: z.bigint().optional(), allowDuplicateNames: z.boolean().optional(), id: z.string().optional(), name: z.string().optional(), @@ -4381,7 +4405,7 @@ export const marshalEditPipelineRequestSchema: z.ZodType = z .object({ pipelineId: z.string().optional(), allowDuplicateNames: z.boolean().optional(), - expectedLastModified: z.number().optional(), + expectedLastModified: z.bigint().optional(), runAs: z.lazy(() => marshalPipelinesJobRunAsSchema).optional(), parameters: z.record(z.string(), z.string()).optional(), id: z.string().optional(), @@ -4791,7 +4815,7 @@ export const marshalIngestionPipelineDefinition_TableSpecificConfig_QueryBasedCo .object({ cursorColumns: z.array(z.string()).optional(), deletionCondition: z.string().optional(), - hardDeletionSyncMinIntervalInSeconds: z.number().optional(), + hardDeletionSyncMinIntervalInSeconds: z.bigint().optional(), }) .transform(d => ({ cursor_columns: d.cursorColumns, @@ -4866,7 +4890,7 @@ export const marshalKafkaOptionsSchema: z.ZodType = z keyTransformer: z.lazy(() => marshalTransformerSchema).optional(), valueTransformer: z.lazy(() => marshalTransformerSchema).optional(), startingOffset: z.string().optional(), - maxOffsetsPerTrigger: z.number().optional(), + maxOffsetsPerTrigger: z.bigint().optional(), clientConfig: z.record(z.string(), z.string()).optional(), }) .transform(d => ({ diff --git a/packages/pipelines/src/v2/utils.ts b/packages/pipelines/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/pipelines/src/v2/utils.ts +++ b/packages/pipelines/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/policyfamilies/package.json b/packages/policyfamilies/package.json index c840da8e..e9ba0178 100644 --- a/packages/policyfamilies/package.json +++ b/packages/policyfamilies/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/policyfamilies/src/v2/client.ts b/packages/policyfamilies/src/v2/client.ts index 43e88a66..23f77f2e 100644 --- a/packages/policyfamilies/src/v2/client.ts +++ b/packages/policyfamilies/src/v2/client.ts @@ -29,7 +29,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -56,7 +56,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/policyfamilies/src/v2/model.ts b/packages/policyfamilies/src/v2/model.ts index b00b4c6d..7e77623f 100644 --- a/packages/policyfamilies/src/v2/model.ts +++ b/packages/policyfamilies/src/v2/model.ts @@ -7,13 +7,13 @@ export interface GetPolicyFamilyRequest { /** The family ID about which to retrieve information. */ policyFamilyId?: string | undefined; /** The version number for the family to fetch. Defaults to the latest version. */ - version?: number | undefined; + version?: bigint | undefined; } /** Returns the list of policy families available to use at their latest version */ export interface ListPolicyFamiliesRequest { /** Maximum number of policy families to return. */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** A token that can be used to get the next page of results. */ pageToken?: string | undefined; } diff --git a/packages/policyfamilies/src/v2/utils.ts b/packages/policyfamilies/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/policyfamilies/src/v2/utils.ts +++ b/packages/policyfamilies/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/postgres/package.json b/packages/postgres/package.json index 68f35467..4430b62b 100644 --- a/packages/postgres/package.json +++ b/packages/postgres/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/postgres/src/v1/client.ts b/packages/postgres/src/v1/client.ts index 7b8b909c..4fe07afd 100644 --- a/packages/postgres/src/v1/client.ts +++ b/packages/postgres/src/v1/client.ts @@ -113,7 +113,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -140,7 +140,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/postgres/src/v1/model.ts b/packages/postgres/src/v1/model.ts index 4fa4c531..c93c39f5 100644 --- a/packages/postgres/src/v1/model.ts +++ b/packages/postgres/src/v1/model.ts @@ -783,7 +783,7 @@ export interface BranchStatus { /** A timestamp indicating when the `current_state` began. */ stateChangeTime?: Temporal.Instant | undefined; /** The logical size of the branch. */ - logicalSizeBytes?: number | undefined; + logicalSizeBytes?: bigint | undefined; /** Absolute expiration time for the branch. Empty if expiration is disabled. */ expireTime?: Temporal.Instant | undefined; /** Part of the resource name. */ @@ -1145,7 +1145,7 @@ export interface DeleteSyncedTableRequest { export interface DeltaTableSyncInfo { /** The Delta Lake commit version that was last successfully synced. */ - deltaCommitVersion?: number | undefined; + deltaCommitVersion?: bigint | undefined; /** * The timestamp when the above Delta version was committed in the source Delta table. * Note: This is the Delta commit time, not the time the data was written to the synced table. @@ -1687,9 +1687,9 @@ export interface ProjectStatus { /** The effective default endpoint settings. */ defaultEndpointSettings?: ProjectDefaultEndpointSettings | undefined; /** The logical size limit for a branch. */ - branchLogicalSizeLimitBytes?: number | undefined; + branchLogicalSizeLimitBytes?: bigint | undefined; /** The current space occupied by the project in storage. */ - syntheticStorageSizeBytes?: number | undefined; + syntheticStorageSizeBytes?: bigint | undefined; /** The budget policy that is applied to the project. */ budgetPolicyId?: string | undefined; /** The effective custom tags associated with the project. */ @@ -1922,7 +1922,7 @@ export interface SyncedTable_SyncedTableStatus { /** The current phase of the data synchronization pipeline. */ provisioningPhase?: ProvisioningPhase | undefined; /** The last source table Delta version that was successfully synced to the synced table. */ - lastProcessedCommitVersion?: number | undefined; + lastProcessedCommitVersion?: bigint | undefined; /** * The end timestamp of the last time any data was synchronized from the source table to the synced * table. This is when the data is available in the synced table. @@ -1952,11 +1952,11 @@ export interface SyncedTablePipelineProgress { * The source table Delta version that was last processed by the pipeline. The pipeline may not * have completely processed this version yet. */ - latestVersionCurrentlyProcessing?: number | undefined; + latestVersionCurrentlyProcessing?: bigint | undefined; /** The number of rows that have been synced in this update. */ - syncedRowCount?: number | undefined; + syncedRowCount?: bigint | undefined; /** The total number of rows that need to be synced in this update. This number may be an estimate. */ - totalRowCount?: number | undefined; + totalRowCount?: bigint | undefined; /** The completion ratio of this update. This is a number between 0 and 1. */ syncProgressCompletion?: number | undefined; /** The estimated time remaining to complete this update in seconds. */ @@ -2141,7 +2141,10 @@ export const unmarshalBranchStatusSchema: z.ZodType = z .string() .transform(s => Temporal.Instant.from(s)) .optional(), - logical_size_bytes: z.number().optional(), + logical_size_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), expire_time: z .string() .transform(s => Temporal.Instant.from(s)) @@ -2314,7 +2317,10 @@ export const unmarshalDatabricksServiceExceptionWithDetailsProtoSchema: z.ZodTyp export const unmarshalDeltaTableSyncInfoSchema: z.ZodType = z .object({ - delta_commit_version: z.number().optional(), + delta_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), delta_commit_time: z .string() .transform(s => Temporal.Instant.from(s)) @@ -2675,8 +2681,14 @@ export const unmarshalProjectStatusSchema: z.ZodType = z default_endpoint_settings: z .lazy(() => unmarshalProjectDefaultEndpointSettingsSchema) .optional(), - branch_logical_size_limit_bytes: z.number().optional(), - synthetic_storage_size_bytes: z.number().optional(), + branch_logical_size_limit_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + synthetic_storage_size_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), budget_policy_id: z.string().optional(), custom_tags: z .array(z.lazy(() => unmarshalProjectCustomTagSchema)) @@ -2839,7 +2851,10 @@ export const unmarshalSyncedTable_SyncedTableStatusSchema: z.ZodType unmarshalSyncedTablePipelineProgressSchema) .optional(), provisioning_phase: z.enum(ProvisioningPhase).optional(), - last_processed_commit_version: z.number().optional(), + last_processed_commit_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), last_sync_time: z .string() .transform(s => Temporal.Instant.from(s)) @@ -2871,9 +2886,18 @@ export const unmarshalSyncedTableOperationMetadataSchema: z.ZodType = z .object({ - latest_version_currently_processing: z.number().optional(), - synced_row_count: z.number().optional(), - total_row_count: z.number().optional(), + latest_version_currently_processing: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + synced_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + total_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), sync_progress_completion: z.number().optional(), estimated_completion_time_seconds: z.number().optional(), }) @@ -2995,7 +3019,7 @@ export const marshalBranchStatusSchema: z.ZodType = z .any() .transform((d: Temporal.Instant) => d.toString()) .optional(), - logicalSizeBytes: z.number().optional(), + logicalSizeBytes: z.bigint().optional(), expireTime: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -3128,7 +3152,7 @@ export const marshalDatabase_DatabaseStatusSchema: z.ZodType = z export const marshalDeltaTableSyncInfoSchema: z.ZodType = z .object({ - deltaCommitVersion: z.number().optional(), + deltaCommitVersion: z.bigint().optional(), deltaCommitTime: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -3422,8 +3446,8 @@ export const marshalProjectStatusSchema: z.ZodType = z defaultEndpointSettings: z .lazy(() => marshalProjectDefaultEndpointSettingsSchema) .optional(), - branchLogicalSizeLimitBytes: z.number().optional(), - syntheticStorageSizeBytes: z.number().optional(), + branchLogicalSizeLimitBytes: z.bigint().optional(), + syntheticStorageSizeBytes: z.bigint().optional(), budgetPolicyId: z.string().optional(), customTags: z.array(z.lazy(() => marshalProjectCustomTagSchema)).optional(), owner: z.string().optional(), @@ -3599,7 +3623,7 @@ export const marshalSyncedTable_SyncedTableStatusSchema: z.ZodType = z .lazy(() => marshalSyncedTablePipelineProgressSchema) .optional(), provisioningPhase: z.enum(ProvisioningPhase).optional(), - lastProcessedCommitVersion: z.number().optional(), + lastProcessedCommitVersion: z.bigint().optional(), lastSyncTime: z .any() .transform((d: Temporal.Instant) => d.toString()) @@ -3625,9 +3649,9 @@ export const marshalSyncedTable_SyncedTableStatusSchema: z.ZodType = z export const marshalSyncedTablePipelineProgressSchema: z.ZodType = z .object({ - latestVersionCurrentlyProcessing: z.number().optional(), - syncedRowCount: z.number().optional(), - totalRowCount: z.number().optional(), + latestVersionCurrentlyProcessing: z.bigint().optional(), + syncedRowCount: z.bigint().optional(), + totalRowCount: z.bigint().optional(), syncProgressCompletion: z.number().optional(), estimatedCompletionTimeSeconds: z.number().optional(), }) diff --git a/packages/postgres/src/v1/utils.ts b/packages/postgres/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/postgres/src/v1/utils.ts +++ b/packages/postgres/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/queries/package.json b/packages/queries/package.json index e8d8dfc2..d61eb8b6 100644 --- a/packages/queries/package.json +++ b/packages/queries/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/queries/src/v1/client.ts b/packages/queries/src/v1/client.ts index 067c3997..fe7f6cb0 100644 --- a/packages/queries/src/v1/client.ts +++ b/packages/queries/src/v1/client.ts @@ -42,7 +42,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -69,7 +69,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/queries/src/v1/utils.ts b/packages/queries/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/queries/src/v1/utils.ts +++ b/packages/queries/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/queryhistory/package.json b/packages/queryhistory/package.json index 967e6136..5aef40ab 100644 --- a/packages/queryhistory/package.json +++ b/packages/queryhistory/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/queryhistory/src/v1/client.ts b/packages/queryhistory/src/v1/client.ts index 35e2af1d..608ea7f0 100644 --- a/packages/queryhistory/src/v1/client.ts +++ b/packages/queryhistory/src/v1/client.ts @@ -25,7 +25,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -52,7 +52,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/queryhistory/src/v1/model.ts b/packages/queryhistory/src/v1/model.ts index e7a65394..7a0322d7 100644 --- a/packages/queryhistory/src/v1/model.ts +++ b/packages/queryhistory/src/v1/model.ts @@ -160,7 +160,7 @@ export interface QueryFilter { /** A range filter for query submitted time. The time range must be less than or equal to 30 days. */ queryStartTimeRange?: TimeRange | undefined; /** A list of user IDs who ran the queries. */ - userIds?: number[] | undefined; + userIds?: bigint[] | undefined; /** * A list of statuses (QUEUED, RUNNING, CANCELED, FAILED, FINISHED) to match query results. Corresponds to * the `status` field in the response. @@ -190,13 +190,13 @@ export interface QueryInfo { /** The text of the query. */ queryText?: string | undefined; /** The time the query started. */ - queryStartTimeMs?: number | undefined; + queryStartTimeMs?: bigint | undefined; /** The time execution of the query ended. */ - executionEndTimeMs?: number | undefined; + executionEndTimeMs?: bigint | undefined; /** The time the query ended. */ - queryEndTimeMs?: number | undefined; + queryEndTimeMs?: bigint | undefined; /** The ID of the user who ran the query. */ - userId?: number | undefined; + userId?: bigint | undefined; /** The email address or username of the user who ran the query. */ userName?: string | undefined; /** URL to the Spark UI query plan. */ @@ -204,7 +204,7 @@ export interface QueryInfo { /** Alias for `warehouse_id`. */ endpointId?: string | undefined; /** The number of results returned by the query. */ - rowsProduced?: number | undefined; + rowsProduced?: bigint | undefined; /** Message describing why the query could not complete. */ errorMessage?: string | undefined; /** A key that can be used to look up query details. */ @@ -212,7 +212,7 @@ export interface QueryInfo { /** Metrics about query execution. */ metrics?: QueryMetrics | undefined; /** The ID of the user whose credentials were used to run the query. */ - executedAsUserId?: number | undefined; + executedAsUserId?: bigint | undefined; /** The email address or username of the user whose credentials were used to run the query. */ executedAsUserName?: string | undefined; /** @@ -234,7 +234,7 @@ export interface QueryInfo { * Total time of the statement execution. This value does not include the time taken to retrieve the results, which * can result in a discrepancy between this value and the start-to-finish wall-clock time. */ - duration?: number | undefined; + duration?: bigint | undefined; /** * Client application that ran the statement. For example: Databricks SQL Editor, Tableau, and Power BI. * This field is derived from information provided by client applications. While values are expected to @@ -258,55 +258,55 @@ export interface QueryInfo { */ export interface QueryMetrics { /** Total execution time of the query from the client’s point of view, in milliseconds. */ - totalTimeMs?: number | undefined; + totalTimeMs?: bigint | undefined; /** Total size of data read by the query, in bytes. */ - readBytes?: number | undefined; + readBytes?: bigint | undefined; /** Total number of rows returned by the query. */ - rowsProducedCount?: number | undefined; + rowsProducedCount?: bigint | undefined; /** Time spent loading metadata and optimizing the query, in milliseconds. */ - compilationTimeMs?: number | undefined; + compilationTimeMs?: bigint | undefined; /** Time spent executing the query, in milliseconds. */ - executionTimeMs?: number | undefined; + executionTimeMs?: bigint | undefined; /** Size of persistent data read from cloud object storage on your cloud tenant, in bytes. */ - readRemoteBytes?: number | undefined; + readRemoteBytes?: bigint | undefined; /** Size pf persistent data written to cloud object storage in your cloud tenant, in bytes. */ - writeRemoteBytes?: number | undefined; + writeRemoteBytes?: bigint | undefined; /** Size of persistent data read from the cache, in bytes. */ - readCacheBytes?: number | undefined; + readCacheBytes?: bigint | undefined; /** Size of data temporarily written to disk while executing the query, in bytes. */ - spillToDiskBytes?: number | undefined; + spillToDiskBytes?: bigint | undefined; /** Sum of execution time for all of the query’s tasks, in milliseconds. */ - taskTotalTimeMs?: number | undefined; + taskTotalTimeMs?: bigint | undefined; /** Number of files read after pruning */ - readFilesCount?: number | undefined; + readFilesCount?: bigint | undefined; /** Number of partitions read after pruning. */ - readPartitionsCount?: number | undefined; + readPartitionsCount?: bigint | undefined; /** Total execution time for all individual Photon query engine tasks in the query, in milliseconds. */ - photonTotalTimeMs?: number | undefined; + photonTotalTimeMs?: bigint | undefined; /** Total number of rows read by the query. */ - rowsReadCount?: number | undefined; + rowsReadCount?: bigint | undefined; /** Time spent fetching the query results after the execution finished, in milliseconds. */ - resultFetchTimeMs?: number | undefined; + resultFetchTimeMs?: bigint | undefined; /** Total amount of data sent over the network between executor nodes during shuffle, in bytes. */ - networkSentBytes?: number | undefined; + networkSentBytes?: bigint | undefined; /** `true` if the query result was fetched from cache, `false` otherwise. */ resultFromCache?: boolean | undefined; /** Total number of file bytes in all tables not read due to pruning */ - prunedBytes?: number | undefined; + prunedBytes?: bigint | undefined; /** Total number of files from all tables not read due to pruning */ - prunedFilesCount?: number | undefined; + prunedFilesCount?: bigint | undefined; /** * Timestamp of when the query was enqueued waiting for a cluster to be provisioned for the warehouse. * This field is optional and will not appear if the query skipped the provisioning queue. */ - provisioningQueueStartTimestamp?: number | undefined; + provisioningQueueStartTimestamp?: bigint | undefined; /** * Timestamp of when the query was enqueued waiting while the warehouse was at max load. * This field is optional and will not appear if the query skipped the overloading queue. */ - overloadingQueueStartTimestamp?: number | undefined; + overloadingQueueStartTimestamp?: bigint | undefined; /** Timestamp of when the underlying compute started compilation of the query. */ - queryCompilationStartTimestamp?: number | undefined; + queryCompilationStartTimestamp?: bigint | undefined; /** * sum of task times completed in a range of wall clock time, approximated to a configurable number of points * aggregated over all stages and jobs in the query (based on task_total_time_ms) @@ -316,23 +316,23 @@ export interface QueryMetrics { * remaining work to be done across all stages in the query, calculated by autoscaler StatementAnalysis.scala, in milliseconds * deprecated: using projected_remaining_task_total_time_ms instead */ - workToBeDone?: number | undefined; + workToBeDone?: bigint | undefined; /** * number of remaining tasks to complete, calculated by autoscaler StatementAnalysis.scala * deprecated: use remaining_task_count instead */ - runnableTasks?: number | undefined; + runnableTasks?: bigint | undefined; /** projected remaining work to be done aggregated across all stages in the query, in milliseconds */ - projectedRemainingTaskTotalTimeMs?: number | undefined; + projectedRemainingTaskTotalTimeMs?: bigint | undefined; /** * number of remaining tasks to complete * this is based on the current status and could be bigger or smaller in the future based on future updates */ - remainingTaskCount?: number | undefined; + remainingTaskCount?: bigint | undefined; /** projected lower bound on remaining total task time based on projected_remaining_task_total_time_ms / maximum concurrency */ - projectedRemainingWallclockTimeMs?: number | undefined; + projectedRemainingWallclockTimeMs?: bigint | undefined; /** Total number of file bytes in all tables read */ - readFilesBytes?: number | undefined; + readFilesBytes?: bigint | undefined; } /** @@ -352,19 +352,19 @@ export interface TaskTimeOverRange { * the same for all entries * start time of first interval is query_start_time_ms */ - interval?: number | undefined; + interval?: bigint | undefined; } export interface TaskTimeOverRangeEntry { /** total task completion time in this time range, aggregated over all stages and jobs in the query */ - taskCompletedTimeMs?: number | undefined; + taskCompletedTimeMs?: bigint | undefined; } export interface TimeRange { /** The start time in milliseconds. */ - startTimeMs?: number | undefined; + startTimeMs?: bigint | undefined; /** The end time in milliseconds. */ - endTimeMs?: number | undefined; + endTimeMs?: bigint | undefined; } export const unmarshalChannelInfoSchema: z.ZodType = z @@ -433,18 +433,36 @@ export const unmarshalQueryInfoSchema: z.ZodType = z query_id: z.string().optional(), status: z.enum(QueryStatus).optional(), query_text: z.string().optional(), - query_start_time_ms: z.number().optional(), - execution_end_time_ms: z.number().optional(), - query_end_time_ms: z.number().optional(), - user_id: z.number().optional(), + query_start_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_end_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + query_end_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), user_name: z.string().optional(), spark_ui_url: z.string().optional(), endpoint_id: z.string().optional(), - rows_produced: z.number().optional(), + rows_produced: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), error_message: z.string().optional(), lookup_key: z.string().optional(), metrics: z.lazy(() => unmarshalQueryMetricsSchema).optional(), - executed_as_user_id: z.number().optional(), + executed_as_user_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), executed_as_user_name: z.string().optional(), session_id: z.string().optional(), is_final: z.boolean().optional(), @@ -452,7 +470,10 @@ export const unmarshalQueryInfoSchema: z.ZodType = z plans_state: z.enum(PlansState).optional(), statement_type: z.enum(QueryStatementType).optional(), warehouse_id: z.string().optional(), - duration: z.number().optional(), + duration: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), client_application: z.string().optional(), query_source: z.lazy(() => unmarshalExternalQuerySourceSchema).optional(), cache_query_id: z.string().optional(), @@ -490,37 +511,118 @@ export const unmarshalQueryInfoSchema: z.ZodType = z export const unmarshalQueryMetricsSchema: z.ZodType = z .object({ - total_time_ms: z.number().optional(), - read_bytes: z.number().optional(), - rows_produced_count: z.number().optional(), - compilation_time_ms: z.number().optional(), - execution_time_ms: z.number().optional(), - read_remote_bytes: z.number().optional(), - write_remote_bytes: z.number().optional(), - read_cache_bytes: z.number().optional(), - spill_to_disk_bytes: z.number().optional(), - task_total_time_ms: z.number().optional(), - read_files_count: z.number().optional(), - read_partitions_count: z.number().optional(), - photon_total_time_ms: z.number().optional(), - rows_read_count: z.number().optional(), - result_fetch_time_ms: z.number().optional(), - network_sent_bytes: z.number().optional(), + total_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + rows_produced_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + compilation_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + execution_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_remote_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + write_remote_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_cache_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + spill_to_disk_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + task_total_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_files_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_partitions_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + photon_total_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + rows_read_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + result_fetch_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + network_sent_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), result_from_cache: z.boolean().optional(), - pruned_bytes: z.number().optional(), - pruned_files_count: z.number().optional(), - provisioning_queue_start_timestamp: z.number().optional(), - overloading_queue_start_timestamp: z.number().optional(), - query_compilation_start_timestamp: z.number().optional(), + pruned_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + pruned_files_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + provisioning_queue_start_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + overloading_queue_start_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + query_compilation_start_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), task_time_over_time_range: z .lazy(() => unmarshalTaskTimeOverRangeSchema) .optional(), - work_to_be_done: z.number().optional(), - runnable_tasks: z.number().optional(), - projected_remaining_task_total_time_ms: z.number().optional(), - remaining_task_count: z.number().optional(), - projected_remaining_wallclock_time_ms: z.number().optional(), - read_files_bytes: z.number().optional(), + work_to_be_done: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + runnable_tasks: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + projected_remaining_task_total_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + remaining_task_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + projected_remaining_wallclock_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + read_files_bytes: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ totalTimeMs: d.total_time_ms, @@ -569,7 +671,10 @@ export const unmarshalTaskTimeOverRangeSchema: z.ZodType = z entries: z .array(z.lazy(() => unmarshalTaskTimeOverRangeEntrySchema)) .optional(), - interval: z.number().optional(), + interval: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ entries: d.entries, @@ -579,7 +684,10 @@ export const unmarshalTaskTimeOverRangeSchema: z.ZodType = z export const unmarshalTaskTimeOverRangeEntrySchema: z.ZodType = z .object({ - task_completed_time_ms: z.number().optional(), + task_completed_time_ms: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ taskCompletedTimeMs: d.task_completed_time_ms, @@ -588,7 +696,7 @@ export const unmarshalTaskTimeOverRangeEntrySchema: z.ZodType marshalTimeRangeSchema).optional(), - userIds: z.array(z.number()).optional(), + userIds: z.array(z.bigint()).optional(), statuses: z.array(z.enum(QueryStatus)).optional(), warehouseIds: z.array(z.string()).optional(), statementIds: z.array(z.string()).optional(), @@ -603,8 +711,8 @@ export const marshalQueryFilterSchema: z.ZodType = z export const marshalTimeRangeSchema: z.ZodType = z .object({ - startTimeMs: z.number().optional(), - endTimeMs: z.number().optional(), + startTimeMs: z.bigint().optional(), + endTimeMs: z.bigint().optional(), }) .transform(d => ({ start_time_ms: d.startTimeMs, diff --git a/packages/queryhistory/src/v1/utils.ts b/packages/queryhistory/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/queryhistory/src/v1/utils.ts +++ b/packages/queryhistory/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/registeredmodels/package.json b/packages/registeredmodels/package.json index 2e4fd238..a1831b21 100644 --- a/packages/registeredmodels/package.json +++ b/packages/registeredmodels/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/registeredmodels/src/v1/client.ts b/packages/registeredmodels/src/v1/client.ts index 23dcabd7..7d50f98a 100644 --- a/packages/registeredmodels/src/v1/client.ts +++ b/packages/registeredmodels/src/v1/client.ts @@ -56,7 +56,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -83,7 +83,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/registeredmodels/src/v1/model.ts b/packages/registeredmodels/src/v1/model.ts index d3a3b582..8c429534 100644 --- a/packages/registeredmodels/src/v1/model.ts +++ b/packages/registeredmodels/src/v1/model.ts @@ -36,11 +36,11 @@ export interface CreateRegisteredModelRequest { /** The three-level (fully qualified) name of the registered model */ fullName?: string | undefined; /** Creation timestamp of the registered model in milliseconds since the Unix epoch */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the registered model */ createdBy?: string | undefined; /** Last-update timestamp of the registered model in milliseconds since the Unix epoch */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the registered model last time */ updatedBy?: string | undefined; /** List of aliases associated with the registered model */ @@ -59,7 +59,7 @@ export interface DeleteModelVersionRequest { /** The three-level (fully qualified) name of the model version */ fullNameArg?: string | undefined; /** The integer version number of the model version */ - versionArg?: number | undefined; + versionArg?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. @@ -121,7 +121,7 @@ export interface GetModelVersionRequest { /** The three-level (fully qualified) name of the model version */ fullNameArg?: string | undefined; /** The integer version number of the model version */ - versionArg?: number | undefined; + versionArg?: bigint | undefined; /** Whether to include aliases associated with the model version in the response */ includeAliases?: boolean | undefined; /** Whether to include model versions in the response for which the principal can only access selective metadata for */ @@ -147,7 +147,7 @@ export interface ListModelVersionsRequest { * - when set to 0, the page length is set to a server configured value (100, as of 1/3/2024) (recommended); * - when set to a value less than 0, an invalid parameter error is returned; */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** Opaque pagination token to go to next page based on previous query. */ pageToken?: string | undefined; /** Whether to include model versions in the response for which the principal can only access selective metadata for */ @@ -192,7 +192,7 @@ export interface ListRegisteredModelsRequest { * - when set to 0, the page length is set to a server configured value (100, as of 4/2/2024); * - when set to a value less than 0, an invalid parameter error is returned; */ - maxResults?: number | undefined; + maxResults?: bigint | undefined; /** Opaque token to send for the next page of results (pagination). */ pageToken?: string | undefined; } @@ -227,7 +227,7 @@ export interface ModelVersionInfo { * ID of the workspace containing the MLflow run that generated this model * version, if applicable */ - runWorkspaceId?: number | undefined; + runWorkspaceId?: bigint | undefined; /** Model version dependencies, for feature-store packaged models */ modelVersionDependencies?: DependencyList | undefined; /** @@ -238,15 +238,15 @@ export interface ModelVersionInfo { */ status?: ModelVersionStatus | undefined; /** Integer model version number, used to reference the model version in API requests. */ - version?: number | undefined; + version?: bigint | undefined; /** The storage location on the cloud under which model version data files are stored */ storageLocation?: string | undefined; /** The unique identifier of the metastore containing the model version */ metastoreId?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the model version */ createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the model version last time */ updatedBy?: string | undefined; /** The unique identifier of the model version */ @@ -259,7 +259,7 @@ export interface RegisteredModelAliasInfo { /** Name of the alias, e.g. 'champion' or 'latest_stable' */ aliasName?: string | undefined; /** Integer version number of the model version to which this alias points. */ - versionNum?: number | undefined; + versionNum?: bigint | undefined; /** The unique identifier of the alias */ id?: string | undefined; /** The name of the parent registered model of the model version, relative to parent schema */ @@ -288,11 +288,11 @@ export interface RegisteredModelInfo { /** The three-level (fully qualified) name of the registered model */ fullName?: string | undefined; /** Creation timestamp of the registered model in milliseconds since the Unix epoch */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the registered model */ createdBy?: string | undefined; /** Last-update timestamp of the registered model in milliseconds since the Unix epoch */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the registered model last time */ updatedBy?: string | undefined; /** List of aliases associated with the registered model */ @@ -307,7 +307,7 @@ export interface SetRegisteredModelAliasRequest { /** The name of the alias */ aliasArg?: string | undefined; /** The version number of the model version to which the alias points */ - versionNum?: number | undefined; + versionNum?: bigint | undefined; } /** A table that is dependent on a SQL object. */ @@ -320,7 +320,7 @@ export interface UpdateModelVersionRequest { /** The three-level (fully qualified) name of the model version */ fullNameArg?: string | undefined; /** The integer version number of the model version */ - versionArg?: number | undefined; + versionArg?: bigint | undefined; /** The name of the parent registered model of the model version, relative to parent schema */ modelName?: string | undefined; /** The name of the catalog containing the model version */ @@ -340,7 +340,7 @@ export interface UpdateModelVersionRequest { * ID of the workspace containing the MLflow run that generated this model * version, if applicable */ - runWorkspaceId?: number | undefined; + runWorkspaceId?: bigint | undefined; /** Model version dependencies, for feature-store packaged models */ modelVersionDependencies?: DependencyList | undefined; /** @@ -351,15 +351,15 @@ export interface UpdateModelVersionRequest { */ status?: ModelVersionStatus | undefined; /** Integer model version number, used to reference the model version in API requests. */ - version?: number | undefined; + version?: bigint | undefined; /** The storage location on the cloud under which model version data files are stored */ storageLocation?: string | undefined; /** The unique identifier of the metastore containing the model version */ metastoreId?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the model version */ createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the model version last time */ updatedBy?: string | undefined; /** The unique identifier of the model version */ @@ -390,11 +390,11 @@ export interface UpdateRegisteredModelRequest { /** The three-level (fully qualified) name of the registered model */ fullName?: string | undefined; /** Creation timestamp of the registered model in milliseconds since the Unix epoch */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the registered model */ createdBy?: string | undefined; /** Last-update timestamp of the registered model in milliseconds since the Unix epoch */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the registered model last time */ updatedBy?: string | undefined; /** List of aliases associated with the registered model */ @@ -506,17 +506,29 @@ export const unmarshalModelVersionInfoSchema: z.ZodType = z source: z.string().optional(), comment: z.string().optional(), run_id: z.string().optional(), - run_workspace_id: z.number().optional(), + run_workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), model_version_dependencies: z .lazy(() => unmarshalDependencyListSchema) .optional(), status: z.enum(ModelVersionStatus).optional(), - version: z.number().optional(), + version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), storage_location: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), id: z.string().optional(), aliases: z @@ -548,7 +560,10 @@ export const unmarshalRegisteredModelAliasInfoSchema: z.ZodType BigInt(v)) + .optional(), id: z.string().optional(), model_name: z.string().optional(), catalog_name: z.string().optional(), @@ -574,9 +589,15 @@ export const unmarshalRegisteredModelInfoSchema: z.ZodType storage_location: z.string().optional(), metastore_id: z.string().optional(), full_name: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), aliases: z .array(z.lazy(() => unmarshalRegisteredModelAliasInfoSchema)) @@ -626,9 +647,9 @@ export const marshalCreateRegisteredModelRequestSchema: z.ZodType = z storageLocation: z.string().optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), aliases: z .array(z.lazy(() => marshalRegisteredModelAliasInfoSchema)) @@ -709,7 +730,7 @@ export const marshalFunctionDependencySchema: z.ZodType = z export const marshalRegisteredModelAliasInfoSchema: z.ZodType = z .object({ aliasName: z.string().optional(), - versionNum: z.number().optional(), + versionNum: z.bigint().optional(), id: z.string().optional(), modelName: z.string().optional(), catalogName: z.string().optional(), @@ -728,7 +749,7 @@ export const marshalSetRegisteredModelAliasRequestSchema: z.ZodType = z .object({ fullNameArg: z.string().optional(), aliasArg: z.string().optional(), - versionNum: z.number().optional(), + versionNum: z.bigint().optional(), }) .transform(d => ({ full_name_arg: d.fullNameArg, @@ -747,24 +768,24 @@ export const marshalTableDependencySchema: z.ZodType = z export const marshalUpdateModelVersionRequestSchema: z.ZodType = z .object({ fullNameArg: z.string().optional(), - versionArg: z.number().optional(), + versionArg: z.bigint().optional(), modelName: z.string().optional(), catalogName: z.string().optional(), schemaName: z.string().optional(), source: z.string().optional(), comment: z.string().optional(), runId: z.string().optional(), - runWorkspaceId: z.number().optional(), + runWorkspaceId: z.bigint().optional(), modelVersionDependencies: z .lazy(() => marshalDependencyListSchema) .optional(), status: z.enum(ModelVersionStatus).optional(), - version: z.number().optional(), + version: z.bigint().optional(), storageLocation: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), id: z.string().optional(), aliases: z @@ -806,9 +827,9 @@ export const marshalUpdateRegisteredModelRequestSchema: z.ZodType = z storageLocation: z.string().optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), aliases: z .array(z.lazy(() => marshalRegisteredModelAliasInfoSchema)) diff --git a/packages/registeredmodels/src/v1/utils.ts b/packages/registeredmodels/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/registeredmodels/src/v1/utils.ts +++ b/packages/registeredmodels/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/repos/package.json b/packages/repos/package.json index 4038c8f6..98aafa37 100644 --- a/packages/repos/package.json +++ b/packages/repos/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/repos/src/v1/client.ts b/packages/repos/src/v1/client.ts index b8c788d1..6d671d38 100644 --- a/packages/repos/src/v1/client.ts +++ b/packages/repos/src/v1/client.ts @@ -42,7 +42,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -69,7 +69,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/repos/src/v1/model.ts b/packages/repos/src/v1/model.ts index bf1afaba..092d9c65 100644 --- a/packages/repos/src/v1/model.ts +++ b/packages/repos/src/v1/model.ts @@ -28,7 +28,7 @@ export interface CreateRepoRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface CreateRepoRequest_Response { /** ID of the Git folder (repo) object in the workspace. */ - id?: number | undefined; + id?: bigint | undefined; /** Path of the Git folder (repo) in the workspace. */ path?: string | undefined; /** URL of the linked Git repository. */ @@ -49,7 +49,7 @@ export interface CreateRepoRequest_Response { export interface DeleteProjectRequest { /** The ID for the corresponding repo to delete. */ - id?: number | undefined; + id?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-empty-object-type -- Proto-style nested message name. @@ -57,13 +57,13 @@ export interface DeleteProjectRequest_Response {} export interface GetRepoRequest { /** ID of the Git folder (repo) object in the workspace. */ - id?: number | undefined; + id?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface GetRepoRequest_Response { /** ID of the Git folder (repo) object in the workspace. */ - id?: number | undefined; + id?: bigint | undefined; /** Path of the Git folder (repo) in the workspace. */ path?: string | undefined; /** URL of the linked Git repository. */ @@ -110,7 +110,7 @@ export interface ListReposRequest_Response { /** Git folder (repo) information. */ export interface RepoInfo { /** Id of the git folder (repo) in the Workspace. */ - id?: number | undefined; + id?: bigint | undefined; /** Root path of the git folder (repo) in the Workspace. */ path?: string | undefined; /** URL of the remote git repository. */ @@ -151,7 +151,7 @@ export interface SparseCheckoutUpdate { export interface UpdateRepoRequest { /** ID of the Git folder (repo) object in the workspace. */ - id?: number | undefined; + id?: bigint | undefined; /** Branch that the local version of the repo is checked out to. */ branch?: string | undefined; /** @@ -174,7 +174,10 @@ export interface UpdateRepoRequest_Response {} export const unmarshalCreateRepoRequest_ResponseSchema: z.ZodType = z .object({ - id: z.number().optional(), + id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), path: z.string().optional(), url: z.string().optional(), provider: z.string().optional(), @@ -200,7 +203,10 @@ export const unmarshalDeleteProjectRequest_ResponseSchema: z.ZodType = z .object({ - id: z.number().optional(), + id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), path: z.string().optional(), url: z.string().optional(), provider: z.string().optional(), @@ -232,7 +238,10 @@ export const unmarshalListReposRequest_ResponseSchema: z.ZodType = z .object({ - id: z.number().optional(), + id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), path: z.string().optional(), url: z.string().optional(), provider: z.string().optional(), @@ -294,7 +303,7 @@ export const marshalSparseCheckoutUpdateSchema: z.ZodType = z export const marshalUpdateRepoRequestSchema: z.ZodType = z .object({ - id: z.number().optional(), + id: z.bigint().optional(), branch: z.string().optional(), tag: z.string().optional(), sparseCheckout: z.lazy(() => marshalSparseCheckoutUpdateSchema).optional(), diff --git a/packages/repos/src/v1/utils.ts b/packages/repos/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/repos/src/v1/utils.ts +++ b/packages/repos/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/resourcequotas/package.json b/packages/resourcequotas/package.json index 4b0efdbf..aabfdab4 100644 --- a/packages/resourcequotas/package.json +++ b/packages/resourcequotas/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/resourcequotas/src/v1/client.ts b/packages/resourcequotas/src/v1/client.ts index dfecd5f9..05d3962e 100644 --- a/packages/resourcequotas/src/v1/client.ts +++ b/packages/resourcequotas/src/v1/client.ts @@ -30,7 +30,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -57,7 +57,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/resourcequotas/src/v1/model.ts b/packages/resourcequotas/src/v1/model.ts index fb0b27c1..d9c05dbe 100644 --- a/packages/resourcequotas/src/v1/model.ts +++ b/packages/resourcequotas/src/v1/model.ts @@ -69,7 +69,7 @@ export interface QuotaInfo { /** The current limit of the resource quota. */ quotaLimit?: number | undefined; /** The timestamp that indicates when the quota count was last updated. */ - lastRefreshedAt?: number | undefined; + lastRefreshedAt?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -101,7 +101,10 @@ export const unmarshalQuotaInfoSchema: z.ZodType = z quota_name: z.string().optional(), quota_count: z.number().optional(), quota_limit: z.number().optional(), - last_refreshed_at: z.number().optional(), + last_refreshed_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ parentSecurableType: d.parent_securable_type, diff --git a/packages/resourcequotas/src/v1/utils.ts b/packages/resourcequotas/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/resourcequotas/src/v1/utils.ts +++ b/packages/resourcequotas/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/rfa/package.json b/packages/rfa/package.json index c99b18eb..056898fa 100644 --- a/packages/rfa/package.json +++ b/packages/rfa/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/rfa/src/v1/client.ts b/packages/rfa/src/v1/client.ts index 80b45360..a18cc5e3 100644 --- a/packages/rfa/src/v1/client.ts +++ b/packages/rfa/src/v1/client.ts @@ -33,7 +33,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -60,7 +60,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/rfa/src/v1/utils.ts b/packages/rfa/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/rfa/src/v1/utils.ts +++ b/packages/rfa/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/schemas/package.json b/packages/schemas/package.json index 499cf9b4..f701f8a6 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/schemas/src/v1/client.ts b/packages/schemas/src/v1/client.ts index 16c62735..27c29071 100644 --- a/packages/schemas/src/v1/client.ts +++ b/packages/schemas/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/schemas/src/v1/model.ts b/packages/schemas/src/v1/model.ts index 1316c496..a4f8f65b 100644 --- a/packages/schemas/src/v1/model.ts +++ b/packages/schemas/src/v1/model.ts @@ -30,11 +30,11 @@ export interface CreateSchemaRequest { /** Full name of schema, in form of __catalog_name__.__schema_name__. */ fullName?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of schema creator. */ createdBy?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified schema. */ updatedBy?: string | undefined; /** The type of the parent catalog. */ @@ -139,11 +139,11 @@ export interface SchemaInfo { /** Full name of schema, in form of __catalog_name__.__schema_name__. */ fullName?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of schema creator. */ createdBy?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified schema. */ updatedBy?: string | undefined; /** The type of the parent catalog. */ @@ -197,11 +197,11 @@ export interface UpdateSchemaRequest { /** Full name of schema, in form of __catalog_name__.__schema_name__. */ fullName?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of schema creator. */ createdBy?: string | undefined; /** Time at which this schema was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified schema. */ updatedBy?: string | undefined; /** The type of the parent catalog. */ @@ -272,9 +272,15 @@ export const unmarshalSchemaInfoSchema: z.ZodType = z enable_predictive_optimization: z.string().optional(), metastore_id: z.string().optional(), full_name: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), catalog_type: z.enum(CatalogType).optional(), storage_location: z.string().optional(), @@ -319,9 +325,9 @@ export const marshalCreateSchemaRequestSchema: z.ZodType = z enablePredictiveOptimization: z.string().optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), catalogType: z.enum(CatalogType).optional(), storageLocation: z.string().optional(), @@ -380,9 +386,9 @@ export const marshalUpdateSchemaRequestSchema: z.ZodType = z enablePredictiveOptimization: z.string().optional(), metastoreId: z.string().optional(), fullName: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), catalogType: z.enum(CatalogType).optional(), storageLocation: z.string().optional(), diff --git a/packages/schemas/src/v1/utils.ts b/packages/schemas/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/schemas/src/v1/utils.ts +++ b/packages/schemas/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/scim/package.json b/packages/scim/package.json index 75fd0577..214314f6 100644 --- a/packages/scim/package.json +++ b/packages/scim/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/scim/src/v1/client.ts b/packages/scim/src/v1/client.ts index 1e61f6b7..75a34e21 100644 --- a/packages/scim/src/v1/client.ts +++ b/packages/scim/src/v1/client.ts @@ -111,7 +111,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -142,7 +142,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); @@ -287,7 +287,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } @@ -470,7 +470,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } @@ -681,7 +681,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } @@ -901,7 +901,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } @@ -1102,7 +1102,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } @@ -1384,7 +1384,7 @@ export class Client { if (items.length === 0) { return; } - pageReq.startIndex = (resp.startIndex ?? 0) + items.length; + pageReq.startIndex = (resp.startIndex ?? 0n) + BigInt(items.length); } } diff --git a/packages/scim/src/v1/model.ts b/packages/scim/src/v1/model.ts index d2c374f6..71614b87 100644 --- a/packages/scim/src/v1/model.ts +++ b/packages/scim/src/v1/model.ts @@ -467,9 +467,9 @@ export interface ListAccountGroupsRequest { /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Desired number of results per page. Default is 10000. */ - count?: number | undefined; + count?: bigint | undefined; /** Attribute to sort the results. */ sortBy?: string | undefined; /** The order to sort the results. */ @@ -482,7 +482,7 @@ export interface ListAccountGroupsResponse { /** User objects returned in the response. */ resources?: AccountGroup[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -492,7 +492,7 @@ export interface ListAccountServicePrincipalsRequest { /** Comma-separated list of attributes to return in response. */ attributes?: string | undefined; /** Desired number of results per page. Default is 10000. */ - count?: number | undefined; + count?: bigint | undefined; /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Query by which the results have to be filtered. Supported operators are equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be formed using logical operators - `and` and `or`. The [SCIM RFC](https://tools.ietf.org/html/rfc7644#section-3.4.2.2) has more details but we currently only support simple expressions. */ @@ -502,7 +502,7 @@ export interface ListAccountServicePrincipalsRequest { /** The order to sort the results. */ sortOrder?: AccountListSort_Order | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** account ID */ accountId?: string | undefined; } @@ -513,7 +513,7 @@ export interface ListAccountServicePrincipalsResponse { /** User objects returned in the response. */ resources?: AccountServicePrincipal[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -523,7 +523,7 @@ export interface ListAccountUsersRequest { /** Comma-separated list of attributes to return in response. */ attributes?: string | undefined; /** Desired number of results per page. Default is 10000. */ - count?: number | undefined; + count?: bigint | undefined; /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Query by which the results have to be filtered. Supported operators are equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be formed using logical operators - `and` and `or`. The [SCIM RFC](https://tools.ietf.org/html/rfc7644#section-3.4.2.2) has more details but we currently only support simple expressions. */ @@ -533,7 +533,7 @@ export interface ListAccountUsersRequest { /** The order to sort the results. */ sortOrder?: AccountListSort_Order | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** account ID */ accountId?: string | undefined; } @@ -544,7 +544,7 @@ export interface ListAccountUsersResponse { /** User objects returned in the response. */ resources?: AccountUser[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -558,9 +558,9 @@ export interface ListGroupsRequest { /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Desired number of results per page. */ - count?: number | undefined; + count?: bigint | undefined; /** Attribute to sort the results. */ sortBy?: string | undefined; /** The order to sort the results. */ @@ -575,7 +575,7 @@ export interface ListGroupsResponse { /** The schema of the service principal. */ schemas?: ListResponseSchema[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -588,7 +588,7 @@ export interface ListServicePrincipalResponse { /** The schema of the List response. */ schemas?: ListResponseSchema[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -598,7 +598,7 @@ export interface ListServicePrincipalsRequest { /** Comma-separated list of attributes to return in response. */ attributes?: string | undefined; /** Desired number of results per page. */ - count?: number | undefined; + count?: bigint | undefined; /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Query by which the results have to be filtered. Supported operators are equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be formed using logical operators - `and` and `or`. The [SCIM RFC](https://tools.ietf.org/html/rfc7644#section-3.4.2.2) has more details but we currently only support simple expressions. */ @@ -608,7 +608,7 @@ export interface ListServicePrincipalsRequest { /** The order to sort the results. */ sortOrder?: ListSort_Order | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; } /** @@ -623,7 +623,7 @@ export interface ListUsersRequest { /** Comma-separated list of attributes to return in response. */ attributes?: string | undefined; /** Desired number of results per page. */ - count?: number | undefined; + count?: bigint | undefined; /** Comma-separated list of attributes to exclude in response. */ excludedAttributes?: string | undefined; /** Query by which the results have to be filtered. Supported operators are equals(`eq`), contains(`co`), starts with(`sw`) and not equals(`ne`). Additionally, simple expressions can be formed using logical operators - `and` and `or`. The [SCIM RFC](https://tools.ietf.org/html/rfc7644#section-3.4.2.2) has more details but we currently only support simple expressions. */ @@ -633,7 +633,7 @@ export interface ListUsersRequest { /** The order to sort the results. */ sortOrder?: ListSort_Order | undefined; /** Specifies the index of the first result. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; } export interface ListUsersResponse { @@ -644,7 +644,7 @@ export interface ListUsersResponse { /** The schema of the List response. */ schemas?: ListResponseSchema[] | undefined; /** Starting index of all the results that matched the request filters. First item is number 1. */ - startIndex?: number | undefined; + startIndex?: bigint | undefined; /** Total results that match the request filters. */ totalResults?: number | undefined; } @@ -1094,7 +1094,10 @@ export const unmarshalListAccountGroupsResponseSchema: z.ZodType unmarshalAccountGroupSchema)).optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ @@ -1111,7 +1114,10 @@ export const unmarshalListAccountServicePrincipalsResponseSchema: z.ZodType unmarshalAccountServicePrincipalSchema)) .optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ @@ -1126,7 +1132,10 @@ export const unmarshalListAccountUsersResponseSchema: z.ZodType unmarshalAccountUserSchema)).optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ @@ -1142,7 +1151,10 @@ export const unmarshalListGroupsResponseSchema: z.ZodType = itemsPerPage: z.number().optional(), Resources: z.array(z.lazy(() => unmarshalGroupSchema)).optional(), schemas: z.array(z.enum(ListResponseSchema)).optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ @@ -1161,7 +1173,10 @@ export const unmarshalListServicePrincipalResponseSchema: z.ZodType unmarshalServicePrincipalSchema)) .optional(), schemas: z.array(z.enum(ListResponseSchema)).optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ @@ -1177,7 +1192,10 @@ export const unmarshalListUsersResponseSchema: z.ZodType = z itemsPerPage: z.number().optional(), Resources: z.array(z.lazy(() => unmarshalUserSchema)).optional(), schemas: z.array(z.enum(ListResponseSchema)).optional(), - startIndex: z.number().optional(), + startIndex: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), totalResults: z.number().optional(), }) .transform(d => ({ diff --git a/packages/scim/src/v1/utils.ts b/packages/scim/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/scim/src/v1/utils.ts +++ b/packages/scim/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 501c94a0..c462f599 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -34,6 +34,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/secrets/package.json b/packages/secrets/package.json index 0daec678..9c95db00 100644 --- a/packages/secrets/package.json +++ b/packages/secrets/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/secrets/src/v1/client.ts b/packages/secrets/src/v1/client.ts index f7df4b4b..a956e4ea 100644 --- a/packages/secrets/src/v1/client.ts +++ b/packages/secrets/src/v1/client.ts @@ -63,7 +63,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -90,7 +90,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/secrets/src/v1/model.ts b/packages/secrets/src/v1/model.ts index b1c35d9e..d8c53d51 100644 --- a/packages/secrets/src/v1/model.ts +++ b/packages/secrets/src/v1/model.ts @@ -185,7 +185,7 @@ export interface SecretMetadata { /** A unique name to identify the secret. */ key?: string | undefined; /** The last updated timestamp (in milliseconds) for the secret. */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; } /** @@ -295,7 +295,10 @@ export const unmarshalPutSecretRequest_ResponseSchema: z.ZodType = z .object({ key: z.string().optional(), - last_updated_timestamp: z.number().optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ key: d.key, diff --git a/packages/secrets/src/v1/utils.ts b/packages/secrets/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/secrets/src/v1/utils.ts +++ b/packages/secrets/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/secretsuc/package.json b/packages/secretsuc/package.json index da84e193..3bca2e4b 100644 --- a/packages/secretsuc/package.json +++ b/packages/secretsuc/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/secretsuc/src/v1/client.ts b/packages/secretsuc/src/v1/client.ts index d63f53da..ec67f46d 100644 --- a/packages/secretsuc/src/v1/client.ts +++ b/packages/secretsuc/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/secretsuc/src/v1/utils.ts b/packages/secretsuc/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/secretsuc/src/v1/utils.ts +++ b/packages/secretsuc/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/settings/package.json b/packages/settings/package.json index d94d5e2c..cb9f6626 100644 --- a/packages/settings/package.json +++ b/packages/settings/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/settings/src/v2/client.ts b/packages/settings/src/v2/client.ts index 60c31456..0971fba0 100644 --- a/packages/settings/src/v2/client.ts +++ b/packages/settings/src/v2/client.ts @@ -46,7 +46,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -77,7 +77,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/settings/src/v2/utils.ts b/packages/settings/src/v2/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/settings/src/v2/utils.ts +++ b/packages/settings/src/v2/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/sharing/package.json b/packages/sharing/package.json index 9bf7cb05..9f1f57a7 100644 --- a/packages/sharing/package.json +++ b/packages/sharing/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/sharing/src/v1/client.ts b/packages/sharing/src/v1/client.ts index 33f64bd5..11225731 100644 --- a/packages/sharing/src/v1/client.ts +++ b/packages/sharing/src/v1/client.ts @@ -97,7 +97,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -124,7 +124,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/sharing/src/v1/model.ts b/packages/sharing/src/v1/model.ts index da5f701f..31f94cf2 100644 --- a/packages/sharing/src/v1/model.ts +++ b/packages/sharing/src/v1/model.ts @@ -116,11 +116,11 @@ export interface CreateProviderRequest { /** The recipient profile. This field is only present when the authentication_type is `TOKEN` or `OAUTH_CLIENT_CREDENTIALS`. */ recipientProfile?: RecipientProfile | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of Provider creator. */ createdBy?: string | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified Provider. */ updatedBy?: string | undefined; /** Cloud vendor of the provider's UC metastore. This field is only present when the __authentication_type__ is **DATABRICKS**. */ @@ -158,7 +158,7 @@ export interface CreateRecipientRequest { */ propertiesKvpairs?: PropertiesKvPairs | undefined; /** Expiration timestamp of the token, in epoch milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** * Full activation url to retrieve the access token. * It will be empty if the token is already retrieved. @@ -167,13 +167,13 @@ export interface CreateRecipientRequest { /** A boolean status field showing whether the Recipient's activation URL has been exercised or not. */ activated?: boolean | undefined; /** Time at which this recipient was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of recipient creator. */ createdBy?: string | undefined; /** This field is only present when the __authentication_type__ is **TOKEN**. */ tokens?: RecipientTokenInfo[] | undefined; /** Time at which the recipient was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of recipient updater. */ updatedBy?: string | undefined; /** @@ -207,11 +207,11 @@ export interface CreateShareRequest { /** A list of shared data objects within the share. */ objects?: SharedDataObject[] | undefined; /** Time at which this share was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of share creator. */ createdBy?: string | undefined; /** Time at which this share was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of share updater. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for the share. */ @@ -749,11 +749,11 @@ export interface ProviderInfo { /** The recipient profile. This field is only present when the authentication_type is `TOKEN` or `OAUTH_CLIENT_CREDENTIALS`. */ recipientProfile?: RecipientProfile | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of Provider creator. */ createdBy?: string | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified Provider. */ updatedBy?: string | undefined; /** Cloud vendor of the provider's UC metastore. This field is only present when the __authentication_type__ is **DATABRICKS**. */ @@ -796,7 +796,7 @@ export interface RecipientInfo { */ propertiesKvpairs?: PropertiesKvPairs | undefined; /** Expiration timestamp of the token, in epoch milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** * Full activation url to retrieve the access token. * It will be empty if the token is already retrieved. @@ -805,13 +805,13 @@ export interface RecipientInfo { /** A boolean status field showing whether the Recipient's activation URL has been exercised or not. */ activated?: boolean | undefined; /** Time at which this recipient was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of recipient creator. */ createdBy?: string | undefined; /** This field is only present when the __authentication_type__ is **TOKEN**. */ tokens?: RecipientTokenInfo[] | undefined; /** Time at which the recipient was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of recipient updater. */ updatedBy?: string | undefined; /** @@ -846,15 +846,15 @@ export interface RecipientTokenInfo { /** Unique ID of the recipient token. */ id?: string | undefined; /** Time at which this recipient token was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of recipient token creator. */ createdBy?: string | undefined; /** Full activation URL to retrieve the access token. It will be empty if the token is already retrieved. */ activationUrl?: string | undefined; /** Expiration timestamp of the token in epoch milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** Time at which this recipient token was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of recipient token updater. */ updatedBy?: string | undefined; } @@ -863,7 +863,7 @@ export interface RegisteredModelAlias { /** Name of the alias. */ aliasName?: string | undefined; /** Numeric model version that alias will reference. */ - versionNum?: number | undefined; + versionNum?: bigint | undefined; } export interface RetrieveToken { @@ -891,7 +891,7 @@ export interface RotateRecipientTokenRequest { * of existing token only to a smaller timestamp, it cannot extend the expiration_time. Use 0 to * expire the existing token immediately, negative number will return an error. */ - existingTokenExpireInSeconds?: number | undefined; + existingTokenExpireInSeconds?: bigint | undefined; } export interface Share { @@ -911,11 +911,11 @@ export interface ShareInfo { /** A list of shared data objects within the share. */ objects?: SharedDataObject[] | undefined; /** Time at which this share was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of share creator. */ createdBy?: string | undefined; /** Time at which this share was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of share updater. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for the share. */ @@ -938,7 +938,7 @@ export interface SharedDataObject { /** The type of the data object. */ dataObjectType?: string | undefined; /** The time when this data object is added to the share, in epoch milliseconds. */ - addedAt?: number | undefined; + addedAt?: bigint | undefined; /** Username of the sharer. */ addedBy?: string | undefined; /** A user-provided comment when adding the data object to the share. */ @@ -982,7 +982,7 @@ export interface SharedDataObject { * * NOTE: The start_version should be <= the `current` version of the object. */ - startVersion?: number | undefined; + startVersion?: bigint | undefined; /** One of: **ACTIVE**, **PERMISSION_DENIED**. */ status?: SharedDataObject_Status_Enum | undefined; /** @@ -1081,11 +1081,11 @@ export interface UpdateProviderRequest { /** The recipient profile. This field is only present when the authentication_type is `TOKEN` or `OAUTH_CLIENT_CREDENTIALS`. */ recipientProfile?: RecipientProfile | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of Provider creator. */ createdBy?: string | undefined; /** Time at which this Provider was created, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified Provider. */ updatedBy?: string | undefined; /** Cloud vendor of the provider's UC metastore. This field is only present when the __authentication_type__ is **DATABRICKS**. */ @@ -1130,7 +1130,7 @@ export interface UpdateRecipientRequest { */ propertiesKvpairs?: PropertiesKvPairs | undefined; /** Expiration timestamp of the token, in epoch milliseconds. */ - expirationTime?: number | undefined; + expirationTime?: bigint | undefined; /** * Full activation url to retrieve the access token. * It will be empty if the token is already retrieved. @@ -1139,13 +1139,13 @@ export interface UpdateRecipientRequest { /** A boolean status field showing whether the Recipient's activation URL has been exercised or not. */ activated?: boolean | undefined; /** Time at which this recipient was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of recipient creator. */ createdBy?: string | undefined; /** This field is only present when the __authentication_type__ is **TOKEN**. */ tokens?: RecipientTokenInfo[] | undefined; /** Time at which the recipient was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of recipient updater. */ updatedBy?: string | undefined; /** @@ -1200,11 +1200,11 @@ export interface UpdateShareRequest { /** A list of shared data objects within the share. */ objects?: SharedDataObject[] | undefined; /** Time at which this share was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of share creator. */ createdBy?: string | undefined; /** Time at which this share was updated, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of share updater. */ updatedBy?: string | undefined; /** Storage Location URL (full path) for the share. */ @@ -1610,9 +1610,15 @@ export const unmarshalProviderInfoSchema: z.ZodType = z comment: z.string().optional(), owner: z.string().optional(), recipient_profile: z.lazy(() => unmarshalRecipientProfileSchema).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -1656,13 +1662,22 @@ export const unmarshalRecipientInfoSchema: z.ZodType = z properties_kvpairs: z .lazy(() => unmarshalPropertiesKvPairsSchema) .optional(), - expiration_time: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), activation_url: z.string().optional(), activated: z.boolean().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), tokens: z.array(z.lazy(() => unmarshalRecipientTokenInfoSchema)).optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -1708,11 +1723,20 @@ export const unmarshalRecipientTokenInfoSchema: z.ZodType = z .object({ id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), activation_url: z.string().optional(), - expiration_time: z.number().optional(), - updated_at: z.number().optional(), + expiration_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), }) .transform(d => ({ @@ -1729,7 +1753,10 @@ export const unmarshalRegisteredModelAliasSchema: z.ZodType BigInt(v)) + .optional(), }) .transform(d => ({ aliasName: d.alias_name, @@ -1769,9 +1796,15 @@ export const unmarshalShareInfoSchema: z.ZodType = z comment: z.string().optional(), storage_root: z.string().optional(), objects: z.array(z.lazy(() => unmarshalSharedDataObjectSchema)).optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), storage_location: z.string().optional(), }) @@ -1805,7 +1838,10 @@ export const unmarshalSharedDataObjectSchema: z.ZodType = z .object({ name: z.string().optional(), data_object_type: z.string().optional(), - added_at: z.number().optional(), + added_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), added_by: z.string().optional(), comment: z.string().optional(), shared_as: z.string().optional(), @@ -1813,7 +1849,10 @@ export const unmarshalSharedDataObjectSchema: z.ZodType = z history_data_sharing_status: z .enum(SharedDataObject_HistoryDataSharingStatus_Enum) .optional(), - start_version: z.number().optional(), + start_version: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), status: z.enum(SharedDataObject_Status_Enum).optional(), content: z.string().optional(), string_shared_as: z.string().optional(), @@ -1921,9 +1960,9 @@ export const marshalCreateProviderRequestSchema: z.ZodType = z comment: z.string().optional(), owner: z.string().optional(), recipientProfile: z.lazy(() => marshalRecipientProfileSchema).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -1957,13 +1996,13 @@ export const marshalCreateRecipientRequestSchema: z.ZodType = z comment: z.string().optional(), ipAccessList: z.lazy(() => marshalIpAccessListSchema).optional(), propertiesKvpairs: z.lazy(() => marshalPropertiesKvPairsSchema).optional(), - expirationTime: z.number().optional(), + expirationTime: z.bigint().optional(), activationUrl: z.string().optional(), activated: z.boolean().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), tokens: z.array(z.lazy(() => marshalRecipientTokenInfoSchema)).optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -2000,9 +2039,9 @@ export const marshalCreateShareRequestSchema: z.ZodType = z comment: z.string().optional(), storageRoot: z.string().optional(), objects: z.array(z.lazy(() => marshalSharedDataObjectSchema)).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageLocation: z.string().optional(), }) @@ -2140,11 +2179,11 @@ export const marshalRecipientProfileSchema: z.ZodType = z export const marshalRecipientTokenInfoSchema: z.ZodType = z .object({ id: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), activationUrl: z.string().optional(), - expirationTime: z.number().optional(), - updatedAt: z.number().optional(), + expirationTime: z.bigint().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), }) .transform(d => ({ @@ -2160,7 +2199,7 @@ export const marshalRecipientTokenInfoSchema: z.ZodType = z export const marshalRotateRecipientTokenRequestSchema: z.ZodType = z .object({ name: z.string().optional(), - existingTokenExpireInSeconds: z.number().optional(), + existingTokenExpireInSeconds: z.bigint().optional(), }) .transform(d => ({ name: d.name, @@ -2171,7 +2210,7 @@ export const marshalSharedDataObjectSchema: z.ZodType = z .object({ name: z.string().optional(), dataObjectType: z.string().optional(), - addedAt: z.number().optional(), + addedAt: z.bigint().optional(), addedBy: z.string().optional(), comment: z.string().optional(), sharedAs: z.string().optional(), @@ -2179,7 +2218,7 @@ export const marshalSharedDataObjectSchema: z.ZodType = z historyDataSharingStatus: z .enum(SharedDataObject_HistoryDataSharingStatus_Enum) .optional(), - startVersion: z.number().optional(), + startVersion: z.bigint().optional(), status: z.enum(SharedDataObject_Status_Enum).optional(), content: z.string().optional(), stringSharedAs: z.string().optional(), @@ -2213,9 +2252,9 @@ export const marshalUpdateProviderRequestSchema: z.ZodType = z comment: z.string().optional(), owner: z.string().optional(), recipientProfile: z.lazy(() => marshalRecipientProfileSchema).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -2253,13 +2292,13 @@ export const marshalUpdateRecipientRequestSchema: z.ZodType = z comment: z.string().optional(), ipAccessList: z.lazy(() => marshalIpAccessListSchema).optional(), propertiesKvpairs: z.lazy(() => marshalPropertiesKvPairsSchema).optional(), - expirationTime: z.number().optional(), + expirationTime: z.bigint().optional(), activationUrl: z.string().optional(), activated: z.boolean().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), tokens: z.array(z.lazy(() => marshalRecipientTokenInfoSchema)).optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), cloud: z.string().optional(), region: z.string().optional(), @@ -2317,9 +2356,9 @@ export const marshalUpdateShareRequestSchema: z.ZodType = z comment: z.string().optional(), storageRoot: z.string().optional(), objects: z.array(z.lazy(() => marshalSharedDataObjectSchema)).optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), storageLocation: z.string().optional(), }) diff --git a/packages/sharing/src/v1/utils.ts b/packages/sharing/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/sharing/src/v1/utils.ts +++ b/packages/sharing/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/statementexecution/package.json b/packages/statementexecution/package.json index 1c0c15c7..50a53c7c 100644 --- a/packages/statementexecution/package.json +++ b/packages/statementexecution/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/statementexecution/src/v1/client.ts b/packages/statementexecution/src/v1/client.ts index 438fe533..95d8f895 100644 --- a/packages/statementexecution/src/v1/client.ts +++ b/packages/statementexecution/src/v1/client.ts @@ -36,7 +36,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -63,7 +63,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/statementexecution/src/v1/model.ts b/packages/statementexecution/src/v1/model.ts index 4efce139..a508218a 100644 --- a/packages/statementexecution/src/v1/model.ts +++ b/packages/statementexecution/src/v1/model.ts @@ -106,14 +106,14 @@ export interface ChunkInfo { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -173,7 +173,7 @@ export interface ExecuteStatementRequest { * it also sets the `truncated` field in the response to indicate whether the result was trimmed due to the limit or * not. */ - rowLimit?: number | undefined; + rowLimit?: bigint | undefined; /** * Applies the given byte limit to the statement's result size. Byte counts are based on internal data * representations and might not match the final size in the requested `format`. If the result was truncated due to @@ -181,7 +181,7 @@ export interface ExecuteStatementRequest { * When using `EXTERNAL_LINKS` disposition, a default `byte_limit` of 100 GiB is applied if `byte_limit` is not * explicitly set. */ - byteLimit?: number | undefined; + byteLimit?: bigint | undefined; /** * Statement execution supports three result formats: `JSON_ARRAY` (default), `ARROW_STREAM`, and `CSV`. * @@ -350,14 +350,14 @@ export interface ExternalLink { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -423,14 +423,14 @@ export interface ResultData { /** The position within the sequence of result set chunks. */ chunkIndex?: number | undefined; /** The starting row offset within the result set. */ - rowOffset?: number | undefined; + rowOffset?: bigint | undefined; /** The number of rows within the result chunk. */ - rowCount?: number | undefined; + rowCount?: bigint | undefined; /** * The number of bytes in the result chunk. This field is not available when using `INLINE` * disposition. */ - byteCount?: number | undefined; + byteCount?: bigint | undefined; /** * When fetching, provides the `chunk_index` for the _next_ chunk. If absent, indicates there are no * more chunks. The next chunk can be fetched with a @@ -454,12 +454,12 @@ export interface ResultManifest { /** Array of result set chunk metadata. */ chunks?: ChunkInfo[] | undefined; /** The total number of rows in the result set. */ - totalRowCount?: number | undefined; + totalRowCount?: bigint | undefined; /** * The total number of bytes in the result set. This field is not available when using `INLINE` * disposition. */ - totalByteCount?: number | undefined; + totalByteCount?: bigint | undefined; /** Indicates whether the result is truncated due to `row_limit` or `byte_limit`. */ truncated?: boolean | undefined; } @@ -528,9 +528,18 @@ export const unmarshalCancelStatementResponseSchema: z.ZodType = z .object({ chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -569,9 +578,18 @@ export const unmarshalExternalLinkSchema: z.ZodType = z expiration: z.string().optional(), http_headers: z.record(z.string(), z.string()).optional(), chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -594,9 +612,18 @@ export const unmarshalResultDataSchema: z.ZodType = z .optional(), data_array: z.array(z.array(jsonValueSchema)).optional(), chunk_index: z.number().optional(), - row_offset: z.number().optional(), - row_count: z.number().optional(), - byte_count: z.number().optional(), + row_offset: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), next_chunk_index: z.number().optional(), next_chunk_internal_link: z.string().optional(), }) @@ -617,8 +644,14 @@ export const unmarshalResultManifestSchema: z.ZodType = z schema: z.lazy(() => unmarshalSchemaSchema).optional(), total_chunk_count: z.number().optional(), chunks: z.array(z.lazy(() => unmarshalChunkInfoSchema)).optional(), - total_row_count: z.number().optional(), - total_byte_count: z.number().optional(), + total_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + total_byte_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), truncated: z.boolean().optional(), }) .transform(d => ({ @@ -691,8 +724,8 @@ export const marshalExecuteStatementRequestSchema: z.ZodType = z warehouseId: z.string().optional(), catalog: z.string().optional(), schema: z.string().optional(), - rowLimit: z.number().optional(), - byteLimit: z.number().optional(), + rowLimit: z.bigint().optional(), + byteLimit: z.bigint().optional(), format: z.enum(Format).optional(), disposition: z.enum(Disposition).optional(), waitTimeout: z.string().optional(), diff --git a/packages/statementexecution/src/v1/utils.ts b/packages/statementexecution/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/statementexecution/src/v1/utils.ts +++ b/packages/statementexecution/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/storageconfigurations/package.json b/packages/storageconfigurations/package.json index 0c899f3d..6615a907 100644 --- a/packages/storageconfigurations/package.json +++ b/packages/storageconfigurations/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/storageconfigurations/src/v1/client.ts b/packages/storageconfigurations/src/v1/client.ts index e2850482..e210950e 100644 --- a/packages/storageconfigurations/src/v1/client.ts +++ b/packages/storageconfigurations/src/v1/client.ts @@ -33,7 +33,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -59,7 +59,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/storageconfigurations/src/v1/model.ts b/packages/storageconfigurations/src/v1/model.ts index a4003280..7efee114 100644 --- a/packages/storageconfigurations/src/v1/model.ts +++ b/packages/storageconfigurations/src/v1/model.ts @@ -50,7 +50,7 @@ export interface StorageConfiguration { /** The human-readable name of the storage configuration. */ storageConfigurationName?: string | undefined; /** Time in epoch milliseconds when the storage configuration was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** * Optional IAM role that is used to access the workspace catalog which is created during workspace creation * for UC by Default. If a storage configuration with this field populated is used to create a workspace, @@ -75,7 +75,10 @@ export const unmarshalStorageConfigurationSchema: z.ZodType unmarshalRootBucketInfoSchema).optional(), storage_configuration_name: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), role_arn: z.string().optional(), }) .transform(d => ({ diff --git a/packages/storageconfigurations/src/v1/utils.ts b/packages/storageconfigurations/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/storageconfigurations/src/v1/utils.ts +++ b/packages/storageconfigurations/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/supervisoragents/package.json b/packages/supervisoragents/package.json index 384ca7cb..a625cafa 100644 --- a/packages/supervisoragents/package.json +++ b/packages/supervisoragents/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/supervisoragents/src/v1/client.ts b/packages/supervisoragents/src/v1/client.ts index e5085077..e422a4f5 100644 --- a/packages/supervisoragents/src/v1/client.ts +++ b/packages/supervisoragents/src/v1/client.ts @@ -54,7 +54,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -81,7 +81,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/supervisoragents/src/v1/utils.ts b/packages/supervisoragents/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/supervisoragents/src/v1/utils.ts +++ b/packages/supervisoragents/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/systemschemas/package.json b/packages/systemschemas/package.json index 11ace6f0..00eee525 100644 --- a/packages/systemschemas/package.json +++ b/packages/systemschemas/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/systemschemas/src/v1/client.ts b/packages/systemschemas/src/v1/client.ts index 9e797358..6767a449 100644 --- a/packages/systemschemas/src/v1/client.ts +++ b/packages/systemschemas/src/v1/client.ts @@ -35,7 +35,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -62,7 +62,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/systemschemas/src/v1/utils.ts b/packages/systemschemas/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/systemschemas/src/v1/utils.ts +++ b/packages/systemschemas/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/tables/package.json b/packages/tables/package.json index 4a9964cd..d9a8f9ff 100644 --- a/packages/tables/package.json +++ b/packages/tables/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/tables/src/v1/client.ts b/packages/tables/src/v1/client.ts index f070caa7..0bd1ddb9 100644 --- a/packages/tables/src/v1/client.ts +++ b/packages/tables/src/v1/client.ts @@ -53,7 +53,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -80,7 +80,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/tables/src/v1/model.ts b/packages/tables/src/v1/model.ts index f69dd439..8848dfdc 100644 --- a/packages/tables/src/v1/model.ts +++ b/packages/tables/src/v1/model.ts @@ -326,11 +326,11 @@ export interface CreateTableRequest { /** Unique ID of the Data Access Configuration to use with the table data. */ dataAccessConfigurationId?: string | undefined; /** Time at which this table was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of table creator. */ createdBy?: string | undefined; /** Time at which this table was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the table. */ updatedBy?: string | undefined; /** The unique identifier of the table. */ @@ -338,7 +338,7 @@ export interface CreateTableRequest { /** Information pertaining to current state of the delta table. */ deltaRuntimePropertiesKvpairs?: DeltaRuntimePropertiesKvPairs | undefined; /** Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted. */ - deletedAt?: number | undefined; + deletedAt?: bigint | undefined; effectivePredictiveOptimizationFlag?: | EffectivePredictiveOptimizationFlag | undefined; @@ -749,11 +749,11 @@ export interface TableInfo { /** Unique ID of the Data Access Configuration to use with the table data. */ dataAccessConfigurationId?: string | undefined; /** Time at which this table was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of table creator. */ createdBy?: string | undefined; /** Time at which this table was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the table. */ updatedBy?: string | undefined; /** The unique identifier of the table. */ @@ -761,7 +761,7 @@ export interface TableInfo { /** Information pertaining to current state of the delta table. */ deltaRuntimePropertiesKvpairs?: DeltaRuntimePropertiesKvPairs | undefined; /** Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted. */ - deletedAt?: number | undefined; + deletedAt?: bigint | undefined; effectivePredictiveOptimizationFlag?: | EffectivePredictiveOptimizationFlag | undefined; @@ -836,11 +836,11 @@ export interface UpdateTableRequest { /** Unique ID of the Data Access Configuration to use with the table data. */ dataAccessConfigurationId?: string | undefined; /** Time at which this table was created, in epoch milliseconds. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Username of table creator. */ createdBy?: string | undefined; /** Time at which this table was last modified, in epoch milliseconds. */ - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** Username of user who last modified the table. */ updatedBy?: string | undefined; /** The unique identifier of the table. */ @@ -848,7 +848,7 @@ export interface UpdateTableRequest { /** Information pertaining to current state of the delta table. */ deltaRuntimePropertiesKvpairs?: DeltaRuntimePropertiesKvPairs | undefined; /** Time at which this table was deleted, in epoch milliseconds. Field is omitted if table is not deleted. */ - deletedAt?: number | undefined; + deletedAt?: bigint | undefined; effectivePredictiveOptimizationFlag?: | EffectivePredictiveOptimizationFlag | undefined; @@ -1248,15 +1248,24 @@ export const unmarshalTableInfoSchema: z.ZodType = z metastore_id: z.string().optional(), full_name: z.string().optional(), data_access_configuration_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), table_id: z.string().optional(), delta_runtime_properties_kvpairs: z .lazy(() => unmarshalDeltaRuntimePropertiesKvPairsSchema) .optional(), - deleted_at: z.number().optional(), + deleted_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), effective_predictive_optimization_flag: z .lazy(() => unmarshalEffectivePredictiveOptimizationFlagSchema) .optional(), @@ -1411,15 +1420,15 @@ export const marshalCreateTableRequestSchema: z.ZodType = z metastoreId: z.string().optional(), fullName: z.string().optional(), dataAccessConfigurationId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), tableId: z.string().optional(), deltaRuntimePropertiesKvpairs: z .lazy(() => marshalDeltaRuntimePropertiesKvPairsSchema) .optional(), - deletedAt: z.number().optional(), + deletedAt: z.bigint().optional(), effectivePredictiveOptimizationFlag: z .lazy(() => marshalEffectivePredictiveOptimizationFlagSchema) .optional(), @@ -1749,15 +1758,15 @@ export const marshalUpdateTableRequestSchema: z.ZodType = z metastoreId: z.string().optional(), fullName: z.string().optional(), dataAccessConfigurationId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), tableId: z.string().optional(), deltaRuntimePropertiesKvpairs: z .lazy(() => marshalDeltaRuntimePropertiesKvPairsSchema) .optional(), - deletedAt: z.number().optional(), + deletedAt: z.bigint().optional(), effectivePredictiveOptimizationFlag: z .lazy(() => marshalEffectivePredictiveOptimizationFlagSchema) .optional(), diff --git a/packages/tables/src/v1/utils.ts b/packages/tables/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/tables/src/v1/utils.ts +++ b/packages/tables/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/tagassignments/package.json b/packages/tagassignments/package.json index f9e7b0d9..1c56c0bc 100644 --- a/packages/tagassignments/package.json +++ b/packages/tagassignments/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/tagassignments/src/v1/client.ts b/packages/tagassignments/src/v1/client.ts index b3916f78..9524b7ce 100644 --- a/packages/tagassignments/src/v1/client.ts +++ b/packages/tagassignments/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/tagassignments/src/v1/utils.ts b/packages/tagassignments/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/tagassignments/src/v1/utils.ts +++ b/packages/tagassignments/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/tagpolicies/package.json b/packages/tagpolicies/package.json index 06421aa4..b4b2a94e 100644 --- a/packages/tagpolicies/package.json +++ b/packages/tagpolicies/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/tagpolicies/src/v1/client.ts b/packages/tagpolicies/src/v1/client.ts index 4de1e450..652b0102 100644 --- a/packages/tagpolicies/src/v1/client.ts +++ b/packages/tagpolicies/src/v1/client.ts @@ -34,7 +34,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -61,7 +61,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/tagpolicies/src/v1/utils.ts b/packages/tagpolicies/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/tagpolicies/src/v1/utils.ts +++ b/packages/tagpolicies/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/tokenmanagement/package.json b/packages/tokenmanagement/package.json index eb9b52f5..40c07e83 100644 --- a/packages/tokenmanagement/package.json +++ b/packages/tokenmanagement/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/tokenmanagement/src/v1/client.ts b/packages/tokenmanagement/src/v1/client.ts index bd1a0796..e4927d05 100644 --- a/packages/tokenmanagement/src/v1/client.ts +++ b/packages/tokenmanagement/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/tokenmanagement/src/v1/model.ts b/packages/tokenmanagement/src/v1/model.ts index f9cedd71..533ba152 100644 --- a/packages/tokenmanagement/src/v1/model.ts +++ b/packages/tokenmanagement/src/v1/model.ts @@ -6,21 +6,21 @@ export interface AdminTokenInfo { /** ID of the token. */ tokenId?: string | undefined; /** Timestamp when the token was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Timestamp when the token expires. */ - expiryTime?: number | undefined; + expiryTime?: bigint | undefined; /** Comment that describes the purpose of the token, specified by the token creator. */ comment?: string | undefined; /** User ID of the user that created the token. */ - createdById?: number | undefined; + createdById?: bigint | undefined; /** Username of the user that created the token. */ createdByUsername?: string | undefined; /** User ID of the user that owns the token. */ - ownerId?: number | undefined; + ownerId?: bigint | undefined; /** If applicable, the ID of the workspace that the token was created in. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** Approximate timestamp for the day the token was last used. Accurate up to 1 day. */ - lastUsedDay?: number | undefined; + lastUsedDay?: bigint | undefined; } /** Configuration details for creating on-behalf tokens. */ @@ -28,7 +28,7 @@ export interface CreateOnBehalfOfTokenRequest { /** Application ID of the service principal. */ applicationId?: string | undefined; /** The number of seconds before the token expires. */ - lifetimeSeconds?: number | undefined; + lifetimeSeconds?: bigint | undefined; /** Comment that describes the purpose of the token. */ comment?: string | undefined; scopes?: string[] | undefined; @@ -70,7 +70,7 @@ export interface GetTokenRequest_Response { */ export interface ListTokensRequest { /** User ID of the user that created the token. */ - createdById?: number | undefined; + createdById?: bigint | undefined; /** Username of the user that created the token. */ createdByUsername?: string | undefined; } @@ -94,14 +94,32 @@ export interface RevokeTokenRequest_Response {} export const unmarshalAdminTokenInfoSchema: z.ZodType = z .object({ token_id: z.string().optional(), - creation_time: z.number().optional(), - expiry_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + expiry_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), comment: z.string().optional(), - created_by_id: z.number().optional(), + created_by_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by_username: z.string().optional(), - owner_id: z.number().optional(), - workspace_id: z.number().optional(), - last_used_day: z.number().optional(), + owner_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_used_day: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ tokenId: d.token_id, @@ -156,7 +174,7 @@ export const unmarshalRevokeTokenRequest_ResponseSchema: z.ZodType(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/tokens/package.json b/packages/tokens/package.json index 4e1ad7f3..332684e7 100644 --- a/packages/tokens/package.json +++ b/packages/tokens/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/tokens/src/v1/client.ts b/packages/tokens/src/v1/client.ts index 21e0cb86..0db65b12 100644 --- a/packages/tokens/src/v1/client.ts +++ b/packages/tokens/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -66,7 +66,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/tokens/src/v1/model.ts b/packages/tokens/src/v1/model.ts index d370b78a..4c6947c7 100644 --- a/packages/tokens/src/v1/model.ts +++ b/packages/tokens/src/v1/model.ts @@ -10,7 +10,7 @@ export interface CreateTokenRequest { * * If the lifetime is not specified, this token remains valid for 2 years. */ - lifetimeSeconds?: number | undefined; + lifetimeSeconds?: bigint | undefined; /** Optional description to attach to the token. */ comment?: string | undefined; /** Optional scopes of the token. */ @@ -38,9 +38,9 @@ export interface PublicTokenInfo { /** The ID of this token. */ tokenId?: string | undefined; /** Server time (in epoch milliseconds) when the token was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; /** Server time (in epoch milliseconds) when the token will expire, or -1 if not applicable. */ - expiryTime?: number | undefined; + expiryTime?: bigint | undefined; /** Comment the token was created with, if applicable. */ comment?: string | undefined; } @@ -91,8 +91,14 @@ export const unmarshalListTokensRequest_ResponseSchema: z.ZodType = z .object({ token_id: z.string().optional(), - creation_time: z.number().optional(), - expiry_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + expiry_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), comment: z.string().optional(), }) .transform(d => ({ @@ -111,7 +117,7 @@ export const unmarshalUpdateTokenResponseSchema: z.ZodType export const marshalCreateTokenRequestSchema: z.ZodType = z .object({ - lifetimeSeconds: z.number().optional(), + lifetimeSeconds: z.bigint().optional(), comment: z.string().optional(), scopes: z.array(z.string()).optional(), }) @@ -124,8 +130,8 @@ export const marshalCreateTokenRequestSchema: z.ZodType = z export const marshalPublicTokenInfoSchema: z.ZodType = z .object({ tokenId: z.string().optional(), - creationTime: z.number().optional(), - expiryTime: z.number().optional(), + creationTime: z.bigint().optional(), + expiryTime: z.bigint().optional(), comment: z.string().optional(), }) .transform(d => ({ diff --git a/packages/tokens/src/v1/utils.ts b/packages/tokens/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/tokens/src/v1/utils.ts +++ b/packages/tokens/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/usagedashboards/package.json b/packages/usagedashboards/package.json index 83fc9ce5..d49e0351 100644 --- a/packages/usagedashboards/package.json +++ b/packages/usagedashboards/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/usagedashboards/src/v1/client.ts b/packages/usagedashboards/src/v1/client.ts index 802e77e8..68a39d47 100644 --- a/packages/usagedashboards/src/v1/client.ts +++ b/packages/usagedashboards/src/v1/client.ts @@ -31,7 +31,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -57,7 +57,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/usagedashboards/src/v1/model.ts b/packages/usagedashboards/src/v1/model.ts index 1a5bf4ec..792f8236 100644 --- a/packages/usagedashboards/src/v1/model.ts +++ b/packages/usagedashboards/src/v1/model.ts @@ -16,7 +16,7 @@ export enum UsageDashboardType { export interface CreateBillingUsageDashboardRequest { /** The workspace ID of the workspace in which the usage dashboard is created. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** account ID. */ accountId?: string | undefined; /** Workspace level usage dashboard shows usage data for the specified workspace ID. Global level usage dashboard shows usage data for all workspaces in the account. */ @@ -33,7 +33,7 @@ export interface CreateBillingUsageDashboardRequest_Response { export interface GetBillingUsageDashboardRequest { /** The workspace ID of the workspace in which the usage dashboard is created. */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** account ID. */ accountId?: string | undefined; /** Workspace level usage dashboard shows usage data for the specified workspace ID. Global level usage dashboard shows usage data for all workspaces in the account. */ @@ -72,7 +72,7 @@ export const unmarshalGetBillingUsageDashboardRequest_ResponseSchema: z.ZodType< export const marshalCreateBillingUsageDashboardRequestSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), accountId: z.string().optional(), dashboardType: z.enum(UsageDashboardType).optional(), majorVersion: z.enum(UsageDashboardMajorVersion).optional(), diff --git a/packages/usagedashboards/src/v1/utils.ts b/packages/usagedashboards/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/usagedashboards/src/v1/utils.ts +++ b/packages/usagedashboards/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/usagepolicy/package.json b/packages/usagepolicy/package.json index 77024dab..3d5c939e 100644 --- a/packages/usagepolicy/package.json +++ b/packages/usagepolicy/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/usagepolicy/src/v1/client.ts b/packages/usagepolicy/src/v1/client.ts index eb91d3b1..cc106625 100644 --- a/packages/usagepolicy/src/v1/client.ts +++ b/packages/usagepolicy/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/usagepolicy/src/v1/model.ts b/packages/usagepolicy/src/v1/model.ts index dbb33613..3b43ee79 100644 --- a/packages/usagepolicy/src/v1/model.ts +++ b/packages/usagepolicy/src/v1/model.ts @@ -54,7 +54,7 @@ export interface Filter { * The policy creator user id to be filtered on. * If unspecified, all policies will be returned. */ - creatorUserId?: number | undefined; + creatorUserId?: bigint | undefined; /** * The policy creator user name to be filtered on. * If unspecified, all policies will be returned. @@ -126,7 +126,7 @@ export interface UsagePolicy { /** A list of tags defined by the customer. At most 20 entries are allowed per policy. */ customTags?: CustomPolicyTag[] | undefined; /** List of workspaces that this usage policy will be exclusively bound to. */ - bindingWorkspaceIds?: number[] | undefined; + bindingWorkspaceIds?: bigint[] | undefined; } export const unmarshalCustomPolicyTagSchema: z.ZodType = z @@ -159,7 +159,9 @@ export const unmarshalUsagePolicySchema: z.ZodType = z custom_tags: z .array(z.lazy(() => unmarshalCustomPolicyTagSchema)) .optional(), - binding_workspace_ids: z.array(z.number()).optional(), + binding_workspace_ids: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ policyId: d.policy_id, @@ -193,7 +195,7 @@ export const marshalCustomPolicyTagSchema: z.ZodType = z export const marshalFilterSchema: z.ZodType = z .object({ policyName: z.string().optional(), - creatorUserId: z.number().optional(), + creatorUserId: z.bigint().optional(), creatorUserName: z.string().optional(), }) .transform(d => ({ @@ -219,7 +221,7 @@ export const marshalUsagePolicySchema: z.ZodType = z policyId: z.string().optional(), policyName: z.string().optional(), customTags: z.array(z.lazy(() => marshalCustomPolicyTagSchema)).optional(), - bindingWorkspaceIds: z.array(z.number()).optional(), + bindingWorkspaceIds: z.array(z.bigint()).optional(), }) .transform(d => ({ policy_id: d.policyId, diff --git a/packages/usagepolicy/src/v1/utils.ts b/packages/usagepolicy/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/usagepolicy/src/v1/utils.ts +++ b/packages/usagepolicy/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/vectorsearch/package.json b/packages/vectorsearch/package.json index e02fc558..4e4323bb 100644 --- a/packages/vectorsearch/package.json +++ b/packages/vectorsearch/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/vectorsearch/src/v1/client.ts b/packages/vectorsearch/src/v1/client.ts index 4a2142ea..eb765b34 100644 --- a/packages/vectorsearch/src/v1/client.ts +++ b/packages/vectorsearch/src/v1/client.ts @@ -84,7 +84,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -113,7 +113,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/vectorsearch/src/v1/model.ts b/packages/vectorsearch/src/v1/model.ts index 16496461..00285144 100644 --- a/packages/vectorsearch/src/v1/model.ts +++ b/packages/vectorsearch/src/v1/model.ts @@ -108,7 +108,7 @@ export interface CreateEndpointRequest { * The actual replica count is calculated at index creation/sync time based on this value. * Best-effort target; the system does not guarantee this QPS will be achieved. */ - targetQps?: number | undefined; + targetQps?: bigint | undefined; } export interface CreateVectorIndexRequest { @@ -278,9 +278,9 @@ export interface Endpoint { /** Creator of the endpoint */ creator?: string | undefined; /** Timestamp of endpoint creation */ - creationTimestamp?: number | undefined; + creationTimestamp?: bigint | undefined; /** Timestamp of last update to the endpoint */ - lastUpdatedTimestamp?: number | undefined; + lastUpdatedTimestamp?: bigint | undefined; /** Type of endpoint */ endpointType?: EndpointType | undefined; /** User who last updated the endpoint */ @@ -308,7 +308,7 @@ export interface EndpointScalingInfo { * The requested QPS target for the endpoint. Best-effort; the system does not * guarantee this QPS will be achieved. */ - requestedTargetQps?: number | undefined; + requestedTargetQps?: bigint | undefined; } /** Status information of an endpoint */ @@ -395,7 +395,7 @@ export interface MetricLabel { /** Single metric value at a specific timestamp */ export interface MetricValue { /** Timestamp of the metric value (milliseconds since epoch) */ - timestamp?: number | undefined; + timestamp?: bigint | undefined; /** Metric value */ value?: number | undefined; } @@ -453,7 +453,7 @@ export interface PatchEndpointRequest { * Target QPS for the endpoint. Best-effort; the system does not guarantee this QPS * will be achieved. */ - targetQps?: number | undefined; + targetQps?: bigint | undefined; } /** Request payload for getting next page of results. */ @@ -626,7 +626,7 @@ export interface UpsertDataVectorIndexResponse { export interface UpsertDeleteDataResult { /** Count of successfully processed rows. */ - successRowCount?: number | undefined; + successRowCount?: bigint | undefined; /** List of primary keys for rows that failed to process. */ failedPrimaryKeys?: string[] | undefined; } @@ -671,7 +671,7 @@ export interface VectorIndexStatus { /** Message associated with the index status */ message?: string | undefined; /** Number of rows indexed */ - indexedRowCount?: number | undefined; + indexedRowCount?: bigint | undefined; /** Whether the index is ready for search */ ready?: boolean | undefined; /** Index API Url to be used to perform operations on the index */ @@ -793,8 +793,14 @@ export const unmarshalEndpointSchema: z.ZodType = z .object({ name: z.string().optional(), creator: z.string().optional(), - creation_timestamp: z.number().optional(), - last_updated_timestamp: z.number().optional(), + creation_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + last_updated_timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), endpoint_type: z.enum(EndpointType).optional(), last_updated_user: z.string().optional(), id: z.string().optional(), @@ -825,7 +831,10 @@ export const unmarshalEndpointScalingInfoSchema: z.ZodType z .object({ state: z.enum(ScalingChangeState).optional(), - requested_target_qps: z.number().optional(), + requested_target_qps: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), }) .transform(d => ({ state: d.state, @@ -909,7 +918,10 @@ export const unmarshalMetricLabelSchema: z.ZodType = z export const unmarshalMetricValueSchema: z.ZodType = z .object({ - timestamp: z.number().optional(), + timestamp: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), value: z.number().optional(), }) .transform(d => ({ @@ -1071,7 +1083,10 @@ export const unmarshalUpsertDataVectorIndexResponseSchema: z.ZodType = z .object({ - success_row_count: z.number().optional(), + success_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), failed_primary_keys: z.array(z.string()).optional(), }) .transform(d => ({ @@ -1143,7 +1158,10 @@ export const unmarshalVectorIndexSchema: z.ZodType = z export const unmarshalVectorIndexStatusSchema: z.ZodType = z .object({ message: z.string().optional(), - indexed_row_count: z.number().optional(), + indexed_row_count: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), ready: z.boolean().optional(), index_url: z.string().optional(), }) @@ -1160,7 +1178,7 @@ export const marshalCreateEndpointRequestSchema: z.ZodType = z endpointType: z.enum(EndpointType).optional(), budgetPolicyId: z.string().optional(), usagePolicyId: z.string().optional(), - targetQps: z.number().optional(), + targetQps: z.bigint().optional(), }) .transform(d => ({ name: d.name, @@ -1327,7 +1345,7 @@ export const marshalPatchEndpointBudgetPolicyRequestSchema: z.ZodType = z export const marshalPatchEndpointRequestSchema: z.ZodType = z .object({ name: z.string().optional(), - targetQps: z.number().optional(), + targetQps: z.bigint().optional(), }) .transform(d => ({ name: d.name, diff --git a/packages/vectorsearch/src/v1/utils.ts b/packages/vectorsearch/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/vectorsearch/src/v1/utils.ts +++ b/packages/vectorsearch/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/volumes/package.json b/packages/volumes/package.json index daabab91..7adb21ca 100644 --- a/packages/volumes/package.json +++ b/packages/volumes/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/volumes/src/v1/client.ts b/packages/volumes/src/v1/client.ts index e05015dc..6ddfe493 100644 --- a/packages/volumes/src/v1/client.ts +++ b/packages/volumes/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -64,7 +64,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/volumes/src/v1/model.ts b/packages/volumes/src/v1/model.ts index 19e1c6e3..32347158 100644 --- a/packages/volumes/src/v1/model.ts +++ b/packages/volumes/src/v1/model.ts @@ -38,10 +38,10 @@ export interface CreateVolumeRequest { volumeId?: string | undefined; /** The unique identifier of the metastore */ metastoreId?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the volume */ createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the volume last time */ updatedBy?: string | undefined; /** The AWS access point to use when accesing s3 for this external location. */ @@ -150,10 +150,10 @@ export interface UpdateVolumeRequest { volumeId?: string | undefined; /** The unique identifier of the metastore */ metastoreId?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the volume */ createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the volume last time */ updatedBy?: string | undefined; /** The AWS access point to use when accesing s3 for this external location. */ @@ -188,10 +188,10 @@ export interface VolumeInfo { volumeId?: string | undefined; /** The unique identifier of the metastore */ metastoreId?: string | undefined; - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** The identifier of the user who created the volume */ createdBy?: string | undefined; - updatedAt?: number | undefined; + updatedAt?: bigint | undefined; /** The identifier of the user who updated the volume last time */ updatedBy?: string | undefined; /** The AWS access point to use when accesing s3 for this external location. */ @@ -256,9 +256,15 @@ export const unmarshalVolumeInfoSchema: z.ZodType = z full_name: z.string().optional(), volume_id: z.string().optional(), metastore_id: z.string().optional(), - created_at: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), created_by: z.string().optional(), - updated_at: z.number().optional(), + updated_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), updated_by: z.string().optional(), access_point: z.string().optional(), encryption_details: z @@ -298,9 +304,9 @@ export const marshalCreateVolumeRequestSchema: z.ZodType = z fullName: z.string().optional(), volumeId: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), accessPoint: z.string().optional(), encryptionDetails: z.lazy(() => marshalEncryptionDetailsSchema).optional(), @@ -367,9 +373,9 @@ export const marshalUpdateVolumeRequestSchema: z.ZodType = z fullName: z.string().optional(), volumeId: z.string().optional(), metastoreId: z.string().optional(), - createdAt: z.number().optional(), + createdAt: z.bigint().optional(), createdBy: z.string().optional(), - updatedAt: z.number().optional(), + updatedAt: z.bigint().optional(), updatedBy: z.string().optional(), accessPoint: z.string().optional(), encryptionDetails: z.lazy(() => marshalEncryptionDetailsSchema).optional(), diff --git a/packages/volumes/src/v1/utils.ts b/packages/volumes/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/volumes/src/v1/utils.ts +++ b/packages/volumes/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/warehouses/package.json b/packages/warehouses/package.json index e31270f1..2260fdaf 100644 --- a/packages/warehouses/package.json +++ b/packages/warehouses/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/warehouses/src/v1/client.ts b/packages/warehouses/src/v1/client.ts index cbdb1273..e846477d 100644 --- a/packages/warehouses/src/v1/client.ts +++ b/packages/warehouses/src/v1/client.ts @@ -69,7 +69,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -98,7 +98,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/warehouses/src/v1/model.ts b/packages/warehouses/src/v1/model.ts index 045312eb..68b06d0a 100644 --- a/packages/warehouses/src/v1/model.ts +++ b/packages/warehouses/src/v1/model.ts @@ -1074,7 +1074,7 @@ export interface EndpointInfo { /** current number of clusters running for the service */ numClusters?: number | undefined; /** Deprecated. current number of active sessions for the warehouse */ - numActiveSessions?: number | undefined; + numActiveSessions?: bigint | undefined; /** state of the endpoint */ state?: EndpointState | undefined; /** the jdbc connection string for this warehouse */ @@ -1209,7 +1209,7 @@ export interface GetWarehouseRequest_Response { /** current number of clusters running for the service */ numClusters?: number | undefined; /** Deprecated. current number of active sessions for the warehouse */ - numActiveSessions?: number | undefined; + numActiveSessions?: bigint | undefined; /** state of the endpoint */ state?: EndpointState | undefined; /** the jdbc connection string for this warehouse */ @@ -1435,7 +1435,7 @@ export interface ListWarehousesRequest { * Service Principal which will be used to fetch the list of endpoints. * If not specified, SQL Gateway will use the user from the session header. */ - runAsUserId?: number | undefined; + runAsUserId?: bigint | undefined; /** The max number of warehouses to return. */ pageSize?: number | undefined; /** @@ -1566,7 +1566,10 @@ export const unmarshalEndpointInfoSchema: z.ZodType = z enable_serverless_compute: z.boolean().optional(), warehouse_type: z.enum(WarehouseType).optional(), num_clusters: z.number().optional(), - num_active_sessions: z.number().optional(), + num_active_sessions: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), state: z.enum(EndpointState).optional(), jdbc_url: z.string().optional(), odbc_params: z.lazy(() => unmarshalOdbcParamsSchema).optional(), @@ -1634,7 +1637,10 @@ export const unmarshalGetWarehouseRequest_ResponseSchema: z.ZodType BigInt(v)) + .optional(), state: z.enum(EndpointState).optional(), jdbc_url: z.string().optional(), odbc_params: z.lazy(() => unmarshalOdbcParamsSchema).optional(), diff --git a/packages/warehouses/src/v1/utils.ts b/packages/warehouses/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/warehouses/src/v1/utils.ts +++ b/packages/warehouses/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/workspacebindings/package.json b/packages/workspacebindings/package.json index ef20e3c5..68c4adff 100644 --- a/packages/workspacebindings/package.json +++ b/packages/workspacebindings/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/workspacebindings/src/v1/client.ts b/packages/workspacebindings/src/v1/client.ts index c608eb8a..79d662ae 100644 --- a/packages/workspacebindings/src/v1/client.ts +++ b/packages/workspacebindings/src/v1/client.ts @@ -39,7 +39,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -66,7 +66,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/workspacebindings/src/v1/model.ts b/packages/workspacebindings/src/v1/model.ts index e6926d0e..6bd4b888 100644 --- a/packages/workspacebindings/src/v1/model.ts +++ b/packages/workspacebindings/src/v1/model.ts @@ -17,7 +17,7 @@ export interface GetCatalogWorkspaceBindingsRequest { // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface GetCatalogWorkspaceBindingsRequest_Response { /** A list of workspace IDs */ - workspaces?: number[] | undefined; + workspaces?: bigint[] | undefined; } export interface GetWorkspaceBindingsRequest { @@ -52,15 +52,15 @@ export interface UpdateCatalogWorkspaceBindingsRequest { /** The name of the catalog. */ catalogName?: string | undefined; /** A list of workspace IDs. */ - assignWorkspaces?: number[] | undefined; + assignWorkspaces?: bigint[] | undefined; /** A list of workspace IDs. */ - unassignWorkspaces?: number[] | undefined; + unassignWorkspaces?: bigint[] | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. export interface UpdateCatalogWorkspaceBindingsRequest_Response { /** A list of workspace IDs */ - workspaces?: number[] | undefined; + workspaces?: bigint[] | undefined; } export interface UpdateWorkspaceBindingsRequest { @@ -87,7 +87,7 @@ export interface UpdateWorkspaceBindingsRequest_Response { export interface WorkspaceBindingInfo { /** Required */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** One of READ_WRITE/READ_ONLY. Default is READ_WRITE. */ bindingType?: BindingType | undefined; } @@ -96,7 +96,9 @@ export interface WorkspaceBindingInfo { export const unmarshalGetCatalogWorkspaceBindingsRequest_ResponseSchema: z.ZodType = z .object({ - workspaces: z.array(z.number()).optional(), + workspaces: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ workspaces: d.workspaces, @@ -120,7 +122,9 @@ export const unmarshalGetWorkspaceBindingsRequest_ResponseSchema: z.ZodType = z .object({ - workspaces: z.array(z.number()).optional(), + workspaces: z + .array(z.union([z.number(), z.bigint()]).transform(v => BigInt(v))) + .optional(), }) .transform(d => ({ workspaces: d.workspaces, @@ -141,7 +145,10 @@ export const unmarshalUpdateWorkspaceBindingsRequest_ResponseSchema: z.ZodType = z .object({ - workspace_id: z.number().optional(), + workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), binding_type: z.enum(BindingType).optional(), }) .transform(d => ({ @@ -152,8 +159,8 @@ export const unmarshalWorkspaceBindingInfoSchema: z.ZodType ({ catalog_name: d.catalogName, @@ -177,7 +184,7 @@ export const marshalUpdateWorkspaceBindingsRequestSchema: z.ZodType = z export const marshalWorkspaceBindingInfoSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), bindingType: z.enum(BindingType).optional(), }) .transform(d => ({ diff --git a/packages/workspacebindings/src/v1/utils.ts b/packages/workspacebindings/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/workspacebindings/src/v1/utils.ts +++ b/packages/workspacebindings/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/workspaceobjects/package.json b/packages/workspaceobjects/package.json index f492a438..d92d9293 100644 --- a/packages/workspaceobjects/package.json +++ b/packages/workspaceobjects/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/workspaceobjects/src/v1/client.ts b/packages/workspaceobjects/src/v1/client.ts index fee6d0b1..f3e76be2 100644 --- a/packages/workspaceobjects/src/v1/client.ts +++ b/packages/workspaceobjects/src/v1/client.ts @@ -45,7 +45,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -72,7 +72,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); diff --git a/packages/workspaceobjects/src/v1/model.ts b/packages/workspaceobjects/src/v1/model.ts index 75d67864..e2470e30 100644 --- a/packages/workspaceobjects/src/v1/model.ts +++ b/packages/workspaceobjects/src/v1/model.ts @@ -150,7 +150,7 @@ export interface ListRequest { /** The absolute path of the notebook or directory. */ path?: string | undefined; /** UTC timestamp in milliseconds */ - notebooksModifiedAfter?: number | undefined; + notebooksModifiedAfter?: bigint | undefined; } // eslint-disable-next-line @typescript-eslint/naming-convention -- Proto-style nested message name. @@ -188,13 +188,13 @@ export interface ObjectInfo { /** The language of the object. This value is set only if the object type is ``NOTEBOOK``. For Jupyter (.ipynb) notebooks, this is always ``PYTHON``. */ language?: Language | undefined; /** Only applicable to files. The creation UTC timestamp. */ - createdAt?: number | undefined; + createdAt?: bigint | undefined; /** Only applicable to files, the last modified UTC timestamp. */ - modifiedAt?: number | undefined; + modifiedAt?: bigint | undefined; /** Unique identifier for the object. */ - objectId?: number | undefined; + objectId?: bigint | undefined; /** Only applicable to files. The file size in bytes can be returned. */ - size?: number | undefined; + size?: bigint | undefined; /** A unique identifier for the object that is consistent across all Databricks APIs. */ resourceId?: string | undefined; } @@ -241,10 +241,22 @@ export const unmarshalObjectInfoSchema: z.ZodType = z object_type: z.enum(ObjectType).optional(), path: z.string().optional(), language: z.enum(Language).optional(), - created_at: z.number().optional(), - modified_at: z.number().optional(), - object_id: z.number().optional(), - size: z.number().optional(), + created_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + modified_at: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + object_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), + size: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), resource_id: z.string().optional(), }) .transform(d => ({ diff --git a/packages/workspaceobjects/src/v1/utils.ts b/packages/workspaceobjects/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/workspaceobjects/src/v1/utils.ts +++ b/packages/workspaceobjects/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams( diff --git a/packages/workspaces/package.json b/packages/workspaces/package.json index 4585054b..84960df4 100644 --- a/packages/workspaces/package.json +++ b/packages/workspaces/package.json @@ -32,6 +32,7 @@ "@databricks/sdk-core": ">=0.1.0-dev.1 <1.0.0", "@databricks/sdk-options": ">=0.0.0 <1.0.0", "@js-temporal/polyfill": "^0.5.0", + "json-bigint": "^1.0.0", "zod": "^4.3.6" }, "engines": { diff --git a/packages/workspaces/src/v1/client.ts b/packages/workspaces/src/v1/client.ts index 9d7dc480..919d1b6e 100644 --- a/packages/workspaces/src/v1/client.ts +++ b/packages/workspaces/src/v1/client.ts @@ -37,7 +37,7 @@ import { // Package identity segment for this client to be used in the User-Agent header. const PACKAGE_SEGMENT = { - key: pkgJson.name.replace(/^@[^/]+\//, ''), + key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''), value: pkgJson.version, }; @@ -65,7 +65,7 @@ export class Client { let info = createDefault().with(PACKAGE_SEGMENT); if (options.credentials !== undefined) { info = info - .with({key: 'sdk-auth', value: AUTH_VERSION}) + .with({key: 'sdk-js-auth', value: AUTH_VERSION}) .with({key: 'auth', value: options.credentials.name()}); } this.userAgent = info.toString(); @@ -264,7 +264,7 @@ export class Client { export class CreateWorkspacePublicWaiter { constructor( private readonly client: Client, - readonly workspaceId: number + readonly workspaceId: bigint ) {} /** @@ -344,7 +344,7 @@ export class CreateWorkspacePublicWaiter { export class UpdateWorkspacePublicWaiter { constructor( private readonly client: Client, - readonly workspaceId: number + readonly workspaceId: bigint ) {} /** diff --git a/packages/workspaces/src/v1/model.ts b/packages/workspaces/src/v1/model.ts index 5ec4c5bb..c027c6a4 100644 --- a/packages/workspaces/src/v1/model.ts +++ b/packages/workspaces/src/v1/model.ts @@ -181,7 +181,7 @@ export interface CreateWorkspaceRequest_CustomTagsEntry { } export interface DeleteWorkspaceRequest { - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; accountId?: string | undefined; } @@ -218,7 +218,7 @@ export interface GcpManagedNetworkConfig { } export interface GetWorkspaceRequest { - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; accountId?: string | undefined; } @@ -248,12 +248,12 @@ export interface UpdateWorkspaceRequest { export interface Workspace { /** A unique integer ID for the workspace */ - workspaceId?: number | undefined; + workspaceId?: bigint | undefined; /** The human-readable name of the workspace. */ workspaceName?: string | undefined; awsRegion?: string | undefined; /** Time in epoch milliseconds when the workspace was created. */ - creationTime?: number | undefined; + creationTime?: bigint | undefined; deploymentName?: string | undefined; /** The status of a workspace */ workspaceStatus?: WorkspaceStatus | undefined; @@ -427,10 +427,16 @@ export const unmarshalGkeConfigSchema: z.ZodType = z export const unmarshalWorkspaceSchema: z.ZodType = z .object({ - workspace_id: z.number().optional(), + workspace_id: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), workspace_name: z.string().optional(), aws_region: z.string().optional(), - creation_time: z.number().optional(), + creation_time: z + .union([z.number(), z.bigint()]) + .transform(v => BigInt(v)) + .optional(), deployment_name: z.string().optional(), workspace_status: z.enum(WorkspaceStatus).optional(), account_id: z.string().optional(), @@ -640,10 +646,10 @@ export const marshalGkeConfigSchema: z.ZodType = z export const marshalWorkspaceSchema: z.ZodType = z .object({ - workspaceId: z.number().optional(), + workspaceId: z.bigint().optional(), workspaceName: z.string().optional(), awsRegion: z.string().optional(), - creationTime: z.number().optional(), + creationTime: z.bigint().optional(), deploymentName: z.string().optional(), workspaceStatus: z.enum(WorkspaceStatus).optional(), accountId: z.string().optional(), diff --git a/packages/workspaces/src/v1/utils.ts b/packages/workspaces/src/v1/utils.ts index fe4fd3c5..a84cc772 100644 --- a/packages/workspaces/src/v1/utils.ts +++ b/packages/workspaces/src/v1/utils.ts @@ -10,8 +10,14 @@ import type { } from '@databricks/sdk-core/http'; import type {Logger} from '@databricks/sdk-core/logger'; import type {CallOptions} from '@databricks/sdk-options/call'; +import JSONBig from 'json-bigint'; import type {z} from 'zod'; +// JSON codec that preserves int64 precision. On the way in, large integer +// literals come back as bigint instead of being rounded to JS Number. On the +// way out, bigint values are emitted as raw JSON number digits. +const jsonBigint = JSONBig({useNativeBigInt: true}); + export interface HttpCallOptions { readonly request: HttpRequest; readonly httpClient: HttpClient; @@ -112,12 +118,12 @@ export function buildHttpRequest( export function parseResponse(body: Uint8Array, schema: z.ZodType): T { const text = new TextDecoder().decode(body); - const parsed: unknown = JSON.parse(text); + const parsed: unknown = jsonBigint.parse(text); return schema.parse(parsed); } export function marshalRequest(data: unknown, schema: z.ZodType): string { - return JSON.stringify(schema.parse(data)); + return jsonBigint.stringify(schema.parse(data)); } export function flattenQueryParams(