@case-framework/survey-core 0.4.0 → 0.4.1
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/README.md +31 -34
- package/build/editor.d.mts +31 -12
- package/build/editor.d.mts.map +1 -1
- package/build/editor.mjs +26 -1
- package/build/editor.mjs.map +1 -1
- package/build/index.d.mts +10 -10
- package/build/index.d.mts.map +1 -1
- package/build/index.mjs +1 -1
- package/build/index.mjs.map +1 -1
- package/build/package.json +26 -26
- package/build/{survey-DShEOjyz.d.mts → survey-BV8YHc3J.d.mts} +29 -29
- package/build/survey-BV8YHc3J.d.mts.map +1 -0
- package/build/{survey-yXdl8xkf.mjs → survey-DnLtf19j.mjs} +2 -2
- package/build/survey-DnLtf19j.mjs.map +1 -0
- package/package.json +21 -21
- package/build/survey-DShEOjyz.d.mts.map +0 -1
- package/build/survey-yXdl8xkf.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -52,15 +52,18 @@ import {
|
|
|
52
52
|
ValueRefTypeLookup,
|
|
53
53
|
ValueType,
|
|
54
54
|
ItemTypeRegistry,
|
|
55
|
-
} from
|
|
55
|
+
} from "@case-framework/survey-core";
|
|
56
56
|
|
|
57
57
|
type SingleChoiceConfig = {
|
|
58
58
|
id: string;
|
|
59
59
|
options: Array<{ id: string; key: string; type: string }>;
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
class SingleChoiceQuestionItemCore extends SurveyItemCore<
|
|
63
|
-
|
|
62
|
+
class SingleChoiceQuestionItemCore extends SurveyItemCore<
|
|
63
|
+
"singleChoiceQuestion",
|
|
64
|
+
SingleChoiceConfig
|
|
65
|
+
> {
|
|
66
|
+
readonly type = "singleChoiceQuestion";
|
|
64
67
|
|
|
65
68
|
parseConfig(rawConfig: unknown): SingleChoiceConfig {
|
|
66
69
|
const cfg = (rawConfig ?? {}) as Partial<SingleChoiceConfig>;
|
|
@@ -96,45 +99,42 @@ import {
|
|
|
96
99
|
ResponseItem,
|
|
97
100
|
ValueType,
|
|
98
101
|
ReservedSurveyItemTypes,
|
|
99
|
-
} from
|
|
102
|
+
} from "@case-framework/survey-core";
|
|
100
103
|
|
|
101
104
|
const survey = Survey.fromJson(
|
|
102
105
|
{
|
|
103
106
|
$schema:
|
|
104
|
-
|
|
107
|
+
"https://github.com/case-framework/case-survey-toolkit/packages/survey-core/schemas/survey-schema.json",
|
|
105
108
|
surveyItems: [
|
|
106
109
|
{
|
|
107
|
-
id:
|
|
108
|
-
key:
|
|
110
|
+
id: "root",
|
|
111
|
+
key: "root",
|
|
109
112
|
itemType: ReservedSurveyItemTypes.Group,
|
|
110
|
-
config: { isRoot: true, items: [
|
|
113
|
+
config: { isRoot: true, items: ["q1"] },
|
|
111
114
|
},
|
|
112
115
|
{
|
|
113
|
-
id:
|
|
114
|
-
key:
|
|
115
|
-
itemType:
|
|
116
|
+
id: "q1",
|
|
117
|
+
key: "q1",
|
|
118
|
+
itemType: "singleChoiceQuestion",
|
|
116
119
|
config: {
|
|
117
|
-
id:
|
|
120
|
+
id: "q1",
|
|
118
121
|
options: [
|
|
119
|
-
{ id:
|
|
120
|
-
{ id:
|
|
122
|
+
{ id: "yes", key: "yes", type: "option" },
|
|
123
|
+
{ id: "no", key: "no", type: "option" },
|
|
121
124
|
],
|
|
122
125
|
},
|
|
123
126
|
},
|
|
124
127
|
],
|
|
125
128
|
},
|
|
126
|
-
pluginRegistry
|
|
129
|
+
pluginRegistry,
|
|
127
130
|
);
|
|
128
131
|
|
|
129
|
-
const engine = new SurveyEngineCore(survey, { locale:
|
|
132
|
+
const engine = new SurveyEngineCore(survey, { locale: "en" });
|
|
130
133
|
|
|
131
134
|
// Set one item response (slot id == config.id in this example).
|
|
132
|
-
engine.setResponse(
|
|
133
|
-
'q1',
|
|
134
|
-
new ResponseItem([['q1', { type: ValueType.reference, value: 'yes' }]])
|
|
135
|
-
);
|
|
135
|
+
engine.setResponse("q1", new ResponseItem([["q1", { type: ValueType.reference, value: "yes" }]]));
|
|
136
136
|
|
|
137
|
-
const pages = engine.getSurveyPages(
|
|
137
|
+
const pages = engine.getSurveyPages("large");
|
|
138
138
|
const responses = engine.getResponses();
|
|
139
139
|
const events = engine.getEvents();
|
|
140
140
|
```
|
|
@@ -142,19 +142,16 @@ const events = engine.getEvents();
|
|
|
142
142
|
### 3. Export responses to CSV
|
|
143
143
|
|
|
144
144
|
```ts
|
|
145
|
-
import {
|
|
146
|
-
SurveyResponse,
|
|
147
|
-
SurveyResponseExporter,
|
|
148
|
-
} from '@case-framework/survey-core';
|
|
145
|
+
import { SurveyResponse, SurveyResponseExporter } from "@case-framework/survey-core";
|
|
149
146
|
|
|
150
|
-
const response = new SurveyResponse(
|
|
147
|
+
const response = new SurveyResponse("response-1", "v1");
|
|
151
148
|
response.responses = new Map(responses.map((r) => [r.itemId, r]));
|
|
152
149
|
response.submittedAt = Math.floor(Date.now() / 1000);
|
|
153
150
|
|
|
154
151
|
const exporter = new SurveyResponseExporter([
|
|
155
152
|
{
|
|
156
|
-
versionId:
|
|
157
|
-
surveyKey: survey.surveyKey ??
|
|
153
|
+
versionId: "v1",
|
|
154
|
+
surveyKey: survey.surveyKey ?? "survey",
|
|
158
155
|
survey,
|
|
159
156
|
},
|
|
160
157
|
]);
|
|
@@ -165,17 +162,17 @@ const csv = exporter.exportResponsesToCsv([response]);
|
|
|
165
162
|
### 4. Edit surveys with the editor entrypoint
|
|
166
163
|
|
|
167
164
|
```ts
|
|
168
|
-
import { SurveyEditor, CommitSource } from
|
|
165
|
+
import { SurveyEditor, CommitSource } from "@case-framework/survey-core/editor";
|
|
169
166
|
|
|
170
167
|
const editor = new SurveyEditor(survey, { pluginRegistry });
|
|
171
168
|
|
|
172
169
|
const newItem = survey.createItemFromRaw({
|
|
173
|
-
id:
|
|
174
|
-
key:
|
|
175
|
-
itemType:
|
|
176
|
-
config: { id:
|
|
170
|
+
id: "q2",
|
|
171
|
+
key: "q2",
|
|
172
|
+
itemType: "singleChoiceQuestion",
|
|
173
|
+
config: { id: "q2", options: [] },
|
|
177
174
|
});
|
|
178
175
|
|
|
179
176
|
editor.addItem({ parentId: survey.rootItem!.id }, newItem);
|
|
180
|
-
editor.commit({ label:
|
|
177
|
+
editor.commit({ label: "Add q2", source: CommitSource.USER });
|
|
181
178
|
```
|
package/build/editor.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { D as SurveyCardContent, E as NavigationContent, Gt as SurveyItemCore, Jt as RawSurveyItem, M as Content, S as RawSurveyAsset, k as SurveyItemTranslations, m as ItemTypeRegistry, t as Survey, vt as TemplateValueDefinition, w as JsonComponentContent, x as RawSurvey } from "./survey-
|
|
1
|
+
import { D as SurveyCardContent, E as NavigationContent, Gt as SurveyItemCore, Jt as RawSurveyItem, M as Content, S as RawSurveyAsset, k as SurveyItemTranslations, m as ItemTypeRegistry, t as Survey, vt as TemplateValueDefinition, w as JsonComponentContent, x as RawSurvey } from "./survey-BV8YHc3J.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/editor/ai-context.d.ts
|
|
4
4
|
type SurveyAIContextScope = "tiny" | "focused" | "full";
|
|
@@ -89,7 +89,7 @@ type SerializedTranslations = {
|
|
|
89
89
|
[locale: string]: JsonComponentContent;
|
|
90
90
|
};
|
|
91
91
|
interface SurveyItemClipboardData {
|
|
92
|
-
type:
|
|
92
|
+
type: "survey-item";
|
|
93
93
|
version: string;
|
|
94
94
|
items: Array<{
|
|
95
95
|
itemId: string;
|
|
@@ -145,12 +145,12 @@ declare class ItemCopyPaste {
|
|
|
145
145
|
*/
|
|
146
146
|
private updateExpressionReferences;
|
|
147
147
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
* Update translation keys for the pasted item
|
|
149
|
+
*/
|
|
150
150
|
private updateTranslations;
|
|
151
151
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
* Validate clipboard data format
|
|
153
|
+
*/
|
|
154
154
|
static isValidClipboardData(data: unknown): data is SurveyItemClipboardData;
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
@@ -164,7 +164,7 @@ declare const CommitSource: {
|
|
|
164
164
|
readonly USER: "user";
|
|
165
165
|
readonly SYSTEM: "system";
|
|
166
166
|
};
|
|
167
|
-
type CommitSource = typeof CommitSource[keyof typeof CommitSource];
|
|
167
|
+
type CommitSource = (typeof CommitSource)[keyof typeof CommitSource];
|
|
168
168
|
interface CommitMeta {
|
|
169
169
|
label: string;
|
|
170
170
|
source?: CommitSource;
|
|
@@ -180,14 +180,22 @@ interface BaseHistoryEntry {
|
|
|
180
180
|
memorySize: number;
|
|
181
181
|
}
|
|
182
182
|
interface SurveySnapshotHistoryEntry extends BaseHistoryEntry {
|
|
183
|
-
kind:
|
|
183
|
+
kind: "survey-snapshot";
|
|
184
184
|
survey: RawSurvey;
|
|
185
185
|
}
|
|
186
186
|
interface AssetChangeHistoryEntry extends BaseHistoryEntry {
|
|
187
|
-
kind:
|
|
187
|
+
kind: "asset-change";
|
|
188
188
|
changes: AssetPatch[];
|
|
189
189
|
}
|
|
190
190
|
type HistoryEntry = SurveySnapshotHistoryEntry | AssetChangeHistoryEntry;
|
|
191
|
+
interface SurveyEditorHistoryCommit {
|
|
192
|
+
index: number;
|
|
193
|
+
kind: HistoryEntry["kind"];
|
|
194
|
+
meta: CommitMeta;
|
|
195
|
+
timestamp: number;
|
|
196
|
+
memorySize: number;
|
|
197
|
+
isCurrent: boolean;
|
|
198
|
+
}
|
|
191
199
|
type SerializedHistoryEntry = SurveySnapshotHistoryEntry | AssetChangeHistoryEntry | (BaseHistoryEntry & {
|
|
192
200
|
survey: RawSurvey;
|
|
193
201
|
});
|
|
@@ -226,12 +234,19 @@ declare class SurveyEditorUndoRedo {
|
|
|
226
234
|
*/
|
|
227
235
|
getHistory(): Array<{
|
|
228
236
|
index: number;
|
|
229
|
-
kind: HistoryEntry[
|
|
237
|
+
kind: HistoryEntry["kind"];
|
|
230
238
|
meta: CommitMeta;
|
|
231
239
|
timestamp: number;
|
|
232
240
|
memorySize: number;
|
|
233
241
|
isCurrent: boolean;
|
|
234
242
|
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Get committed history entries after the initial state up to the current index.
|
|
245
|
+
*
|
|
246
|
+
* Redo-only future entries are intentionally omitted so the returned list describes the active
|
|
247
|
+
* change chain from the initial state to the current editor state.
|
|
248
|
+
*/
|
|
249
|
+
getCommitsSinceInitial(): SurveyEditorHistoryCommit[];
|
|
235
250
|
/**
|
|
236
251
|
* Get the current index in the history
|
|
237
252
|
*/
|
|
@@ -277,7 +292,7 @@ declare class SurveyEditorUndoRedo {
|
|
|
277
292
|
interface SerializedSurveyEditor {
|
|
278
293
|
version: string;
|
|
279
294
|
survey: RawSurvey;
|
|
280
|
-
undoRedo: ReturnType<SurveyEditorUndoRedo[
|
|
295
|
+
undoRedo: ReturnType<SurveyEditorUndoRedo["serialize"]>;
|
|
281
296
|
hasUncommittedChanges: boolean;
|
|
282
297
|
}
|
|
283
298
|
interface SurveyEditorConfig extends Partial<UndoRedoConfig> {
|
|
@@ -312,6 +327,10 @@ declare class SurveyEditor {
|
|
|
312
327
|
entries: number;
|
|
313
328
|
};
|
|
314
329
|
getUndoRedoConfig(): UndoRedoConfig;
|
|
330
|
+
/**
|
|
331
|
+
* Get committed changes after the initial editor state up to the current undo/redo position.
|
|
332
|
+
*/
|
|
333
|
+
getCommitsSinceInitial(): SurveyEditorHistoryCommit[];
|
|
315
334
|
/**
|
|
316
335
|
* Serialize the SurveyEditor state to JSON
|
|
317
336
|
* @returns A JSON-serializable object containing the complete editor state
|
|
@@ -445,5 +464,5 @@ declare class SurveyEditor {
|
|
|
445
464
|
pasteItem(clipboardData: SurveyItemClipboardData, target: Target): string;
|
|
446
465
|
}
|
|
447
466
|
//#endregion
|
|
448
|
-
export { AssetPatch, BuildSurveyAIContextPackOptions, CommitMeta, CommitSource, ItemCopyPaste, SerializedSurveyEditor, SerializedTranslations, SurveyAIContextIndexes, SurveyAIContextPack, SurveyAIContextPurpose, SurveyAIContextScope, SurveyAIFocus, SurveyAIItemContextNode, SurveyAIKeyIndexEntry, SurveyAIOutlineNode, SurveyAITranslationSnippet, SurveyEditor, SurveyEditorConfig, SurveyEditorUndoRedo, SurveyItemClipboardData, Target, UndoRedoConfig, buildSurveyAIContextPack };
|
|
467
|
+
export { AssetPatch, BuildSurveyAIContextPackOptions, CommitMeta, CommitSource, ItemCopyPaste, SerializedSurveyEditor, SerializedTranslations, SurveyAIContextIndexes, SurveyAIContextPack, SurveyAIContextPurpose, SurveyAIContextScope, SurveyAIFocus, SurveyAIItemContextNode, SurveyAIKeyIndexEntry, SurveyAIOutlineNode, SurveyAITranslationSnippet, SurveyEditor, SurveyEditorConfig, SurveyEditorHistoryCommit, SurveyEditorUndoRedo, SurveyItemClipboardData, Target, UndoRedoConfig, buildSurveyAIContextPack };
|
|
449
468
|
//# sourceMappingURL=editor.d.mts.map
|
package/build/editor.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.mts","names":[],"sources":["../src/editor/ai-context.ts","../src/editor/types.ts","../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"mappings":";;;KAKY,oBAAA;AAAA,KACA,sBAAA;AAAA,UAQK,mBAAA;EACf,MAAA;EACA,QAAA;EACA,KAAA;EACA,QAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;AAAA;AAAA,UAGe,aAAA;EACf,WAAA;EACA,YAAA;EACA,WAAA;EACA,cAAA;EACA,YAAA;AAAA;AAAA,UAGe,0BAAA;EACf,MAAA;EACA,UAAA;EACA,IAAA;AAAA;AAAA,UAGe,uBAAA;EACf,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,EAAc,0BAAA;EACd,WAAA,EAAa,uBAAA;AAAA;AAAA,UAGE,qBAAA;EACf,MAAA;EACA,QAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA;EACA,IAAA;AAAA;AAAA,UAGe,sBAAA;EACf,QAAA,EAAU,qBAAA;EACV,aAAA;AAAA;AAAA,UAGe,mBAAA;EACf,OAAA,EAAS,sBAAA;EACT,KAAA,EAAO,oBAAA;EACP,SAAA;EACA,OAAA;EACA,SAAA;EACA,OAAA,EAAS,mBAAA;EACT,KAAA,GAAQ,aAAA;EACR,SAAA,GAAY,uBAAA;EACZ,OAAA,GAAU,sBAAA;EACV,KAAA;IACE,gBAAA;IACA,iBAAA;IACA,sBAAA;EAAA;EAEF,SAAA,GAAY,SAAA;AAAA;AAAA,UAGG,+BAAA;EACf,OAAA,GAAU,sBAAA;EACV,KAAA,GAAQ,oBAAA;EACR,WAAA;EACA,gBAAA;EACA,YAAA;EACA,cAAA;EACA,oBAAA;EACA,kBAAA;EACA,+BAAA;EACA,2BAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"editor.d.mts","names":[],"sources":["../src/editor/ai-context.ts","../src/editor/types.ts","../src/editor/item-copy-paste.ts","../src/editor/undo-redo.ts","../src/editor/survey-editor.ts"],"mappings":";;;KAKY,oBAAA;AAAA,KACA,sBAAA;AAAA,UAQK,mBAAA;EACf,MAAA;EACA,QAAA;EACA,KAAA;EACA,QAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA;EACA,UAAA;AAAA;AAAA,UAGe,aAAA;EACf,WAAA;EACA,YAAA;EACA,WAAA;EACA,cAAA;EACA,YAAA;AAAA;AAAA,UAGe,0BAAA;EACf,MAAA;EACA,UAAA;EACA,IAAA;AAAA;AAAA,UAGe,uBAAA;EACf,MAAA;EACA,QAAA;EACA,OAAA;EACA,OAAA;EACA,SAAA;EACA,WAAA;EACA,YAAA,EAAc,0BAAA;EACd,WAAA,EAAa,uBAAA;AAAA;AAAA,UAGE,qBAAA;EACf,MAAA;EACA,QAAA;EACA,GAAA;EACA,OAAA;EACA,SAAA;EACA,IAAA;AAAA;AAAA,UAGe,sBAAA;EACf,QAAA,EAAU,qBAAA;EACV,aAAA;AAAA;AAAA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AAA,GAAiB,sBAAA;EJ7b5C;;;;EI6cZ,wBAAA,CAAyB,OAAA;IACvB,UAAA;MAAe,MAAA;MAAgB,OAAA,GAAU,iBAAA;IAAA;IACzC,UAAA;MAAe,MAAA;MAAgB,OAAA,GAAU,iBAAA;IAAA;IACzC,kBAAA;MAAuB,MAAA;MAAgB,OAAA;QAAY,eAAA,GAAkB,OAAA;MAAA;IAAA;EAAA;EJ9cvE;;;EIweA,kBAAA,CAAA;IAAwB,KAAA;IAAe,KAAA;EAAA;EJnelB;AAGvB;;EIweE,qBAAA,CAAsB,KAAA;IAAS,KAAA;IAAe,KAAA;EAAA;EJte9C;;;EI8eA,WAAA,CAAA;IAAA,CAAkB,GAAA;EAAA;EJzelB;;;EIifA,cAAA,CAAe,QAAA;IAAA,CAAa,GAAA;EAAA;EJlGd;;;EI0Gd,gBAAA,CAAiB,GAAA,WAAc,uBAAA;EJxGtB;;;EIgHT,iBAAA,CAAA,GAAqB,GAAA,SAAY,uBAAA;EJjHzB;;;EIgIR,gBAAA,CAAiB,GAAA,UAAa,aAAA,EAAe,uBAAA;EJ9H5C;;;EIsID,mBAAA,CAAoB,GAAA;;;AHjnBtB;EGynBE,QAAA,CAAS,OAAA,WAAkB,cAAA;;;;EAQ3B,SAAA,CAAA,GAAa,GAAA,SAAY,cAAA;;;AFvnB3B;EE8nBE,QAAA,CAAS,OAAA,UAAiB,KAAA,EAAO,cAAA;;;;EAqBjC,WAAA,CAAY,OAAA;EF9oB0B;;;;;EEuqBtC,QAAA,CAAS,MAAA,WAAiB,uBAAA;EFhqB8B;;;;;;EE2qBxD,SAAA,CAAU,aAAA,EAAe,uBAAA,EAAyB,MAAA,EAAQ,MAAA;AAAA"}
|
package/build/editor.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as generateId, a as getContentPlainText, nt as structuredCloneMethod, t as Survey, u as SurveyItemTranslations, v as GroupItemCore } from "./survey-
|
|
1
|
+
import { $ as generateId, a as getContentPlainText, nt as structuredCloneMethod, t as Survey, u as SurveyItemTranslations, v as GroupItemCore } from "./survey-DnLtf19j.mjs";
|
|
2
2
|
//#region src/editor/ai-context.ts
|
|
3
3
|
const DEFAULT_SCOPE_LIMITS = {
|
|
4
4
|
tiny: 40,
|
|
@@ -724,6 +724,25 @@ var SurveyEditorUndoRedo = class SurveyEditorUndoRedo {
|
|
|
724
724
|
}));
|
|
725
725
|
}
|
|
726
726
|
/**
|
|
727
|
+
* Get committed history entries after the initial state up to the current index.
|
|
728
|
+
*
|
|
729
|
+
* Redo-only future entries are intentionally omitted so the returned list describes the active
|
|
730
|
+
* change chain from the initial state to the current editor state.
|
|
731
|
+
*/
|
|
732
|
+
getCommitsSinceInitial() {
|
|
733
|
+
return this.history.slice(1, this.currentIndex + 1).map((entry, offset) => {
|
|
734
|
+
const index = offset + 1;
|
|
735
|
+
return {
|
|
736
|
+
index,
|
|
737
|
+
kind: entry.kind,
|
|
738
|
+
meta: entry.meta,
|
|
739
|
+
timestamp: entry.timestamp,
|
|
740
|
+
memorySize: entry.memorySize,
|
|
741
|
+
isCurrent: index === this.currentIndex
|
|
742
|
+
};
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
727
746
|
* Get the current index in the history
|
|
728
747
|
*/
|
|
729
748
|
getCurrentIndex() {
|
|
@@ -911,6 +930,12 @@ var SurveyEditor = class SurveyEditor {
|
|
|
911
930
|
return this._undoRedo.getConfig();
|
|
912
931
|
}
|
|
913
932
|
/**
|
|
933
|
+
* Get committed changes after the initial editor state up to the current undo/redo position.
|
|
934
|
+
*/
|
|
935
|
+
getCommitsSinceInitial() {
|
|
936
|
+
return this._undoRedo.getCommitsSinceInitial();
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
914
939
|
* Serialize the SurveyEditor state to JSON
|
|
915
940
|
* @returns A JSON-serializable object containing the complete editor state
|
|
916
941
|
*/
|