@dremio/js-sdk 0.26.0 → 0.27.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/cloud/organizations/Organization.d.ts +5 -0
- package/dist/cloud/organizations/Organization.js +21 -1
- package/dist/cloud/organizations/Organization.js.map +1 -1
- package/dist/cloud/organizations/OrganizationsResource.js +1 -1
- package/dist/cloud/organizations/OrganizationsResource.js.map +1 -1
- package/package.json +1 -1
|
@@ -82,6 +82,10 @@ export declare const organizationPropertiesCodec: z.ZodMiniCodec<z.ZodMiniObject
|
|
|
82
82
|
modifiedAt: z.ZodMiniCustom<Temporal.Instant, Temporal.Instant>;
|
|
83
83
|
name: z.ZodMiniString<string>;
|
|
84
84
|
}, z.core.$strip>>;
|
|
85
|
+
declare const organizationUpdateSchema: z.ZodMiniObject<{
|
|
86
|
+
name: z.ZodMiniString<string>;
|
|
87
|
+
defaultProjectId: z.ZodMiniString<string>;
|
|
88
|
+
}, z.core.$strip>;
|
|
85
89
|
type OrganizationProperties = z.output<typeof organizationPropertiesCodec>;
|
|
86
90
|
export declare class Organization implements OrganizationProperties {
|
|
87
91
|
#private;
|
|
@@ -103,6 +107,7 @@ export declare class Organization implements OrganizationProperties {
|
|
|
103
107
|
readonly _isCreatedWithCFT: OrganizationProperties["_isCreatedWithCFT"];
|
|
104
108
|
constructor(config: V2Config, properties: OrganizationProperties);
|
|
105
109
|
get settled(): boolean;
|
|
110
|
+
update(fields: Partial<z.infer<typeof organizationUpdateSchema>>): import("ts-results-es").AsyncResult<Organization, import("../index.ts").HttpError>;
|
|
106
111
|
static schema: z.ZodMiniObject<{
|
|
107
112
|
id: z.ZodMiniString<string>;
|
|
108
113
|
state: z.ZodMiniEnum<{
|
|
@@ -83,6 +83,10 @@ export const organizationPropertiesCodec = z.codec(organizationPropertiesInSchem
|
|
|
83
83
|
};
|
|
84
84
|
},
|
|
85
85
|
});
|
|
86
|
+
const organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {
|
|
87
|
+
defaultProjectId: true,
|
|
88
|
+
name: true,
|
|
89
|
+
});
|
|
86
90
|
export class Organization {
|
|
87
91
|
auditDestinationCloudType;
|
|
88
92
|
auditDestinationCredentials;
|
|
@@ -100,7 +104,6 @@ export class Organization {
|
|
|
100
104
|
* @hidden
|
|
101
105
|
*/
|
|
102
106
|
_isCreatedWithCFT;
|
|
103
|
-
// eslint-disable-next-line no-unused-private-class-members
|
|
104
107
|
#config;
|
|
105
108
|
constructor(config, properties) {
|
|
106
109
|
this.auditDestinationCloudType = properties.auditDestinationCloudType;
|
|
@@ -124,6 +127,23 @@ export class Organization {
|
|
|
124
127
|
this.state === "FAILED" ||
|
|
125
128
|
this.state === "INVALID");
|
|
126
129
|
}
|
|
130
|
+
update(fields) {
|
|
131
|
+
return this.#config
|
|
132
|
+
.v2Request("organizations", {
|
|
133
|
+
body: JSON.stringify(z.parse(organizationUpdateSchema, {
|
|
134
|
+
defaultProjectId: this.defaultProjectId,
|
|
135
|
+
name: fields.name || this.name,
|
|
136
|
+
})),
|
|
137
|
+
headers: {
|
|
138
|
+
Accept: "application/json",
|
|
139
|
+
"Content-Type": "application/json",
|
|
140
|
+
},
|
|
141
|
+
keepalive: true,
|
|
142
|
+
method: "PUT",
|
|
143
|
+
})
|
|
144
|
+
.map((res) => res.json())
|
|
145
|
+
.map((entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)));
|
|
146
|
+
}
|
|
127
147
|
static schema = organizationPropertiesCodec.def.out;
|
|
128
148
|
}
|
|
129
149
|
//# sourceMappingURL=Organization.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM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IAAI,CAAC,KAAK,KAAK,SAAS;YACxB,IAAI,CAAC,KAAK,KAAK,QAAQ;YACvB,IAAI,CAAC,KAAK,KAAK,SAAS,CACzB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.enum([\"AWS\", \"AZURE\"]),\n auditDestinationCredentials: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n auditDestinationPath: z.string(),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Organization.js","sourceRoot":"","sources":["../../../src/cloud/organizations/Organization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,MAAM,8BAA8B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,yBAAyB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IACnD,2BAA2B,EAAE,CAAC,CAAC,MAAM,CAAC;QACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;QACvB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;QAC3B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,wBAAwB,EAAE,UAAU,CAAC,CAAC;KACnE,CAAC;IACF,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE;IAChC,SAAS,EAAE,CAAC,CAAC,QAAQ,CACnB,CAAC,CAAC,KAAK,CACL,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;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CAAC,IAAI;aAC/B,CAAC,CACH;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,kBAAkB;gBAC1B,cAAc,EAAE,kBAAkB;aACnC;YACD,SAAS,EAAE,IAAI;YACf,MAAM,EAAE,KAAK;SACd,CAAC;aACD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;aAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC1F,CAAC;IACN,CAAC;IAED,MAAM,CAAC,MAAM,GAAG,2BAA2B,CAAC,GAAG,CAAC,GAAG,CAAC","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport { Temporal } from \"temporal-polyfill\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nconst organizationPropertiesInSchema = z.object({\n auditDestinationCloudType: z.enum([\"AWS\", \"AZURE\"]),\n auditDestinationCredentials: z.object({\n accessKeyId: z.string(),\n secretAccessKey: z.string(),\n type: z.enum([\"ACCESS_KEY\", \"AZURE_ACTIVE_DIRECTORY\", \"IAM_ROLE\"]),\n }),\n auditDestinationPath: z.string(),\n cloudTags: z.optional(\n z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n ),\n createdAt: z.string(),\n createdBy: z.string(),\n defaultProjectId: z.string(),\n id: z.string(),\n isCreatedWithCFT: z.boolean(),\n modifiedAt: z.string(),\n modifiedBy: z.string(),\n name: z.string(),\n state: z.enum([\n \"ACTIVE\",\n \"FAILED\",\n \"DELETED\",\n \"INVALID\",\n \"CFT_STARTED\",\n \"CFT_COMPLETE\",\n \"COMMISSIONING\",\n \"MARK_ROLLBACK\",\n \"FIRST_CLOUD_ADDED\",\n \"ROLLBACK_COMPLETED\",\n \"CFT_FINISH_TIMEOUT\",\n ]),\n});\n\nexport const organizationPropertiesCodec = z.codec(\n organizationPropertiesInSchema,\n z.extend(\n z.omit(organizationPropertiesInSchema, {\n cloudTags: true,\n createdAt: true,\n isCreatedWithCFT: true,\n modifiedAt: true,\n name: true,\n }),\n {\n _isCreatedWithCFT: z.boolean(),\n cloudTags: z.array(\n z.object({\n key: z.string(),\n value: z.string(),\n }),\n ),\n createdAt: z.instanceof(Temporal.Instant),\n modifiedAt: z.instanceof(Temporal.Instant),\n name: z.string(),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n _isCreatedWithCFT: v.isCreatedWithCFT,\n cloudTags: v.cloudTags ?? [],\n createdAt: Temporal.Instant.from(new Date(v.createdAt).toISOString()),\n modifiedAt: Temporal.Instant.from(new Date(v.modifiedAt).toISOString()),\n };\n },\n encode(v) {\n return {\n ...v,\n createdAt: Temporal.Instant.toString(),\n isCreatedWithCFT: v._isCreatedWithCFT,\n modifiedAt: Temporal.Instant.toString(),\n };\n },\n },\n);\n\nconst organizationUpdateSchema = z.pick(organizationPropertiesCodec.def.out, {\n defaultProjectId: true,\n name: true,\n});\n\ntype OrganizationProperties = z.output<typeof organizationPropertiesCodec>;\n\nexport class Organization implements OrganizationProperties {\n readonly auditDestinationCloudType: OrganizationProperties[\"auditDestinationCloudType\"];\n readonly auditDestinationCredentials: OrganizationProperties[\"auditDestinationCredentials\"];\n readonly auditDestinationPath: OrganizationProperties[\"auditDestinationPath\"];\n readonly cloudTags: OrganizationProperties[\"cloudTags\"];\n readonly createdAt: OrganizationProperties[\"createdAt\"];\n readonly createdBy: OrganizationProperties[\"createdBy\"];\n readonly defaultProjectId: OrganizationProperties[\"defaultProjectId\"];\n readonly id: OrganizationProperties[\"id\"];\n readonly modifiedAt: OrganizationProperties[\"modifiedAt\"];\n readonly modifiedBy: OrganizationProperties[\"modifiedBy\"];\n readonly name: OrganizationProperties[\"name\"];\n readonly state: OrganizationProperties[\"state\"];\n\n /**\n * @hidden\n */\n readonly _isCreatedWithCFT: OrganizationProperties[\"_isCreatedWithCFT\"];\n\n readonly #config: V2Config;\n\n constructor(config: V2Config, properties: OrganizationProperties) {\n this.auditDestinationCloudType = properties.auditDestinationCloudType;\n this.auditDestinationCredentials = properties.auditDestinationCredentials;\n this.auditDestinationPath = properties.auditDestinationPath;\n this.cloudTags = properties.cloudTags;\n this.createdAt = properties.createdAt;\n this.createdBy = properties.createdBy;\n this.defaultProjectId = properties.defaultProjectId;\n this.id = properties.id;\n this._isCreatedWithCFT = properties._isCreatedWithCFT;\n this.modifiedAt = properties.modifiedAt;\n this.modifiedBy = properties.modifiedBy;\n this.name = properties.name;\n this.state = properties.state;\n\n this.#config = config;\n }\n\n get settled(): boolean {\n return (\n this.state === \"ACTIVE\" ||\n this.state === \"DELETED\" ||\n this.state === \"FAILED\" ||\n this.state === \"INVALID\"\n );\n }\n\n update(fields: Partial<z.infer<typeof organizationUpdateSchema>>) {\n return this.#config\n .v2Request(\"organizations\", {\n body: JSON.stringify(\n z.parse(organizationUpdateSchema, {\n defaultProjectId: this.defaultProjectId,\n name: fields.name || this.name,\n }),\n ),\n headers: {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n },\n keepalive: true,\n method: \"PUT\",\n })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n static schema = organizationPropertiesCodec.def.out;\n}\n"]}
|
|
@@ -24,7 +24,7 @@ export class OrganizationsResource {
|
|
|
24
24
|
return this.#config
|
|
25
25
|
.v2Request("organizations", { headers: { Accept: "application/json" }, signal })
|
|
26
26
|
.map((res) => res.json())
|
|
27
|
-
.map((entity) => this.
|
|
27
|
+
.map((entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)));
|
|
28
28
|
}
|
|
29
29
|
_organizationFromEntity(entity) {
|
|
30
30
|
return new Organization(this.#config, z.decode(organizationPropertiesCodec, entity));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrganizationsResource.js","sourceRoot":"","sources":["../../../src/cloud/organizations/OrganizationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,OAAO,qBAAqB;IACvB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,QAAQ,CAAC,EAAE,MAAM,KAAkB,EAAE;QACnC,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC/E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;aAChF,GAAG,
|
|
1
|
+
{"version":3,"file":"OrganizationsResource.js","sourceRoot":"","sources":["../../../src/cloud/organizations/OrganizationsResource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAG9E,MAAM,OAAO,qBAAqB;IACvB,OAAO,CAA4B;IAE5C,YAAY,MAAiC;QAC3C,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,QAAQ,CAAC,EAAE,MAAM,KAAkB,EAAE;QACnC,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,MAAM,EAAE,CAAC;aAC/E,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAA0D,CAAC;aAChF,GAAG,CACF,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAC1F,CAAC;IACN,CAAC;IAED,uBAAuB,CAAC,MAAmD;QACzE,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,2BAA2B,EAAE,MAAM,CAAC,CAAC,CAAC;IACvF,CAAC;CACF","sourcesContent":["/*\n * Copyright (C) 2024-2025 Dremio Corporation\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as z from \"zod/mini\";\nimport type { ResourceConfig, V2Config } from \"../../common/Config.ts\";\nimport { Organization, organizationPropertiesCodec } from \"./Organization.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\n\nexport class OrganizationsResource {\n readonly #config: ResourceConfig & V2Config;\n\n constructor(config: ResourceConfig & V2Config) {\n this.#config = config;\n }\n\n retrieve({ signal }: SignalParam = {}) {\n return this.#config\n .v2Request(\"organizations\", { headers: { Accept: \"application/json\" }, signal })\n .map((res) => res.json() as Promise<z.input<typeof organizationPropertiesCodec>>)\n .map(\n (entity) => new Organization(this.#config, z.decode(organizationPropertiesCodec, entity)),\n );\n }\n\n _organizationFromEntity(entity: z.input<typeof organizationPropertiesCodec>) {\n return new Organization(this.#config, z.decode(organizationPropertiesCodec, entity));\n }\n}\n"]}
|