@dremio/js-sdk 0.28.0 → 0.28.1

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.
@@ -11,4 +11,6 @@ export declare class User implements z.output<typeof userPropertiesCodec> {
11
11
  readonly status: z.output<typeof userPropertiesCodec>["status"];
12
12
  readonly username: string;
13
13
  constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>);
14
+ get displayName(): string;
15
+ get initials(): string;
14
16
  }
@@ -33,5 +33,23 @@ export class User {
33
33
  this.status = properties.status;
34
34
  this.username = properties.username;
35
35
  }
36
+ get displayName() {
37
+ if (this.givenName || this.familyName) {
38
+ return [this.givenName, this.familyName].filter(Boolean).join(" ");
39
+ }
40
+ if (this.username) {
41
+ return this.username;
42
+ }
43
+ if (this.email) {
44
+ return this.email;
45
+ }
46
+ return this.id;
47
+ }
48
+ get initials() {
49
+ if (this.givenName && this.familyName) {
50
+ return this.givenName.charAt(0) + this.familyName.charAt(0);
51
+ }
52
+ return this.displayName.slice(0, 2);
53
+ }
36
54
  }
37
55
  //# sourceMappingURL=User.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,IAAI;IACf,2DAA2D;IAClD,OAAO,CAAW;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAgB;IAC1B,SAAS,CAAgB;IACzB,EAAE,CAAS;IACX,KAAK,CAAgD;IACrD,MAAM,CAAiD;IACvD,QAAQ,CAAS;IAE1B,YAAY,MAAgB,EAAE,UAAgD;QAC5E,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,UAAU,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;QAChC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;IACtC,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 type z from \"zod\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly roles: z.output<typeof userPropertiesCodec>[\"roles\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.roles = properties.roles;\n this.status = properties.status;\n this.username = properties.username;\n }\n}\n"]}
1
+ {"version":3,"file":"User.js","sourceRoot":"","sources":["../../../src/cloud/users/User.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,MAAM,OAAO,IAAI;IACf,2DAA2D;IAClD,OAAO,CAAW;IAClB,KAAK,CAAgB;IACrB,UAAU,CAAgB;IAC1B,SAAS,CAAgB;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,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtC,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 type z from \"zod\";\nimport type { userPropertiesCodec } from \"./userPropertiesCodec.ts\";\nimport type { V2Config } from \"../../common/Config.ts\";\n\nexport class User implements z.output<typeof userPropertiesCodec> {\n // eslint-disable-next-line no-unused-private-class-members\n readonly #config: V2Config;\n readonly email: string | null;\n readonly familyName: string | null;\n readonly givenName: string | null;\n readonly id: string;\n readonly roles: z.output<typeof userPropertiesCodec>[\"roles\"];\n readonly status: z.output<typeof userPropertiesCodec>[\"status\"];\n readonly username: string;\n\n constructor(config: V2Config, properties: z.output<typeof userPropertiesCodec>) {\n this.#config = config;\n this.email = properties.email;\n this.familyName = properties.familyName;\n this.givenName = properties.givenName;\n this.id = properties.id;\n this.roles = properties.roles;\n this.status = properties.status;\n this.username = properties.username;\n }\n\n get displayName(): string {\n if (this.givenName || this.familyName) {\n return [this.givenName, this.familyName].filter(Boolean).join(\" \");\n }\n\n if (this.username) {\n return this.username;\n }\n\n if (this.email) {\n return this.email;\n }\n\n return this.id;\n }\n\n get initials(): string {\n if (this.givenName && this.familyName) {\n return this.givenName.charAt(0) + this.familyName.charAt(0);\n }\n\n return this.displayName.slice(0, 2);\n }\n}\n"]}
@@ -33,8 +33,8 @@ export const userPropertiesCodec = z.codec(userPropertiesInSchema, z.extend(z.om
33
33
  lastName: true,
34
34
  }), {
35
35
  email: z.nullable(z.string().check(z.email())),
36
- familyName: z.nullable(z.string()),
37
- givenName: z.nullable(z.string()),
36
+ familyName: z.nullable(z.string().check(z.trim())),
37
+ givenName: z.nullable(z.string().check(z.trim())),
38
38
  }), {
39
39
  decode(v) {
40
40
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;KACjD,CAAC,CACH;IACD,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CACrD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CACxC,sBAAsB,EACtB,CAAC,CAAC,MAAM,CACN,CAAC,CAAC,IAAI,CAAC,sBAAsB,EAAE;IAC7B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,QAAQ,EAAE,IAAI;CACf,CAAC,EACF;IACE,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAClC,CACF,EACD;IACE,MAAM,CAAC,CAAC;QACN,OAAO;YACL,GAAG,CAAC;YACJ,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,IAAI;YACtB,UAAU,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI;YAC9B,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,IAAI;SAC/B,CAAC;IACJ,CAAC;IACD,MAAM,CAAC,CAAC;QACN,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,CAAC;QACpD,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,QAAQ,EAAE,UAAU,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF,CACF,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\";\n\nconst userPropertiesInSchema = z.object({\n email: z.string(),\n firstName: z.string(),\n id: z.string().check(z.minLength(1)),\n lastName: z.string(),\n roles: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n }),\n ),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.extend(\n z.omit(userPropertiesInSchema, {\n email: true,\n firstName: true,\n lastName: true,\n }),\n {\n email: z.nullable(z.string().check(z.email())),\n familyName: z.nullable(z.string()),\n givenName: z.nullable(z.string()),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n email: v.email || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n };\n },\n encode(v) {\n const { email, familyName, givenName, ...rest } = v;\n return {\n ...rest,\n email: email || \"\",\n firstName: givenName || \"\",\n lastName: familyName || \"\",\n };\n },\n },\n);\n"]}
1
+ {"version":3,"file":"userPropertiesCodec.js","sourceRoot":"","sources":["../../../src/cloud/users/userPropertiesCodec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAE9B,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CACZ,CAAC,CAAC,MAAM,CAAC;QACP,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAA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,OAAO;YACL,GAAG,IAAI;YACP,KAAK,EAAE,KAAK,IAAI,EAAE;YAClB,SAAS,EAAE,SAAS,IAAI,EAAE;YAC1B,QAAQ,EAAE,UAAU,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;CACF,CACF,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\";\n\nconst userPropertiesInSchema = z.object({\n email: z.string(),\n firstName: z.string(),\n id: z.string().check(z.minLength(1)),\n lastName: z.string(),\n roles: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n type: z.enum([\"INTERNAL\", \"EXTERNAL\", \"SYSTEM\"]),\n }),\n ),\n status: z.enum([\"ACTIVE\", \"INACTIVE\"]),\n username: z.string().check(z.trim(), z.minLength(1)),\n});\n\nexport const userPropertiesCodec = z.codec(\n userPropertiesInSchema,\n z.extend(\n z.omit(userPropertiesInSchema, {\n email: true,\n firstName: true,\n lastName: true,\n }),\n {\n email: z.nullable(z.string().check(z.email())),\n familyName: z.nullable(z.string().check(z.trim())),\n givenName: z.nullable(z.string().check(z.trim())),\n },\n ),\n {\n decode(v) {\n return {\n ...v,\n email: v.email || null,\n familyName: v.lastName || null,\n givenName: v.firstName || null,\n };\n },\n encode(v) {\n const { email, familyName, givenName, ...rest } = v;\n return {\n ...rest,\n email: email || \"\",\n firstName: givenName || \"\",\n lastName: familyName || \"\",\n };\n },\n },\n);\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.28.0",
3
+ "version": "0.28.1",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",