tpmkms_4wp 9.3.0-beta.9 → 9.4.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/common/animals.instance.json +0 -65
- package/common/animals.js +2 -3
- package/common/animals.test.json +1607 -1
- package/common/articles.js +2 -4
- package/common/asking.js +21 -5
- package/common/avatar.js +2 -2
- package/common/characters.js +2 -2
- package/common/colors.instance.json +28 -70
- package/common/colors.js +2 -2
- package/common/comparable.instance.json +0 -15
- package/common/comparable.js +2 -2
- package/common/concept.js +1 -2
- package/common/conjunction.js +3 -5
- package/common/countable.js +2 -14
- package/common/crew.instance.json +0 -130
- package/common/crew.js +2 -2
- package/common/currency.js +2 -3
- package/common/dateTimeSelectors.instance.json +175 -0
- package/common/dateTimeSelectors.js +168 -0
- package/common/dateTimeSelectors.test.json +85622 -0
- package/common/dates.instance.json +538 -506
- package/common/dates.js +112 -15
- package/common/dates.test.json +11021 -514
- package/common/dialogues.js +8 -47
- package/common/dimension.instance.json +0 -5
- package/common/dimension.js +4 -4
- package/common/edible.instance.json +56 -160
- package/common/edible.js +2 -2
- package/common/emotions.instance.json +0 -5
- package/common/emotions.js +2 -2
- package/common/errors.js +3 -0
- package/common/evaluate.js +2 -2
- package/common/events.js +1 -2
- package/common/fastfood.instance.json +262 -713
- package/common/fastfood.js +2 -4
- package/common/formulas.instance.json +0 -5
- package/common/formulas.js +3 -1
- package/common/gdefaults.js +2 -3
- package/common/help.js +2 -2
- package/common/helpers/dateTimeSelectors.js +198 -0
- package/common/helpers/dialogues.js +11 -8
- package/common/helpers/properties.js +2 -2
- package/common/helpers.js +22 -63
- package/common/hierarchy.js +12 -13
- package/common/javascript.js +2 -3
- package/common/kirk.instance.json +0 -5
- package/common/kirk.js +2 -3
- package/common/length.instance.json +0 -75
- package/common/length.js +2 -3
- package/common/listener.js +3 -1
- package/common/math.instance.json +0 -5
- package/common/math.js +2 -3
- package/common/menus.instance.json +0 -35
- package/common/menus.js +3 -1
- package/common/meta.js +4 -5
- package/common/nameable.js +3 -1
- package/common/negation.js +2 -2
- package/common/numbers.js +6 -3
- package/common/ordering.instance.json +0 -10
- package/common/ordering.js +2 -3
- package/common/ordinals.js +2 -3
- package/common/people.instance.json +0 -40
- package/common/people.js +2 -3
- package/common/percentages.js +2 -3
- package/common/percentages.test.json +57 -11
- package/common/pipboy.instance.json +84 -85
- package/common/pipboy.js +1 -1
- package/common/pokemon.instance.json +0 -65
- package/common/pokemon.js +1 -2
- package/common/pos.js +2 -2
- package/common/pressure.instance.json +0 -20
- package/common/pressure.js +2 -2
- package/common/properties.instance.json +0 -5
- package/common/properties.js +11 -13
- package/common/punctuation.js +2 -2
- package/common/reminders.instance.json +145 -35
- package/common/reminders.js +264 -82
- package/common/reminders.test.json +69523 -970
- package/common/reports.instance.json +2 -12
- package/common/reports.js +1 -1
- package/common/scorekeeper.js +2 -2
- package/common/sdefaults.js +1 -1
- package/common/self.js +1 -1
- package/common/sizeable.js +2 -2
- package/common/spock.instance.json +0 -5
- package/common/spock.js +1 -1
- package/common/stgame.js +1 -1
- package/common/stm.js +1 -1
- package/common/tell.js +2 -2
- package/common/temperature.instance.json +84 -20
- package/common/temperature.js +2 -2
- package/common/tester.js +0 -1
- package/common/testing.js +0 -1
- package/common/time.js +10 -8
- package/common/time.test.json +73 -119
- package/common/tokenize.js +1 -1
- package/common/ui.instance.json +0 -5
- package/common/ui.js +1 -1
- package/common/weight.instance.json +0 -60
- package/common/weight.js +2 -2
- package/common/wp.instance.json +56 -70
- package/common/wp.js +1 -3
- package/common/yesno.js +2 -2
- package/main.js +2 -0
- package/package.json +8 -4
- package/common/helpers/reminders.js +0 -48
package/common/fastfood.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
const { knowledgeModule, ensureTestFile, where } = require('./runtime').theprogrammablemind
|
2
|
-
const { defaultContextCheck, propertyToArray } = require('./helpers')
|
2
|
+
const { defaultObjectCheck, defaultContextCheck, propertyToArray } = require('./helpers')
|
3
3
|
const edible = require('./edible')
|
4
4
|
const events = require('./events')
|
5
5
|
const sizeable = require('./sizeable')
|
@@ -996,9 +996,7 @@ knowledgeModule( {
|
|
996
996
|
{ property: 'pieces', filter: ['marker', 'value', 'text' ] },
|
997
997
|
],
|
998
998
|
context: [
|
999
|
-
|
1000
|
-
// TODO some kind of conditional selector { match: (value) => value.marker == 'count', filter: ['marker', 'value', 'text'] },
|
1001
|
-
{ property: 'comboNumber', filter: ['marker', 'value', 'text' ] },
|
999
|
+
defaultContextCheck({ extra: ['comboNumber'] }),
|
1002
1000
|
],
|
1003
1001
|
},
|
1004
1002
|
},
|
package/common/formulas.js
CHANGED
package/common/gdefaults.js
CHANGED
package/common/help.js
CHANGED
@@ -0,0 +1,198 @@
|
|
1
|
+
const pluralize = require('pluralize')
|
2
|
+
const deepEqual = require('deep-equal')
|
3
|
+
const { chooseNumber, zip } = require('../helpers.js')
|
4
|
+
const { compose, translationMapping, translationMappingToInstantiatorMappings } = require('./meta.js')
|
5
|
+
|
6
|
+
const dayMap = {
|
7
|
+
'sunday_dates': 0,
|
8
|
+
'monday_dates': 1,
|
9
|
+
'tuesday_dates': 2,
|
10
|
+
'wednesday_dates': 3,
|
11
|
+
'thursday_dates': 4,
|
12
|
+
'friday_dates': 5,
|
13
|
+
'saturday_dates': 6
|
14
|
+
};
|
15
|
+
|
16
|
+
function getNextDayOfWeek(date, targetDay) {
|
17
|
+
|
18
|
+
const targetDayNum = dayMap[targetDay.toLowerCase()]
|
19
|
+
if (!targetDayNum) {
|
20
|
+
return
|
21
|
+
}
|
22
|
+
const currentDay = date.getDay();
|
23
|
+
|
24
|
+
let daysUntilNext = targetDayNum - currentDay;
|
25
|
+
if (daysUntilNext <= 0) {
|
26
|
+
daysUntilNext += 7; // If target day is today or past, get next week's occurrence
|
27
|
+
}
|
28
|
+
|
29
|
+
const nextDate = new Date(date);
|
30
|
+
nextDate.setDate(date.getDate() + daysUntilNext);
|
31
|
+
return nextDate;
|
32
|
+
}
|
33
|
+
|
34
|
+
function toMonthNumber(value) {
|
35
|
+
const map = {
|
36
|
+
"jan_dates": 1,
|
37
|
+
"feb_dates": 2,
|
38
|
+
"mar_dates": 3,
|
39
|
+
"apr_dates": 4,
|
40
|
+
"may_dates": 5,
|
41
|
+
"jun_dates": 6,
|
42
|
+
"jul_dates": 7,
|
43
|
+
"aug_dates": 8,
|
44
|
+
"sept_dates": 9,
|
45
|
+
"oct_dates": 10,
|
46
|
+
"nov_dates": 11,
|
47
|
+
"dec_dates": 12,
|
48
|
+
"january_dates": 1,
|
49
|
+
"february_dates": 2,
|
50
|
+
"march_dates": 3,
|
51
|
+
"april_dates": 4,
|
52
|
+
"june_dates": 6,
|
53
|
+
"july_dates": 7,
|
54
|
+
"august_dates": 8,
|
55
|
+
"september_dates": 9,
|
56
|
+
"october_dates": 10,
|
57
|
+
"november_dates": 11,
|
58
|
+
"december_dates": 12,
|
59
|
+
}
|
60
|
+
return map[value]
|
61
|
+
}
|
62
|
+
|
63
|
+
function getTime(time) {
|
64
|
+
let hour = 0
|
65
|
+
const minute = 0
|
66
|
+
const second = 0
|
67
|
+
let hour_offset = 0
|
68
|
+
if (time.time?.ampm?.ampm == 'pm') {
|
69
|
+
hour_offset = 12
|
70
|
+
}
|
71
|
+
if (time.marker == 'integer') {
|
72
|
+
hour = time.value
|
73
|
+
} else if (time.marker == 'atTime') {
|
74
|
+
hour = time.time.value
|
75
|
+
}
|
76
|
+
hour += hour_offset
|
77
|
+
if (time.hour) {
|
78
|
+
hour = time.hour
|
79
|
+
}
|
80
|
+
if (time.second) {
|
81
|
+
second = time.second
|
82
|
+
}
|
83
|
+
if (time.minute) {
|
84
|
+
minute = time.minute
|
85
|
+
}
|
86
|
+
return { hour, minute, second }
|
87
|
+
}
|
88
|
+
|
89
|
+
instantiate = (isA, now, context) => {
|
90
|
+
const getType = (context, type) => {
|
91
|
+
if (context.marker == 'onDate_dates' && context.date?.marker == type) {
|
92
|
+
return context.date
|
93
|
+
} if (context.marker == type) {
|
94
|
+
return context
|
95
|
+
}
|
96
|
+
}
|
97
|
+
let value
|
98
|
+
if (value = getType(context, 'monthDay_dates')) {
|
99
|
+
const day = value.day.value;
|
100
|
+
// const month = toMonthNumber(value.month.value);
|
101
|
+
const month = value.month.month_ordinal
|
102
|
+
const currentMonth = now.getMonth() + 1; // 1-based (January = 1)
|
103
|
+
const currentYear = now.getFullYear();
|
104
|
+
const year = currentMonth >= month ? currentYear + 1 : currentYear;
|
105
|
+
const date = new Date(year, month-1, day)
|
106
|
+
return date.toISOString()
|
107
|
+
} else if (value = getType(context, 'monthDayYear_dates')) {
|
108
|
+
const day = value.day.value;
|
109
|
+
// const month = toMonthNumber(value.month.value);
|
110
|
+
const month = value.month.month_ordinal
|
111
|
+
const year = value.year.value;
|
112
|
+
const date = new Date(year, month-1, day)
|
113
|
+
return date.toISOString()
|
114
|
+
} else if (isA(context?.marker, 'dateTimeSelector')) {
|
115
|
+
// (on date) OR (date)
|
116
|
+
const date = context.date?.date || context.date
|
117
|
+
const dateTimeSelector = getNextDayOfWeek(now, date.value)
|
118
|
+
const time = context.time || context.defaultTime
|
119
|
+
if (time) {
|
120
|
+
const hms = getTime(time)
|
121
|
+
dateTimeSelector.setHours(hms.hour)
|
122
|
+
dateTimeSelector.setMinutes(hms.minute)
|
123
|
+
dateTimeSelector.setSeconds(hms.second)
|
124
|
+
dateTimeSelector.setMilliseconds(0)
|
125
|
+
}
|
126
|
+
return dateTimeSelector.toISOString()
|
127
|
+
} else if (context.dateTimeSelector) {
|
128
|
+
const dateTimeSelector = getNextDayOfWeek(now, context.dateTimeSelector?.value)
|
129
|
+
if (dateTimeSelector) {
|
130
|
+
return dateTimeSelector.toISOString()
|
131
|
+
}
|
132
|
+
} else if (context.value) {
|
133
|
+
const dateTimeSelector = getNextDayOfWeek(now, context.value)
|
134
|
+
if (dateTimeSelector) {
|
135
|
+
return dateTimeSelector.toISOString()
|
136
|
+
}
|
137
|
+
}
|
138
|
+
}
|
139
|
+
|
140
|
+
// function getNthDayOfMonth(dayName, ordinal, monthName, year = new Date().getFullYear()) {
|
141
|
+
function getNthDayOfMonth(dayName, ordinal, monthName, now) {
|
142
|
+
// Validate inputs
|
143
|
+
const days = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
144
|
+
const months = [ 'january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december' ];
|
145
|
+
|
146
|
+
let year = now.getFullYear()
|
147
|
+
|
148
|
+
dayName = dayName.toLowerCase();
|
149
|
+
monthName = monthName.toLowerCase();
|
150
|
+
|
151
|
+
if (!days.includes(dayName)) throw new Error('Invalid day name');
|
152
|
+
if (!months.includes(monthName)) throw new Error('Invalid month name');
|
153
|
+
if (!Number.isInteger(ordinal) || ordinal < 1 || ordinal > 5) throw new Error('Ordinal must be an integer between 1 and 5');
|
154
|
+
|
155
|
+
const monthIndex = months.indexOf(monthName);
|
156
|
+
if (monthIndex <= now.getMonth()) {
|
157
|
+
year += 1
|
158
|
+
}
|
159
|
+
const targetDayIndex = days.indexOf(dayName);
|
160
|
+
|
161
|
+
const date = new Date(year, monthIndex, 1);
|
162
|
+
|
163
|
+
while (date.getDay() !== targetDayIndex) {
|
164
|
+
date.setDate(date.getDate() + 1);
|
165
|
+
}
|
166
|
+
|
167
|
+
date.setDate(date.getDate() + (ordinal - 1) * 7);
|
168
|
+
|
169
|
+
if (date.getMonth() !== monthIndex) {
|
170
|
+
throw new Error(`The ${ordinal}th ${dayName} does not exist in ${monthName} ${year}`);
|
171
|
+
}
|
172
|
+
|
173
|
+
return date.toISOString();
|
174
|
+
}
|
175
|
+
|
176
|
+
function getNthWeekdayAfterDate(startDate, weekday_ordinal, n) {
|
177
|
+
// Ensure startDate is a Date object
|
178
|
+
const date = new Date(startDate);
|
179
|
+
let weekday_index = weekday_ordinal - 1
|
180
|
+
// Normalize weekday_index (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
|
181
|
+
weekday_index = (weekday_index % 7 + 7) % 7;
|
182
|
+
// Get current day of the week
|
183
|
+
const currentDay = date.getDay();
|
184
|
+
// Calculate days until the next desired weekday_index
|
185
|
+
let daysUntilNext = (weekday_index - currentDay + 7) % 7;
|
186
|
+
if (daysUntilNext === 0) daysUntilNext = 7; // Move to next occurrence if already on the desired weekday_index
|
187
|
+
// Calculate total days to add: days until next weekday_index + 7 days for each additional occurrence
|
188
|
+
const daysToAdd = daysUntilNext + (n - 1) * 7;
|
189
|
+
// Add days to the start date
|
190
|
+
date.setDate(date.getDate() + daysToAdd);
|
191
|
+
return date.toISOString();
|
192
|
+
}
|
193
|
+
|
194
|
+
module.exports = {
|
195
|
+
instantiate,
|
196
|
+
getNthDayOfMonth,
|
197
|
+
getNthWeekdayAfterDate,
|
198
|
+
}
|
@@ -77,12 +77,7 @@ class API {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
// word is for one or many
|
80
|
-
makeObject({config, context, types=[], source_value=undefined, doPluralize=true} = {}) {
|
81
|
-
/*
|
82
|
-
if (!context.unknown) {
|
83
|
-
return context.value
|
84
|
-
}
|
85
|
-
*/
|
80
|
+
async makeObject({config, context, types=[], source_value=undefined, doPluralize=true, initial={}} = {}) {
|
86
81
|
if (typeof context == 'string') {
|
87
82
|
context = { word: context, value: context }
|
88
83
|
}
|
@@ -103,11 +98,18 @@ class API {
|
|
103
98
|
}
|
104
99
|
return concept
|
105
100
|
}
|
101
|
+
|
102
|
+
initial.value = source_value || concept
|
103
|
+
await this.args.s({ value, makeObject: true, initial })
|
106
104
|
// config.addOperator({ pattern: `(["${fixUps(concept)}"])`, allowDups: true })
|
107
|
-
config.addOperator({ pattern: `(["${concept}"])`, allowDups: true })
|
105
|
+
config.addOperator({ pattern: `(["${concept}"|])`, allowDups: true })
|
108
106
|
config.addBridge({ id: concept, level: 0, bridge: `{ ...next(operator), value: or(operator.value, '${source_value || concept}') }` , allowDups: true })
|
107
|
+
|
109
108
|
const addConcept = (word, number) => {
|
110
|
-
|
109
|
+
if (number) {
|
110
|
+
initial.number = number
|
111
|
+
}
|
112
|
+
config.addWord(word, { id: concept, initial: JSON.stringify(initial) } )
|
111
113
|
const baseTypes = [
|
112
114
|
'theAble',
|
113
115
|
'queryable',
|
@@ -119,6 +121,7 @@ class API {
|
|
119
121
|
this.setupObjectHierarchy(config, concept, {types: allTypes});
|
120
122
|
}
|
121
123
|
|
124
|
+
pluralize.isSingular(word)
|
122
125
|
if (pluralize.isSingular(word)) {
|
123
126
|
addConcept(word, 'one')
|
124
127
|
doPluralize && addConcept(pluralize.plural(word), 'many')
|
@@ -546,9 +546,9 @@ class API {
|
|
546
546
|
}
|
547
547
|
}
|
548
548
|
|
549
|
-
makeObject(args) {
|
549
|
+
async makeObject(args) {
|
550
550
|
const types = [ 'hierarchyAble', 'object', 'property' ];
|
551
|
-
return args.km("dialogues").api.makeObject({ ...args, types: (args.types || []).concat(types) });
|
551
|
+
return await args.km("dialogues").api.makeObject({ ...args, types: (args.types || []).concat(types) });
|
552
552
|
}
|
553
553
|
|
554
554
|
relation_add (relations) {
|
package/common/helpers.js
CHANGED
@@ -151,75 +151,33 @@ const toEValue = (context) => {
|
|
151
151
|
return context;
|
152
152
|
}
|
153
153
|
|
154
|
-
const
|
155
|
-
return
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
throw new Error("Expected the <checks> argument to defaultContextCheck to be a list of <property> or { property: <property>, filter: <checks> }. Where <property> is a string.")
|
154
|
+
const defaultObjectCheck = (extra = []) => {
|
155
|
+
return {
|
156
|
+
objects: [
|
157
|
+
{
|
158
|
+
match: ({objects}) => true,
|
159
|
+
apply: () => extra
|
160
|
+
},
|
161
|
+
],
|
164
162
|
}
|
165
163
|
}
|
166
164
|
|
167
|
-
const defaultContextCheckProperties =
|
165
|
+
const defaultContextCheckProperties = (extra) => {
|
166
|
+
return ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra]
|
167
|
+
}
|
168
168
|
|
169
|
-
const
|
170
|
-
let
|
171
|
-
if (
|
172
|
-
|
173
|
-
}
|
174
|
-
|
175
|
-
for (const property of properties) {
|
176
|
-
defaultContextCheckValidify(properties)
|
177
|
-
if (typeof property == 'string') {
|
178
|
-
expanded.push({ property, filter: defaultContextCheckProperties })
|
179
|
-
} else if (property.property && property.filter) {
|
180
|
-
expanded.push({ property: property.property, filter: [defaultContextCheckProperties, ...expand_checks(property.filter)] })
|
181
|
-
} else {
|
182
|
-
expanded = [...expanded, ...expand_checks(property)]
|
183
|
-
}
|
184
|
-
}
|
185
|
-
return expanded
|
169
|
+
const defaultContextCheck = ({marker, extra = [], exported = false} = {}) => {
|
170
|
+
let match
|
171
|
+
if (marker) {
|
172
|
+
match = ({context}) => context.marker == marker
|
173
|
+
} else {
|
174
|
+
match = ({context}) => !Array.isArray(context)
|
186
175
|
}
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
}
|
191
|
-
expanded.push({ property: key, filter: [...expand_checks(properties[key])] })
|
192
|
-
}
|
176
|
+
return {
|
177
|
+
match,
|
178
|
+
exported,
|
179
|
+
apply: () => ['marker', 'text', 'verbatim', 'value', 'evalue', 'isResponse', { properties: 'modifiers' }, { properties: 'postModifiers' }, ...extra],
|
193
180
|
}
|
194
|
-
return expanded
|
195
|
-
|
196
|
-
}
|
197
|
-
|
198
|
-
const defaultContextCheck = (properties = []) => {
|
199
|
-
defaultContextCheckValidify(properties)
|
200
|
-
return [
|
201
|
-
...defaultContextCheckProperties,
|
202
|
-
// ...properties.map((property) => { return { property, filter: defaultContextCheckProperties } }),
|
203
|
-
...expand_checks(properties),
|
204
|
-
(object) => {
|
205
|
-
if (typeof object.value == 'object') {
|
206
|
-
return { property: 'value', filter: defaultContextCheckProperties }
|
207
|
-
} else {
|
208
|
-
return 'value'
|
209
|
-
}
|
210
|
-
},
|
211
|
-
(object) => {
|
212
|
-
if (!Array.isArray(object.modifiers)) {
|
213
|
-
return
|
214
|
-
}
|
215
|
-
if (typeof object.modifiers[0] == 'object') {
|
216
|
-
return { property: 'modifiers', filter: defaultContextCheckProperties }
|
217
|
-
} else {
|
218
|
-
return 'modifiers'
|
219
|
-
}
|
220
|
-
},
|
221
|
-
{ property: 'modifiers', isPropertyList: true, filter: defaultContextCheckProperties }
|
222
|
-
]
|
223
181
|
}
|
224
182
|
|
225
183
|
const isA = (hierarchy) => (child, parent, { strict=false } = {}) => {
|
@@ -312,6 +270,7 @@ module.exports = {
|
|
312
270
|
getValue,
|
313
271
|
defaultContextCheck,
|
314
272
|
defaultContextCheckProperties,
|
273
|
+
defaultObjectCheck,
|
315
274
|
toEValue,
|
316
275
|
millisecondsUntilHourOfDay,
|
317
276
|
indent,
|
package/common/hierarchy.js
CHANGED
@@ -164,15 +164,15 @@ const config = {
|
|
164
164
|
notes: 'c is a y',
|
165
165
|
where: where(),
|
166
166
|
match: ({context, listable}) => listable(context.marker, 'hierarchyAble') && !context.pullFromContext && !context.wantsValue && context.same && !context.same.pullFromContext && context.same.wantsValue,
|
167
|
-
apply: ({context, km, objects, asList, baseConfig : config}) => {
|
167
|
+
apply: async ({context, km, objects, asList, baseConfig : config}) => {
|
168
168
|
const api = km('properties').api
|
169
169
|
// mark c as an instance?
|
170
170
|
const oneConcepts = asList(context);
|
171
171
|
const twoConcepts = asList(context.same);
|
172
172
|
for (let oneConcept of oneConcepts.value) {
|
173
173
|
for (let twoConcept of twoConcepts.value) {
|
174
|
-
oneConcept = api.makeObject({config, context})
|
175
|
-
twoConcept = api.makeObject({config, context: context.same})
|
174
|
+
oneConcept = await api.makeObject({config, context})
|
175
|
+
twoConcept = await api.makeObject({config, context: context.same})
|
176
176
|
api.rememberIsA(oneConcept, twoConcept)
|
177
177
|
}
|
178
178
|
}
|
@@ -183,14 +183,14 @@ const config = {
|
|
183
183
|
notes: 'an x is a y',
|
184
184
|
where: where(),
|
185
185
|
match: ({context, listable}) => listable(context.marker, 'hierarchyAble') && !context.pullFromContext && context.wantsValue && context.same,
|
186
|
-
apply: ({context, km, objects, baseConfig : config, asList}) => {
|
186
|
+
apply: async ({context, km, objects, baseConfig : config, asList}) => {
|
187
187
|
const api = km('properties').api
|
188
188
|
const oneConcepts = asList(context);
|
189
189
|
const twoConcepts = asList(context.same);
|
190
190
|
for (let oneConcept of oneConcepts.value) {
|
191
191
|
for (let twoConcept of twoConcepts.value) {
|
192
|
-
oneConcept = api.makeObject({config, context})
|
193
|
-
twoConcept = api.makeObject({config, context: context.same})
|
192
|
+
oneConcept = await api.makeObject({config, context})
|
193
|
+
twoConcept = await api.makeObject({config, context: context.same})
|
194
194
|
api.rememberIsA(oneConcept, twoConcept)
|
195
195
|
context.sameWasProcessed = true
|
196
196
|
}
|
@@ -246,15 +246,15 @@ const config = {
|
|
246
246
|
|
247
247
|
return listable(context, 'hierarchyAble') && context.same && context.same.concept && !context.query
|
248
248
|
},
|
249
|
-
apply: (args) => {
|
249
|
+
apply: async (args) => {
|
250
250
|
const {callId, config, objects, km, context, asList, listable} = args
|
251
251
|
const api = km('properties').api
|
252
252
|
const oneConcepts = asList(context);
|
253
253
|
const twoConcepts = asList(context.same);
|
254
254
|
for (const oneConcept of oneConcepts.value) {
|
255
255
|
for (const twoConcept of twoConcepts.value) {
|
256
|
-
oneConceptId = api.makeObject({...args, context: oneConcept})
|
257
|
-
twoConceptId = api.makeObject({...args, context: twoConcept})
|
256
|
+
oneConceptId = await api.makeObject({...args, context: oneConcept})
|
257
|
+
twoConceptId = await api.makeObject({...args, context: twoConcept})
|
258
258
|
api.rememberIsA(oneConceptId, twoConceptId)
|
259
259
|
context.sameWasProcessed = true
|
260
260
|
}
|
@@ -305,10 +305,9 @@ knowledgeModule( {
|
|
305
305
|
// TODO doesnt this need the KM
|
306
306
|
checks: {
|
307
307
|
objects: ['children', 'concept', 'parents', 'properties'],
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
308
|
+
context: [
|
309
|
+
defaultContextCheck(),
|
310
|
+
],
|
312
311
|
},
|
313
312
|
includes: {
|
314
313
|
words: true,
|
package/common/javascript.js
CHANGED