@kravc/dos 2.0.0-alpha.21 → 2.0.0-alpha.22
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/.claude/settings.local.json +16 -1
- package/dist/Service/test/ensureItem.d.ts.map +1 -1
- package/dist/Service/test/ensureItem.js +1 -0
- package/dist/Service/test/ensureItem.js.map +1 -1
- package/dist/Service/test/ensureNoItem.d.ts.map +1 -1
- package/dist/Service/test/ensureNoItem.js +1 -0
- package/dist/Service/test/ensureNoItem.js.map +1 -1
- package/dist/Service/test/firstItemGet.d.ts.map +1 -1
- package/dist/Service/test/firstItemGet.js +1 -0
- package/dist/Service/test/firstItemGet.js.map +1 -1
- package/dist/Service/useComposerMiddleware.d.ts.map +1 -1
- package/dist/Service/useComposerMiddleware.js +3 -2
- package/dist/Service/useComposerMiddleware.js.map +1 -1
- package/package.json +5 -4
- package/src/Service/test/ensureItem.ts +1 -0
- package/src/Service/test/ensureNoItem.ts +1 -0
- package/src/Service/test/firstItemGet.ts +1 -0
- package/src/Service/useComposerMiddleware.ts +3 -2
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
|
-
"Bash(
|
|
4
|
+
"Bash(npm outdated:*)",
|
|
5
|
+
"Bash(npm info:*)",
|
|
6
|
+
"Bash(npm pack:*)",
|
|
7
|
+
"Bash(node -e \"const m = require\\(''''/Users/ok/dev/dos/dos/node_modules/read-yaml-file''''\\); console.log\\(Object.keys\\(m\\)\\)\")",
|
|
8
|
+
"Bash(tar -tf read-yaml-file-3.0.0.tgz)",
|
|
9
|
+
"Bash(tar -xOf read-yaml-file-3.0.0.tgz package/index.js)",
|
|
10
|
+
"Bash(rm -f read-yaml-file-3.0.0.tgz)",
|
|
11
|
+
"Bash(tar -xOf z-schema-12.1.1.tgz package/package.json)",
|
|
12
|
+
"Bash(node -e \"const d=JSON.parse\\(require\\(''''fs''''\\).readFileSync\\(''''/dev/stdin'''',''''utf8''''\\)\\); console.log\\(''''type:'''', d.type, ''''main:'''', d.main, ''''exports:'''', JSON.stringify\\(d.exports, null, 2\\)\\)\")",
|
|
13
|
+
"Bash(rm -f z-schema-12.1.1.tgz)",
|
|
14
|
+
"Bash(npm install:*)",
|
|
15
|
+
"Bash(npx tsc:*)",
|
|
16
|
+
"Bash(node -e \"const ZSchema = require\\(''''/Users/ok/dev/dos/dos/node_modules/z-schema''''\\); console.log\\(Object.getOwnPropertyNames\\(ZSchema.prototype\\).join\\(''''\\\\n''''\\)\\)\")",
|
|
17
|
+
"Bash(node:*)",
|
|
18
|
+
"Bash(npx tsc@5.9.3 --noEmit)",
|
|
19
|
+
"Bash(npm test:*)"
|
|
5
20
|
]
|
|
6
21
|
}
|
|
7
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensureItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":"AACA,OAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9D,4DAA4D;AAC5D,QAAA,MAAM,UAAU,GAAI,OAAO,KAAK,EAAE,OAAO,KAAK,SAG7C,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/// <reference types="jest" />
|
|
6
7
|
const findItem_1 = __importDefault(require("./findItem"));
|
|
7
8
|
/** Ensures item to exists in a list for specified query. */
|
|
8
9
|
const ensureItem = (items, query) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8D;AAE9D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,KAAY,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"ensureItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureItem.ts"],"names":[],"mappings":";;;;;AAAA,8BAA8B;AAC9B,0DAA8D;AAE9D,4DAA4D;AAC5D,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,KAAY,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACpC,MAAM,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureNoItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ensureNoItem.d.ts","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":"AACA,OAAiB,EAAE,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAE9D,iEAAiE;AACjE,QAAA,MAAM,YAAY,GAAI,MAAM,KAAK,EAAE,OAAO,KAAK,SAG9C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
/// <reference types="jest" />
|
|
6
7
|
const findItem_1 = __importDefault(require("./findItem"));
|
|
7
8
|
/** Ensures item does not exist in a list for specified query. */
|
|
8
9
|
const ensureNoItem = (data, query) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensureNoItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":";;;;;AAAA,0DAA8D;AAE9D,iEAAiE;AACjE,MAAM,YAAY,GAAG,CAAC,IAAW,EAAE,KAAY,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"ensureNoItem.js","sourceRoot":"","sources":["../../../src/Service/test/ensureNoItem.ts"],"names":[],"mappings":";;;;;AAAA,8BAA8B;AAC9B,0DAA8D;AAE9D,iEAAiE;AACjE,MAAM,YAAY,GAAG,CAAC,IAAW,EAAE,KAAY,EAAE,EAAE;IACjD,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AAC/B,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstItemGet.d.ts","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"firstItemGet.d.ts","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,4FAA4F;AAC5F,QAAA,MAAM,YAAY,GAAI,OAAO,KAAK,EAAE,eAAe,MAAM,EAAE,sBAAqB,OAAe,YAU9F,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/// <reference types="jest" />
|
|
3
4
|
const lodash_1 = require("lodash");
|
|
4
5
|
const schema_1 = require("@kravc/schema");
|
|
5
6
|
/** Returns value or ensures specified attribute exists for the first item from the list. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firstItemGet.js","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":";;AAAA,mCAA6B;AAC7B,0CAAoC;AAGpC,4FAA4F;AAC5F,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,aAAqB,EAAE,sBAA+B,KAAK,EAAE,EAAE;IACjG,MAAM,CAAE,SAAS,CAAE,GAAG,KAAK,CAAC;IAE5B,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,IAAA,YAAG,EAAC,SAAS,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;IAEhC,OAAO,IAAA,YAAG,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"firstItemGet.js","sourceRoot":"","sources":["../../../src/Service/test/firstItemGet.ts"],"names":[],"mappings":";;AAAA,8BAA8B;AAC9B,mCAA6B;AAC7B,0CAAoC;AAGpC,4FAA4F;AAC5F,MAAM,YAAY,GAAG,CAAC,KAAY,EAAE,aAAqB,EAAE,sBAA+B,KAAK,EAAE,EAAE;IACjG,MAAM,CAAE,SAAS,CAAE,GAAG,KAAK,CAAC;IAE5B,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO,IAAA,YAAG,EAAC,SAAS,IAAI,EAAE,EAAE,aAAa,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,CAAC;IAEhC,OAAO,IAAA,YAAG,EAAC,SAAS,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC,CAAC;AAEF,kBAAe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerMiddleware.d.ts","sourceRoot":"","sources":["../../src/Service/useComposerMiddleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useComposerMiddleware.d.ts","sourceRoot":"","sources":["../../src/Service/useComposerMiddleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAc1C,8DAA8D;AAC9D,QAAA,MAAM,qBAAqB,GAAI,UAAU,OAAO,EAAE,SAAS,OAAO;;;;;;QAqCjE,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const fs_1 = require("fs");
|
|
4
|
+
const js_yaml_1 = require("js-yaml");
|
|
4
5
|
const useOasMiddleware_1 = require("./useOasMiddleware");
|
|
5
6
|
const ROOT_PATH = process.cwd();
|
|
6
7
|
const COMPOSER_FILES = [
|
|
@@ -18,7 +19,7 @@ const useComposerMiddleware = (_service, context) => {
|
|
|
18
19
|
/** Returns specified composer source file. */
|
|
19
20
|
const readFileJson = (httpPath) => {
|
|
20
21
|
const fileName = httpPath.replace('/', '');
|
|
21
|
-
const composerSource = (0,
|
|
22
|
+
const composerSource = (0, js_yaml_1.load)((0, fs_1.readFileSync)(`${ROOT_PATH}/.composer/${fileName}`, 'utf8'));
|
|
22
23
|
return JSON.stringify(composerSource, null, 2);
|
|
23
24
|
};
|
|
24
25
|
const isComposerPath = COMPOSER_FILES.includes(httpPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComposerMiddleware.js","sourceRoot":"","sources":["../../src/Service/useComposerMiddleware.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"useComposerMiddleware.js","sourceRoot":"","sources":["../../src/Service/useComposerMiddleware.ts"],"names":[],"mappings":";;AAAA,2BAAkC;AAClC,qCAA+B;AAE/B,yDAA0D;AAE1D,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAEhC,MAAM,cAAc,GAAG;IACrB,aAAa;IACb,eAAe;IACf,iBAAiB;IACjB,iBAAiB;IACjB,kBAAkB;IAClB,kBAAkB;CACnB,CAAC;AAEF,8DAA8D;AAC9D,MAAM,qBAAqB,GAAG,CAAC,QAAiB,EAAE,OAAgB,EAAE,EAAE;IACpE,MAAM,EACJ,QAAQ,EACR,UAAU,EACV,aAAa,EACd,GAAG,OAAO,CAAC;IAEZ,MAAM,YAAY,GAAG,UAAU,KAAK,KAAK,CAAC;IAE1C,8CAA8C;IAC9C,MAAM,YAAY,GAAG,CAAC,QAAgB,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAC3C,MAAM,cAAc,GAAG,IAAA,cAAI,EAAC,IAAA,iBAAY,EAAC,GAAG,SAAS,cAAc,QAAQ,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;QAExF,OAAO,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC;IAEF,MAAM,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEzD,MAAM,0BAA0B,GAC9B,aAAa;QACb,YAAY;QACZ,cAAc,CAAC;IAEjB,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAExC,OAAO;QACL,OAAO,EAAE;YACP,cAAc,EAAE,4BAAS;SAC1B;QACD,UAAU,EAAE,4BAAS;QACrB,IAAI,EAAE,QAAQ;KACf,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,qBAAqB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kravc/dos",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.22",
|
|
4
4
|
"description": "Convention-based, easy-to-use library for building API-driven serverless services.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Service",
|
|
@@ -35,13 +35,13 @@
|
|
|
35
35
|
"author": "Oleksandr Kravets <a@kra.vc>",
|
|
36
36
|
"license": "ISC",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@kravc/schema": "^2.8.
|
|
38
|
+
"@kravc/schema": "^2.8.3",
|
|
39
39
|
"@types/jsonwebtoken": "^9.0.10",
|
|
40
40
|
"cookie": "^1.1.1",
|
|
41
|
+
"js-yaml": "^4.1.1",
|
|
41
42
|
"jsonwebtoken": "^9.0.3",
|
|
42
43
|
"lodash": "^4.17.23",
|
|
43
44
|
"pluralize": "^8.0.0",
|
|
44
|
-
"read-yaml-file": "^2.1.0",
|
|
45
45
|
"safe-stable-stringify": "^2.5.0",
|
|
46
46
|
"ulid": "^3.0.2",
|
|
47
47
|
"z-schema": "^6.0.2"
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"@eslint/js": "^10.0.1",
|
|
51
51
|
"@kravc/http": "^0.5.0",
|
|
52
52
|
"@types/jest": "^30.0.0",
|
|
53
|
+
"@types/js-yaml": "^4.0.9",
|
|
53
54
|
"@types/lodash": "^4.17.23",
|
|
54
55
|
"@types/pluralize": "^0.0.33",
|
|
55
56
|
"eslint": "^10.0.1",
|
|
@@ -60,7 +61,7 @@
|
|
|
60
61
|
"rimraf": "^6.1.3",
|
|
61
62
|
"ts-jest": "^29.4.6",
|
|
62
63
|
"ts-node": "^10.9.2",
|
|
63
|
-
"typescript": "^
|
|
64
|
+
"typescript": "^6.0.2",
|
|
64
65
|
"typescript-eslint": "^8.56.0"
|
|
65
66
|
}
|
|
66
67
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import { load } from 'js-yaml';
|
|
2
3
|
import type { Context } from '../Context';
|
|
3
4
|
import { OK_STATUS, JSON_TYPE } from './useOasMiddleware';
|
|
4
5
|
|
|
@@ -26,7 +27,7 @@ const useComposerMiddleware = (_service: unknown, context: Context) => {
|
|
|
26
27
|
/** Returns specified composer source file. */
|
|
27
28
|
const readFileJson = (httpPath: string) => {
|
|
28
29
|
const fileName = httpPath.replace('/', '');
|
|
29
|
-
const composerSource =
|
|
30
|
+
const composerSource = load(readFileSync(`${ROOT_PATH}/.composer/${fileName}`, 'utf8'));
|
|
30
31
|
|
|
31
32
|
return JSON.stringify(composerSource, null, 2);
|
|
32
33
|
};
|