@cms0/cms0 0.0.8 → 0.0.9
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/dist/cjs/index.cjs +35 -3
- package/dist/esm/index.js +2 -3
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,8 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
36
|
exports.cms0 = cms0;
|
|
4
37
|
const schema_descriptors_1 = require("@cms0/cms0/schema-descriptors");
|
|
5
|
-
const
|
|
38
|
+
const Shared = __importStar(require("@cms0/shared"));
|
|
6
39
|
/**
|
|
7
40
|
* Initializes the CMS SDK for a given schema.
|
|
8
41
|
* @param config configuration including API base URL or database URL.
|
|
@@ -11,7 +44,6 @@ const shared_1 = require("@cms0/shared");
|
|
|
11
44
|
function cms0(config) {
|
|
12
45
|
const baseUrl = config.apiConfig?.baseUrl?.replace(/\/$/, "") ?? "";
|
|
13
46
|
const apiKey = config.apiConfig?.key;
|
|
14
|
-
console.log("apiKey: ", apiKey);
|
|
15
47
|
return new Proxy({}, {
|
|
16
48
|
get(target, prop) {
|
|
17
49
|
if (!(prop in schema_descriptors_1.schemaDescriptor.roots)) {
|
|
@@ -31,7 +63,7 @@ function cms0(config) {
|
|
|
31
63
|
}
|
|
32
64
|
const data = await res.json();
|
|
33
65
|
// Validate via Zod
|
|
34
|
-
const { zodSchemas } =
|
|
66
|
+
const { zodSchemas } = Shared.buildZodSchemasFromDescriptor(schema_descriptors_1.schemaDescriptor);
|
|
35
67
|
const schema = zodSchemas[prop];
|
|
36
68
|
if (!schema) {
|
|
37
69
|
// If no schema found, return the raw data
|
package/dist/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { schemaDescriptor } from "@cms0/cms0/schema-descriptors";
|
|
2
|
-
import
|
|
2
|
+
import * as Shared from "@cms0/shared";
|
|
3
3
|
/**
|
|
4
4
|
* Initializes the CMS SDK for a given schema.
|
|
5
5
|
* @param config configuration including API base URL or database URL.
|
|
@@ -8,7 +8,6 @@ import { buildZodSchemasFromDescriptor } from "@cms0/shared";
|
|
|
8
8
|
export function cms0(config) {
|
|
9
9
|
const baseUrl = config.apiConfig?.baseUrl?.replace(/\/$/, "") ?? "";
|
|
10
10
|
const apiKey = config.apiConfig?.key;
|
|
11
|
-
console.log("apiKey: ", apiKey);
|
|
12
11
|
return new Proxy({}, {
|
|
13
12
|
get(target, prop) {
|
|
14
13
|
if (!(prop in schemaDescriptor.roots)) {
|
|
@@ -28,7 +27,7 @@ export function cms0(config) {
|
|
|
28
27
|
}
|
|
29
28
|
const data = await res.json();
|
|
30
29
|
// Validate via Zod
|
|
31
|
-
const { zodSchemas } = buildZodSchemasFromDescriptor(schemaDescriptor);
|
|
30
|
+
const { zodSchemas } = Shared.buildZodSchemasFromDescriptor(schemaDescriptor);
|
|
32
31
|
const schema = zodSchemas[prop];
|
|
33
32
|
if (!schema) {
|
|
34
33
|
// If no schema found, return the raw data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKlD,MAAM,MAAM,WAAW,CAAC,MAAM,IAAI;KAC/B,CAAC,IAAI,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAkDrE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cms0/cms0",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "restricted"
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"ts-node": "^10.9.2",
|
|
58
58
|
"typescript": "^5.9.3",
|
|
59
59
|
"zod": "^4.1.12",
|
|
60
|
-
"@cms0/shared": "0.0.
|
|
60
|
+
"@cms0/shared": "0.0.5"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/lodash": "^4.17.21",
|