@cognite/dune 0.2.2 → 0.2.3

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.
@@ -30,7 +30,6 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>tsconfig.json'
30
30
  "@/*": ["./src/*"]
31
31
  }
32
32
  },
33
- "include": ["src"],
34
- "references": [{ "path": "./tsconfig.node.json" }]
33
+ "include": ["src"]
35
34
  }
36
35
 
@@ -3,6 +3,7 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>tsconfig.node.js
3
3
  ---
4
4
  {
5
5
  "compilerOptions": {
6
+ "composite": true,
6
7
  "target": "ES2022",
7
8
  "lib": ["ES2023"],
8
9
  "module": "ESNext",
@@ -13,7 +14,7 @@ to: '<%= useCurrentDir ? "" : ((directoryName || name) + "/") %>tsconfig.node.js
13
14
  "allowImportingTsExtensions": true,
14
15
  "isolatedModules": true,
15
16
  "moduleDetection": "force",
16
- "noEmit": true,
17
+ "emitDeclarationOnly": true,
17
18
 
18
19
  /* Linting */
19
20
  "strict": true,
@@ -35,7 +35,7 @@ declare class CdfApplicationDeployer {
35
35
  * @returns {Promise<number>} Data set ID (numerical)
36
36
  * @throws {Error} If data set doesn't exist or user doesn't have access
37
37
  */
38
- validateDataSet(): Promise<number | undefined>;
38
+ validateDataSet(): Promise<number>;
39
39
  /**
40
40
  * Upload application package to CDF Files API
41
41
  * @param {string} appExternalId - Application external ID
@@ -22,9 +22,9 @@ var CdfApplicationDeployer = class {
22
22
  { externalId: this.DATA_SET_EXTERNAL_ID }
23
23
  ]);
24
24
  return dataSets[0].id;
25
- } catch (error) {
25
+ } catch {
26
26
  try {
27
- this.client.datasets.create([
27
+ const created = await this.client.datasets.create([
28
28
  {
29
29
  externalId: this.DATA_SET_EXTERNAL_ID,
30
30
  name: "Published Custom Apps",
@@ -33,7 +33,8 @@ var CdfApplicationDeployer = class {
33
33
  }
34
34
  ]);
35
35
  console.log(`\u2705 Data set '${this.DATA_SET_EXTERNAL_ID}' created`);
36
- } catch (error2) {
36
+ return created[0].id;
37
+ } catch {
37
38
  throw new Error(
38
39
  `Failed to create data set '${this.DATA_SET_EXTERNAL_ID}'. Please ask your IT admin to create it or grant access.`
39
40
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cognite/dune",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Build and deploy React apps to Cognite Data Fusion",
5
5
  "keywords": [
6
6
  "cognite",
@@ -24,15 +24,16 @@ export class CdfApplicationDeployer {
24
24
  * @returns {Promise<number>} Data set ID (numerical)
25
25
  * @throws {Error} If data set doesn't exist or user doesn't have access
26
26
  */
27
- async validateDataSet() {
27
+ async validateDataSet(): Promise<number> {
28
28
  try {
29
29
  const dataSets = await this.client.datasets.retrieve([
30
30
  { externalId: this.DATA_SET_EXTERNAL_ID },
31
31
  ]);
32
32
  return dataSets[0].id;
33
- } catch (error) {
33
+ } catch {
34
+ // Dataset doesn't exist, try to create it
34
35
  try {
35
- this.client.datasets.create([
36
+ const created = await this.client.datasets.create([
36
37
  {
37
38
  externalId: this.DATA_SET_EXTERNAL_ID,
38
39
  name: "Published Custom Apps",
@@ -41,7 +42,8 @@ export class CdfApplicationDeployer {
41
42
  },
42
43
  ]);
43
44
  console.log(`✅ Data set '${this.DATA_SET_EXTERNAL_ID}' created`);
44
- } catch (error) {
45
+ return created[0].id;
46
+ } catch {
45
47
  throw new Error(
46
48
  `Failed to create data set '${this.DATA_SET_EXTERNAL_ID}'. Please ask your IT admin to create it or grant access.`
47
49
  );