@databricks/sdk-uc-grants 0.34.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/v1/model.js CHANGED
@@ -1,111 +1,79 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { z } from 'zod';
3
- export const unmarshalEffectivePrivilegeSchema = z
4
- .object({
5
- privilege: z.string().optional(),
6
- inherited_from_type: z.string().optional(),
7
- inherited_from_name: z.string().optional(),
8
- })
9
- .transform(d => ({
10
- privilege: d.privilege,
11
- inheritedFromType: d.inherited_from_type,
12
- inheritedFromName: d.inherited_from_name,
1
+ import { z } from "zod";
2
+
3
+ //#region src/v1/model.ts
4
+ const unmarshalEffectivePrivilegeSchema = z.object({
5
+ privilege: z.string().optional(),
6
+ inherited_from_type: z.string().optional(),
7
+ inherited_from_name: z.string().optional()
8
+ }).transform((d) => ({
9
+ privilege: d.privilege,
10
+ inheritedFromType: d.inherited_from_type,
11
+ inheritedFromName: d.inherited_from_name
13
12
  }));
14
- export const unmarshalEffectivePrivilegeAssignmentSchema = z
15
- .object({
16
- principal: z.string().optional(),
17
- privileges: z
18
- .array(z.lazy(() => unmarshalEffectivePrivilegeSchema))
19
- .optional(),
20
- })
21
- .transform(d => ({
22
- principal: d.principal,
23
- privileges: d.privileges,
13
+ const unmarshalEffectivePrivilegeAssignmentSchema = z.object({
14
+ principal: z.string().optional(),
15
+ privileges: z.array(z.lazy(() => unmarshalEffectivePrivilegeSchema)).optional()
16
+ }).transform((d) => ({
17
+ principal: d.principal,
18
+ privileges: d.privileges
24
19
  }));
25
- export const unmarshalGetEffectivePermissionsResponseSchema = z
26
- .object({
27
- next_page_token: z.string().optional(),
28
- privilege_assignments: z
29
- .array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema))
30
- .optional(),
31
- })
32
- .transform(d => ({
33
- nextPageToken: d.next_page_token,
34
- privilegeAssignments: d.privilege_assignments,
20
+ const unmarshalGetEffectivePermissionsResponseSchema = z.object({
21
+ next_page_token: z.string().optional(),
22
+ privilege_assignments: z.array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema)).optional()
23
+ }).transform((d) => ({
24
+ nextPageToken: d.next_page_token,
25
+ privilegeAssignments: d.privilege_assignments
35
26
  }));
36
- export const unmarshalGetPermissionsResponseSchema = z
37
- .object({
38
- next_page_token: z.string().optional(),
39
- privilege_assignments: z
40
- .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
41
- .optional(),
42
- })
43
- .transform(d => ({
44
- nextPageToken: d.next_page_token,
45
- privilegeAssignments: d.privilege_assignments,
27
+ const unmarshalGetPermissionsResponseSchema = z.object({
28
+ next_page_token: z.string().optional(),
29
+ privilege_assignments: z.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema)).optional()
30
+ }).transform((d) => ({
31
+ nextPageToken: d.next_page_token,
32
+ privilegeAssignments: d.privilege_assignments
46
33
  }));
47
- export const unmarshalListEffectivePrivilegeAssignmentsResponseSchema = z
48
- .object({
49
- effective_privilege_assignments: z
50
- .array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema))
51
- .optional(),
52
- next_page_token: z.string().optional(),
53
- })
54
- .transform(d => ({
55
- effectivePrivilegeAssignments: d.effective_privilege_assignments,
56
- nextPageToken: d.next_page_token,
34
+ const unmarshalListEffectivePrivilegeAssignmentsResponseSchema = z.object({
35
+ effective_privilege_assignments: z.array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema)).optional(),
36
+ next_page_token: z.string().optional()
37
+ }).transform((d) => ({
38
+ effectivePrivilegeAssignments: d.effective_privilege_assignments,
39
+ nextPageToken: d.next_page_token
57
40
  }));
58
- export const unmarshalListPrivilegeAssignmentsResponseSchema = z
59
- .object({
60
- privilege_assignments: z
61
- .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
62
- .optional(),
63
- next_page_token: z.string().optional(),
64
- })
65
- .transform(d => ({
66
- privilegeAssignments: d.privilege_assignments,
67
- nextPageToken: d.next_page_token,
41
+ const unmarshalListPrivilegeAssignmentsResponseSchema = z.object({
42
+ privilege_assignments: z.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema)).optional(),
43
+ next_page_token: z.string().optional()
44
+ }).transform((d) => ({
45
+ privilegeAssignments: d.privilege_assignments,
46
+ nextPageToken: d.next_page_token
68
47
  }));
69
- export const unmarshalPrivilegeAssignmentSchema = z
70
- .object({
71
- principal: z.string().optional(),
72
- privileges: z.array(z.string()).optional(),
73
- })
74
- .transform(d => ({
75
- principal: d.principal,
76
- privileges: d.privileges,
48
+ const unmarshalPrivilegeAssignmentSchema = z.object({
49
+ principal: z.string().optional(),
50
+ privileges: z.array(z.string()).optional()
51
+ }).transform((d) => ({
52
+ principal: d.principal,
53
+ privileges: d.privileges
77
54
  }));
78
- export const unmarshalUpdatePermissionsResponseSchema = z
79
- .object({
80
- privilege_assignments: z
81
- .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))
82
- .optional(),
83
- })
84
- .transform(d => ({
85
- privilegeAssignments: d.privilege_assignments,
55
+ const unmarshalUpdatePermissionsResponseSchema = z.object({ privilege_assignments: z.array(z.lazy(() => unmarshalPrivilegeAssignmentSchema)).optional() }).transform((d) => ({ privilegeAssignments: d.privilege_assignments }));
56
+ const marshalPermissionsChangeSchema = z.object({
57
+ principal: z.string().optional(),
58
+ add: z.array(z.string()).optional(),
59
+ remove: z.array(z.string()).optional()
60
+ }).transform((d) => ({
61
+ principal: d.principal,
62
+ add: d.add,
63
+ remove: d.remove
86
64
  }));
87
- export const marshalPermissionsChangeSchema = z
88
- .object({
89
- principal: z.string().optional(),
90
- add: z.array(z.string()).optional(),
91
- remove: z.array(z.string()).optional(),
92
- })
93
- .transform(d => ({
94
- principal: d.principal,
95
- add: d.add,
96
- remove: d.remove,
97
- }));
98
- export const marshalUpdatePermissionsRequestSchema = z
99
- .object({
100
- securableType: z.string().optional(),
101
- securableFullName: z.string().optional(),
102
- omitPermissionsInResponse: z.boolean().optional(),
103
- changes: z.array(z.lazy(() => marshalPermissionsChangeSchema)).optional(),
104
- })
105
- .transform(d => ({
106
- securable_type: d.securableType,
107
- securable_full_name: d.securableFullName,
108
- omit_permissions_in_response: d.omitPermissionsInResponse,
109
- changes: d.changes,
65
+ const marshalUpdatePermissionsRequestSchema = z.object({
66
+ securableType: z.string().optional(),
67
+ securableFullName: z.string().optional(),
68
+ omitPermissionsInResponse: z.boolean().optional(),
69
+ changes: z.array(z.lazy(() => marshalPermissionsChangeSchema)).optional()
70
+ }).transform((d) => ({
71
+ securable_type: d.securableType,
72
+ securable_full_name: d.securableFullName,
73
+ omit_permissions_in_response: d.omitPermissionsInResponse,
74
+ changes: d.changes
110
75
  }));
76
+
77
+ //#endregion
78
+ export { marshalPermissionsChangeSchema, marshalUpdatePermissionsRequestSchema, unmarshalEffectivePrivilegeAssignmentSchema, unmarshalEffectivePrivilegeSchema, unmarshalGetEffectivePermissionsResponseSchema, unmarshalGetPermissionsResponseSchema, unmarshalListEffectivePrivilegeAssignmentsResponseSchema, unmarshalListPrivilegeAssignmentsResponseSchema, unmarshalPrivilegeAssignmentSchema, unmarshalUpdatePermissionsResponseSchema };
111
79
  //# sourceMappingURL=model.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/v1/model.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAE/E,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAyMtB,MAAM,CAAC,MAAM,iCAAiC,GAC5C,CAAC;KACE,MAAM,CAAC;IACN,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,SAAS,EAAE,C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AC;KACD,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,cAAc,EAAE,CAAC,CAAC,aAAa;IAC/B,mBAAmB,EAAE,CAAC,CAAC,iBAAiB;IACxC,4BAA4B,EAAE,CAAC,CAAC,yBAAyB;IACzD,OAAO,EAAE,CAAC,CAAC,OAAO;CACnB,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"model.js","names":[],"sources":["../../src/v1/model.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport {z} from 'zod';\n\nexport interface EffectivePrivilege {\n /** The privilege assigned to the principal. */\n privilege?: string | undefined;\n /**\n * The type of the object that conveys this privilege via inheritance.\n * This field is omitted when privilege is not inherited (it's assigned to the securable itself).\n */\n inheritedFromType?: string | undefined;\n /**\n * The full name of the object that conveys this privilege via inheritance.\n * This field is omitted when privilege is not inherited (it's assigned to the securable itself).\n */\n inheritedFromName?: string | undefined;\n}\n\nexport interface EffectivePrivilegeAssignment {\n /** The principal (user email address or group name). */\n principal?: string | undefined;\n /** The privileges conveyed to the principal (either directly or via inheritance). */\n privileges?: EffectivePrivilege[] | undefined;\n}\n\nexport interface GetEffectivePermissionsRequest {\n /** Type of securable. */\n securableType?: string | undefined;\n /** Full name of securable. */\n securableFullName?: string | undefined;\n /** If provided, only the effective permissions for the specified principal (user or group) are returned. */\n principal?: string | undefined;\n /**\n * Specifies the maximum number of privileges to return (page length).\n * Every EffectivePrivilegeAssignment present in a single page response is guaranteed to contain all the effective\n * privileges granted on (or inherited by) the requested Securable for the respective principal.\n *\n * If not set, all the effective permissions are returned.\n * If set to\n * - lesser than 0: invalid parameter error\n * - 0: page length is set to a server configured value\n * - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at\n * least one complete EffectivePrivilegeAssignment in a single page response)\n * - greater than (or equal to) 150: page length is the minimum of this value and a server configured value\n */\n maxResults?: number | undefined;\n /** Opaque token for the next page of results (pagination). */\n pageToken?: string | undefined;\n}\n\nexport interface GetEffectivePermissionsResponse {\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * __page_token__ should be set to this value for the next request (for the next page of results).\n */\n nextPageToken?: string | undefined;\n /** The privileges conveyed to each principal (either directly or via inheritance) */\n privilegeAssignments?: EffectivePrivilegeAssignment[] | undefined;\n}\n\nexport interface GetPermissionsRequest {\n /** Type of securable. */\n securableType?: string | undefined;\n /** Full name of securable. */\n securableFullName?: string | undefined;\n /** If provided, only the permissions for the specified principal (user or group) are returned. */\n principal?: string | undefined;\n /**\n * Specifies the maximum number of privileges to return (page length).\n * Every PrivilegeAssignment present in a single page response is guaranteed to contain all the privileges granted on\n * the requested Securable for the respective principal.\n *\n * If not set, all the permissions are returned.\n * If set to\n * - lesser than 0: invalid parameter error\n * - 0: page length is set to a server configured value\n * - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at\n * least one complete PrivilegeAssignment in a single page response)\n * - greater than (or equal to) 150: page length is the minimum of this value and a server configured value\n */\n maxResults?: number | undefined;\n /** Opaque pagination token to go to next page based on previous query. */\n pageToken?: string | undefined;\n}\n\nexport interface GetPermissionsResponse {\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * __page_token__ should be set to this value for the next request (for the next page of results).\n */\n nextPageToken?: string | undefined;\n /** The privileges assigned to each principal */\n privilegeAssignments?: PrivilegeAssignment[] | undefined;\n}\n\nexport interface ListEffectivePrivilegeAssignmentsRequest {\n /** Type of securable. */\n securableType?: string | undefined;\n /** Full name of securable. */\n fullName?: string | undefined;\n /** If provided, only the effective permissions for the specified principal (user or group) are returned. */\n principal?: string | undefined;\n /**\n * Specifies the maximum number of privilege assignments to return (page length).\n * Every EffectivePrivilegeAssignment present in a single page response is guaranteed to contain all the effective\n * privileges granted on (or inherited by) the requested Securable for the respective principal.\n *\n * If not set, a server-configured default is used.\n * If set to\n * - lesser than 0: invalid parameter error\n * - 0: page length is set to a server configured value\n * - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at\n * least one complete EffectivePrivilegeAssignment in a single page response)\n * - greater than (or equal to) 150: page length is the minimum of this value and a server configured value\n */\n pageSize?: number | undefined;\n /** Opaque pagination token to go to next page based on previous query. */\n pageToken?: string | undefined;\n}\n\nexport interface ListEffectivePrivilegeAssignmentsResponse {\n /** The effective privilege assignments for the securable (and optional principal). */\n effectivePrivilegeAssignments?: EffectivePrivilegeAssignment[] | undefined;\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * __page_token__ should be set to this value for the next request (for the next page of results).\n */\n nextPageToken?: string | undefined;\n}\n\nexport interface ListPrivilegeAssignmentsRequest {\n /** Type of securable. */\n securableType?: string | undefined;\n /** Full name of securable. */\n fullName?: string | undefined;\n /** If provided, only the permissions for the specified principal (user or group) are returned. */\n principal?: string | undefined;\n /**\n * Specifies the maximum number of privilege assignments to return (page length).\n * Every PrivilegeAssignment present in a single page response is guaranteed to contain all the privileges granted on\n * the requested Securable for the respective principal.\n *\n * If not set, page length is the server configured value.\n * If set to\n * - lesser than 0: invalid parameter error\n * - 0: page length is set to a server configured value\n * - lesser than 150 but greater than 0: invalid parameter error (this is to ensure that server is able to return at\n * least one complete PrivilegeAssignment in a single page response)\n * - greater than (or equal to) 150: page length is the minimum of this value and a server configured value\n */\n pageSize?: number | undefined;\n /** Opaque pagination token to go to next page based on previous query. */\n pageToken?: string | undefined;\n}\n\nexport interface ListPrivilegeAssignmentsResponse {\n privilegeAssignments?: PrivilegeAssignment[] | undefined;\n /**\n * Opaque token to retrieve the next page of results. Absent if there are no more pages.\n * __page_token__ should be set to this value for the next request (for the next page of results).\n */\n nextPageToken?: string | undefined;\n}\n\nexport interface PermissionsChange {\n /**\n * The principal whose privileges we are changing.\n * Only one of principal or principal_id should be specified, never both at the same time.\n */\n principal?: string | undefined;\n /** The set of privileges to add. */\n add?: string[] | undefined;\n /** The set of privileges to remove. */\n remove?: string[] | undefined;\n}\n\nexport interface PrivilegeAssignment {\n /**\n * The principal (user email address or group name).\n * For deleted principals, `principal` is empty while `principal_id` is populated.\n */\n principal?: string | undefined;\n /** The privileges assigned to the principal. */\n privileges?: string[] | undefined;\n}\n\nexport interface UpdatePermissionsRequest {\n /** Type of securable. */\n securableType?: string | undefined;\n /** Full name of securable. */\n securableFullName?: string | undefined;\n /** Optional, default false. Specifies whether all the permissions should be returned in the response. */\n omitPermissionsInResponse?: boolean | undefined;\n /** Array of permissions change objects. */\n changes?: PermissionsChange[] | undefined;\n}\n\nexport interface UpdatePermissionsResponse {\n /** The privileges assigned to each principal */\n privilegeAssignments?: PrivilegeAssignment[] | undefined;\n}\n\nexport const unmarshalEffectivePrivilegeSchema: z.ZodType<EffectivePrivilege> =\n z\n .object({\n privilege: z.string().optional(),\n inherited_from_type: z.string().optional(),\n inherited_from_name: z.string().optional(),\n })\n .transform(d => ({\n privilege: d.privilege,\n inheritedFromType: d.inherited_from_type,\n inheritedFromName: d.inherited_from_name,\n }));\n\nexport const unmarshalEffectivePrivilegeAssignmentSchema: z.ZodType<EffectivePrivilegeAssignment> =\n z\n .object({\n principal: z.string().optional(),\n privileges: z\n .array(z.lazy(() => unmarshalEffectivePrivilegeSchema))\n .optional(),\n })\n .transform(d => ({\n principal: d.principal,\n privileges: d.privileges,\n }));\n\nexport const unmarshalGetEffectivePermissionsResponseSchema: z.ZodType<GetEffectivePermissionsResponse> =\n z\n .object({\n next_page_token: z.string().optional(),\n privilege_assignments: z\n .array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema))\n .optional(),\n })\n .transform(d => ({\n nextPageToken: d.next_page_token,\n privilegeAssignments: d.privilege_assignments,\n }));\n\nexport const unmarshalGetPermissionsResponseSchema: z.ZodType<GetPermissionsResponse> =\n z\n .object({\n next_page_token: z.string().optional(),\n privilege_assignments: z\n .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))\n .optional(),\n })\n .transform(d => ({\n nextPageToken: d.next_page_token,\n privilegeAssignments: d.privilege_assignments,\n }));\n\nexport const unmarshalListEffectivePrivilegeAssignmentsResponseSchema: z.ZodType<ListEffectivePrivilegeAssignmentsResponse> =\n z\n .object({\n effective_privilege_assignments: z\n .array(z.lazy(() => unmarshalEffectivePrivilegeAssignmentSchema))\n .optional(),\n next_page_token: z.string().optional(),\n })\n .transform(d => ({\n effectivePrivilegeAssignments: d.effective_privilege_assignments,\n nextPageToken: d.next_page_token,\n }));\n\nexport const unmarshalListPrivilegeAssignmentsResponseSchema: z.ZodType<ListPrivilegeAssignmentsResponse> =\n z\n .object({\n privilege_assignments: z\n .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))\n .optional(),\n next_page_token: z.string().optional(),\n })\n .transform(d => ({\n privilegeAssignments: d.privilege_assignments,\n nextPageToken: d.next_page_token,\n }));\n\nexport const unmarshalPrivilegeAssignmentSchema: z.ZodType<PrivilegeAssignment> =\n z\n .object({\n principal: z.string().optional(),\n privileges: z.array(z.string()).optional(),\n })\n .transform(d => ({\n principal: d.principal,\n privileges: d.privileges,\n }));\n\nexport const unmarshalUpdatePermissionsResponseSchema: z.ZodType<UpdatePermissionsResponse> =\n z\n .object({\n privilege_assignments: z\n .array(z.lazy(() => unmarshalPrivilegeAssignmentSchema))\n .optional(),\n })\n .transform(d => ({\n privilegeAssignments: d.privilege_assignments,\n }));\n\nexport const marshalPermissionsChangeSchema: z.ZodType = z\n .object({\n principal: z.string().optional(),\n add: z.array(z.string()).optional(),\n remove: z.array(z.string()).optional(),\n })\n .transform(d => ({\n principal: d.principal,\n add: d.add,\n remove: d.remove,\n }));\n\nexport const marshalUpdatePermissionsRequestSchema: z.ZodType = z\n .object({\n securableType: z.string().optional(),\n securableFullName: z.string().optional(),\n omitPermissionsInResponse: z.boolean().optional(),\n changes: z.array(z.lazy(() => marshalPermissionsChangeSchema)).optional(),\n })\n .transform(d => ({\n securable_type: d.securableType,\n securable_full_name: d.securableFullName,\n omit_permissions_in_response: d.omitPermissionsInResponse,\n changes: d.changes,\n }));\n"],"mappings":";;;AA2MA,MAAa,oCACX,EACG,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B,eAAe,EAAE;CAClB,EAAE;AAEP,MAAa,qCACX,EACG,OAAO;CACN,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,YAAY,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CAC3C,CAAC,CACD,WAAU,OAAM;CACf,WAAW,EAAE;CACb,YAAY,EAAE;CACf,EAAE;AAEP,MAAa,2CACX,EACG,OAAO,EACN,uBAAuB,EACpB,MAAM,EAAE,WAAW,mCAAmC,CAAC,CACvD,UAAU,EACd,CAAC,CACD,WAAU,OAAM,EACf,sBAAsB,EAAE,uBACzB,EAAE;AAEP,MAAa,iCAA4C,EACtD,OAAO;CACN,WAAW,EAAE,QAAQ,CAAC,UAAU;CAChC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACnC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;CACvC,CAAC,CACD,WAAU,OAAM;CACf,WAAW,EAAE;CACb,KAAK,EAAE;CACP,QAAQ,EAAE;CACX,EAAE;AAEL,MAAa,wCAAmD,EAC7D,OAAO;CACN,eAAe,EAAE,QAAQ,CAAC,UAAU;CACpC,mBAAmB,EAAE,QAAQ,CAAC,UAAU;CACxC,2BAA2B,EAAE,SAAS,CAAC,UAAU;CACjD,SAAS,EAAE,MAAM,EAAE,WAAW,+BAA+B,CAAC,CAAC,UAAU;CAC1E,CAAC,CACD,WAAU,OAAM;CACf,gBAAgB,EAAE;CAClB,qBAAqB,EAAE;CACvB,8BAA8B,EAAE;CAChC,SAAS,EAAE;CACZ,EAAE"}
@@ -1,23 +1,25 @@
1
- import type { HttpClient } from '@databricks/sdk-core/http';
2
- import type { ClientOptions } from '@databricks/sdk-options/client';
1
+ import { HttpClient } from "@databricks/sdk-core/http";
2
+ import { ClientOptions } from "@databricks/sdk-options/client";
3
+
4
+ //#region src/v1/transport.d.ts
3
5
  /**
4
6
  * The configuration a client needs to issue requests, resolved from
5
7
  * {@link ClientOptions} and a configuration profile.
6
8
  */
7
- export interface ResolvedClientConfig {
8
- /** Host with any trailing slash removed. */
9
- host: string;
10
- /**
11
- * Default account ID for account-level paths that contain an account_id
12
- * segment. A request's own accountId still wins.
13
- */
14
- accountId?: string;
15
- /**
16
- * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
17
- */
18
- workspaceId?: string;
19
- /** HTTP client with authentication, and any configured timeout, applied. */
20
- httpClient: HttpClient;
9
+ interface ResolvedClientConfig {
10
+ /** Host with any trailing slash removed. */
11
+ host: string;
12
+ /**
13
+ * Default account ID for account-level paths that contain an account_id
14
+ * segment. A request's own accountId still wins.
15
+ */
16
+ accountId?: string;
17
+ /**
18
+ * Workspace ID used to route workspace-level calls on unified hosts (SPOG).
19
+ */
20
+ workspaceId?: string;
21
+ /** HTTP client with authentication, and any configured timeout, applied. */
22
+ httpClient: HttpClient;
21
23
  }
22
24
  /**
23
25
  * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
@@ -29,5 +31,7 @@ export interface ResolvedClientConfig {
29
31
  *
30
32
  * @throws if host is neither provided nor present in the resolved profile.
31
33
  */
32
- export declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
34
+ declare function resolveClientConfig(options: ClientOptions): Promise<ResolvedClientConfig>;
35
+ //#endregion
36
+ export { ResolvedClientConfig, resolveClientConfig };
33
37
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,gCAAgC,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,4EAA4E;IAC5E,UAAU,EAAE,UAAU,CAAC;CACxB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,oBAAoB,CAAC,CA4B/B"}
1
+ {"version":3,"file":"transport.d.ts","names":[],"sources":["../../src/v1/transport.ts"],"mappings":";;;;;;AAkBA;;UAAiB,oBAAA;EAgBO;EAdtB,IAAA;EAMA;;;;EAAA,SAAA;EAQsB;AAaxB;;EAhBE,WAAA;EAiBS;EAdT,UAAA,EAAY,UAAA;AAAA;;;;;;;;;;;iBAaQ,mBAAA,CACpB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,oBAAA"}
@@ -1,74 +1,65 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { defaultCredentials } from '@databricks/sdk-auth/credentials';
3
- import { newFetchHttpClient } from '@databricks/sdk-core/http';
4
- import { resolve } from '@databricks/sdk-core/profiles';
1
+ import { defaultCredentials } from "@databricks/sdk-auth/credentials";
2
+ import { newFetchHttpClient } from "@databricks/sdk-core/http";
3
+ import { resolve } from "@databricks/sdk-core/profiles";
4
+
5
+ //#region src/v1/transport.ts
5
6
  /**
6
- * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
7
- *
8
- * A configuration profile is always resolved from the config file and
9
- * environment variables (per options.profileOptions); it supplies host,
10
- * accountId, workspaceId, and credentials wherever the caller did not set them
11
- * explicitly. Explicit options always take precedence.
12
- *
13
- * @throws if host is neither provided nor present in the resolved profile.
14
- */
15
- export async function resolveClientConfig(options) {
16
- const profile = await resolve(options.profileOptions);
17
- const host = options.host ?? profile.host;
18
- if (host === undefined) {
19
- throw new Error('Host is required.');
20
- }
21
- // The provided httpClient (or the default fetch client) is the base wire;
22
- // authentication and the optional timeout are layered on top of it. The
23
- // default credential chain reuses the profile resolved above so that the
24
- // same profileOptions govern host and authentication alike.
25
- const base = options.httpClient ?? newFetchHttpClient();
26
- const credentials = options.credentials ?? defaultCredentials({ profile });
27
- let httpClient = new AuthHttpClient(base, credentials);
28
- if (options.timeout !== undefined) {
29
- httpClient = new TimeoutHttpClient(httpClient, options.timeout);
30
- }
31
- const accountId = options.accountId ?? profile.accountId;
32
- const workspaceId = options.workspaceId ?? profile.workspaceId;
33
- return {
34
- host: host.replace(/\/$/, ''),
35
- httpClient,
36
- ...(accountId !== undefined && { accountId }),
37
- ...(workspaceId !== undefined && { workspaceId }),
38
- };
7
+ * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.
8
+ *
9
+ * A configuration profile is always resolved from the config file and
10
+ * environment variables (per options.profileOptions); it supplies host,
11
+ * accountId, workspaceId, and credentials wherever the caller did not set them
12
+ * explicitly. Explicit options always take precedence.
13
+ *
14
+ * @throws if host is neither provided nor present in the resolved profile.
15
+ */
16
+ async function resolveClientConfig(options) {
17
+ const profile = await resolve(options.profileOptions);
18
+ const host = options.host ?? profile.host;
19
+ if (host === void 0) throw new Error("Host is required.");
20
+ let httpClient = new AuthHttpClient(options.httpClient ?? newFetchHttpClient(), options.credentials ?? defaultCredentials({ profile }));
21
+ if (options.timeout !== void 0) httpClient = new TimeoutHttpClient(httpClient, options.timeout);
22
+ const accountId = options.accountId ?? profile.accountId;
23
+ const workspaceId = options.workspaceId ?? profile.workspaceId;
24
+ return {
25
+ host: host.replace(/\/$/, ""),
26
+ httpClient,
27
+ ...accountId !== void 0 && { accountId },
28
+ ...workspaceId !== void 0 && { workspaceId }
29
+ };
39
30
  }
40
31
  /** Wraps an HttpClient and adds authentication headers to requests. */
41
- class AuthHttpClient {
42
- base;
43
- credentials;
44
- constructor(base, credentials) {
45
- this.base = base;
46
- this.credentials = credentials;
47
- }
48
- async send(request) {
49
- const authHeaders = await this.credentials.authHeaders();
50
- // Do not modify the original request.
51
- const headers = new Headers(request.headers);
52
- for (const h of authHeaders) {
53
- headers.set(h.key, h.value);
54
- }
55
- return this.base.send({ ...request, headers });
56
- }
57
- }
32
+ var AuthHttpClient = class {
33
+ constructor(base, credentials) {
34
+ this.base = base;
35
+ this.credentials = credentials;
36
+ }
37
+ async send(request) {
38
+ const authHeaders = await this.credentials.authHeaders();
39
+ const headers = new Headers(request.headers);
40
+ for (const h of authHeaders) headers.set(h.key, h.value);
41
+ return this.base.send({
42
+ ...request,
43
+ headers
44
+ });
45
+ }
46
+ };
58
47
  /** Wraps an HttpClient and applies a default timeout to requests. */
59
- class TimeoutHttpClient {
60
- base;
61
- timeout;
62
- constructor(base, timeout) {
63
- this.base = base;
64
- this.timeout = timeout;
65
- }
66
- async send(request) {
67
- const timeoutSignal = AbortSignal.timeout(this.timeout);
68
- const signal = request.signal !== undefined
69
- ? AbortSignal.any([request.signal, timeoutSignal])
70
- : timeoutSignal;
71
- return this.base.send({ ...request, signal });
72
- }
73
- }
48
+ var TimeoutHttpClient = class {
49
+ constructor(base, timeout) {
50
+ this.base = base;
51
+ this.timeout = timeout;
52
+ }
53
+ async send(request) {
54
+ const timeoutSignal = AbortSignal.timeout(this.timeout);
55
+ const signal = request.signal !== void 0 ? AbortSignal.any([request.signal, timeoutSignal]) : timeoutSignal;
56
+ return this.base.send({
57
+ ...request,
58
+ signal
59
+ });
60
+ }
61
+ };
62
+
63
+ //#endregion
64
+ export { resolveClientConfig };
74
65
  //# sourceMappingURL=transport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/v1/transport.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAG/E,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAC;AAMpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAC,OAAO,EAAC,MAAM,+BAA+B,CAAC;AA0BtD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,OAAsB;IAEtB,MAAM,OAAO,GAAY,MAAM,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAE/D,MAAM,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W,CAAC,WAAW,EAAE,CAAC;QACzD,sCAAsC;QACtC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,KAAK,MAAM,CAAC,IAAI,WAAW,EAAE,CAAC;YAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;QAC9B,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,OAAO,EAAC,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,qEAAqE;AACrE,MAAM,iBAAiB;IAEF;IACA;IAFnB,YACmB,IAAgB,EAChB,OAAe;QADf,SAAI,GAAJ,IAAI,CAAY;QAChB,YAAO,GAAP,OAAO,CAAQ;IAC/B,CAAC;IAEJ,KAAK,CAAC,IAAI,CAAC,OAAoB;QAC7B,MAAM,aAAa,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxD,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,KAAK,SAAS;YAC1B,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YAClD,CAAC,CAAC,aAAa,CAAC;QACpB,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAC,GAAG,OAAO,EAAE,MAAM,EAAC,CAAC,CAAC;IAC9C,CAAC;CACF"}
1
+ {"version":3,"file":"transport.js","names":[],"sources":["../../src/v1/transport.ts"],"sourcesContent":["// Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.\n\nimport type {Credentials} from '@databricks/sdk-auth';\nimport {defaultCredentials} from '@databricks/sdk-auth/credentials';\nimport type {\n HttpClient,\n HttpRequest,\n HttpResponse,\n} from '@databricks/sdk-core/http';\nimport {newFetchHttpClient} from '@databricks/sdk-core/http';\nimport type {Profile} from '@databricks/sdk-core/profiles';\nimport {resolve} from '@databricks/sdk-core/profiles';\nimport type {ClientOptions} from '@databricks/sdk-options/client';\n\n/**\n * The configuration a client needs to issue requests, resolved from\n * {@link ClientOptions} and a configuration profile.\n */\nexport interface ResolvedClientConfig {\n /** Host with any trailing slash removed. */\n host: string;\n\n /**\n * Default account ID for account-level paths that contain an account_id\n * segment. A request's own accountId still wins.\n */\n accountId?: string;\n\n /**\n * Workspace ID used to route workspace-level calls on unified hosts (SPOG).\n */\n workspaceId?: string;\n\n /** HTTP client with authentication, and any configured timeout, applied. */\n httpClient: HttpClient;\n}\n\n/**\n * Resolves {@link ClientOptions} into a {@link ResolvedClientConfig}.\n *\n * A configuration profile is always resolved from the config file and\n * environment variables (per options.profileOptions); it supplies host,\n * accountId, workspaceId, and credentials wherever the caller did not set them\n * explicitly. Explicit options always take precedence.\n *\n * @throws if host is neither provided nor present in the resolved profile.\n */\nexport async function resolveClientConfig(\n options: ClientOptions\n): Promise<ResolvedClientConfig> {\n const profile: Profile = await resolve(options.profileOptions);\n\n const host = options.host ?? profile.host;\n if (host === undefined) {\n throw new Error('Host is required.');\n }\n\n // The provided httpClient (or the default fetch client) is the base wire;\n // authentication and the optional timeout are layered on top of it. The\n // default credential chain reuses the profile resolved above so that the\n // same profileOptions govern host and authentication alike.\n const base = options.httpClient ?? newFetchHttpClient();\n const credentials = options.credentials ?? defaultCredentials({profile});\n let httpClient: HttpClient = new AuthHttpClient(base, credentials);\n if (options.timeout !== undefined) {\n httpClient = new TimeoutHttpClient(httpClient, options.timeout);\n }\n\n const accountId = options.accountId ?? profile.accountId;\n const workspaceId = options.workspaceId ?? profile.workspaceId;\n\n return {\n host: host.replace(/\\/$/, ''),\n httpClient,\n ...(accountId !== undefined && {accountId}),\n ...(workspaceId !== undefined && {workspaceId}),\n };\n}\n\n/** Wraps an HttpClient and adds authentication headers to requests. */\nclass AuthHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly credentials: Credentials\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const authHeaders = await this.credentials.authHeaders();\n // Do not modify the original request.\n const headers = new Headers(request.headers);\n for (const h of authHeaders) {\n headers.set(h.key, h.value);\n }\n return this.base.send({...request, headers});\n }\n}\n\n/** Wraps an HttpClient and applies a default timeout to requests. */\nclass TimeoutHttpClient implements HttpClient {\n constructor(\n private readonly base: HttpClient,\n private readonly timeout: number\n ) {}\n\n async send(request: HttpRequest): Promise<HttpResponse> {\n const timeoutSignal = AbortSignal.timeout(this.timeout);\n const signal =\n request.signal !== undefined\n ? AbortSignal.any([request.signal, timeoutSignal])\n : timeoutSignal;\n return this.base.send({...request, signal});\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AA+CA,eAAsB,oBACpB,SAC+B;CAC/B,MAAM,UAAmB,MAAM,QAAQ,QAAQ,eAAe;CAE9D,MAAM,OAAO,QAAQ,QAAQ,QAAQ;AACrC,KAAI,SAAS,OACX,OAAM,IAAI,MAAM,oBAAoB;CAStC,IAAI,aAAyB,IAAI,eAFpB,QAAQ,cAAc,oBAAoB,EACnC,QAAQ,eAAe,mBAAmB,EAAC,SAAQ,CAAC,CACN;AAClE,KAAI,QAAQ,YAAY,OACtB,cAAa,IAAI,kBAAkB,YAAY,QAAQ,QAAQ;CAGjE,MAAM,YAAY,QAAQ,aAAa,QAAQ;CAC/C,MAAM,cAAc,QAAQ,eAAe,QAAQ;AAEnD,QAAO;EACL,MAAM,KAAK,QAAQ,OAAO,GAAG;EAC7B;EACA,GAAI,cAAc,UAAa,EAAC,WAAU;EAC1C,GAAI,gBAAgB,UAAa,EAAC,aAAY;EAC/C;;;AAIH,IAAM,iBAAN,MAA2C;CACzC,YACE,AAAiB,MACjB,AAAiB,aACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,cAAc,MAAM,KAAK,YAAY,aAAa;EAExD,MAAM,UAAU,IAAI,QAAQ,QAAQ,QAAQ;AAC5C,OAAK,MAAM,KAAK,YACd,SAAQ,IAAI,EAAE,KAAK,EAAE,MAAM;AAE7B,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAQ,CAAC;;;;AAKhD,IAAM,oBAAN,MAA8C;CAC5C,YACE,AAAiB,MACjB,AAAiB,SACjB;EAFiB;EACA;;CAGnB,MAAM,KAAK,SAA6C;EACtD,MAAM,gBAAgB,YAAY,QAAQ,KAAK,QAAQ;EACvD,MAAM,SACJ,QAAQ,WAAW,SACf,YAAY,IAAI,CAAC,QAAQ,QAAQ,cAAc,CAAC,GAChD;AACN,SAAO,KAAK,KAAK,KAAK;GAAC,GAAG;GAAS;GAAO,CAAC"}
@@ -1,21 +1,25 @@
1
- import type { HttpClient, HttpRequest } from '@databricks/sdk-core/http';
2
- import type { Logger } from '@databricks/sdk-core/logger';
3
- import type { CallOptions } from '@databricks/sdk-options/call';
4
- import type { z } from 'zod';
5
- export interface HttpCallOptions {
6
- readonly request: HttpRequest;
7
- readonly httpClient: HttpClient;
8
- readonly logger: Logger;
1
+ import { Logger } from "@databricks/sdk-core/logger";
2
+ import { HttpClient, HttpRequest } from "@databricks/sdk-core/http";
3
+ import { z } from "zod";
4
+ import { CallOptions } from "@databricks/sdk-options/call";
5
+
6
+ //#region src/v1/utils.d.ts
7
+ interface HttpCallOptions {
8
+ readonly request: HttpRequest;
9
+ readonly httpClient: HttpClient;
10
+ readonly logger: Logger;
9
11
  }
10
12
  /**
11
13
  * Translates public CallOptions to the internal Options shape accepted by
12
14
  * execute(). Even though the shapes match today, this isolates the public
13
15
  * API from the executor's internal type so they can diverge.
14
16
  */
15
- export declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
16
- export declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
17
- export declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
18
- export declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
19
- export declare function marshalRequest(data: unknown, schema: z.ZodType): string;
20
- export declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
17
+ declare function executeCall(call: (signal?: AbortSignal) => Promise<void>, options?: CallOptions): Promise<void>;
18
+ declare function executeHttpCall(opts: HttpCallOptions): Promise<Uint8Array>;
19
+ declare function buildHttpRequest(method: string, url: string, headers: Headers, signal?: AbortSignal, body?: string | ReadableStream<Uint8Array>): HttpRequest;
20
+ declare function parseResponse<T>(body: Uint8Array, schema: z.ZodType<T>): T;
21
+ declare function marshalRequest(data: unknown, schema: z.ZodType): string;
22
+ declare function flattenQueryParams(prefix: string, value: unknown, params: URLSearchParams): void;
23
+ //#endregion
24
+ export { HttpCallOptions, buildHttpRequest, executeCall, executeHttpCall, flattenQueryParams, marshalRequest, parseResponse };
21
25
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/v1/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EAEZ,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,6BAA6B,CAAC;AACxD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAO3B,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC7C,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,IAAI,CAAC,CASf;AA2BD,wBAAsB,eAAe,CACnC,IAAI,EAAE,eAAe,GACpB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