archiyou 0.7.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.
Files changed (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +215 -0
  3. package/dist/archiyou.js +35969 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/src/Annotator.d.ts +55 -0
  6. package/dist/src/AnnotatorBaseAnnotation.d.ts +16 -0
  7. package/dist/src/AnnotatorDimensionLine.d.ts +92 -0
  8. package/dist/src/Bbox.d.ts +126 -0
  9. package/dist/src/Beams.d.ts +316 -0
  10. package/dist/src/Brep.d.ts +152 -0
  11. package/dist/src/Calc.d.ts +48 -0
  12. package/dist/src/CalcDb.d.ts +33 -0
  13. package/dist/src/CalcTable.d.ts +60 -0
  14. package/dist/src/CalcTableIO.d.ts +130 -0
  15. package/dist/src/CodeParser.d.ts +58 -0
  16. package/dist/src/ComponentManager.d.ts +33 -0
  17. package/dist/src/Console.d.ts +34 -0
  18. package/dist/src/Doc.d.ts +181 -0
  19. package/dist/src/DocDocument.d.ts +27 -0
  20. package/dist/src/DocPDFExporter.d.ts +105 -0
  21. package/dist/src/DocPage.d.ts +75 -0
  22. package/dist/src/DocPageContainer.d.ts +65 -0
  23. package/dist/src/DocPageContainerGraphic.d.ts +10 -0
  24. package/dist/src/DocPageContainerImage.d.ts +21 -0
  25. package/dist/src/DocPageContainerTable.d.ts +21 -0
  26. package/dist/src/DocPageContainerText.d.ts +23 -0
  27. package/dist/src/DocPageContainerTextArea.d.ts +23 -0
  28. package/dist/src/DocPageContainerView.d.ts +22 -0
  29. package/dist/src/DocUtils.d.ts +12 -0
  30. package/dist/src/DocViewSVGManager.d.ts +91 -0
  31. package/dist/src/Edge.d.ts +190 -0
  32. package/dist/src/Exporter.d.ts +100 -0
  33. package/dist/src/Face.d.ts +134 -0
  34. package/dist/src/GLTFBuilder.d.ts +30 -0
  35. package/dist/src/IO.d.ts +87 -0
  36. package/dist/src/LibraryConnector.d.ts +56 -0
  37. package/dist/src/Make.d.ts +85 -0
  38. package/dist/src/MakeOperations.d.ts +32 -0
  39. package/dist/src/OBbox.d.ts +121 -0
  40. package/dist/src/Obj.d.ts +104 -0
  41. package/dist/src/OcLoader.d.ts +39 -0
  42. package/dist/src/ParamManager.d.ts +57 -0
  43. package/dist/src/ParamManagerOperator.d.ts +68 -0
  44. package/dist/src/Pipeline.d.ts +20 -0
  45. package/dist/src/Point.d.ts +88 -0
  46. package/dist/src/Runner.d.ts +230 -0
  47. package/dist/src/RunnerComponentImporter.d.ts +71 -0
  48. package/dist/src/RunnerOps.d.ts +15 -0
  49. package/dist/src/Script.d.ts +78 -0
  50. package/dist/src/ScriptOutputManager.d.ts +19 -0
  51. package/dist/src/ScriptOutputPath.d.ts +48 -0
  52. package/dist/src/ScriptParam.d.ts +78 -0
  53. package/dist/src/Selector.d.ts +48 -0
  54. package/dist/src/Services.d.ts +68 -0
  55. package/dist/src/Shape.d.ts +628 -0
  56. package/dist/src/ShapeCollection.d.ts +429 -0
  57. package/dist/src/Shell.d.ts +48 -0
  58. package/dist/src/Sketch.d.ts +162 -0
  59. package/dist/src/Solid.d.ts +54 -0
  60. package/dist/src/Vector.d.ts +167 -0
  61. package/dist/src/Vertex.d.ts +57 -0
  62. package/dist/src/VertexCollection.d.ts +11 -0
  63. package/dist/src/Wire.d.ts +180 -0
  64. package/dist/src/constants.d.ts +112 -0
  65. package/dist/src/decorators.d.ts +27 -0
  66. package/dist/src/garbageCollection.d.ts +4 -0
  67. package/dist/src/init.d.ts +5 -0
  68. package/dist/src/internal.d.ts +67 -0
  69. package/dist/src/models.d.ts +40 -0
  70. package/dist/src/typeguards.d.ts +88 -0
  71. package/dist/src/types.d.ts +944 -0
  72. package/dist/src/utils.d.ts +140 -0
  73. package/dist/src/wasm/build-scripts/build_wasm_base64.d.ts +8 -0
  74. package/dist/src/wasm/index.d.ts +8 -0
  75. package/dist/src/workerUtils.d.ts +14 -0
  76. package/dist/wasm/README.md +13 -0
  77. package/dist/wasm/archiyou-opencascade.d.ts +9933 -0
  78. package/dist/wasm/archiyou-opencascade.js +16 -0
  79. package/dist/wasm/archiyou-opencascade.wasm +0 -0
  80. package/dist/wasm/index.js +32 -0
  81. package/dist/wasm/node.d.ts +16 -0
  82. package/dist/wasm/node.js +40 -0
  83. package/package.json +66 -0
@@ -0,0 +1,152 @@
1
+ import { Vector, Point, Obj, Vertex, Edge, Wire, Face, Shell, Solid, ShapeCollection, Sketch, PointLike, SelectionString, PointLikeSequence, MakeWireInput, MakeFaceInput, MakeShellInput, MakeSolidInput, AnyShapeOrCollection, AnyShapeOrCollectionOrSelectionString, ModelUnits, SketchPlaneName, Annotator } from './internal';
2
+ declare global {
3
+ interface Console {
4
+ geom: any;
5
+ user: any;
6
+ exec: any;
7
+ }
8
+ }
9
+ export declare class Brep {
10
+ _oc: any;
11
+ _annotator: Annotator;
12
+ _console: any;
13
+ _cache: {
14
+ (key: string): any;
15
+ };
16
+ _units: ModelUnits;
17
+ scene: Obj;
18
+ activeLayer: Obj;
19
+ layerStack: Array<Obj>;
20
+ activeSketch: Sketch;
21
+ _duration: number;
22
+ _captureShapesStart: ShapeCollection;
23
+ _activeLayerGroup: Obj;
24
+ constructor();
25
+ units(u?: ModelUnits): ModelUnits;
26
+ /** Creates a 2D/3D Point */
27
+ Point(p: PointLike, ...args: any[]): Point;
28
+ /** Creates a 2D/3D Vector */
29
+ Vector(p: PointLike, ...args: any[]): Vector;
30
+ /** Creates a 2D/3D Point */
31
+ Vertex(p: PointLike, ...args: any[]): Vertex;
32
+ /** Creates a Line Edge */
33
+ Edge(start: PointLike, end: PointLike): Edge;
34
+ /** Create a Line Edge */
35
+ Line(start: PointLike, end: PointLike): Edge;
36
+ /** Make an Arc with start, mid and end Point */
37
+ Arc(start: PointLike, mid: PointLike, end: PointLike): Edge;
38
+ /** Make a Spline going through given Points */
39
+ Spline(points: PointLikeSequence, ...args: any[]): Edge;
40
+ /** Creates a Wire out of sequence of Points, Edges */
41
+ Wire(entities: MakeWireInput, ...args: any[]): Wire;
42
+ /** Make Line Wire by supplying multiple points */
43
+ Polyline(entities: MakeWireInput, ...args: any[]): Wire;
44
+ /** Make 2D Spiral */
45
+ Spiral(firstRadius: number, secondRadius: number, angle: number, lefthand: boolean): Wire;
46
+ Helix(radius?: number, height?: number, angle?: number, pivot?: PointLike, direction?: PointLike, lefthand?: boolean, coneSemiAngle?: number): Wire;
47
+ /** Creates an Face */
48
+ Face(entities: MakeFaceInput, ...args: any[]): Face | Shell;
49
+ /** Create a planar Face with width and depth and optional position */
50
+ Plane(width?: number, depth?: number, normal?: PointLike, position?: PointLike): Face;
51
+ /** Create a planar Face between two Points */
52
+ PlaneBetween(from: PointLike, to: PointLike): Face;
53
+ /** Create a 2D planar Face */
54
+ Rect(width?: number, depth?: number, position?: PointLike): Face;
55
+ /** Creates a rectangular Face */
56
+ RectBetween(from: PointLike, to: PointLike): Face;
57
+ /** Create the basic planes along the main axis */
58
+ BasePlane(axis?: string, size?: number): Face;
59
+ /** Create circular Face */
60
+ Circle(radius?: number): Face | Shell;
61
+ /** Create a Shell */
62
+ Shell(entities: MakeShellInput, ...args: any[]): Shell;
63
+ /** Create a Solid */
64
+ Solid(shells: MakeSolidInput, ...args: any[]): Solid;
65
+ /** Create a Solid Box with width, depth and height and optional a position */
66
+ Box(width?: number, depth?: number, height?: number, position?: PointLike): Solid;
67
+ /** Alias for a Solid Box with width, depth and height and optional a position */
68
+ Cube(width?: number, depth?: number, height?: number, position?: PointLike): Solid;
69
+ BoxBetween(from: PointLike, to: PointLike): Solid;
70
+ /** Create a Solid Sphere */
71
+ Sphere(radius?: number, position?: PointLike): Solid;
72
+ /** Create a Solid Cone */
73
+ Cone(bottomRadius?: number, topRadius?: number, height?: number, position?: PointLike): Solid;
74
+ /** Create a Solid Cylinder */
75
+ Cylinder(radius?: number, height?: number, position?: PointLike, angle?: number): Solid;
76
+ /** Start sketching a 2D Shape on a given plane, face, or plane given by xAxis and yAxis */
77
+ sketch(plane?: SketchPlaneName | Face | PointLike, yAxis?: PointLike): Sketch;
78
+ isTemp(): void;
79
+ select(selectionString: SelectionString): void;
80
+ atVertices(): void;
81
+ moveTo(point: PointLike, ...args: any[]): void;
82
+ lineTo(point: PointLike, ...args: any[]): void;
83
+ splineTo(points: PointLikeSequence, ...args: any[]): void;
84
+ arcTo(mid: PointLike, end: PointLike): void;
85
+ rectTo(point: PointLike, ...args: any[]): void;
86
+ rect(width?: number, height?: number): void;
87
+ circleTo(point: PointLike, ...args: any[]): void;
88
+ circle(radius: number): void;
89
+ close(): void;
90
+ combine(): void;
91
+ mirror(origin?: PointLike, direction?: Vector, autoOp?: boolean): void;
92
+ offset(amount?: number, type?: string): void;
93
+ offsetted(amount?: number, type?: string): void;
94
+ fillet(size?: number, vertices?: AnyShapeOrCollectionOrSelectionString): void;
95
+ chamfer(distance?: number, angle?: number, vertices?: AnyShapeOrCollectionOrSelectionString): void;
96
+ thicken(distance?: number): void;
97
+ thickened(distance?: number): void;
98
+ importSketch(): AnyShapeOrCollection;
99
+ /** Group Shapes into a ShapeCollection */
100
+ group(shapes: AnyShapeOrCollection, ...args: any[]): ShapeCollection;
101
+ /** Group Shapes into a ShapeCollection */
102
+ collection(shapes: AnyShapeOrCollection, ...args: any[]): ShapeCollection;
103
+ /** Group Shapes into a ShapeCollection */
104
+ Collection(shapes: AnyShapeOrCollection, ...args: any[]): ShapeCollection;
105
+ /** Get active layer of group of layers */
106
+ getActiveLayer(): Obj;
107
+ addToActiveLayer(obj: Obj): this;
108
+ /** Add layer Obj to parent */
109
+ addToActiveLayerParent(layer: Obj): void;
110
+ /** Recursively get all objects within the scene Obj */
111
+ allObjs(): Obj[];
112
+ /** Remove Obj from Scene */
113
+ removeObj(o: Obj): void;
114
+ /** Return all Shapes in Scene as ShapeCollection */
115
+ all(): ShapeCollection;
116
+ /** Return all shapes on the active layer */
117
+ layerShapes(): ShapeCollection;
118
+ /** Create and/or activate a layer as sibling to active layer (or Scene)
119
+ * IMPORTANT: a layer is always a direct child of the Scene root
120
+ */
121
+ layer(name?: string): Obj;
122
+ getLayerNames(): Array<string>;
123
+ getObjNames(): Array<string>;
124
+ /** Set Layer Obj as active */
125
+ setActiveLayer(layerObj: Obj): Obj;
126
+ getLayer(layerName?: string): Obj;
127
+ /** get Shapes of given/active layer */
128
+ getLayerShapes(layerName?: string): ShapeCollection;
129
+ deleteLayer(layerName?: string): boolean;
130
+ getLatestLayerOnStack(): Obj;
131
+ returnToPreviousLayer(): Obj;
132
+ /** return to Scene root Obj */
133
+ resetLayers(): Obj;
134
+ /** clean out the scene and reset stuff if needed */
135
+ reset(): void;
136
+ /** Get a name for a layer based on existing ones and a pattern */
137
+ getNextLayerName(name: string): string;
138
+ /** Get unique name based on current names in Scene */
139
+ getNextObjName(name: string): string;
140
+ /** Start combining new layers into another layer with given name
141
+ * Call endLayerGroup() to stop grouping layers
142
+ * TODO: For later advanced use we can even supply a name of a parent Obj
143
+ */
144
+ layerGroup(name: string, inObjName?: string): Obj;
145
+ /** end grouping of Layer. Layers are now again created on scene root */
146
+ endLayerGroup(): Obj;
147
+ /** Start capturing of all new Shapes */
148
+ _captureShapes(): ShapeCollection;
149
+ /** Capture all created shapes between points in time by comparing current to _captureShapesStart */
150
+ _captureShapesEnd(): ShapeCollection;
151
+ sceneToOCCompound(): void;
152
+ }
@@ -0,0 +1,48 @@
1
+ import { ArchiyouApp, Brep, Db, Table, Metric, MetricName, MetricOptions, TableLocation, DataRows } from './internal';
2
+ export declare class Calc {
3
+ _ay: ArchiyouApp;
4
+ _brep: Brep;
5
+ db: Db;
6
+ dbData: Object;
7
+ _metrics: {
8
+ [key: string]: Metric;
9
+ };
10
+ gsheets: Record<string, any>;
11
+ constructor();
12
+ setArchiyou(ay: ArchiyouApp): void;
13
+ /** We need to know when we can load the Shapes */
14
+ init(): void;
15
+ reset(): void;
16
+ /** Get names of tables */
17
+ tables(): Array<string>;
18
+ /** Get table instances */
19
+ getTables(only: Array<string>): Array<Table>;
20
+ getTableNames(): Array<string>;
21
+ /** Make or get table with data
22
+ * @param name string
23
+ * @param data [ val1, val2, val3 ] or [{ col1: val1, col2: val2 }{ ... }]
24
+ */
25
+ table(name: string, data?: DataRows, columns?: Array<string>): Calc | Table;
26
+ /** Output raw data */
27
+ toTableData(only?: Array<string>): Record<string, Object>;
28
+ toMetricsData(only?: Array<string>): Record<string, Metric>;
29
+ /** Get internal metric objects */
30
+ metrics(): Record<string, Metric>;
31
+ /** Get internal metric objects with filtering
32
+ * @param only - array of metric names to filter by, or '*' to get all metrics
33
+ */
34
+ getMetrics(only?: Array<string>): Array<Metric>;
35
+ /** Add Metric element to dashboard */
36
+ metric(name: MetricName, data: string | number, options: MetricOptions): Metric;
37
+ /** Convert metrics to own table */
38
+ metricsToTable(): Table;
39
+ getMetricNames(): Array<string>;
40
+ setupGSheetUtils(): void;
41
+ /** Get raw data by simple table lookup with location and return TableLocation object
42
+ * We can expect values like:
43
+ * tableName
44
+ * otherTable.columnname => all values in column
45
+ * otherTable[1] => all values in row
46
+ */
47
+ _resolveTableLocation(tableLocation: string): TableLocation;
48
+ }
@@ -0,0 +1,33 @@
1
+ import { Brep, Table } from './internal';
2
+ export declare class Db {
3
+ DEBUG: boolean;
4
+ UNNAMED_TABLE: string;
5
+ _brep: Brep;
6
+ _tables: Object;
7
+ shapes: Table;
8
+ objects: Table;
9
+ constructor(brep: Brep);
10
+ init(): void;
11
+ isInitiated(): boolean;
12
+ /** reset */
13
+ reset(): void;
14
+ /** Generate standard tables */
15
+ setupTables(): void;
16
+ saveTable(table: Table, name?: string): void;
17
+ /** Rename table and update its references in Db */
18
+ renameTable(table: Table, newName: string): void;
19
+ /** Get names of tables */
20
+ tables(): Array<string>;
21
+ table(name: string): Table;
22
+ generateShapesData(): Array<Object>;
23
+ generateObjsData(): Array<Object>;
24
+ /** Output tables as raw data */
25
+ toTableData(only?: string | Array<string>): Record<string, Object>;
26
+ /** Output tables as Excel file buffers */
27
+ toTableExcel(only?: string | Array<string>): Promise<Record<string, ArrayBuffer>>;
28
+ generateTestShapesData(amount?: number): Array<Object>;
29
+ generateTestShape(): Object;
30
+ generateTestObjsData(amount?: number): Array<Object>;
31
+ generateTestObj(): Object;
32
+ randomShapeType(): string;
33
+ }
@@ -0,0 +1,60 @@
1
+ import { JSONSchema7 } from 'json-schema';
2
+ import { Db, DataRowsColumnValue, DataRowColumnValue, DataRows } from './internal';
3
+ export declare class Table {
4
+ DEFAULT_COL_NAME: string;
5
+ _name: string;
6
+ _db: Db;
7
+ _dataRows: DataRowsColumnValue;
8
+ _schema: JSONSchema7;
9
+ _component: string;
10
+ /** Make Table from rows with Objects or values */
11
+ constructor(data: DataRows, columns?: Array<string>);
12
+ /** Print table to console */
13
+ print(): DataRowsColumnValue;
14
+ /** Get/set name */
15
+ name(newName?: string): string | Table;
16
+ /** Set JSON schema for defining the structure of this table */
17
+ schema(schema?: JSONSchema7): this;
18
+ /** Validate this Table against its schema */
19
+ validate(): void;
20
+ /** Save this Table in the database*/
21
+ save(name: string): Table;
22
+ firstRow(): DataRowColumnValue;
23
+ /** Get size of table in rows and columns */
24
+ shape(): Array<number>;
25
+ size(): Array<number>;
26
+ numRows(): number;
27
+ numColumns(): number;
28
+ /** Set name of columns */
29
+ setColumns(names: Array<string>): Table;
30
+ /** Get column names */
31
+ columns(): Array<string>;
32
+ /** Return index labels. By default serial integers */
33
+ index(): Array<string | number>;
34
+ /** Add a simple row consisting of valyues */
35
+ addRow(row: Array<string | number | Record<string, string | number>>): this;
36
+ /** Output raw data in rows
37
+ * in format { [col1: row1val, col2: row1val2], [col1: row2val, ..] ... }
38
+ * */
39
+ toData(): DataRows;
40
+ /** Export this Table to Excel format in ArrayBuffer
41
+ * We use write-excel-file (https://www.npmjs.com/package/write-excel-file)
42
+ * And use automatic value type detection
43
+ */
44
+ toExcel(): Promise<ArrayBuffer>;
45
+ /** Output to Row objects */
46
+ toDataRows(): DataRowsColumnValue;
47
+ /** Output to raw Array of values of this column */
48
+ toDataColumn(columnName: string): Array<number | string>;
49
+ _protectNullUndefined(value: any): any;
50
+ _zip(keys: Array<string>, values: Array<any>): {};
51
+ _checkColumn(name: string): boolean;
52
+ _checkColumns(names: Array<string>): string[];
53
+ /** Remap keys of Object to new */
54
+ _remapObject(obj: Object, map: Object): {};
55
+ /** We need to convert some values into their real type */
56
+ _makeRealValue(value: string): string | number | boolean;
57
+ _isNumeric(value: string): boolean;
58
+ _checkObject(obj: Object, columns: Array<string>): boolean;
59
+ _range(startIndex: number, endIndex: number): Array<number>;
60
+ }
@@ -0,0 +1,130 @@
1
+ import { Table } from './internal';
2
+ interface GoogleDriveFile {
3
+ id: string;
4
+ name: string;
5
+ mimeType: string;
6
+ parents: string[];
7
+ createdTime: string;
8
+ modifiedTime: string;
9
+ }
10
+ type GoogleDriveItem = GoogleDriveFile & {
11
+ type: 'folder' | 'file';
12
+ };
13
+ interface GoogleSheetNamedRange {
14
+ name: string;
15
+ range: GoogleSheetRange;
16
+ }
17
+ interface GoogleSheetRange {
18
+ sheetId: string;
19
+ startRowIndex: number;
20
+ startColumnIndex: number;
21
+ endRowIndex: number;
22
+ endColumnIndex: number;
23
+ }
24
+ type GoogleSpreadsheet = any;
25
+ type GoogleSpreadsheetCell = any;
26
+ export declare class TableIO {
27
+ GOOGLE_KEYFILE_PATH: string;
28
+ GOOGLE_SHEETS_BASE_URL: string;
29
+ _table: Table;
30
+ _googleModule: any;
31
+ _googleSpreadsheetModule: any;
32
+ _googleAuth: any;
33
+ _googleDriveId: string;
34
+ constructor(table?: Table);
35
+ /** Export table to Excel format */
36
+ exportExcel(table: Table): Promise<ArrayBuffer>;
37
+ exportGoogleSheets(table: Table, email: string, key: string): Promise<void>;
38
+ /** Load Google module and authenticate */
39
+ initGoogle(keyfilePath?: string, driveId?: string): Promise<this>;
40
+ checkGoogleInitialized(): void;
41
+ /** Create new Google Sheet document and return its id */
42
+ createGoogleSheet(title: string, folderPath: string): Promise<string>;
43
+ _googleListFolder(folderId: string): Promise<Array<GoogleDriveItem>>;
44
+ /** List a folder specific by path
45
+ * Get files and folders from Google Drive based on path
46
+ * @param path - Path relative to the main folder (e.g., './', 'subfolder1', 'subfolder1/subfolder2')
47
+ * @returns Array of file/folder objects with id, name, type, and mimeType
48
+ */
49
+ _googleListPath(path?: string): Promise<Array<GoogleDriveItem>>;
50
+ /** Get file or folder by path, return undefined if not exists
51
+ * @param path - Path relative to the main folder (e.g., './', 'subfolder1/file.txt')
52
+ * @returns File or Folder item
53
+ */
54
+ _googleGetPathItem(path: string): Promise<GoogleDriveItem | undefined>;
55
+ /** Copy a Google Drive item to a new location given as path
56
+ * NOTE: Please make sure the folders exist!
57
+ */
58
+ copyGoogleItem(item: GoogleDriveItem, itemNewPath: string): Promise<GoogleDriveItem>;
59
+ /** Get content of item by path
60
+ * If path is file get file contents
61
+ * If path is folder get list of items in folder
62
+ */
63
+ private _googleGetContentPath;
64
+ /** Get content of a file or folder */
65
+ private _googleGetItemContent;
66
+ /** Get content of a file based on its mimeType */
67
+ private _googleGetItemFileContent;
68
+ private _isGoogleWorkspaceFile;
69
+ /** Export Google Workspace files to downloadable formats */
70
+ private _exportGoogleWorkspaceFile;
71
+ /** Download regular (non-Google Workspace) files */
72
+ private _downloadRegularFile;
73
+ openGoogleSheet(sheetId: string): Promise<GoogleSpreadsheet>;
74
+ /** Powertool that creates a copy of a template sheet
75
+ * then fills in the inputs, resolve any IMPORTRANGE formulas, and returns the id of a new sheet
76
+ */
77
+ googleSheetFromTemplate(templateSheetPath: string, newSheetPath: string, inputs: Record<string, any>, makePublic?: boolean, returnUrl?: boolean): Promise<string>;
78
+ /** Load module google-spreadsheet dynamically */
79
+ _initGoogleSpreadsheet(): Promise<void>;
80
+ /** Get named ranges from a Google Sheet
81
+ * Named ranges are predefined ranges of cells that can be referenced by name
82
+ * NOTE: Named ranges are global to the spreadsheet, not per worksheet
83
+ * @param sheet - Google Spreadsheet object
84
+ * @returns Array of named ranges with their details
85
+ * @example
86
+ * [
87
+ * {
88
+ * namedRangeId: 'g34lb4bdpigh',
89
+ * name: 'MyNamedRange',
90
+ * range: {
91
+ * sheetId: 0,
92
+ * startRowIndex: 1,
93
+ * endRowIndex: 5,
94
+ * startColumnIndex: 1,
95
+ * endColumnIndex: 3
96
+ * }
97
+ * },
98
+ * ...
99
+ * ]
100
+ *
101
+ * NOTE: Because google-spreadsheet doesn't support named ranges yet, we implement it using Google API directly
102
+ *
103
+ */
104
+ _googleSheetGetNamedRanges(sheet: GoogleSpreadsheet): Promise<Array<GoogleSheetNamedRange>>;
105
+ /** Set and save inputs on a Google Sheet
106
+ * We use named ranges to set inputs (inputs.<<name>>)
107
+ * So make sure to define named ranges in the sheet like inputs.width, inputs.depth, etc.
108
+ * @param inputs - Record of named range to values
109
+ *
110
+ */
111
+ googleSheetSetInputs(sheet: GoogleSpreadsheet, inputs: Record<string, any>): Promise<void>;
112
+ /** Replace any references to other sheets (using IMPORTRANGE)
113
+ * with actual data from the referenced sheets
114
+ * For now search all worksheets for IMPORTRANGE formulas
115
+ *
116
+ * @param sheet - Google Spreadsheet object
117
+ * @param worksheets - Optional array of worksheet names to process, if empty process all. Case insensitive.
118
+ */
119
+ googleSheetResolveImportRangeFormulas(sheet: GoogleSpreadsheet, worksheets?: Array<string>): Promise<void>;
120
+ _googleWorksheetIterateCells(worksheet: any, callback: (cell: GoogleSpreadsheetCell, row: number, col: number) => void): Promise<void>;
121
+ /** Iterate over cells in a sheet, or specific worksheet
122
+ * If callback returns GoogleSpreadsheetCell instance, update the cells content
123
+ */
124
+ _googleSheetIterEditCells(sheet: GoogleSpreadsheet, worksheets: Array<string>, callback: (cell: GoogleSpreadsheetCell, row: any, col: number) => Promise<GoogleSpreadsheetCell | void>): Promise<void>;
125
+ /** Set permissions on a Google Drive file using Drive API directly */
126
+ googleDriveSetPermissions(sheet: GoogleSpreadsheet, role: 'reader' | 'writer' | 'commenter', type: 'user' | 'group' | 'domain' | 'anyone', emailAddress?: string): Promise<void>;
127
+ /** Remove public access from a Google Drive file */
128
+ googleDriveRemovePublicAccess(sheet: GoogleSpreadsheet): Promise<void>;
129
+ }
130
+ export {};
@@ -0,0 +1,58 @@
1
+ import { Statement } from './internal';
2
+ import { Options, Node } from 'acorn';
3
+ import { ScriptVersion, ImportStatement } from './models';
4
+ import { IO } from './IO';
5
+ interface PreStats {
6
+ numStatements: number;
7
+ }
8
+ export declare class CodeParser {
9
+ ACORN_OPTIONS: Options;
10
+ IMPORT_RE: RegExp;
11
+ LOAD_RE: RegExp;
12
+ DOC_RE: RegExp;
13
+ config: any;
14
+ code: string;
15
+ io: IO;
16
+ tree: any;
17
+ statements: Array<Statement>;
18
+ importStatements: Array<ImportStatement>;
19
+ prestats: PreStats;
20
+ importedScriptCache: {
21
+ [key: string]: ScriptVersion;
22
+ };
23
+ importedScriptQueue: Array<ImportStatement>;
24
+ constructor(code: string, config: any, io: IO);
25
+ update(code: string, config?: any): void;
26
+ /** Split as best as possible into seperate statements to be executed */
27
+ parse(): void;
28
+ /** Create Statements from AST tree */
29
+ makeStatements(): Array<Statement>;
30
+ getGlobalVars(): Array<string>;
31
+ getCodeOfNode(node: Node): string;
32
+ /** Filter statement on a given filters */
33
+ filterStatements(): void;
34
+ removeDeclarations(): void;
35
+ addComponentCodeDeclarations(componentCode: string): string;
36
+ /** Preload special statements like $import and $load which need to fetch data */
37
+ preloadSpecialStatements(): Promise<Statement[]>;
38
+ transformImportStatement(importStatement: ImportStatement, importedScript: ScriptVersion): void;
39
+ parseImportStatement(statement: Statement): ImportStatement;
40
+ /** Fetch component from cache or from servers */
41
+ fetchImportScript(importStatement: ImportStatement): Promise<ScriptVersion>;
42
+ handleFetchedImportScript(response: any): Promise<ScriptVersion>;
43
+ handleFetchedImportScriptError(importStatement: ImportStatement): void;
44
+ manageImportScriptQueue(): void;
45
+ placeImportScriptInCache(script: ScriptVersion): void;
46
+ /** Get import script from cache */
47
+ getImportScriptFromCache(name: string): Promise<ScriptVersion>;
48
+ /** Test is a given statement is a import statement */
49
+ isImportStatement(statement: Statement): boolean;
50
+ isLoadStatement(statement: Statement): boolean;
51
+ isDocStatement(statement: Statement): boolean;
52
+ /** Output statements */
53
+ getStatements(): Promise<Array<Statement>>;
54
+ /** Synchronous call to get statement without importing components */
55
+ getStatementsWithoutImports(): Array<Statement>;
56
+ _generateImportedScriptRealCode(importedScript: ScriptVersion, importStatement: ImportStatement): string;
57
+ }
58
+ export {};
@@ -0,0 +1,33 @@
1
+ import { ArchiyouApp, ScriptVersion } from './internal';
2
+ export declare class ComponentManager {
3
+ _ay: ArchiyouApp;
4
+ _components: Record<string, any>;
5
+ _scriptCache: Record<string, any>;
6
+ constructor(_ay: ArchiyouApp);
7
+ /** Register a component for importing
8
+ *
9
+ * @param path - the path to the component script on Archiyou platform, can be with or without version
10
+ * 'archiyou/wall:1.0' or 'archiyou/wall' - version pinning is probably better
11
+ * @params params - any parameters values to pass to the component
12
+ * @params options - any options to pass to the component - repe
13
+ *
14
+ * $component[an instance of ComponentManager].load('path/to/my-component.js')
15
+ *
16
+ */
17
+ load(path: string, params: Record<string, any>, options: Record<string, any>): this;
18
+ }
19
+ /** ImportComponent */
20
+ export declare class ImportComponent {
21
+ _manager: ComponentManager;
22
+ _path: string;
23
+ _params: Record<string, any>;
24
+ _options: Record<string, any>;
25
+ _script: ScriptVersion;
26
+ _error: boolean;
27
+ constructor(path: string, params: Record<string, any>, options: Record<string, any>);
28
+ setManager(manager: ComponentManager): this;
29
+ /** Fetch the script of the component */
30
+ fetchScript(useCache?: boolean): Promise<this>;
31
+ /** Give information on the component by loading it */
32
+ info(): void;
33
+ }
@@ -0,0 +1,34 @@
1
+ import { ConsoleMessage, ConsoleMessageType } from './types';
2
+ export declare class Console {
3
+ USE_COLORS: boolean;
4
+ ENDING_COLOR: string;
5
+ TYPE_TO_COLOR_CODE: Record<ConsoleMessageType, string>;
6
+ output: any;
7
+ buffer: Array<ConsoleMessage>;
8
+ _originalConsole: any;
9
+ constructor(output: any);
10
+ /** Binds either to Vuex store, WebWorker, direct console or an internal array */
11
+ connect(output?: any): void;
12
+ /** Reset the Console, removing all previous messages */
13
+ reset(): void;
14
+ _getOutputType(): string;
15
+ /** pass the message allong */
16
+ sendMessage(message: ConsoleMessage): void;
17
+ _wrapMessageStringWithColor(message: ConsoleMessage): string;
18
+ newMessage(type: ConsoleMessageType, message: any): void;
19
+ stringifyMessage(message: any): string;
20
+ info(message: any): void;
21
+ log(message: any): void;
22
+ /** Make a user message */
23
+ user(message: any): void;
24
+ /** log an error */
25
+ error(message: any): void;
26
+ warn(message: any): void;
27
+ /** Creation of geometry */
28
+ geom(message: any): void;
29
+ /** Messages about statement execution */
30
+ exec(message: any): void;
31
+ _currentTime(): string;
32
+ getBufferedMessages(types?: Array<ConsoleMessageType>): Array<ConsoleMessage>;
33
+ getErrors(): Array<ConsoleMessage>;
34
+ }