@blinkk/root-cms 1.0.0-alpha.0 → 1.0.0-alpha.10
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/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +6 -0
- package/dist/plugin.js +17 -0
- package/dist/plugin.js.map +1 -0
- package/dist/schema.d.ts +2 -1
- package/dist/schema.js.map +1 -1
- package/package.json +20 -11
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export const test = {};\n"],"mappings":";AAAO,IAAM,OAAO,CAAC;","names":[]}
|
package/dist/plugin.d.ts
ADDED
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
function cmsPlugin(options) {
|
|
3
|
+
return {
|
|
4
|
+
name: "root-cms",
|
|
5
|
+
configureServer: (server) => {
|
|
6
|
+
server.use("/cms", (req, res) => {
|
|
7
|
+
console.log("root config context var:");
|
|
8
|
+
console.log(req.rootConfig);
|
|
9
|
+
res.end("cms");
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
cmsPlugin
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/plugin.ts"],"sourcesContent":["import {Plugin, Request, Response} from '@blinkk/root';\n\ntype CMSPluginOptions = {};\n\nexport function cmsPlugin(options?: CMSPluginOptions): Plugin {\n return {\n name: 'root-cms',\n configureServer: (server) => {\n server.use('/cms', (req: Request, res: Response) => {\n console.log('root config context var:');\n console.log(req.rootConfig);\n res.end('cms');\n });\n },\n };\n}\n"],"mappings":";AAIO,SAAS,UAAU,SAAoC;AAC5D,SAAO;AAAA,IACL,MAAM;AAAA,IACN,iBAAiB,CAAC,WAAW;AAC3B,aAAO,IAAI,QAAQ,CAAC,KAAc,QAAkB;AAClD,gBAAQ,IAAI,0BAA0B;AACtC,gBAAQ,IAAI,IAAI,UAAU;AAC1B,YAAI,IAAI,KAAK;AAAA,MACf,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
|
package/dist/schema.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ interface CommonFieldProps {
|
|
|
5
5
|
type: string;
|
|
6
6
|
default?: any;
|
|
7
7
|
hidden?: boolean;
|
|
8
|
+
deprecated?: boolean;
|
|
8
9
|
}
|
|
9
10
|
declare type StringField = CommonFieldProps & {
|
|
10
11
|
type: 'string';
|
|
@@ -61,7 +62,7 @@ declare type ArrayField = CommonFieldProps & {
|
|
|
61
62
|
type: 'array';
|
|
62
63
|
default?: Array<any>;
|
|
63
64
|
preview?: (value: any) => string;
|
|
64
|
-
of: ObjectField | OneOfField;
|
|
65
|
+
of: ImageField | ObjectField | OneOfField;
|
|
65
66
|
};
|
|
66
67
|
declare function array(field: Omit<ArrayField, 'type'>): ArrayField;
|
|
67
68
|
declare type OneOfField = CommonFieldProps & {
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/schema.ts"],"sourcesContent":["export interface CommonFieldProps {\n id?: string;\n label?: string;\n help?: string;\n type: string;\n default?: any;\n hidden?: boolean;\n}\n\nexport type StringField = CommonFieldProps & {\n type: 'string';\n default?: string;\n translate?: boolean;\n};\n\nexport function string(field: Omit<StringField, 'type'>): StringField {\n return {...field, type: 'string'};\n}\n\nexport type NumberField = CommonFieldProps & {\n type: 'number';\n default?: number;\n};\n\nexport function number(field: Omit<NumberField, 'type'>): NumberField {\n return {...field, type: 'number'};\n}\n\nexport type DateField = CommonFieldProps & {\n type: 'date';\n default?: string;\n};\n\nexport function date(field: Omit<DateField, 'type'>): DateField {\n return {...field, type: 'date'};\n}\n\nexport type DateTimeField = CommonFieldProps & {\n type: 'datetime';\n default?: string;\n};\n\nexport function datetime(field: Omit<DateTimeField, 'type'>): DateTimeField {\n return {...field, type: 'datetime'};\n}\n\nexport type BooleanField = CommonFieldProps & {\n type: 'boolean';\n default?: boolean;\n};\n\nexport function boolean(field: Omit<BooleanField, 'type'>): BooleanField {\n return {...field, type: 'boolean'};\n}\n\nexport type SelectField = CommonFieldProps & {\n type: 'select';\n default?: string;\n options?: {\n values?: Array<{value: string; label?: string}>;\n };\n};\n\nexport function select(field: Omit<SelectField, 'type'>): SelectField {\n return {...field, type: 'select'};\n}\n\nexport type MultiSelectField = Omit<SelectField, 'type'> & {\n type: 'multiselect';\n default?: string[];\n};\n\nexport function multiselect(\n field: Omit<MultiSelectField, 'type'>\n): MultiSelectField {\n return {...field, type: 'multiselect'};\n}\n\nexport type ImageField = CommonFieldProps & {\n type: 'image';\n};\n\nexport function image(field: Omit<ImageField, 'type'>): ImageField {\n return {...field, type: 'image'};\n}\n\nexport type ObjectField = CommonFieldProps & {\n type: 'object';\n fields: FieldWithId[];\n};\n\nexport function object(field: Omit<ObjectField, 'type'>): ObjectField {\n return {...field, type: 'object'};\n}\n\nexport type ArrayField = CommonFieldProps & {\n type: 'array';\n default?: Array<any>;\n preview?: (value: any) => string;\n of: ObjectField | OneOfField;\n};\n\nexport function array(field: Omit<ArrayField, 'type'>): ArrayField {\n return {...field, type: 'array'};\n}\n\nexport type OneOfField = CommonFieldProps & {\n type: 'oneof';\n types: Array<Schema>;\n};\n\nexport function oneOf(field: Omit<OneOfField, 'type'>): OneOfField {\n return {...field, type: 'oneof'};\n}\n\nexport type Field =\n | StringField\n | NumberField\n | DateField\n | DateTimeField\n | BooleanField\n | SelectField\n | MultiSelectField\n | ImageField\n | ObjectField\n | ArrayField\n | OneOfField;\n\nexport type FieldWithId = Field;\n\nexport interface Schema {\n name: string;\n description?: string;\n fields: Array<FieldWithId>;\n}\n\nexport function defineSchema(schema: Schema): Schema {\n return schema;\n}\n\nexport const define = defineSchema;\n"],"mappings":";
|
|
1
|
+
{"version":3,"sources":["../src/schema.ts"],"sourcesContent":["export interface CommonFieldProps {\n id?: string;\n label?: string;\n help?: string;\n type: string;\n default?: any;\n hidden?: boolean;\n deprecated?: boolean;\n}\n\nexport type StringField = CommonFieldProps & {\n type: 'string';\n default?: string;\n translate?: boolean;\n};\n\nexport function string(field: Omit<StringField, 'type'>): StringField {\n return {...field, type: 'string'};\n}\n\nexport type NumberField = CommonFieldProps & {\n type: 'number';\n default?: number;\n};\n\nexport function number(field: Omit<NumberField, 'type'>): NumberField {\n return {...field, type: 'number'};\n}\n\nexport type DateField = CommonFieldProps & {\n type: 'date';\n default?: string;\n};\n\nexport function date(field: Omit<DateField, 'type'>): DateField {\n return {...field, type: 'date'};\n}\n\nexport type DateTimeField = CommonFieldProps & {\n type: 'datetime';\n default?: string;\n};\n\nexport function datetime(field: Omit<DateTimeField, 'type'>): DateTimeField {\n return {...field, type: 'datetime'};\n}\n\nexport type BooleanField = CommonFieldProps & {\n type: 'boolean';\n default?: boolean;\n};\n\nexport function boolean(field: Omit<BooleanField, 'type'>): BooleanField {\n return {...field, type: 'boolean'};\n}\n\nexport type SelectField = CommonFieldProps & {\n type: 'select';\n default?: string;\n options?: {\n values?: Array<{value: string; label?: string}>;\n };\n};\n\nexport function select(field: Omit<SelectField, 'type'>): SelectField {\n return {...field, type: 'select'};\n}\n\nexport type MultiSelectField = Omit<SelectField, 'type'> & {\n type: 'multiselect';\n default?: string[];\n};\n\nexport function multiselect(\n field: Omit<MultiSelectField, 'type'>\n): MultiSelectField {\n return {...field, type: 'multiselect'};\n}\n\nexport type ImageField = CommonFieldProps & {\n type: 'image';\n};\n\nexport function image(field: Omit<ImageField, 'type'>): ImageField {\n return {...field, type: 'image'};\n}\n\nexport type ObjectField = CommonFieldProps & {\n type: 'object';\n fields: FieldWithId[];\n};\n\nexport function object(field: Omit<ObjectField, 'type'>): ObjectField {\n return {...field, type: 'object'};\n}\n\nexport type ArrayField = CommonFieldProps & {\n type: 'array';\n default?: Array<any>;\n preview?: (value: any) => string;\n // NOTE(stevenle): the array field should only accept object values to keep\n // the schemas future-friendly. For example, if we were to accept primatives\n // (e.g. Array<string>) and the developer decides in the future that they\n // need to add extra fields to that array type, they would have to create a\n // new field, create a new schema field, and then perform a db migration to\n // update from the old field type to the new field type. But if we enforce\n // objects here, a developer should technically be able to add fields to the\n // nested field definition without breaking any existing db entries.\n of: ImageField | ObjectField | OneOfField;\n};\n\nexport function array(field: Omit<ArrayField, 'type'>): ArrayField {\n return {...field, type: 'array'};\n}\n\nexport type OneOfField = CommonFieldProps & {\n type: 'oneof';\n types: Array<Schema>;\n};\n\nexport function oneOf(field: Omit<OneOfField, 'type'>): OneOfField {\n return {...field, type: 'oneof'};\n}\n\nexport type Field =\n | StringField\n | NumberField\n | DateField\n | DateTimeField\n | BooleanField\n | SelectField\n | MultiSelectField\n | ImageField\n | ObjectField\n | ArrayField\n | OneOfField;\n\nexport type FieldWithId = Field;\n\nexport interface Schema {\n name: string;\n description?: string;\n fields: Array<FieldWithId>;\n}\n\nexport function defineSchema(schema: Schema): Schema {\n return schema;\n}\n\nexport const define = defineSchema;\n"],"mappings":";AAgBO,SAAS,OAAO,OAA+C;AACpE,SAAO,EAAC,GAAG,OAAO,MAAM,SAAQ;AAClC;AAOO,SAAS,OAAO,OAA+C;AACpE,SAAO,EAAC,GAAG,OAAO,MAAM,SAAQ;AAClC;AAOO,SAAS,KAAK,OAA2C;AAC9D,SAAO,EAAC,GAAG,OAAO,MAAM,OAAM;AAChC;AAOO,SAAS,SAAS,OAAmD;AAC1E,SAAO,EAAC,GAAG,OAAO,MAAM,WAAU;AACpC;AAOO,SAAS,QAAQ,OAAiD;AACvE,SAAO,EAAC,GAAG,OAAO,MAAM,UAAS;AACnC;AAUO,SAAS,OAAO,OAA+C;AACpE,SAAO,EAAC,GAAG,OAAO,MAAM,SAAQ;AAClC;AAOO,SAAS,YACd,OACkB;AAClB,SAAO,EAAC,GAAG,OAAO,MAAM,cAAa;AACvC;AAMO,SAAS,MAAM,OAA6C;AACjE,SAAO,EAAC,GAAG,OAAO,MAAM,QAAO;AACjC;AAOO,SAAS,OAAO,OAA+C;AACpE,SAAO,EAAC,GAAG,OAAO,MAAM,SAAQ;AAClC;AAiBO,SAAS,MAAM,OAA6C;AACjE,SAAO,EAAC,GAAG,OAAO,MAAM,QAAO;AACjC;AAOO,SAAS,MAAM,OAA6C;AACjE,SAAO,EAAC,GAAG,OAAO,MAAM,QAAO;AACjC;AAuBO,SAAS,aAAa,QAAwB;AACnD,SAAO;AACT;AAEO,IAAM,SAAS;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,30 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blinkk/root-cms",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"author": "s@blinkk.com",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
6
|
"engines": {
|
|
8
7
|
"node": ">=16.0.0"
|
|
9
8
|
},
|
|
10
9
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"dist/**/*"
|
|
10
|
+
"dist/*"
|
|
13
11
|
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"module": "./dist/index.js",
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
14
15
|
"exports": {
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"import": "./dist/
|
|
18
|
-
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./*": {
|
|
21
|
+
"types": "./dist/*.d.ts",
|
|
22
|
+
"import": "./dist/*.js"
|
|
19
23
|
}
|
|
20
24
|
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@blinkk/root": "1.0.0-alpha.17",
|
|
27
|
+
"firebase": "^9.13.0"
|
|
28
|
+
},
|
|
21
29
|
"devDependencies": {
|
|
30
|
+
"@types/node": "^18.11.8",
|
|
22
31
|
"tsup": "^6.3.0",
|
|
23
32
|
"vitest": "^0.18.1"
|
|
24
33
|
},
|
|
25
34
|
"scripts": {
|
|
26
|
-
"build": "rm -rf dist && tsup",
|
|
27
|
-
"test": "vitest run",
|
|
28
|
-
"test:watch": "vitest"
|
|
35
|
+
"build": "rm -rf dist && tsup-node",
|
|
36
|
+
"test": "pnpm build && vitest run",
|
|
37
|
+
"test:watch": "pnpm build && vitest"
|
|
29
38
|
}
|
|
30
39
|
}
|