@stepzen/sdk 0.44.0 → 0.45.0-experimental.6baaa11

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.
Files changed (111) hide show
  1. package/lib/client-v2.d.ts +6 -6
  2. package/lib/client-v2.d.ts.map +1 -1
  3. package/lib/client-v2.js +16 -21
  4. package/lib/client-v2.js.map +1 -1
  5. package/lib/client.d.ts +10 -10
  6. package/lib/client.d.ts.map +1 -1
  7. package/lib/client.js +18 -24
  8. package/lib/client.js.map +1 -1
  9. package/lib/commands/account.d.ts +1 -1
  10. package/lib/commands/account.d.ts.map +1 -1
  11. package/lib/commands/account.js +8 -10
  12. package/lib/commands/account.js.map +1 -1
  13. package/lib/commands/authenticate.d.ts +1 -1
  14. package/lib/commands/authenticate.d.ts.map +1 -1
  15. package/lib/commands/authenticate.js +8 -10
  16. package/lib/commands/authenticate.js.map +1 -1
  17. package/lib/commands/deploy.d.ts +1 -1
  18. package/lib/commands/deploy.d.ts.map +1 -1
  19. package/lib/commands/deploy.js +7 -9
  20. package/lib/commands/deploy.js.map +1 -1
  21. package/lib/commands/getPublicAccount.d.ts +1 -1
  22. package/lib/commands/getPublicAccount.d.ts.map +1 -1
  23. package/lib/commands/getPublicAccount.js +8 -10
  24. package/lib/commands/getPublicAccount.js.map +1 -1
  25. package/lib/commands/list.d.ts +1 -1
  26. package/lib/commands/list.d.ts.map +1 -1
  27. package/lib/commands/list.js +7 -9
  28. package/lib/commands/list.js.map +1 -1
  29. package/lib/commands/upload.d.ts +1 -1
  30. package/lib/commands/upload.d.ts.map +1 -1
  31. package/lib/commands/upload.js +18 -20
  32. package/lib/commands/upload.js.map +1 -1
  33. package/lib/commands-v2/account.d.ts +1 -1
  34. package/lib/commands-v2/account.d.ts.map +1 -1
  35. package/lib/commands-v2/account.js +3 -5
  36. package/lib/commands-v2/account.js.map +1 -1
  37. package/lib/commands-v2/delete.d.ts +1 -1
  38. package/lib/commands-v2/delete.d.ts.map +1 -1
  39. package/lib/commands-v2/delete.js +4 -6
  40. package/lib/commands-v2/delete.js.map +1 -1
  41. package/lib/commands-v2/deploy.d.ts +1 -1
  42. package/lib/commands-v2/deploy.d.ts.map +1 -1
  43. package/lib/commands-v2/deploy.js +3 -5
  44. package/lib/commands-v2/deploy.js.map +1 -1
  45. package/lib/commands-v2/getPublicAccount.d.ts +1 -1
  46. package/lib/commands-v2/getPublicAccount.d.ts.map +1 -1
  47. package/lib/commands-v2/getPublicAccount.js +3 -5
  48. package/lib/commands-v2/getPublicAccount.js.map +1 -1
  49. package/lib/commands-v2/list.d.ts +1 -1
  50. package/lib/commands-v2/list.d.ts.map +1 -1
  51. package/lib/commands-v2/list.js +3 -5
  52. package/lib/commands-v2/list.js.map +1 -1
  53. package/lib/index.d.ts +4 -13
  54. package/lib/index.d.ts.map +1 -1
  55. package/lib/index.js +4 -28
  56. package/lib/index.js.map +1 -1
  57. package/lib/init-v2.d.ts +8 -8
  58. package/lib/init-v2.d.ts.map +1 -1
  59. package/lib/init-v2.js +7 -11
  60. package/lib/init-v2.js.map +1 -1
  61. package/lib/init.d.ts +11 -11
  62. package/lib/init.d.ts.map +1 -1
  63. package/lib/init.js +7 -11
  64. package/lib/init.js.map +1 -1
  65. package/lib/shared/constants.js +6 -9
  66. package/lib/shared/constants.js.map +1 -1
  67. package/lib/shared/graphql-client.d.ts +6 -5
  68. package/lib/shared/graphql-client.d.ts.map +1 -1
  69. package/lib/shared/graphql-client.js +12 -18
  70. package/lib/shared/graphql-client.js.map +1 -1
  71. package/lib/shared/payloads.d.ts +4 -4
  72. package/lib/shared/payloads.d.ts.map +1 -1
  73. package/lib/shared/payloads.js +35 -26
  74. package/lib/shared/payloads.js.map +1 -1
  75. package/lib/shared/request.d.ts +1 -1
  76. package/lib/shared/request.d.ts.map +1 -1
  77. package/lib/shared/request.js +7 -11
  78. package/lib/shared/request.js.map +1 -1
  79. package/lib/shared/rmtemp.js +6 -10
  80. package/lib/shared/rmtemp.js.map +1 -1
  81. package/lib/shared/transpiling.js +10 -14
  82. package/lib/shared/transpiling.js.map +1 -1
  83. package/lib/shared/types.d.ts +4 -4
  84. package/lib/shared/types.d.ts.map +1 -1
  85. package/lib/shared/types.js +1 -2
  86. package/lib/shared/types.js.map +1 -1
  87. package/lib/shared/validation.js +6 -11
  88. package/lib/shared/validation.js.map +1 -1
  89. package/package.json +19 -15
  90. package/src/client-v2.ts +7 -7
  91. package/src/client.ts +7 -7
  92. package/src/commands/account.ts +4 -4
  93. package/src/commands/authenticate.ts +4 -4
  94. package/src/commands/deploy.ts +4 -4
  95. package/src/commands/getPublicAccount.ts +13 -5
  96. package/src/commands/list.ts +4 -4
  97. package/src/commands/upload.ts +9 -9
  98. package/src/commands-v2/account.ts +2 -2
  99. package/src/commands-v2/delete.ts +3 -3
  100. package/src/commands-v2/deploy.ts +2 -2
  101. package/src/commands-v2/getPublicAccount.ts +2 -2
  102. package/src/commands-v2/list.ts +2 -2
  103. package/src/index.ts +4 -27
  104. package/src/init-v2.ts +4 -4
  105. package/src/init.ts +4 -4
  106. package/src/shared/graphql-client.ts +9 -8
  107. package/src/shared/payloads.ts +34 -13
  108. package/src/shared/request.ts +8 -3
  109. package/src/shared/rmtemp.ts +4 -4
  110. package/src/shared/transpiling.ts +6 -6
  111. package/src/shared/validation.ts +4 -4
package/src/client.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import accountCommand from './commands/account'
4
- import deploy from './commands/deploy'
3
+ import accountCommand from './commands/account.js'
4
+ import deploy from './commands/deploy.js'
5
5
  import {
6
6
  AnonymousClientOptions,
7
7
  SDKConfiguration,
8
8
  StepZenAccount,
9
- } from './shared/types'
10
- import list from './commands/list'
11
- import upload from './commands/upload'
12
- import getPublicAccount from './commands/getPublicAccount'
9
+ } from './shared/types.js'
10
+ import list from './commands/list.js'
11
+ import upload from './commands/upload.js'
12
+ import getPublicAccount from './commands/getPublicAccount.js'
13
13
 
14
- export * from './shared/types'
14
+ export * from './shared/types.js'
15
15
 
16
16
  export const validateCreateClientOptions = async (
17
17
  options: StepZenAccount | Required<AnonymousClientOptions>,
@@ -1,11 +1,11 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import fetch from '@stepzen/fetch'
5
5
 
6
- import {ADMIN_ACCOUNT_URL} from '../shared/constants'
7
- import {getRequestHeaders} from '../shared/request'
8
- import {SDKConfiguration, StepZenAccount} from '../shared/types'
6
+ import {ADMIN_ACCOUNT_URL} from '../shared/constants.js'
7
+ import {getRequestHeaders} from '../shared/request.js'
8
+ import {SDKConfiguration, StepZenAccount} from '../shared/types.js'
9
9
 
10
10
  export default async (
11
11
  account: StepZenAccount,
@@ -1,11 +1,11 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import fetch from '@stepzen/fetch'
5
5
 
6
- import {ADMIN_VERIFY_URL} from '../shared/constants'
7
- import {getRequestHeaders} from '../shared/request'
8
- import {SDKConfiguration, StepZenAccount} from '../shared/types'
6
+ import {ADMIN_VERIFY_URL} from '../shared/constants.js'
7
+ import {getRequestHeaders} from '../shared/request.js'
8
+ import {SDKConfiguration, StepZenAccount} from '../shared/types.js'
9
9
 
10
10
  export default async (
11
11
  settings: StepZenAccount,
@@ -1,16 +1,16 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import fetch from '@stepzen/fetch'
5
5
 
6
- import {ADMIN_DEPLOY_URL} from '../shared/constants'
7
- import {getRequestHeaders} from '../shared/request'
6
+ import {ADMIN_DEPLOY_URL} from '../shared/constants.js'
7
+ import {getRequestHeaders} from '../shared/request.js'
8
8
  import {
9
9
  SDKConfiguration,
10
10
  StepZenAccount,
11
11
  StepZenDeploy,
12
12
  ZenCtlResponse,
13
- } from '../shared/types'
13
+ } from '../shared/types.js'
14
14
 
15
15
  export default async (
16
16
  details: StepZenDeploy,
@@ -1,14 +1,16 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import type {ExecutionResult} from 'graphql/execution/execute.js'
4
+
5
+ import debug from 'debug'
4
6
  import fetch from '@stepzen/fetch'
5
7
 
6
- import {getUserAgent} from '../shared/request'
8
+ import {getUserAgent} from '../shared/request.js'
7
9
  import {
8
10
  AnonymousClientOptions,
9
11
  SDKConfiguration,
10
12
  StepZenCredentials,
11
- } from '../shared/types'
13
+ } from '../shared/types.js'
12
14
 
13
15
  export default async (
14
16
  options: Required<AnonymousClientOptions>,
@@ -57,12 +59,18 @@ export default async (
57
59
  },
58
60
  }),
59
61
  })
60
- const json = await response.json()
62
+ const json = (await response.json()) as ExecutionResult<{
63
+ getAccountDetails: {
64
+ account: string
65
+ adminkey: string
66
+ apikey: string
67
+ }
68
+ }>
61
69
  debug('stepzen:createAnonymousAccount')(json)
62
70
  if (json.errors) {
63
71
  return {
64
72
  success: false,
65
- errors: json.errors,
73
+ errors: json.errors.map(e => e.message),
66
74
  }
67
75
  }
68
76
 
@@ -1,16 +1,16 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import fetch from '@stepzen/fetch'
5
5
 
6
- import {ADMIN_LIST_URL} from '../shared/constants'
7
- import {getRequestHeaders} from '../shared/request'
6
+ import {ADMIN_LIST_URL} from '../shared/constants.js'
7
+ import {getRequestHeaders} from '../shared/request.js'
8
8
  import {
9
9
  SDKConfiguration,
10
10
  StepZenAccount,
11
11
  StepZenList,
12
12
  ZenCtlResponse,
13
- } from '../shared/types'
13
+ } from '../shared/types.js'
14
14
 
15
15
  export default async (
16
16
  details: StepZenList,
@@ -1,21 +1,21 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
4
- import * as path from 'path'
3
+ import debug from 'debug'
4
+ import path from 'node:path'
5
5
  import fetch from '@stepzen/fetch'
6
6
 
7
- import {ADMIN_UPLOAD_URL} from '../shared/constants'
8
- import {generateYamlPayload, generateZipPayload} from '../shared/payloads'
9
- import {getRequestHeaders} from '../shared/request'
7
+ import {ADMIN_UPLOAD_URL} from '../shared/constants.js'
8
+ import {generateYamlPayload, generateZipPayload} from '../shared/payloads.js'
9
+ import {getRequestHeaders} from '../shared/request.js'
10
10
  import {
11
11
  SDKConfiguration,
12
12
  StepZenAccount,
13
13
  StepZenUpload,
14
14
  ZenCtlResponse,
15
- } from '../shared/types'
16
- import {transpileConfigurationset} from '../shared/transpiling'
17
- import {validateConfigurationset, validateSchema} from '../shared/validation'
18
- import {rmtemp} from '../shared/rmtemp'
15
+ } from '../shared/types.js'
16
+ import {transpileConfigurationset} from '../shared/transpiling.js'
17
+ import {validateConfigurationset, validateSchema} from '../shared/validation.js'
18
+ import {rmtemp} from '../shared/rmtemp.js'
19
19
 
20
20
  export default async (
21
21
  details: StepZenUpload,
@@ -4,8 +4,8 @@ import {
4
4
  SDKConfigurationV2,
5
5
  StepZenAccountV2,
6
6
  ZenCtlResponseV2,
7
- } from '../shared/types'
8
- import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client'
7
+ } from '../shared/types.js'
8
+ import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client.js'
9
9
 
10
10
  export default async ({
11
11
  account,
@@ -1,12 +1,12 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import {
5
5
  SDKConfigurationV2,
6
6
  StepZenDeleteV2,
7
7
  ZenCtlResponseV2,
8
- } from '../shared/types'
9
- import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client'
8
+ } from '../shared/types.js'
9
+ import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client.js'
10
10
 
11
11
  export default async ({
12
12
  account,
@@ -6,8 +6,8 @@ import {
6
6
  SDKConfigurationV2,
7
7
  StepZenEndpointV2,
8
8
  ZenCtlResponseV2,
9
- } from '../shared/types'
10
- import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client'
9
+ } from '../shared/types.js'
10
+ import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client.js'
11
11
 
12
12
  export default async ({
13
13
  account,
@@ -4,8 +4,8 @@ import {
4
4
  SDKConfigurationV2,
5
5
  StepZenCredentialsV2,
6
6
  ZenCtlResponseV2,
7
- } from '../shared/types'
8
- import {fetchPublicAccountGraphQLQuery} from '../shared/graphql-client'
7
+ } from '../shared/types.js'
8
+ import {fetchPublicAccountGraphQLQuery} from '../shared/graphql-client.js'
9
9
 
10
10
  export default async ({
11
11
  token,
@@ -4,8 +4,8 @@ import type {
4
4
  SDKConfigurationV2,
5
5
  ZenCtlResponseV2,
6
6
  StepZenEndpointV2,
7
- } from '../shared/types'
8
- import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client'
7
+ } from '../shared/types.js'
8
+ import {fetchZenCtlGraphQLQuery} from '../shared/graphql-client.js'
9
9
 
10
10
  export default async ({
11
11
  account,
package/src/index.ts CHANGED
@@ -1,29 +1,6 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as path from 'path'
4
- import {init, SDK} from './init'
5
-
6
- export * from './init'
7
- export * from './init-v2'
8
- export * from './shared/types'
9
- export {fetchGraphQLQuery} from './shared/graphql-client'
10
-
11
- /**
12
- * The default SDK instance that does not know the name of the app using the SDK.
13
- * It tries to guess the app name from `process.argv`
14
- *
15
- * @deprecated use the init({appName: 'my-app/1.2.3'}) method to initialis an SDK instance
16
- */
17
- const stepzen: SDK = init({
18
- // For legacy apps use the script name (e.g. `index.js` as the app name)
19
- // Fallback to `node` if this file is imported into an interactive node shell
20
- appName: path.basename(process.argv[1] || process.argv[0]),
21
- })
22
-
23
- export default stepzen
24
-
25
- // Hack: support both ESM-style imports: `import stepzen from '@stepzen/sdk'`
26
- // and keep the backwards-compat with CJS-style imports: `const stepzen = require('@stepzen/sdk')`
27
- // NOTE: if at any point in the future there is a name collision between `stepzen` and ES exports
28
- // this hack will break
29
- module.exports = {...module.exports, ...stepzen}
3
+ export * from './init.js'
4
+ export * from './init-v2.js'
5
+ export * from './shared/types.js'
6
+ export {fetchGraphQLQuery} from './shared/graphql-client.js'
package/src/init-v2.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import accountCommand from './commands-v2/account'
4
- import {createSdkClient} from './client-v2'
5
- import {getUserAgent} from './shared/request'
6
- import {SDKConfigurationV2} from './shared/types'
3
+ import accountCommand from './commands-v2/account.js'
4
+ import {createSdkClient} from './client-v2.js'
5
+ import {getUserAgent} from './shared/request.js'
6
+ import {SDKConfigurationV2} from './shared/types.js'
7
7
 
8
8
  export const initV2 = (sdkConfig: SDKConfigurationV2) => {
9
9
  return {
package/src/init.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import authenticate from './commands/authenticate'
4
- import {createSdkClient} from './client'
5
- import {getUserAgent} from './shared/request'
3
+ import authenticate from './commands/authenticate.js'
4
+ import {createSdkClient} from './client.js'
5
+ import {getUserAgent} from './shared/request.js'
6
6
  import {
7
7
  AnonymousClientOptions,
8
8
  SDKConfiguration,
9
9
  UserCredentialsClientOptions,
10
- } from './shared/types'
10
+ } from './shared/types.js'
11
11
 
12
12
  export const init = (sdkConfig: SDKConfiguration) => {
13
13
  const defaults = {
@@ -1,11 +1,12 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
3
+ import debug from 'debug'
4
4
  import fetch from '@stepzen/fetch'
5
5
  import type {ExecutionResult} from 'graphql'
6
+ import type {ObjMap} from 'graphql/jsutils/ObjMap.js'
6
7
 
7
- import {SDKConfigurationV2} from './types'
8
- import {getUserAgent} from './request'
8
+ import {SDKConfigurationV2} from './types.js'
9
+ import {getUserAgent} from './request.js'
9
10
 
10
11
  // The StepZen's ZenCtl GraphQL API offers stronger guarantees than defined in
11
12
  // the GraphQL standard:
@@ -14,14 +15,14 @@ export type GraphQLResponse<TData = Record<string, any>> =
14
15
  | GraphQLErrorResponse<TData>
15
16
 
16
17
  // 1. a successful response would always have a non-null `data` property and no `errors`.
17
- type GraphQLSuccessResponse<TData> = ExecutionResult<TData> & {
18
+ type GraphQLSuccessResponse<TData> = ExecutionResult<TData, ObjMap<unknown>> & {
18
19
  data: TData
19
20
  errors: undefined
20
21
  }
21
22
 
22
23
  // 2. an error response would always have a non-null `errors` property.
23
- type GraphQLErrorResponse<TData> = ExecutionResult<TData> &
24
- Required<Pick<ExecutionResult<TData>, 'errors'>>
24
+ type GraphQLErrorResponse<TData> = ExecutionResult<TData, ObjMap<unknown>> &
25
+ Required<Pick<ExecutionResult<TData, ObjMap<unknown>>, 'errors'>>
25
26
 
26
27
  export const fetchGraphQLQuery = async <T = Record<string, any>>({
27
28
  url,
@@ -35,7 +36,7 @@ export const fetchGraphQLQuery = async <T = Record<string, any>>({
35
36
  variables?: Record<string, any>
36
37
  operationName?: string
37
38
  headers?: Record<string, any>
38
- }): Promise<ExecutionResult<T>> => {
39
+ }): Promise<ExecutionResult<T, ObjMap<unknown>>> => {
39
40
  debug('stepzen:sdk:url')(url)
40
41
  debug('stepzen:sdk:headers')(headers)
41
42
  debug('stepzen:sdk:query')(query)
@@ -68,7 +69,7 @@ export const fetchGraphQLQuery = async <T = Record<string, any>>({
68
69
  )
69
70
  }
70
71
 
71
- const json = await response.json()
72
+ const json = (await response.json()) as GraphQLResponse<T>
72
73
  debug('stepzen:sdk:response')(JSON.stringify(json))
73
74
  // trace is a JSON readable summation in a single line; eventually allow stepzen request to return this directly?
74
75
  debug('stepzen:sdk:trace')(
@@ -2,18 +2,38 @@
2
2
 
3
3
  // This file contains helpers that zip a file or directory
4
4
 
5
- import * as archiver from 'archiver'
6
- import * as debug from 'debug'
7
- import * as FormData from 'form-data'
8
- import * as fs from 'fs'
9
- import * as glob from 'glob'
10
- import * as os from 'os'
11
- import * as path from 'path'
12
- import * as yaml from 'yaml'
13
- import {transpileConfigurationset} from './transpiling'
14
- import {validateConfigurationset} from './validation'
15
- import {Configuration, SchemaFiles} from './types'
16
- import {rmtemp} from './rmtemp'
5
+ import archiver from 'archiver'
6
+ import debug from 'debug'
7
+ import {FormData} from 'formdata-node'
8
+ import fs from 'node:fs'
9
+ import glob from 'glob'
10
+ import os from 'node:os'
11
+ import path from 'node:path'
12
+ import {Readable} from 'node:stream'
13
+ import yaml from 'yaml'
14
+ import {transpileConfigurationset} from './transpiling.js'
15
+ import {validateConfigurationset} from './validation.js'
16
+ import {Configuration, SchemaFiles} from './types.js'
17
+ import {rmtemp} from './rmtemp.js'
18
+
19
+ // https://www.npmjs.com/package/formdata-node#usage
20
+ class BlobFromStream {
21
+ _stream: Readable
22
+ _size: number
23
+
24
+ constructor(stream: Readable, size: number) {
25
+ this._stream = stream
26
+ this._size = size
27
+ }
28
+
29
+ stream() {
30
+ return this._stream
31
+ }
32
+
33
+ get [Symbol.toStringTag]() {
34
+ return 'Blob'
35
+ }
36
+ }
17
37
 
18
38
  type YamlPayload = FormData
19
39
  type ZipPayload = FormData
@@ -100,7 +120,8 @@ export const generateZipPayload = async (
100
120
  // Once we're done, append a ReadStream to the tmp file
101
121
  output.on('close', () => {
102
122
  const stream = fs.createReadStream(filepath)
103
- payload.append('zip', stream)
123
+ const {size} = fs.statSync(filepath)
124
+ payload.append('zip', new BlobFromStream(stream, size))
104
125
  // Remove the temporary zip
105
126
  stream.on('close', () => {
106
127
  fs.unlinkSync(filepath)
@@ -1,10 +1,15 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as os from 'os'
3
+ import os from 'node:os'
4
4
  import * as isWsl from 'is-wsl'
5
- import {SDKConfiguration, StepZenAccount, ZenCtlRequestHeaders} from './types'
5
+ import {createRequire} from 'node:module'
6
+ import {
7
+ SDKConfiguration,
8
+ StepZenAccount,
9
+ ZenCtlRequestHeaders,
10
+ } from './types.js'
6
11
 
7
- const {version} = require('../../package.json')
12
+ const {version} = createRequire(import.meta.url)('../../package.json')
8
13
 
9
14
  // mimics the logic from @oclif/config
10
15
  // https://github.com/oclif/core/blob/d7067d13c7d80c9e0064455c27ac1ebb6ee53fd2/src/config/config.ts#L128
@@ -1,9 +1,9 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as fs from 'fs'
4
- import * as path from 'path'
5
- import * as os from 'os'
6
- import * as debug from 'debug'
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import os from 'node:os'
6
+ import debug from 'debug'
7
7
 
8
8
  // ----------------------------------------------------------------------------
9
9
  // THIS ENTIRE FILE IS COPIED FROM packages/cli/src/shared/rmtemp.ts
@@ -1,12 +1,12 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as dotenv from 'dotenv'
4
- import * as debug from 'debug'
5
- import * as fsx from 'fs-extra'
6
- import * as os from 'os'
7
- import * as path from 'path'
3
+ import dotenv from 'dotenv'
4
+ import debug from 'debug'
5
+ import fsx from 'fs-extra'
6
+ import os from 'node:os'
7
+ import path from 'node:path'
8
8
  import {transpile} from '@stepzen/transpiler'
9
- import {rmtemp} from './rmtemp'
9
+ import {rmtemp} from './rmtemp.js'
10
10
 
11
11
  /**
12
12
  * @returns `undefined` when called without arguments
@@ -1,9 +1,9 @@
1
1
  // Copyright IBM Corp. 2020, 2024
2
2
 
3
- import * as debug from 'debug'
4
- import * as fs from 'fs'
5
- import * as glob from 'glob'
6
- import * as yaml from 'yaml'
3
+ import debug from 'debug'
4
+ import fs from 'node:fs'
5
+ import glob from 'glob'
6
+ import yaml from 'yaml'
7
7
 
8
8
  // Validate the Configurationset file
9
9
  export const validateConfigurationset = async (file: string | undefined) => {