@ekairos/domain 1.21.0 → 1.21.3-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.
- package/package.json +4 -1
- package/dist/__type_tests__/domain-builder.typecheck.d.ts +0 -2
- package/dist/__type_tests__/domain-builder.typecheck.d.ts.map +0 -1
- package/dist/__type_tests__/domain-builder.typecheck.js +0 -660
- package/dist/__type_tests__/domain-builder.typecheck.js.map +0 -1
- package/dist/__type_tests__/domain-conflicts-examples.d.ts +0 -2
- package/dist/__type_tests__/domain-conflicts-examples.d.ts.map +0 -1
- package/dist/__type_tests__/domain-conflicts-examples.js +0 -8
- package/dist/__type_tests__/domain-conflicts-examples.js.map +0 -1
- package/dist/__type_tests__/instant-schema-example.d.ts +0 -227
- package/dist/__type_tests__/instant-schema-example.d.ts.map +0 -1
- package/dist/__type_tests__/instant-schema-example.js +0 -188
- package/dist/__type_tests__/instant-schema-example.js.map +0 -1
- package/dist/__type_tests__/instant-schema-migration-example.d.ts +0 -191
- package/dist/__type_tests__/instant-schema-migration-example.d.ts.map +0 -1
- package/dist/__type_tests__/instant-schema-migration-example.js +0 -178
- package/dist/__type_tests__/instant-schema-migration-example.js.map +0 -1
- package/dist/__type_tests__/test.schema.d.ts +0 -95
- package/dist/__type_tests__/test.schema.d.ts.map +0 -1
- package/dist/__type_tests__/test.schema.js +0 -86
- package/dist/__type_tests__/test.schema.js.map +0 -1
- package/dist/index.d.ts +0 -39
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -203
- package/dist/index.js.map +0 -1
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
export declare const instantSchema: import("@instantdb/core").InstantSchemaDef<import("@instantdb/core").EntitiesWithLinks<import("@instantdb/core").EntitiesWithLinks<{
|
|
2
|
-
$users: import("@instantdb/core").EntityDef<any, any, any>;
|
|
3
|
-
$files: import("@instantdb/core").EntityDef<any, any, any>;
|
|
4
|
-
organizations: import("@instantdb/core").EntityDef<{
|
|
5
|
-
clerkOrgId: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
6
|
-
name: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
7
|
-
timezone: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
8
|
-
}, {}, void>;
|
|
9
|
-
transactions: import("@instantdb/core").EntityDef<{
|
|
10
|
-
provider: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
11
|
-
externalId: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
12
|
-
amount: import("@instantdb/core").DataAttrDef<number, true, false>;
|
|
13
|
-
currency: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
14
|
-
status: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
15
|
-
description: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
16
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, true>;
|
|
17
|
-
updatedAt: import("@instantdb/core").DataAttrDef<Date, false, true>;
|
|
18
|
-
}, {}, void>;
|
|
19
|
-
payments: import("@instantdb/core").EntityDef<{
|
|
20
|
-
provider: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
21
|
-
externalPaymentId: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
22
|
-
amount: import("@instantdb/core").DataAttrDef<number, true, false>;
|
|
23
|
-
currency: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
24
|
-
status: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
25
|
-
method: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
26
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
27
|
-
}, {}, void>;
|
|
28
|
-
projects: import("@instantdb/core").EntityDef<{
|
|
29
|
-
name: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
30
|
-
description: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
31
|
-
status: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
32
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
33
|
-
updatedAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
34
|
-
}, {}, void>;
|
|
35
|
-
tasks: import("@instantdb/core").EntityDef<{
|
|
36
|
-
title: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
37
|
-
description: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
38
|
-
status: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
39
|
-
priority: import("@instantdb/core").DataAttrDef<string, false, false>;
|
|
40
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
41
|
-
updatedAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
42
|
-
}, {}, void>;
|
|
43
|
-
app_settings: import("@instantdb/core").EntityDef<{
|
|
44
|
-
key: import("@instantdb/core").DataAttrDef<string, true, true>;
|
|
45
|
-
value: import("@instantdb/core").DataAttrDef<any, true, false>;
|
|
46
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
47
|
-
updatedAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
48
|
-
}, {}, void>;
|
|
49
|
-
notifications: import("@instantdb/core").EntityDef<{
|
|
50
|
-
type: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
51
|
-
message: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
52
|
-
read: import("@instantdb/core").DataAttrDef<boolean, false, false>;
|
|
53
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
54
|
-
}, {}, void>;
|
|
55
|
-
}, {
|
|
56
|
-
transactionOrganization: {
|
|
57
|
-
readonly forward: {
|
|
58
|
-
readonly on: "transactions";
|
|
59
|
-
readonly has: "one";
|
|
60
|
-
readonly label: "organization";
|
|
61
|
-
};
|
|
62
|
-
readonly reverse: {
|
|
63
|
-
readonly on: "organizations";
|
|
64
|
-
readonly has: "many";
|
|
65
|
-
readonly label: "transactions";
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
transactionUser: {
|
|
69
|
-
readonly forward: {
|
|
70
|
-
readonly on: "transactions";
|
|
71
|
-
readonly has: "one";
|
|
72
|
-
readonly label: "createdBy";
|
|
73
|
-
};
|
|
74
|
-
readonly reverse: {
|
|
75
|
-
readonly on: "$users";
|
|
76
|
-
readonly has: "many";
|
|
77
|
-
readonly label: "transactions";
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
transactionPayment: {
|
|
81
|
-
readonly forward: {
|
|
82
|
-
readonly on: "transactions";
|
|
83
|
-
readonly has: "one";
|
|
84
|
-
readonly label: "payment";
|
|
85
|
-
};
|
|
86
|
-
readonly reverse: {
|
|
87
|
-
readonly on: "payments";
|
|
88
|
-
readonly has: "one";
|
|
89
|
-
readonly label: "transaction";
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
projectOrganization: {
|
|
93
|
-
readonly forward: {
|
|
94
|
-
readonly on: "projects";
|
|
95
|
-
readonly has: "one";
|
|
96
|
-
readonly label: "organization";
|
|
97
|
-
};
|
|
98
|
-
readonly reverse: {
|
|
99
|
-
readonly on: "organizations";
|
|
100
|
-
readonly has: "many";
|
|
101
|
-
readonly label: "projects";
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
taskAssignee: {
|
|
105
|
-
readonly forward: {
|
|
106
|
-
readonly on: "tasks";
|
|
107
|
-
readonly has: "one";
|
|
108
|
-
readonly label: "assignee";
|
|
109
|
-
};
|
|
110
|
-
readonly reverse: {
|
|
111
|
-
readonly on: "$users";
|
|
112
|
-
readonly has: "many";
|
|
113
|
-
readonly label: "assignedTasks";
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
projectTasks: {
|
|
117
|
-
readonly forward: {
|
|
118
|
-
readonly on: "projects";
|
|
119
|
-
readonly has: "many";
|
|
120
|
-
readonly label: "tasks";
|
|
121
|
-
};
|
|
122
|
-
readonly reverse: {
|
|
123
|
-
readonly on: "tasks";
|
|
124
|
-
readonly has: "one";
|
|
125
|
-
readonly label: "project";
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
organizationMembers: {
|
|
129
|
-
readonly forward: {
|
|
130
|
-
readonly on: "organizations";
|
|
131
|
-
readonly has: "many";
|
|
132
|
-
readonly label: "members";
|
|
133
|
-
};
|
|
134
|
-
readonly reverse: {
|
|
135
|
-
readonly on: "$users";
|
|
136
|
-
readonly has: "many";
|
|
137
|
-
readonly label: "organizations";
|
|
138
|
-
};
|
|
139
|
-
};
|
|
140
|
-
settingsOrganization: {
|
|
141
|
-
readonly forward: {
|
|
142
|
-
readonly on: "app_settings";
|
|
143
|
-
readonly has: "one";
|
|
144
|
-
readonly label: "organization";
|
|
145
|
-
};
|
|
146
|
-
readonly reverse: {
|
|
147
|
-
readonly on: "organizations";
|
|
148
|
-
readonly has: "many";
|
|
149
|
-
readonly label: "settings";
|
|
150
|
-
};
|
|
151
|
-
};
|
|
152
|
-
notificationUser: {
|
|
153
|
-
readonly forward: {
|
|
154
|
-
readonly on: "notifications";
|
|
155
|
-
readonly has: "one";
|
|
156
|
-
readonly label: "user";
|
|
157
|
-
};
|
|
158
|
-
readonly reverse: {
|
|
159
|
-
readonly on: "$users";
|
|
160
|
-
readonly has: "many";
|
|
161
|
-
readonly label: "notifications";
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
notificationTransaction: {
|
|
165
|
-
readonly forward: {
|
|
166
|
-
readonly on: "notifications";
|
|
167
|
-
readonly has: "one";
|
|
168
|
-
readonly label: "relatedTransaction";
|
|
169
|
-
};
|
|
170
|
-
readonly reverse: {
|
|
171
|
-
readonly on: "transactions";
|
|
172
|
-
readonly has: "many";
|
|
173
|
-
readonly label: "notifications";
|
|
174
|
-
};
|
|
175
|
-
};
|
|
176
|
-
notificationProject: {
|
|
177
|
-
readonly forward: {
|
|
178
|
-
readonly on: "notifications";
|
|
179
|
-
readonly has: "one";
|
|
180
|
-
readonly label: "relatedProject";
|
|
181
|
-
};
|
|
182
|
-
readonly reverse: {
|
|
183
|
-
readonly on: "projects";
|
|
184
|
-
readonly has: "many";
|
|
185
|
-
readonly label: "notifications";
|
|
186
|
-
};
|
|
187
|
-
};
|
|
188
|
-
}>, import("@instantdb/core").LinksDef<any>>, import("@instantdb/core").LinksDef<any>, import("@instantdb/core").RoomsDef>;
|
|
189
|
-
export type AppSchema = typeof instantSchema;
|
|
190
|
-
export default instantSchema;
|
|
191
|
-
//# sourceMappingURL=instant-schema-migration-example.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instant-schema-migration-example.d.ts","sourceRoot":"","sources":["../../src/__type_tests__/instant-schema-migration-example.ts"],"names":[],"mappings":"AAoKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0HAAwC,CAAC;AASnE,MAAM,MAAM,SAAS,GAAG,OAAO,aAAa,CAAC;AAC7C,eAAe,aAAa,CAAC"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Example: Migrating from manual instant.schema.ts to domain-based schema
|
|
3
|
-
// This shows how to convert your existing ekairos-web instant.schema.ts
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.instantSchema = void 0;
|
|
6
|
-
const core_1 = require("@instantdb/core");
|
|
7
|
-
const index_1 = require("../index");
|
|
8
|
-
// BEFORE: Manual schema with 400+ lines
|
|
9
|
-
// const _schema = i.schema({
|
|
10
|
-
// entities: { /* 200+ lines of entities */ },
|
|
11
|
-
// links: { /* 200+ lines of links */ },
|
|
12
|
-
// rooms: { /* rooms */ },
|
|
13
|
-
// });
|
|
14
|
-
// AFTER: Domain-based schema - modular and maintainable
|
|
15
|
-
// Core domain - fundamental entities shared across all domains
|
|
16
|
-
const coreDomain = (0, index_1.domain)({
|
|
17
|
-
entities: {
|
|
18
|
-
organizations: core_1.i.entity({
|
|
19
|
-
clerkOrgId: core_1.i.string().indexed().unique(),
|
|
20
|
-
name: core_1.i.string(),
|
|
21
|
-
timezone: core_1.i.string().optional(),
|
|
22
|
-
}),
|
|
23
|
-
},
|
|
24
|
-
links: {},
|
|
25
|
-
rooms: {},
|
|
26
|
-
});
|
|
27
|
-
// Finance domain - all financial entities and operations
|
|
28
|
-
const financeDomain = (0, index_1.domain)("finance")
|
|
29
|
-
.includes(coreDomain)
|
|
30
|
-
.schema({
|
|
31
|
-
entities: {
|
|
32
|
-
transactions: core_1.i.entity({
|
|
33
|
-
provider: core_1.i.string().indexed(),
|
|
34
|
-
externalId: core_1.i.string().indexed(),
|
|
35
|
-
amount: core_1.i.number(),
|
|
36
|
-
currency: core_1.i.string().optional(),
|
|
37
|
-
status: core_1.i.string().indexed(),
|
|
38
|
-
description: core_1.i.string().optional(),
|
|
39
|
-
createdAt: core_1.i.date().indexed(),
|
|
40
|
-
updatedAt: core_1.i.date().indexed().optional(),
|
|
41
|
-
}),
|
|
42
|
-
payments: core_1.i.entity({
|
|
43
|
-
provider: core_1.i.string().indexed(),
|
|
44
|
-
externalPaymentId: core_1.i.string().indexed(),
|
|
45
|
-
amount: core_1.i.number(),
|
|
46
|
-
currency: core_1.i.string().optional(),
|
|
47
|
-
status: core_1.i.string().indexed(),
|
|
48
|
-
method: core_1.i.string().optional(),
|
|
49
|
-
createdAt: core_1.i.date(),
|
|
50
|
-
}),
|
|
51
|
-
},
|
|
52
|
-
links: {
|
|
53
|
-
transactionOrganization: {
|
|
54
|
-
forward: { on: "transactions", has: "one", label: "organization" },
|
|
55
|
-
reverse: { on: "organizations", has: "many", label: "transactions" },
|
|
56
|
-
},
|
|
57
|
-
transactionUser: {
|
|
58
|
-
forward: { on: "transactions", has: "one", label: "createdBy" },
|
|
59
|
-
reverse: { on: "$users", has: "many", label: "transactions" },
|
|
60
|
-
},
|
|
61
|
-
transactionPayment: {
|
|
62
|
-
forward: { on: "transactions", has: "one", label: "payment" },
|
|
63
|
-
reverse: { on: "payments", has: "one", label: "transaction" },
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
rooms: {},
|
|
67
|
-
});
|
|
68
|
-
// Management domain - project and task management
|
|
69
|
-
const managementDomain = (0, index_1.domain)("management")
|
|
70
|
-
.includes(coreDomain)
|
|
71
|
-
.schema({
|
|
72
|
-
entities: {
|
|
73
|
-
projects: core_1.i.entity({
|
|
74
|
-
name: core_1.i.string(),
|
|
75
|
-
description: core_1.i.string().optional(),
|
|
76
|
-
status: core_1.i.string(),
|
|
77
|
-
createdAt: core_1.i.date(),
|
|
78
|
-
updatedAt: core_1.i.date(),
|
|
79
|
-
}),
|
|
80
|
-
tasks: core_1.i.entity({
|
|
81
|
-
title: core_1.i.string(),
|
|
82
|
-
description: core_1.i.string().optional(),
|
|
83
|
-
status: core_1.i.string(),
|
|
84
|
-
priority: core_1.i.string().optional(),
|
|
85
|
-
createdAt: core_1.i.date(),
|
|
86
|
-
updatedAt: core_1.i.date(),
|
|
87
|
-
}),
|
|
88
|
-
},
|
|
89
|
-
links: {
|
|
90
|
-
projectOrganization: {
|
|
91
|
-
forward: { on: "projects", has: "one", label: "organization" },
|
|
92
|
-
reverse: { on: "organizations", has: "many", label: "projects" },
|
|
93
|
-
},
|
|
94
|
-
taskAssignee: {
|
|
95
|
-
forward: { on: "tasks", has: "one", label: "assignee" },
|
|
96
|
-
reverse: { on: "$users", has: "many", label: "assignedTasks" },
|
|
97
|
-
},
|
|
98
|
-
projectTasks: {
|
|
99
|
-
forward: { on: "projects", has: "many", label: "tasks" },
|
|
100
|
-
reverse: { on: "tasks", has: "one", label: "project" },
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
rooms: {},
|
|
104
|
-
});
|
|
105
|
-
// App domain - combines everything for the complete application
|
|
106
|
-
const appDomain = (0, index_1.domain)("app")
|
|
107
|
-
.includes(coreDomain) // Include core entities
|
|
108
|
-
.includes(financeDomain) // Include finance (transitively includes core)
|
|
109
|
-
.includes(managementDomain) // Include management (transitively includes core)
|
|
110
|
-
.schema({
|
|
111
|
-
entities: {
|
|
112
|
-
// App-specific entities
|
|
113
|
-
app_settings: core_1.i.entity({
|
|
114
|
-
key: core_1.i.string().unique().indexed(),
|
|
115
|
-
value: core_1.i.any(),
|
|
116
|
-
createdAt: core_1.i.date(),
|
|
117
|
-
updatedAt: core_1.i.date(),
|
|
118
|
-
}),
|
|
119
|
-
notifications: core_1.i.entity({
|
|
120
|
-
type: core_1.i.string(),
|
|
121
|
-
message: core_1.i.string(),
|
|
122
|
-
read: core_1.i.boolean().optional(),
|
|
123
|
-
createdAt: core_1.i.date(),
|
|
124
|
-
}),
|
|
125
|
-
// Add all the other entities from your current schema here...
|
|
126
|
-
// (locations, routes, items, etc.)
|
|
127
|
-
},
|
|
128
|
-
links: {
|
|
129
|
-
// Core organization links (base entities available here)
|
|
130
|
-
organizationMembers: {
|
|
131
|
-
forward: { on: "organizations", has: "many", label: "members" },
|
|
132
|
-
reverse: { on: "$users", has: "many", label: "organizations" },
|
|
133
|
-
},
|
|
134
|
-
// App-specific links
|
|
135
|
-
settingsOrganization: {
|
|
136
|
-
forward: { on: "app_settings", has: "one", label: "organization" },
|
|
137
|
-
reverse: { on: "organizations", has: "many", label: "settings" },
|
|
138
|
-
},
|
|
139
|
-
notificationUser: {
|
|
140
|
-
forward: { on: "notifications", has: "one", label: "user" },
|
|
141
|
-
reverse: { on: "$users", has: "many", label: "notifications" },
|
|
142
|
-
},
|
|
143
|
-
// Cross-domain references work automatically
|
|
144
|
-
notificationTransaction: {
|
|
145
|
-
forward: { on: "notifications", has: "one", label: "relatedTransaction" },
|
|
146
|
-
reverse: { on: "transactions", has: "many", label: "notifications" },
|
|
147
|
-
},
|
|
148
|
-
notificationProject: {
|
|
149
|
-
forward: { on: "notifications", has: "one", label: "relatedProject" },
|
|
150
|
-
reverse: { on: "projects", has: "many", label: "notifications" },
|
|
151
|
-
},
|
|
152
|
-
// Add all the other links from your current schema here...
|
|
153
|
-
// (organization links, finance links, etc.)
|
|
154
|
-
},
|
|
155
|
-
rooms: {
|
|
156
|
-
// Add rooms from your current schema
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
// FINAL SCHEMA: Direct compatibility with InstantDB
|
|
160
|
-
exports.instantSchema = core_1.i.schema(appDomain.toInstantSchema());
|
|
161
|
-
exports.default = exports.instantSchema;
|
|
162
|
-
/*
|
|
163
|
-
MIGRATION BENEFITS:
|
|
164
|
-
|
|
165
|
-
1. 📦 Modularity: Each domain is independent and reusable
|
|
166
|
-
2. 🔗 Type Safety: Cross-domain links are fully validated
|
|
167
|
-
3. 🚀 Maintainability: Changes are localized to relevant domains
|
|
168
|
-
4. ⚡ Performance: Only load domains you need in specific contexts
|
|
169
|
-
5. 🔄 Compatibility: Drop-in replacement for existing i.schema() calls
|
|
170
|
-
6. 🎯 Clarity: Intent is clear - domains explicitly include their dependencies
|
|
171
|
-
|
|
172
|
-
NEXT STEPS:
|
|
173
|
-
1. Break down your current instant.schema.ts into logical domains
|
|
174
|
-
2. Use .includes() to establish dependencies between domains
|
|
175
|
-
3. Replace manual schema with domain.toInstantSchema()
|
|
176
|
-
4. Test thoroughly - all existing functionality should work identically
|
|
177
|
-
*/
|
|
178
|
-
//# sourceMappingURL=instant-schema-migration-example.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"instant-schema-migration-example.js","sourceRoot":"","sources":["../../src/__type_tests__/instant-schema-migration-example.ts"],"names":[],"mappings":";AAAA,0EAA0E;AAC1E,wEAAwE;;;AAExE,0CAAoC;AACpC,oCAAkC;AAElC,wCAAwC;AACxC,6BAA6B;AAC7B,gDAAgD;AAChD,0CAA0C;AAC1C,4BAA4B;AAC5B,MAAM;AAEN,wDAAwD;AAExD,+DAA+D;AAC/D,MAAM,UAAU,GAAG,IAAA,cAAM,EAA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AAU,EAAE;SACjE;QACD,gBAAgB,EAAE;YAChB,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE;YAC3D,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;SAC/D;QACD,6CAA6C;QAC7C,uBAAuB,EAAE;YACvB,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAoB,EAAE;YACzE,OAAO,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;SACrE;QACD,mBAAmB,EAAE;YACnB,OAAO,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE;YACrE,OAAO,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;SACjE;QACD,2DAA2D;QAC3D,4CAA4C;KAC7C;IACD,KAAK,EAAE;IACL,qCAAqC;KACtC;CACF,CAAC,CAAC;AAEL,oDAAoD;AACvC,QAAA,aAAa,GAAG,QAAC,CAAC,MAAM,CAAC,SAAS,CAAC,eAAe,EAAE,CAAC,CAAC;AAUnE,kBAAe,qBAAa,CAAC;AAE7B;;;;;;;;;;;;;;;EAeE"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
declare const schema: import("@instantdb/core").InstantSchemaDef<import("@instantdb/core").EntitiesWithLinks<{
|
|
2
|
-
$users: import("@instantdb/core").EntityDef<any, any, any>;
|
|
3
|
-
$files: import("@instantdb/core").EntityDef<any, any, any>;
|
|
4
|
-
test_a_items: import("@instantdb/core").EntityDef<{
|
|
5
|
-
name: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
6
|
-
value: import("@instantdb/core").DataAttrDef<number, true, false>;
|
|
7
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
8
|
-
}, {}, void>;
|
|
9
|
-
test_b_items: import("@instantdb/core").EntityDef<{
|
|
10
|
-
title: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
11
|
-
status: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
12
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
13
|
-
}, {}, void>;
|
|
14
|
-
combined_items: import("@instantdb/core").EntityDef<{
|
|
15
|
-
description: import("@instantdb/core").DataAttrDef<string, true, false>;
|
|
16
|
-
priority: import("@instantdb/core").DataAttrDef<number, false, false>;
|
|
17
|
-
createdAt: import("@instantdb/core").DataAttrDef<Date, true, false>;
|
|
18
|
-
}, {}, void>;
|
|
19
|
-
}, {
|
|
20
|
-
testAItemsOwner: {
|
|
21
|
-
readonly forward: {
|
|
22
|
-
readonly on: "test_a_items";
|
|
23
|
-
readonly has: "one";
|
|
24
|
-
readonly label: "owner";
|
|
25
|
-
};
|
|
26
|
-
readonly reverse: {
|
|
27
|
-
readonly on: "$users";
|
|
28
|
-
readonly has: "many";
|
|
29
|
-
readonly label: "owned_test_a_items";
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
testBItemsCreator: {
|
|
33
|
-
readonly forward: {
|
|
34
|
-
readonly on: "test_b_items";
|
|
35
|
-
readonly has: "one";
|
|
36
|
-
readonly label: "creator";
|
|
37
|
-
};
|
|
38
|
-
readonly reverse: {
|
|
39
|
-
readonly on: "$users";
|
|
40
|
-
readonly has: "many";
|
|
41
|
-
readonly label: "created_test_b_items";
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
testBItemsRelated: {
|
|
45
|
-
readonly forward: {
|
|
46
|
-
readonly on: "test_b_items";
|
|
47
|
-
readonly has: "one";
|
|
48
|
-
readonly label: "related";
|
|
49
|
-
};
|
|
50
|
-
readonly reverse: {
|
|
51
|
-
readonly on: "test_a_items";
|
|
52
|
-
readonly has: "many";
|
|
53
|
-
readonly label: "test_b_items";
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
combinedItemsParent: {
|
|
57
|
-
readonly forward: {
|
|
58
|
-
readonly on: "combined_items";
|
|
59
|
-
readonly has: "one";
|
|
60
|
-
readonly label: "parent";
|
|
61
|
-
};
|
|
62
|
-
readonly reverse: {
|
|
63
|
-
readonly on: "test_b_items";
|
|
64
|
-
readonly has: "many";
|
|
65
|
-
readonly label: "combined_items";
|
|
66
|
-
};
|
|
67
|
-
};
|
|
68
|
-
combinedItemsOwner: {
|
|
69
|
-
readonly forward: {
|
|
70
|
-
readonly on: "combined_items";
|
|
71
|
-
readonly has: "one";
|
|
72
|
-
readonly label: "owner";
|
|
73
|
-
};
|
|
74
|
-
readonly reverse: {
|
|
75
|
-
readonly on: "$users";
|
|
76
|
-
readonly has: "many";
|
|
77
|
-
readonly label: "owned_combined_items";
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
combinedItemsFiles: {
|
|
81
|
-
readonly forward: {
|
|
82
|
-
readonly on: "combined_items";
|
|
83
|
-
readonly has: "many";
|
|
84
|
-
readonly label: "files";
|
|
85
|
-
};
|
|
86
|
-
readonly reverse: {
|
|
87
|
-
readonly on: "$files";
|
|
88
|
-
readonly has: "one";
|
|
89
|
-
readonly label: "combined_item";
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
}>, import("@instantdb/core").LinksDef<any>, import("@instantdb/core").RoomsDef>;
|
|
93
|
-
export type TestSchema = typeof schema;
|
|
94
|
-
export default schema;
|
|
95
|
-
//# sourceMappingURL=test.schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.schema.d.ts","sourceRoot":"","sources":["../../src/__type_tests__/test.schema.ts"],"names":[],"mappings":"AAqFA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gFAAuC,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC;AACvC,eAAe,MAAM,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// Schema file for testing with instant-cli push
|
|
4
|
-
// This schema demonstrates all domain builder features:
|
|
5
|
-
// - Multiple domains with includes
|
|
6
|
-
// - Cross-domain links
|
|
7
|
-
// - Links to base entities ($users, $files)
|
|
8
|
-
// - Complex entity relationships
|
|
9
|
-
const index_1 = require("../index");
|
|
10
|
-
const core_1 = require("@instantdb/core");
|
|
11
|
-
// Domain A: Core entities
|
|
12
|
-
const testDomainA = (0, index_1.domain)("testA").schema({
|
|
13
|
-
entities: {
|
|
14
|
-
test_a_items: core_1.i.entity({
|
|
15
|
-
name: core_1.i.string(),
|
|
16
|
-
value: core_1.i.number(),
|
|
17
|
-
createdAt: core_1.i.date(),
|
|
18
|
-
}),
|
|
19
|
-
},
|
|
20
|
-
links: {
|
|
21
|
-
testAItemsOwner: {
|
|
22
|
-
forward: { on: "test_a_items", has: "one", label: "owner" },
|
|
23
|
-
reverse: { on: "$users", has: "many", label: "owned_test_a_items" },
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
rooms: {},
|
|
27
|
-
});
|
|
28
|
-
// Domain B: Includes Domain A and adds its own entities with cross-domain links
|
|
29
|
-
const testDomainB = (0, index_1.domain)("testB")
|
|
30
|
-
.includes(testDomainA)
|
|
31
|
-
.schema({
|
|
32
|
-
entities: {
|
|
33
|
-
test_b_items: core_1.i.entity({
|
|
34
|
-
title: core_1.i.string(),
|
|
35
|
-
status: core_1.i.string(),
|
|
36
|
-
createdAt: core_1.i.date(),
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
links: {
|
|
40
|
-
testBItemsCreator: {
|
|
41
|
-
forward: { on: "test_b_items", has: "one", label: "creator" },
|
|
42
|
-
reverse: { on: "$users", has: "many", label: "created_test_b_items" },
|
|
43
|
-
},
|
|
44
|
-
// Cross-domain link: references test_a_items from included domain
|
|
45
|
-
testBItemsRelated: {
|
|
46
|
-
forward: { on: "test_b_items", has: "one", label: "related" },
|
|
47
|
-
reverse: { on: "test_a_items", has: "many", label: "test_b_items" },
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
rooms: {},
|
|
51
|
-
});
|
|
52
|
-
// Combined schema: Includes both domains and adds final entities
|
|
53
|
-
// This demonstrates the full power of domain composition
|
|
54
|
-
const combinedTestSchema = (0, index_1.domain)("combined")
|
|
55
|
-
.includes(testDomainA)
|
|
56
|
-
.includes(testDomainB)
|
|
57
|
-
.schema({
|
|
58
|
-
entities: {
|
|
59
|
-
combined_items: core_1.i.entity({
|
|
60
|
-
description: core_1.i.string(),
|
|
61
|
-
priority: core_1.i.number().optional(),
|
|
62
|
-
createdAt: core_1.i.date(),
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
links: {
|
|
66
|
-
// Link to entities from included domains
|
|
67
|
-
combinedItemsParent: {
|
|
68
|
-
forward: { on: "combined_items", has: "one", label: "parent" },
|
|
69
|
-
reverse: { on: "test_b_items", has: "many", label: "combined_items" },
|
|
70
|
-
},
|
|
71
|
-
// Link to base entities
|
|
72
|
-
combinedItemsOwner: {
|
|
73
|
-
forward: { on: "combined_items", has: "one", label: "owner" },
|
|
74
|
-
reverse: { on: "$users", has: "many", label: "owned_combined_items" },
|
|
75
|
-
},
|
|
76
|
-
// Link to files (base entity)
|
|
77
|
-
combinedItemsFiles: {
|
|
78
|
-
forward: { on: "combined_items", has: "many", label: "files" },
|
|
79
|
-
reverse: { on: "$files", has: "one", label: "combined_item" },
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
rooms: {},
|
|
83
|
-
});
|
|
84
|
-
const schema = combinedTestSchema.toInstantSchema();
|
|
85
|
-
exports.default = schema;
|
|
86
|
-
//# sourceMappingURL=test.schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test.schema.js","sourceRoot":"","sources":["../../src/__type_tests__/test.schema.ts"],"names":[],"mappings":";;AAAA,gDAAgD;AAChD,wDAAwD;AACxD,mCAAmC;AACnC,uBAAuB;AACvB,4CAA4C;AAC5C,iCAAiC;AACjC,oCAAkC;AAClC,0CAAoC;AAEpC,0BAA0B;AAC1B,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE;QACR,YAAY,EAAE,QAAC,CAAC,MAAM,CAAC;YACrB,IAAI,EAAE,QAAC,CAAC,MAAM,EAAE;YAChB,KAAK,EAAE,QAAC,CAAC,MAAM,EAAE;YACjB,SAAS,EAAE,QAAC,CAAC,IAAI,EAAE;SACpB,CAAC;KACH;IACD,KAAK,EAAE;QACL,eAAe,EAAE;YACf,OAAO,EAAE,EAAE,EAAE,EAAE,cAAc,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;YAC3D,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE;SACpE;KACF;IACD,KAAK,EAAE,EAAE;CACV,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,WAAW,GAAG,IAAA,cAAM,EAAC,OAAO,CAAC;KAChC,QAAQ,CAAC,WAAW,CAAC;KACrB,MAAM,CAAC;IACN,QAAQ,EAAE;QACR,YAAY,EAAE,QAAC,CAAC,MAAM,CAAC;YACrB,KAAK,EAAE,QAAC,CAAC,MAAM,EAAE;YACjB,MAAM,EAAE,QAAC,CAAC,MAAM,EAAE;YAClB,SAAS,EAAE,QAAC,CAAC,IAAI,EAAE;SACpB,CAAC;KACH;IACD,KAAK,EAAE;QACL,iBAAiB,EAAE;YACjB,OAAO,EAAE,EAAE,EAAE,EAAE,cAAc,E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AAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE;SACtE;QACD,8BAA8B;QAC9B,kBAAkB,EAAE;YAClB,OAAO,EAAE,EAAE,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE;YAC9D,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE;SAC9D;KACF;IACD,KAAK,EAAE,EAAE;CACV,CAAC,CAAC;AAEL,MAAM,MAAM,GAAG,kBAAkB,CAAC,eAAe,EAAE,CAAC;AAGpD,kBAAe,MAAM,CAAC"}
|
package/dist/index.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { i } from "@instantdb/core";
|
|
2
|
-
import type { EntitiesDef, LinksDef, RoomsDef, InstantSchemaDef, EntityDef } from "@instantdb/core";
|
|
3
|
-
export type DomainDefinition<E extends EntitiesDef, L extends LinksDef<E>, R extends RoomsDef> = {
|
|
4
|
-
entities: E;
|
|
5
|
-
links: L;
|
|
6
|
-
rooms: R;
|
|
7
|
-
};
|
|
8
|
-
export type DomainInstance<E extends EntitiesDef, L extends LinksDef<E>, R extends RoomsDef> = DomainDefinition<E, L, R> & {
|
|
9
|
-
schema: () => any;
|
|
10
|
-
compose: <E2 extends EntitiesDef, L2 extends LinksDef<E2>, R2 extends RoomsDef>(other: DomainInstance<E2, L2, R2> | DomainDefinition<E2, L2, R2>) => DomainInstance<E & E2, LinksDef<E & E2>, R & R2>;
|
|
11
|
-
};
|
|
12
|
-
export type SchemaOf<D extends DomainDefinition<any, any, any> | DomainSchemaResult<any, any, any>> = D extends DomainSchemaResult<any, any, any> ? ReturnType<D["toInstantSchema"]> : InstantSchemaDef<D["entities"], LinksDef<D["entities"]>, D["rooms"]>;
|
|
13
|
-
type MergeEntities<A extends EntitiesDef, B extends EntitiesDef> = {
|
|
14
|
-
[K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
|
|
15
|
-
};
|
|
16
|
-
type MergeLinks<A extends LinksDef<any>, B extends LinksDef<any>> = {
|
|
17
|
-
[K in keyof A | keyof B]: K extends keyof A ? A[K] : K extends keyof B ? B[K] : never;
|
|
18
|
-
};
|
|
19
|
-
export type DomainSchemaResult<E extends EntitiesDef = EntitiesDef, L extends LinksDef<any> = LinksDef<any>, R extends RoomsDef = RoomsDef> = ReturnType<typeof i.schema<WithBase<E>, L, R>> & {
|
|
20
|
-
readonly originalEntities: E;
|
|
21
|
-
toInstantSchema: () => ReturnType<typeof i.schema<WithBase<E>, L, R>>;
|
|
22
|
-
};
|
|
23
|
-
type BaseEntitiesPhantom = {
|
|
24
|
-
$users: EntityDef<any, any, any>;
|
|
25
|
-
$files: EntityDef<any, any, any>;
|
|
26
|
-
};
|
|
27
|
-
type WithBase<E extends EntitiesDef> = MergeEntities<E, BaseEntitiesPhantom>;
|
|
28
|
-
export type DomainBuilder<AccumE extends EntitiesDef, AccumL extends LinksDef<any> = LinksDef<any>> = {
|
|
29
|
-
includes<E2 extends EntitiesDef, L2 extends LinksDef<any> = {}>(other: DomainInstance<E2, L2, any> | DomainSchemaResult<E2, L2, any> | InstantSchemaDef<E2, L2, any> | (() => DomainInstance<E2, L2, any> | DomainSchemaResult<E2, L2, any> | InstantSchemaDef<E2, L2, any>) | undefined): DomainBuilder<MergeEntities<AccumE, E2>, MergeLinks<AccumL, L2>>;
|
|
30
|
-
schema<LE extends EntitiesDef, const LL extends LinksDef<WithBase<MergeEntities<AccumE, LE>>>>(def: {
|
|
31
|
-
entities: LE;
|
|
32
|
-
links: LL;
|
|
33
|
-
rooms: RoomsDef;
|
|
34
|
-
}): DomainSchemaResult<MergeEntities<AccumE, LE>, MergeLinks<AccumL, LL>, RoomsDef>;
|
|
35
|
-
};
|
|
36
|
-
export declare function domain<E extends EntitiesDef, L extends LinksDef<E>, R extends RoomsDef>(def: DomainDefinition<E, L, R>): DomainInstance<E, L, R>;
|
|
37
|
-
export declare function domain(name?: string): DomainBuilder<{}, {}>;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKpG,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,IAAI;IAC/F,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,QAAQ,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG;IACzH,MAAM,EAAE,MAAM,GAAG,CAAC;IAClB,OAAO,EAAE,CAAC,EAAE,SAAS,WAAW,EAAE,EAAE,SAAS,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,SAAS,QAAQ,EAC5E,KAAK,EAAE,cAAc,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,GAAG,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,KAC7D,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;CACvD,CAAC;AA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