@stepzen/sdk 0.44.0 → 0.45.0-experimental.32a4304
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/lib/client-v2.d.ts +6 -6
- package/lib/client-v2.d.ts.map +1 -1
- package/lib/client-v2.js +16 -21
- package/lib/client-v2.js.map +1 -1
- package/lib/client.d.ts +10 -10
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +18 -24
- package/lib/client.js.map +1 -1
- package/lib/commands/account.d.ts +1 -1
- package/lib/commands/account.d.ts.map +1 -1
- package/lib/commands/account.js +8 -10
- package/lib/commands/account.js.map +1 -1
- package/lib/commands/authenticate.d.ts +1 -1
- package/lib/commands/authenticate.d.ts.map +1 -1
- package/lib/commands/authenticate.js +8 -10
- package/lib/commands/authenticate.js.map +1 -1
- package/lib/commands/deploy.d.ts +1 -1
- package/lib/commands/deploy.d.ts.map +1 -1
- package/lib/commands/deploy.js +7 -9
- package/lib/commands/deploy.js.map +1 -1
- package/lib/commands/getPublicAccount.d.ts +1 -1
- package/lib/commands/getPublicAccount.d.ts.map +1 -1
- package/lib/commands/getPublicAccount.js +6 -8
- package/lib/commands/getPublicAccount.js.map +1 -1
- package/lib/commands/list.d.ts +1 -1
- package/lib/commands/list.d.ts.map +1 -1
- package/lib/commands/list.js +7 -9
- package/lib/commands/list.js.map +1 -1
- package/lib/commands/upload.d.ts +1 -1
- package/lib/commands/upload.d.ts.map +1 -1
- package/lib/commands/upload.js +18 -20
- package/lib/commands/upload.js.map +1 -1
- package/lib/commands-v2/account.d.ts +1 -1
- package/lib/commands-v2/account.d.ts.map +1 -1
- package/lib/commands-v2/account.js +3 -5
- package/lib/commands-v2/account.js.map +1 -1
- package/lib/commands-v2/delete.d.ts +1 -1
- package/lib/commands-v2/delete.d.ts.map +1 -1
- package/lib/commands-v2/delete.js +4 -6
- package/lib/commands-v2/delete.js.map +1 -1
- package/lib/commands-v2/deploy.d.ts +1 -1
- package/lib/commands-v2/deploy.d.ts.map +1 -1
- package/lib/commands-v2/deploy.js +3 -5
- package/lib/commands-v2/deploy.js.map +1 -1
- package/lib/commands-v2/getPublicAccount.d.ts +1 -1
- package/lib/commands-v2/getPublicAccount.d.ts.map +1 -1
- package/lib/commands-v2/getPublicAccount.js +3 -5
- package/lib/commands-v2/getPublicAccount.js.map +1 -1
- package/lib/commands-v2/list.d.ts +1 -1
- package/lib/commands-v2/list.d.ts.map +1 -1
- package/lib/commands-v2/list.js +3 -5
- package/lib/commands-v2/list.js.map +1 -1
- package/lib/index.d.ts +4 -13
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -28
- package/lib/index.js.map +1 -1
- package/lib/init-v2.d.ts +5 -5
- package/lib/init-v2.d.ts.map +1 -1
- package/lib/init-v2.js +7 -11
- package/lib/init-v2.js.map +1 -1
- package/lib/init.d.ts +8 -8
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +7 -11
- package/lib/init.js.map +1 -1
- package/lib/shared/constants.js +6 -9
- package/lib/shared/constants.js.map +1 -1
- package/lib/shared/graphql-client.d.ts +5 -4
- package/lib/shared/graphql-client.d.ts.map +1 -1
- package/lib/shared/graphql-client.js +11 -17
- package/lib/shared/graphql-client.js.map +1 -1
- package/lib/shared/payloads.d.ts +2 -2
- package/lib/shared/payloads.d.ts.map +1 -1
- package/lib/shared/payloads.js +18 -25
- package/lib/shared/payloads.js.map +1 -1
- package/lib/shared/request.d.ts +1 -1
- package/lib/shared/request.d.ts.map +1 -1
- package/lib/shared/request.js +7 -11
- package/lib/shared/request.js.map +1 -1
- package/lib/shared/rmtemp.js +6 -10
- package/lib/shared/rmtemp.js.map +1 -1
- package/lib/shared/transpiling.js +10 -14
- package/lib/shared/transpiling.js.map +1 -1
- package/lib/shared/types.js +1 -2
- package/lib/shared/types.js.map +1 -1
- package/lib/shared/validation.js +6 -11
- package/lib/shared/validation.js.map +1 -1
- package/package.json +8 -6
- package/src/client-v2.ts +7 -7
- package/src/client.ts +7 -7
- package/src/commands/account.ts +4 -4
- package/src/commands/authenticate.ts +4 -4
- package/src/commands/deploy.ts +4 -4
- package/src/commands/getPublicAccount.ts +3 -3
- package/src/commands/list.ts +4 -4
- package/src/commands/upload.ts +9 -9
- package/src/commands-v2/account.ts +2 -2
- package/src/commands-v2/delete.ts +3 -3
- package/src/commands-v2/deploy.ts +2 -2
- package/src/commands-v2/getPublicAccount.ts +2 -2
- package/src/commands-v2/list.ts +2 -2
- package/src/index.ts +4 -27
- package/src/init-v2.ts +4 -4
- package/src/init.ts +4 -4
- package/src/shared/graphql-client.ts +8 -7
- package/src/shared/payloads.ts +12 -12
- package/src/shared/request.ts +8 -3
- package/src/shared/rmtemp.ts +4 -4
- package/src/shared/transpiling.ts +6 -6
- package/src/shared/validation.ts +4 -4
package/src/commands/upload.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
// Copyright IBM Corp. 2020, 2024
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
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
|
|
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,
|
package/src/commands-v2/list.ts
CHANGED
|
@@ -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
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export
|
|
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
|
|
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
|
|
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)
|
package/src/shared/payloads.ts
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
// This file contains helpers that zip a file or directory
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
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 'form-data'
|
|
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 yaml from 'yaml'
|
|
13
|
+
import {transpileConfigurationset} from './transpiling.js'
|
|
14
|
+
import {validateConfigurationset} from './validation.js'
|
|
15
|
+
import {Configuration, SchemaFiles} from './types.js'
|
|
16
|
+
import {rmtemp} from './rmtemp.js'
|
|
17
17
|
|
|
18
18
|
type YamlPayload = FormData
|
|
19
19
|
type ZipPayload = FormData
|
package/src/shared/request.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// Copyright IBM Corp. 2020, 2024
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import os from 'node:os'
|
|
4
4
|
import * as isWsl from 'is-wsl'
|
|
5
|
-
import {
|
|
5
|
+
import {createRequire} from 'node:module'
|
|
6
|
+
import {
|
|
7
|
+
SDKConfiguration,
|
|
8
|
+
StepZenAccount,
|
|
9
|
+
ZenCtlRequestHeaders,
|
|
10
|
+
} from './types.js'
|
|
6
11
|
|
|
7
|
-
const {version} =
|
|
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
|
package/src/shared/rmtemp.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright IBM Corp. 2020, 2024
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
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
|
package/src/shared/validation.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright IBM Corp. 2020, 2024
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
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) => {
|