@dremio/js-sdk 0.8.0 → 0.9.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.
@@ -2,8 +2,11 @@ import { Err, Ok } from "ts-results-es";
2
2
  import type { V3Config } from "../../common/Config.ts";
3
3
  import type { SignalParam } from "../../common/Params.ts";
4
4
  import { User } from "../../oss/users/User.ts";
5
+ import type { RoleReference } from "../roles/Role.ts";
5
6
  export declare class EnterpriseUser extends User {
6
7
  #private;
8
+ roles: RoleReference[];
9
+ source: string;
7
10
  constructor(properties: EnterpriseUserProperties, config: V3Config);
8
11
  tokens({ signal }?: SignalParam): Promise<Err<any> | Ok<{
9
12
  createdAt: Date;
@@ -13,6 +16,8 @@ export declare class EnterpriseUser extends User {
13
16
  }[]>>;
14
17
  }
15
18
  export declare const enterpriseUserEntityToProperties: (entity: any) => {
19
+ roles: RoleReference[];
20
+ source: string;
16
21
  email: string;
17
22
  familyName: string | null;
18
23
  givenName: string | null;
@@ -17,9 +17,13 @@ import { Err, Ok } from "ts-results-es";
17
17
  import { User, userEntityToProperties } from "../../oss/users/User.js";
18
18
  export class EnterpriseUser extends User {
19
19
  #config;
20
+ roles;
21
+ source;
20
22
  constructor(properties, config) {
21
23
  super(properties);
22
24
  this.#config = config;
25
+ this.roles = properties.roles;
26
+ this.source = properties.source;
23
27
  }
24
28
  tokens({ signal } = {}) {
25
29
  return this.#config
@@ -39,5 +43,7 @@ export class EnterpriseUser extends User {
39
43
  }
40
44
  export const enterpriseUserEntityToProperties = (entity) => ({
41
45
  ...userEntityToProperties(entity),
46
+ roles: entity.roles,
47
+ source: entity.source,
42
48
  });
43
49
  //# sourceMappingURL=EnterpriseUser.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnterpriseUser.js","sourceRoot":"","sources":["../../../src/enterprise/users/EnterpriseUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAYvE,MAAM,OAAO,cAAe,SAAQ,IAAI;IACtC,OAAO,CAAW;IAElB,YAAY,UAAoC,EAAE,MAAgB;QAChE,KAAK,CAAC,UAAU,CAAC,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,MAAM,CAAC,EAAE,MAAM,KAAkB,EAAE;QACjC,OAAO,IAAI,CAAC,OAAO;aAChB,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE,QAAQ,EAAE;YAClC,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;YACvC,MAAM;SACP,CAAC;aACD,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAiC,CAAC;aACxD,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACjB,EAAE,CACA,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAC5B,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACpC,SAAS,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YACpC,EAAE,EAAE,KAAK,CAAC,GAAG;YACb,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC,CACJ,CACF;aACA,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC;IAChE,GAAG,sBAAsB,CAAC,MAAM,CAAC;CAClC,CAAC,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 { Err, Ok } from \"ts-results-es\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { User, userEntityToProperties } from \"../../oss/users/User.ts\";\n\ntype UserTokensResponse = {\n data: {\n tid: string;\n uid: string;\n label: string;\n createdAt: string;\n expiresAt: string;\n }[];\n};\n\nexport class EnterpriseUser extends User {\n #config: V3Config;\n\n constructor(properties: EnterpriseUserProperties, config: V3Config) {\n super(properties);\n this.#config = config;\n }\n\n tokens({ signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`user/${this.id}/token`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .then((res) => res.json() as Promise<UserTokensResponse>)\n .then((response) =>\n Ok(\n response.data.map((token) => ({\n createdAt: new Date(token.createdAt),\n expiresAt: new Date(token.expiresAt),\n id: token.tid,\n label: token.label,\n })),\n ),\n )\n .catch((e) => Err(e));\n }\n}\n\nexport const enterpriseUserEntityToProperties = (entity: any) => ({\n ...userEntityToProperties(entity),\n});\n\nexport type EnterpriseUserProperties = ReturnType<typeof enterpriseUserEntityToProperties>;\n"]}
1
+ {"version":3,"file":"EnterpriseUser.js","sourceRoot":"","sources":["../../../src/enterprise/users/EnterpriseUser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAavE,MAAM,OAAO,cAAe,SAAQ,IAAI;IACtC,OAAO,CAAW;IAElB,KAAK,CAAkB;IACvB,MAAM,CAAS;IAE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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 { Err, Ok } from \"ts-results-es\";\nimport type { V3Config } from \"../../common/Config.ts\";\nimport type { SignalParam } from \"../../common/Params.ts\";\nimport { User, userEntityToProperties } from \"../../oss/users/User.ts\";\nimport type { RoleReference } from \"../roles/Role.ts\";\n\ntype UserTokensResponse = {\n data: {\n tid: string;\n uid: string;\n label: string;\n createdAt: string;\n expiresAt: string;\n }[];\n};\n\nexport class EnterpriseUser extends User {\n #config: V3Config;\n\n roles: RoleReference[];\n source: string;\n\n constructor(properties: EnterpriseUserProperties, config: V3Config) {\n super(properties);\n this.#config = config;\n this.roles = properties.roles;\n this.source = properties.source;\n }\n\n tokens({ signal }: SignalParam = {}) {\n return this.#config\n .v3Request(`user/${this.id}/token`, {\n headers: { Accept: \"application/json\" },\n signal,\n })\n .then((res) => res.json() as Promise<UserTokensResponse>)\n .then((response) =>\n Ok(\n response.data.map((token) => ({\n createdAt: new Date(token.createdAt),\n expiresAt: new Date(token.expiresAt),\n id: token.tid,\n label: token.label,\n })),\n ),\n )\n .catch((e) => Err(e));\n }\n}\n\nexport const enterpriseUserEntityToProperties = (entity: any) => ({\n ...userEntityToProperties(entity),\n roles: entity.roles as RoleReference[],\n source: entity.source as string,\n});\n\nexport type EnterpriseUserProperties = ReturnType<typeof enterpriseUserEntityToProperties>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dremio/js-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "JavaScript library for the Dremio API",
5
5
  "keywords": [
6
6
  "dremio",