@thatopen/services 0.25.0 → 0.26.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.
@@ -0,0 +1,9 @@
1
+ import { EngineServicesClient } from '../client';
2
+ import { Recipe } from '../recipes';
3
+
4
+ export { fragToRevit, ifcToRevit } from './records-to-revit';
5
+ export { rhinoToRevit } from './rhino-to-revit';
6
+ /** The built-in recipes, in catalog order. */
7
+ export declare const builtinRecipes: Recipe<any>[];
8
+ /** Registers every built-in recipe on the client's registry. */
9
+ export declare function registerBuiltinRecipes(client: EngineServicesClient): void;
@@ -0,0 +1,24 @@
1
+ import { Recipe } from '../recipes';
2
+
3
+ /** A family type of the target, as the target publishes it. */
4
+ interface RevitType {
5
+ categoryId: string;
6
+ family: string;
7
+ type: string;
8
+ }
9
+ interface Settings {
10
+ /** The Revit type every proposed column gets. */
11
+ columnType?: RevitType;
12
+ /**
13
+ * Trust the records' own style names instead: `lookRef`
14
+ * "Family:Type" becomes the proposal's Family and Type verbatim. Revit
15
+ * matches a type exactly and refuses the whole request when one is missing
16
+ * — right for a model that came FROM this Revit, wrong for anything else.
17
+ */
18
+ trustStyleNames?: boolean;
19
+ /** Also propose free-standing family instances (furniture, equipment). Needs trustStyleNames. */
20
+ includeInstances?: boolean;
21
+ }
22
+ export declare const fragToRevit: Recipe<Settings>;
23
+ export declare const ifcToRevit: Recipe<Settings>;
24
+ export {};
@@ -0,0 +1,16 @@
1
+ import { Recipe } from '../recipes';
2
+
3
+ /** A family type of the target, as the target publishes it. */
4
+ interface RevitType {
5
+ categoryId: string;
6
+ family: string;
7
+ type: string;
8
+ }
9
+ interface Settings {
10
+ /** The Rhino layer that drives placement. */
11
+ layer: string;
12
+ /** The Revit type every placed object becomes. */
13
+ instanceType: RevitType;
14
+ }
15
+ export declare const rhinoToRevit: Recipe<Settings>;
16
+ export {};
@@ -0,0 +1,42 @@
1
+ import { RecipeContext } from '../recipes';
2
+ import { FragItem } from '../frag-items';
3
+
4
+ /** The modeling engine's attribute names (its `element-attributes.ts`). */
5
+ export declare const ELEMENT_FIELD = "Element";
6
+ export declare const CARRIED_FIELD = "Carried";
7
+ /** Revit's internal length unit: where every position has to end up. */
8
+ export declare const FEET_PER_METRE: number;
9
+ /** One semantic record, as saved: `params` carries the kind-specific fields. */
10
+ export interface OurRecord {
11
+ id: string;
12
+ kind: string;
13
+ params: Record<string, unknown>;
14
+ /** The item it rode in (its guid is the publisher's id, when it has one). */
15
+ item: FragItem;
16
+ }
17
+ /** Every record of a read .frag: items' `Element` plus their `Carried` lists. */
18
+ export declare function recordsOf(items: FragItem[]): OurRecord[];
19
+ /**
20
+ * A param the converter double-encodes (`params.run`, `params.member`,
21
+ * `params.definition`… are JSON IN TEXT inside the record's JSON).
22
+ */
23
+ export declare function innerJson<T>(record: OurRecord, param: string): T | null;
24
+ /** Level id (`datum:N`) → its name, from the document's datum records. */
25
+ export declare function levelNames(records: OurRecord[]): Map<string, string>;
26
+ /**
27
+ * Source id → what this recipe already made for it, read back from its own
28
+ * APPLIED suggestions: the i-th id the target answered with is what the i-th
29
+ * change made. It keeps nothing of its own, so it behaves the same whoever
30
+ * runs it and wherever (the pattern the first end-to-end conversion proved).
31
+ */
32
+ export declare function whatItMadeBefore(context: RecipeContext<never> | RecipeContext<unknown>, author: string): Promise<Map<string, string>>;
33
+ /** The project file the person picked as a recipe's source. */
34
+ export interface PickedFile {
35
+ fileId: string;
36
+ name: string;
37
+ }
38
+ /** Downloads and reads the picked .frag, with the errors a person can act on. */
39
+ export declare function readPickedFrag(context: RecipeContext<unknown>, picked: PickedFile | undefined): Promise<{
40
+ picked: PickedFile;
41
+ contents: import('../frag-items').FragContents;
42
+ }>;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Reads what a .frag SAYS — its metadata and its items' guids, categories and
3
+ * attributes — without loading it as something to look at.
4
+ *
5
+ * The fragments model loader is for models somebody will render: it starts
6
+ * workers, builds tiles and boxes, and streams geometry. A recipe wants none
7
+ * of that. It wants the data, it wants it synchronously enough to loop over,
8
+ * and it wants it for files that may have no geometry at all.
9
+ *
10
+ * So this walks the flatbuffer directly, using the same schema the writer
11
+ * uses, which also keeps the two honest about each other. The schema comes
12
+ * from the OPTIONAL PEER `@thatopen/fragments` (plus `flatbuffers`), loaded
13
+ * when `readFrag` runs — same arrangement as {@link OperationBuilder}.
14
+ */
15
+ export interface FragItem {
16
+ localId: number;
17
+ /** The publisher's own id for this thing — a Rhino object guid, a Revit UniqueId. */
18
+ guid: string | null;
19
+ category: string | null;
20
+ attrs: Record<string, string>;
21
+ }
22
+ export interface FragContents {
23
+ /** Whatever the publisher declared: units, axes, application. Parsed, or `{}` if unreadable. */
24
+ metadata: Record<string, unknown>;
25
+ /** In file order, which for an operation payload is the order the ids come back in. */
26
+ items: FragItem[];
27
+ }
28
+ export declare function readFrag(bytes: Uint8Array): Promise<FragContents>;