@eide/foir-cli 0.1.26 → 0.1.28

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.
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Model and record seed configuration helpers.
3
+ *
4
+ * These helpers provide type-safe configuration for seeding models and records
5
+ * using types generated from the platform's GraphQL schema.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { defineModels, defineRecords } from '@eide/foir-cli/seed';
10
+ *
11
+ * // Define models
12
+ * export const models = defineModels([
13
+ * {
14
+ * key: 'my_model',
15
+ * name: 'My Model',
16
+ * fields: [...]
17
+ * }
18
+ * ]);
19
+ *
20
+ * // Define records
21
+ * export const records = defineRecords([
22
+ * {
23
+ * modelKey: 'my_model',
24
+ * naturalKey: 'my-record',
25
+ * data: { ... }
26
+ * }
27
+ * ]);
28
+ * ```
29
+ */
30
+ import type { CreateModelInput, CreateRecordInput, FieldDefinitionInput } from '../graphql/generated.js';
31
+ /**
32
+ * Define a single model with type safety.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * export default defineModel({
37
+ * key: 'tilly_page',
38
+ * name: 'Tilly Page',
39
+ * fields: [
40
+ * { key: 'title', type: 'text', label: 'Title', required: true }
41
+ * ],
42
+ * config: {
43
+ * versioning: true,
44
+ * publishing: true
45
+ * }
46
+ * });
47
+ * ```
48
+ */
49
+ export declare function defineModel(model: CreateModelInput): CreateModelInput;
50
+ /**
51
+ * Define multiple models with type safety.
52
+ *
53
+ * @example
54
+ * ```typescript
55
+ * export default defineModels([
56
+ * {
57
+ * key: 'model_a',
58
+ * name: 'Model A',
59
+ * fields: [...]
60
+ * },
61
+ * {
62
+ * key: 'model_b',
63
+ * name: 'Model B',
64
+ * fields: [...]
65
+ * }
66
+ * ]);
67
+ * ```
68
+ */
69
+ export declare function defineModels(models: CreateModelInput[]): CreateModelInput[];
70
+ /**
71
+ * Define a single record with type safety.
72
+ *
73
+ * @example
74
+ * ```typescript
75
+ * export default defineRecord({
76
+ * modelKey: 'tilly_page',
77
+ * naturalKey: 'home',
78
+ * data: {
79
+ * title: 'Home Page',
80
+ * blocks: [...]
81
+ * }
82
+ * });
83
+ * ```
84
+ */
85
+ export declare function defineRecord(record: CreateRecordInput): CreateRecordInput;
86
+ /**
87
+ * Define multiple records with type safety.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * export default defineRecords([
92
+ * {
93
+ * modelKey: 'tilly_page',
94
+ * naturalKey: 'home',
95
+ * data: { title: 'Home' }
96
+ * },
97
+ * {
98
+ * modelKey: 'tilly_page',
99
+ * naturalKey: 'about',
100
+ * data: { title: 'About' }
101
+ * }
102
+ * ]);
103
+ * ```
104
+ */
105
+ export declare function defineRecords(records: CreateRecordInput[]): CreateRecordInput[];
106
+ /**
107
+ * Define a field with type safety.
108
+ * Alias of the extension helper for convenience.
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const titleField = defineField({
113
+ * key: 'title',
114
+ * type: 'text',
115
+ * label: 'Title',
116
+ * required: true
117
+ * });
118
+ * ```
119
+ */
120
+ export declare function defineField(field: FieldDefinitionInput): FieldDefinitionInput;
121
+ export type { CreateModelInput, CreateRecordInput, FieldDefinitionInput, } from '../graphql/generated.js';
122
+ //# sourceMappingURL=seed-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-helpers.d.ts","sourceRoot":"","sources":["../../src/lib/seed-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,EACrB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,gBAAgB,CAErE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAE3E;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,iBAAiB,GAAG,iBAAiB,CAEzE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,iBAAiB,EAAE,GAC3B,iBAAiB,EAAE,CAErB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,oBAAoB,GAC1B,oBAAoB,CAEtB;AAGD,YAAY,EACV,gBAAgB,EAChB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Model and record seed configuration helpers.
3
+ *
4
+ * These helpers provide type-safe configuration for seeding models and records
5
+ * using types generated from the platform's GraphQL schema.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { defineModels, defineRecords } from '@eide/foir-cli/seed';
10
+ *
11
+ * // Define models
12
+ * export const models = defineModels([
13
+ * {
14
+ * key: 'my_model',
15
+ * name: 'My Model',
16
+ * fields: [...]
17
+ * }
18
+ * ]);
19
+ *
20
+ * // Define records
21
+ * export const records = defineRecords([
22
+ * {
23
+ * modelKey: 'my_model',
24
+ * naturalKey: 'my-record',
25
+ * data: { ... }
26
+ * }
27
+ * ]);
28
+ * ```
29
+ */
30
+ /**
31
+ * Define a single model with type safety.
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * export default defineModel({
36
+ * key: 'tilly_page',
37
+ * name: 'Tilly Page',
38
+ * fields: [
39
+ * { key: 'title', type: 'text', label: 'Title', required: true }
40
+ * ],
41
+ * config: {
42
+ * versioning: true,
43
+ * publishing: true
44
+ * }
45
+ * });
46
+ * ```
47
+ */
48
+ export function defineModel(model) {
49
+ return model;
50
+ }
51
+ /**
52
+ * Define multiple models with type safety.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * export default defineModels([
57
+ * {
58
+ * key: 'model_a',
59
+ * name: 'Model A',
60
+ * fields: [...]
61
+ * },
62
+ * {
63
+ * key: 'model_b',
64
+ * name: 'Model B',
65
+ * fields: [...]
66
+ * }
67
+ * ]);
68
+ * ```
69
+ */
70
+ export function defineModels(models) {
71
+ return models;
72
+ }
73
+ /**
74
+ * Define a single record with type safety.
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * export default defineRecord({
79
+ * modelKey: 'tilly_page',
80
+ * naturalKey: 'home',
81
+ * data: {
82
+ * title: 'Home Page',
83
+ * blocks: [...]
84
+ * }
85
+ * });
86
+ * ```
87
+ */
88
+ export function defineRecord(record) {
89
+ return record;
90
+ }
91
+ /**
92
+ * Define multiple records with type safety.
93
+ *
94
+ * @example
95
+ * ```typescript
96
+ * export default defineRecords([
97
+ * {
98
+ * modelKey: 'tilly_page',
99
+ * naturalKey: 'home',
100
+ * data: { title: 'Home' }
101
+ * },
102
+ * {
103
+ * modelKey: 'tilly_page',
104
+ * naturalKey: 'about',
105
+ * data: { title: 'About' }
106
+ * }
107
+ * ]);
108
+ * ```
109
+ */
110
+ export function defineRecords(records) {
111
+ return records;
112
+ }
113
+ /**
114
+ * Define a field with type safety.
115
+ * Alias of the extension helper for convenience.
116
+ *
117
+ * @example
118
+ * ```typescript
119
+ * const titleField = defineField({
120
+ * key: 'title',
121
+ * type: 'text',
122
+ * label: 'Title',
123
+ * required: true
124
+ * });
125
+ * ```
126
+ */
127
+ export function defineField(field) {
128
+ return field;
129
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eide/foir-cli",
3
- "version": "0.1.26",
3
+ "version": "0.1.28",
4
4
  "description": "Universal platform CLI for EIDE — scriptable, composable resource management",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -21,12 +21,33 @@
21
21
  "./extensions": {
22
22
  "types": "./dist/lib/extension-helpers.js",
23
23
  "import": "./dist/lib/extension-helpers.js"
24
+ },
25
+ "./seed": {
26
+ "types": "./dist/lib/seed-helpers.js",
27
+ "import": "./dist/lib/seed-helpers.js"
24
28
  }
25
29
  },
26
30
  "files": [
27
31
  "dist",
28
32
  "README.md"
29
33
  ],
34
+ "scripts": {
35
+ "build": "tsc",
36
+ "dev:cli": "tsx src/cli.ts",
37
+ "check-types": "tsc --noEmit",
38
+ "lint": "eslint src/",
39
+ "lint:fix": "eslint src/ --fix",
40
+ "test": "vitest run",
41
+ "test:watch": "vitest watch",
42
+ "codegen": "graphql-codegen --config codegen.ts",
43
+ "codegen:watch": "graphql-codegen --config codegen.ts --watch",
44
+ "prepublishOnly": "npm run build",
45
+ "patch": "npm run build && npm version patch",
46
+ "minor": "npm run build && npm version minor",
47
+ "major": "npm run build && npm version major",
48
+ "publish": "npm run build && npm publish",
49
+ "release": "npm run build && npm version patch && npm publish"
50
+ },
30
51
  "keywords": [
31
52
  "foir",
32
53
  "eide",
@@ -70,20 +91,5 @@
70
91
  "repository": {
71
92
  "type": "git",
72
93
  "url": "https://github.com/eidebuild/foir-cli.git"
73
- },
74
- "scripts": {
75
- "build": "tsc",
76
- "dev:cli": "tsx src/cli.ts",
77
- "check-types": "tsc --noEmit",
78
- "lint": "eslint src/",
79
- "lint:fix": "eslint src/ --fix",
80
- "test": "vitest run",
81
- "test:watch": "vitest watch",
82
- "codegen": "graphql-codegen --config codegen.ts",
83
- "codegen:watch": "graphql-codegen --config codegen.ts --watch",
84
- "patch": "npm run build && npm version patch",
85
- "minor": "npm run build && npm version minor",
86
- "major": "npm run build && npm version major",
87
- "release": "npm run build && npm version patch && npm publish"
88
94
  }
89
- }
95
+ }