@draftwright/specify-core-wasm 0.1.17 → 0.2.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/NOTICE +24 -0
- package/README.md +12 -8
- package/package.json +3 -2
- package/specify_core_wasm.d.ts +11 -4
- package/specify_core_wasm.js +18 -13
- package/specify_core_wasm_bg.wasm +0 -0
package/NOTICE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
specify-core-rust (a Rust port of specify-core)
|
|
2
|
+
Copyright (C) 2026 Betwixt Limited (trading as Draftwright)
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
5
|
+
this software except in compliance with the License. You may obtain a copy of the
|
|
6
|
+
License in LICENSE or at http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
|
|
8
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
9
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
10
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
11
|
+
specific language governing permissions and limitations under the License.
|
|
12
|
+
|
|
13
|
+
Third-party material:
|
|
14
|
+
|
|
15
|
+
- tests/fixtures/freecad contains unmodified FreeCAD-library STEP files by
|
|
16
|
+
nicoguaro and Francisco, compressed for regression tests, under CC-BY-3.0.
|
|
17
|
+
Attribution, source links and the licence are in that directory.
|
|
18
|
+
|
|
19
|
+
- src/specify_core/fonts/futural.jhf is the Hershey "Futura Light" single-stroke
|
|
20
|
+
font in James Hurt's format, from https://github.com/kamalmostafa/hershey-fonts.
|
|
21
|
+
The Hershey Fonts were originally created by Dr. A. V. Hershey while working
|
|
22
|
+
at the U. S. National Bureau of Standards. The format of the Font data in this
|
|
23
|
+
distribution was originally created by James Hurt, Cognition, Inc., 900
|
|
24
|
+
Technology Park Drive, Billerica, MA 01821 (mit-eddie!ci-dandelion!hurt).
|
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# specify-core-wasm
|
|
2
2
|
|
|
3
3
|
Browser bindings for specify-core. See [the WASM guide](https://github.com/pzfreo/specify-core/blob/main/docs/wasm.md)
|
|
4
|
-
for the JSON API, build instructions and
|
|
4
|
+
for the JSON API, build instructions and installation, from npm
|
|
5
|
+
(`npm install @draftwright/specify-core-wasm`) or from a release archive.
|
|
5
6
|
|
|
6
7
|
Initialize the web module, then use `IntentEngine`, `review` and `interpret`.
|
|
7
8
|
Errors are thrown as strings. STEP input must be decompressed. The constructor opens a file
|
|
@@ -11,15 +12,18 @@ the parts with `IntentEngine.parts(name, bytes)` and open one with
|
|
|
11
12
|
original file. `writePmi` uses the upstream verified writer and optionally stores the
|
|
12
13
|
base64 `draftwright editor project` attribute on the part.
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
Apache-2.0; see [LICENSE](https://github.com/pzfreo/specify-core/blob/main/LICENSE) and
|
|
16
|
+
[NOTICE](https://github.com/pzfreo/specify-core/blob/main/NOTICE). The bundled haecceity and
|
|
17
|
+
quiddity ([pzfreo/quiddity](https://github.com/pzfreo/quiddity)) are Apache-2.0 too.
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
Snapshot faces include usable unique authored STEP `f:` names.
|
|
17
20
|
Shared/generic labels retain geometric matching and are omitted from analysis. Keep the entire
|
|
18
21
|
`evidence()` object with external answers: named parts use schema 3; missing or
|
|
19
22
|
duplicate names are unresolved without geometric fallback. See
|
|
20
|
-
[face-name matching and compatibility](
|
|
23
|
+
[face-name matching and compatibility](https://github.com/pzfreo/specify-core/blob/main/docs/face-names.md).
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
Answer sidecars (with geometry evidence) can be exported before writing:
|
|
26
|
+
`engine.exportAnswers(answersJson, approvalsJson?)` returns an answer map as JSON: the answers
|
|
27
|
+
given plus exactly the defaults approved (`{"<part>": {"<id>": value}}`).
|
|
28
|
+
Open questions and carry blocks do not throw (`writePmi` reports what is open). See
|
|
29
|
+
[answer files](https://github.com/pzfreo/specify-core/blob/main/docs/answers.md#export-a-sidecar).
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@draftwright/specify-core-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Browser bindings for Specify's questions and manufacturing intent",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.2.0",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"files": [
|
|
12
12
|
"specify_core_wasm_bg.wasm",
|
|
13
13
|
"specify_core_wasm.js",
|
|
14
|
-
"specify_core_wasm.d.ts"
|
|
14
|
+
"specify_core_wasm.d.ts",
|
|
15
|
+
"NOTICE"
|
|
15
16
|
],
|
|
16
17
|
"main": "specify_core_wasm.js",
|
|
17
18
|
"types": "specify_core_wasm.d.ts",
|
package/specify_core_wasm.d.ts
CHANGED
|
@@ -141,6 +141,10 @@ export interface SavedViewFinding {
|
|
|
141
141
|
/** Report in writePmi JSON; optional diagnostic keys are absent when empty. */
|
|
142
142
|
export interface WriteReport {
|
|
143
143
|
output: string;
|
|
144
|
+
/** False when required questions are still open; the file is written all the same. */
|
|
145
|
+
complete: boolean;
|
|
146
|
+
/** The required question ids still open (as `write` would list them); [] when complete. */
|
|
147
|
+
missing: string[];
|
|
144
148
|
written: string[];
|
|
145
149
|
not_written: string[];
|
|
146
150
|
warnings: string[];
|
|
@@ -175,6 +179,7 @@ export interface PmiItemChange {
|
|
|
175
179
|
old?: string;
|
|
176
180
|
new?: string;
|
|
177
181
|
reason?: string;
|
|
182
|
+
detail?: string;
|
|
178
183
|
}
|
|
179
184
|
export interface DiffPmi {
|
|
180
185
|
items: PmiItemChange[];
|
|
@@ -203,10 +208,12 @@ export class IntentEngine {
|
|
|
203
208
|
*/
|
|
204
209
|
evidence(): string;
|
|
205
210
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
211
|
+
* Answer map for saving: the answers given, exactly the defaults in `approved`
|
|
212
|
+
* (optional JSON, `{"<part>": {"<id>": value}}` with the values the person saw; none
|
|
213
|
+
* when absent) and `_specify.evidence`. Never every default (ADR P9); open questions
|
|
214
|
+
* stay open. Throws if an approval is not an open question's default as it stands.
|
|
208
215
|
*/
|
|
209
|
-
exportAnswers(answers: string): string;
|
|
216
|
+
exportAnswers(answers: string, approved?: string | null): string;
|
|
210
217
|
/**
|
|
211
218
|
* Part `part` (an index from `IntentEngine.parts`) of any file, an assembly included.
|
|
212
219
|
*/
|
|
@@ -307,7 +314,7 @@ export interface InitOutput {
|
|
|
307
314
|
readonly intentengine_acceptDefaults: (a: number, b: number, c: number) => [number, number, number, number];
|
|
308
315
|
readonly intentengine_bom: (a: number, b: number) => [number, number, number, number];
|
|
309
316
|
readonly intentengine_evidence: (a: number) => [number, number, number, number];
|
|
310
|
-
readonly intentengine_exportAnswers: (a: number, b: number, c: number) => [number, number, number, number];
|
|
317
|
+
readonly intentengine_exportAnswers: (a: number, b: number, c: number, d: number, e: number) => [number, number, number, number];
|
|
311
318
|
readonly intentengine_open: (a: number, b: number, c: number, d: number) => [number, number, number];
|
|
312
319
|
readonly intentengine_openPart: (a: number, b: number, c: number, d: number, e: number) => [number, number, number];
|
|
313
320
|
readonly intentengine_original: (a: number) => [number, number];
|
package/specify_core_wasm.js
CHANGED
|
@@ -89,29 +89,34 @@ export class IntentEngine {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
92
|
+
* Answer map for saving: the answers given, exactly the defaults in `approved`
|
|
93
|
+
* (optional JSON, `{"<part>": {"<id>": value}}` with the values the person saw; none
|
|
94
|
+
* when absent) and `_specify.evidence`. Never every default (ADR P9); open questions
|
|
95
|
+
* stay open. Throws if an approval is not an open question's default as it stands.
|
|
94
96
|
* @param {string} answers
|
|
97
|
+
* @param {string | null} [approved]
|
|
95
98
|
* @returns {string}
|
|
96
99
|
*/
|
|
97
|
-
exportAnswers(answers) {
|
|
98
|
-
let
|
|
99
|
-
let
|
|
100
|
+
exportAnswers(answers, approved) {
|
|
101
|
+
let deferred4_0;
|
|
102
|
+
let deferred4_1;
|
|
100
103
|
try {
|
|
101
104
|
const ptr0 = passStringToWasm0(answers, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
102
105
|
const len0 = WASM_VECTOR_LEN;
|
|
103
|
-
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
+
var ptr1 = isLikeNone(approved) ? 0 : passStringToWasm0(approved, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
107
|
+
var len1 = WASM_VECTOR_LEN;
|
|
108
|
+
const ret = wasm.intentengine_exportAnswers(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
109
|
+
var ptr3 = ret[0];
|
|
110
|
+
var len3 = ret[1];
|
|
106
111
|
if (ret[3]) {
|
|
107
|
-
|
|
112
|
+
ptr3 = 0; len3 = 0;
|
|
108
113
|
throw takeFromExternrefTable0(ret[2]);
|
|
109
114
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return getStringFromWasm0(
|
|
115
|
+
deferred4_0 = ptr3;
|
|
116
|
+
deferred4_1 = len3;
|
|
117
|
+
return getStringFromWasm0(ptr3, len3);
|
|
113
118
|
} finally {
|
|
114
|
-
wasm.__wbindgen_free(
|
|
119
|
+
wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
/**
|
|
Binary file
|