@ossy/cli 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ossy/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ossy-se/packages.git"
@@ -24,5 +24,9 @@
24
24
  "access": "public",
25
25
  "registry": "https://registry.npmjs.org"
26
26
  },
27
- "gitHead": "80c0c70120640e7b389d1881a71b2376fd523095"
27
+ "files": [
28
+ "/build",
29
+ "README.md"
30
+ ],
31
+ "gitHead": "a768d71e76cc523f367cd764a403c0960f8d2e93"
28
32
  }
package/CHANGELOG.md DELETED
@@ -1,163 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## 0.1.3 (2025-10-31)
7
-
8
- **Note:** Version bump only for package @ossy/cli
9
-
10
-
11
-
12
-
13
-
14
- ## 0.1.2 (2025-10-31)
15
-
16
- **Note:** Version bump only for package @ossy/cli
17
-
18
-
19
-
20
-
21
-
22
- ## 0.1.1 (2025-10-31)
23
-
24
- **Note:** Version bump only for package @ossy/cli
25
-
26
-
27
-
28
-
29
-
30
- # 0.1.0 (2025-10-30)
31
-
32
-
33
- ### Features
34
-
35
- * **sdk:** get current workspace ([#4](https://github.com/ossy-se/packages/issues/4)) ([afce7d5](https://github.com/ossy-se/packages/commit/afce7d5787af42691f62c9eba672ea1be000e19e))
36
-
37
-
38
-
39
-
40
-
41
- ## 0.0.21 (2025-10-30)
42
-
43
- **Note:** Version bump only for package @ossy/cli
44
-
45
-
46
-
47
-
48
-
49
- ## 0.0.20 (2025-10-27)
50
-
51
- **Note:** Version bump only for package @ossy/cli
52
-
53
-
54
-
55
-
56
-
57
- ## 0.0.19 (2025-10-27)
58
-
59
- **Note:** Version bump only for package @ossy/cli
60
-
61
-
62
-
63
-
64
-
65
- ## 0.0.18 (2025-10-27)
66
-
67
- **Note:** Version bump only for package @ossy/cli
68
-
69
-
70
-
71
-
72
-
73
- ## 0.0.17 (2025-10-27)
74
-
75
- **Note:** Version bump only for package @ossy/cli
76
-
77
-
78
-
79
-
80
-
81
- ## 0.0.16 (2025-10-27)
82
-
83
- **Note:** Version bump only for package @ossy/cli
84
-
85
-
86
-
87
-
88
-
89
- ## 0.0.15 (2025-10-25)
90
-
91
- **Note:** Version bump only for package @ossy/cli
92
-
93
-
94
-
95
-
96
-
97
- ## 0.0.14 (2025-10-25)
98
-
99
- **Note:** Version bump only for package @ossy/cli
100
-
101
-
102
-
103
-
104
-
105
- ## 0.0.13 (2025-10-25)
106
-
107
- **Note:** Version bump only for package @ossy/cli
108
-
109
-
110
-
111
-
112
-
113
- ## 0.0.12 (2025-10-25)
114
-
115
- **Note:** Version bump only for package @ossy/cli
116
-
117
-
118
-
119
-
120
-
121
- ## [0.0.11](https://github.com/ossy-se/packages/compare/@ossy/cli@0.0.10...@ossy/cli@0.0.11) (2025-10-25)
122
-
123
- **Note:** Version bump only for package @ossy/cli
124
-
125
-
126
-
127
-
128
-
129
- ## 0.0.10 (2025-10-25)
130
-
131
- **Note:** Version bump only for package @ossy/cli
132
-
133
-
134
-
135
-
136
-
137
- ## 0.0.9 (2025-10-25)
138
-
139
- **Note:** Version bump only for package @ossy/cli
140
-
141
-
142
-
143
-
144
-
145
- ## 0.0.8 (2025-10-25)
146
-
147
- **Note:** Version bump only for package @ossy/cli
148
-
149
-
150
-
151
-
152
-
153
- ## 0.0.7 (2025-10-25)
154
-
155
- **Note:** Version bump only for package @ossy/cli
156
-
157
-
158
-
159
-
160
-
161
- ## 0.0.6 (2025-10-25)
162
-
163
- **Note:** Version bump only for package @ossy/cli
package/src/cms/cli.js DELETED
@@ -1,67 +0,0 @@
1
- #!/usr/bin/env node
2
- import { resolve } from 'path'
3
- import { readFileSync } from 'fs'
4
- import arg from 'arg'
5
- import fetch from 'node-fetch'
6
- import { logInfo, logError, logErrorAndReject, logDebug } from '../log.js'
7
-
8
- const Api = {
9
- uploadResourceTemplates: (apiUrl, token, workspaceId, resourceTemplates) => {
10
- const endpoint = `${apiUrl}/workspaces/${workspaceId}/resource-templates`
11
-
12
- const fetchOptions = {
13
- method: 'POST',
14
- headers: { 'Authorization': token, 'Content-Type': 'application/json' },
15
- body: JSON.stringify(resourceTemplates)
16
- }
17
-
18
- return fetch(endpoint, fetchOptions)
19
- }
20
- }
21
-
22
- const resolveConfigImport = path => path.endsWith('json')
23
- ? Promise.resolve(JSON.parse(readFileSync(path), 'utf8'))
24
- : import(path)
25
-
26
- const importResourceTemplates = options => {
27
-
28
- const parsedArgs = arg({
29
- '--authentication': String,
30
- '--a': '--authentication',
31
-
32
- '--config': String,
33
- '-c': '--config',
34
- }, { argv: options })
35
-
36
- logInfo({ message: '[CMS] reading files' })
37
- const token = parsedArgs['--authentication'];
38
- const filePath = resolve(parsedArgs['--config'])
39
-
40
- if (!token) return logErrorAndReject({ message: '[CMS] No token provided with --authentication'})
41
-
42
- return resolveConfigImport(filePath)
43
- .then(module => {
44
- const config = module?.default
45
- const apiUrl = config?.apiUrl || 'https://api.ossy.se/api/v0'
46
- const workspaceId = config?.workspaceId
47
- const resourceTemplates = config?.resourceTemplates
48
-
49
- if (!workspaceId) return logErrorAndReject({ message: '[CMS] No workspaceId provided in ossy.json'})
50
- if (!resourceTemplates) return logErrorAndReject({ message: '[CMS] No resource templates provided in ossy.json'})
51
-
52
- logInfo({ message: '[CMS] uploading resource templates' })
53
-
54
- Api.uploadResourceTemplates(apiUrl, token, workspaceId, resourceTemplates)
55
- .then(response => {
56
- logInfo({ message: '[CMS] Done' })
57
- })
58
- .catch(error => logError({ message: '[CMS] Error', error }))
59
- })
60
-
61
- }
62
-
63
- export const handler = ([command, ...options]) => {
64
- !!command
65
- ? { 'import-resource-templates': importResourceTemplates }[command](options)
66
- : logError({ message: '[CMS] No command provided' })
67
- }
package/src/log.js DELETED
@@ -1,44 +0,0 @@
1
- // interface LogInput {
2
- // type: TypeOfMessage;
3
- // message: string;
4
- // data?: any;
5
- // dataPrefix: string;
6
- // }
7
-
8
- const TypeOfMessage = {
9
- Info: 'INFO',
10
- Error: 'ERROR',
11
- Debug: 'DEBUG'
12
- }
13
-
14
-
15
- export const log = (...params) => { console.log(...params) }
16
- const prefixTo = (prefix, message) => `[${prefix}]${message.startsWith('[') ? '' : ': '}`
17
-
18
- export const logInfo = logInput => {
19
- const messagePrefix = prefixTo(TypeOfMessage.Info, logInput.message)
20
- log(`${messagePrefix}${logInput.message}`)
21
- }
22
-
23
- export const logError = logInput => {
24
- const messagePrefix = prefixTo(TypeOfMessage.Error, logInput.message)
25
- log('\n')
26
- log(`${messagePrefix}${logInput.message}`)
27
- logInput.error && log('[Reason]:', logInput.error)
28
- log('\n')
29
- }
30
-
31
- export const logDebug = logInput => {
32
- const isDebugOn = process.env.DEBUG || true
33
- if (!isDebugOn) return
34
- const messagePrefix = prefixTo(TypeOfMessage.Debug, logInput.message)
35
- log('\n')
36
- log(`${messagePrefix}${logInput.message}`)
37
- logInput.data && log('[DEBUG DATA]:', logInput.data)
38
- log('\n')
39
- }
40
-
41
- export const logErrorAndReject = logInput => {
42
- logError(logInput)
43
- return Promise.reject(logInput.error)
44
- }