bimplus-websdk 1.0.64 → 1.0.65
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/.github/copilot-instructions.md +64 -0
- package/.github/instructions/api-core.instructions.md +144 -0
- package/.github/instructions/project-attributes.instructions.md +172 -0
- package/.github/instructions/test-conventions.instructions.md +209 -0
- package/.github/instructions/typescript-declarations.instructions.md +116 -0
- package/README.md +118 -118
- package/clean +3 -3
- package/dist/bimplus-websdk.js +1 -1
- package/eslint.config.mjs +36 -35
- package/install +3 -3
- package/jsinspect +20 -20
- package/package.json +72 -72
- package/reinstall +4 -4
- package/types/bimplus-websdk.d.ts +532 -532
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
applyTo: "websdk/types/bimplus-websdk.d.ts"
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Bimplus WebSDK — TypeScript Declarations
|
|
6
|
+
|
|
7
|
+
## File Structure
|
|
8
|
+
|
|
9
|
+
All declarations live inside a single module augmentation — never add top-level exports outside it:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
declare module 'bimplus-websdk' {
|
|
13
|
+
// all types here
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Base Type Aliases
|
|
20
|
+
|
|
21
|
+
These are already defined — use them for parameter and return types instead of plain `string`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
Guid // string UUID
|
|
25
|
+
ProjectId // Guid
|
|
26
|
+
ModelId // Guid
|
|
27
|
+
LayerId // Guid
|
|
28
|
+
DivisionTopologyId // Guid
|
|
29
|
+
RevisionId // string
|
|
30
|
+
TeamSlug // string
|
|
31
|
+
AccessToken // string
|
|
32
|
+
AccessTokenType // string
|
|
33
|
+
HTML // string
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Pattern for a New Resource Module
|
|
39
|
+
|
|
40
|
+
For each new `src/Api/MyResource.js`, add three things:
|
|
41
|
+
|
|
42
|
+
### 1. A data interface
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
export interface MyResourceData {
|
|
46
|
+
id: Guid;
|
|
47
|
+
name: string;
|
|
48
|
+
// match field names from the REST API response exactly
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 2. A class declaration
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
export class MyResource {
|
|
56
|
+
constructor(api: Api);
|
|
57
|
+
get(id?: Guid): Promise<MyResourceData | MyResourceData[]>;
|
|
58
|
+
post(data: string): Promise<MyResourceData>;
|
|
59
|
+
put(id: Guid, data: string): Promise<MyResourceData>;
|
|
60
|
+
delete(id: Guid): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 3. A property on the `Api` class
|
|
65
|
+
|
|
66
|
+
Add to the existing `Api` class body, matching the exact property name from `src/Api/Api.js`:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
// In src/Api/Api.js: this.myResource = new MyResource(this)
|
|
70
|
+
myResource: MyResource;
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Conventions
|
|
76
|
+
|
|
77
|
+
- All async methods return `Promise<T>` — never use jQuery types (`JQuery.Promise`, `$.Deferred`) in declarations
|
|
78
|
+
- For optional parameters use `?`: `get(id?: Guid)`
|
|
79
|
+
- For methods that return a single item or an array: `Promise<T | T[]>`
|
|
80
|
+
- `data` parameters passed as `JSON.stringify(...)` in the source are typed as `string`
|
|
81
|
+
- Keep parameter names consistent with the JSDoc `@param` names in the corresponding source file
|
|
82
|
+
- For complex `data` shapes that are always structured objects (not stringified), define a dedicated interface and use it: `post(data: MyResourceData): Promise<MyResourceData>`
|
|
83
|
+
- For query-param-only options (e.g. `additionalParams`), use a typed object or the existing `AdditionalParams` alias:
|
|
84
|
+
```ts
|
|
85
|
+
type AdditionalParams = { [key: string]: string };
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Api Class Declaration
|
|
91
|
+
|
|
92
|
+
The `Api` class in this file is the single source of truth for TypeScript consumers. Every namespace instantiated in `src/Api/Api.js` must appear as a property:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
export class Api {
|
|
96
|
+
constructor(config?: ApiConfig);
|
|
97
|
+
setAccessToken(token: AccessToken): void;
|
|
98
|
+
setTokenType(tokenType: AccessTokenType): void;
|
|
99
|
+
setAccessTokenAndType(token: AccessToken, tokenType: AccessTokenType): void;
|
|
100
|
+
getAccessToken(): AccessToken;
|
|
101
|
+
getTokenType(): AccessTokenType;
|
|
102
|
+
getAccessTokenAndType(): { token: AccessToken; tokenType: AccessTokenType };
|
|
103
|
+
setTeamSlug(slug: TeamSlug): void;
|
|
104
|
+
getTeamSlug(): TeamSlug;
|
|
105
|
+
getApiUrl(): string;
|
|
106
|
+
getApiTeamUrl(): string;
|
|
107
|
+
|
|
108
|
+
// resource namespaces
|
|
109
|
+
authorize: Authorize;
|
|
110
|
+
projects: Projects;
|
|
111
|
+
models: Models;
|
|
112
|
+
// ... one line per namespace
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
When adding a new module, append its property in the same order it appears in the `Api` constructor in `src/Api/Api.js`.
|
package/README.md
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
|
-
bim+ websdk
|
|
2
|
-
=========
|
|
3
|
-
|
|
4
|
-
bim+ websdk is a javascript wrapper around the bim+ api
|
|
5
|
-
|
|
6
|
-
Quick Links
|
|
7
|
-
-----------
|
|
8
|
-
|
|
9
|
-
https://nemetschekprime.atlassian.net/wiki/spaces/bimpluspublic/pages/1090127532/Bimplus+Web+SDK+Reference
|
|
10
|
-
|
|
11
|
-
How to build
|
|
12
|
-
------------
|
|
13
|
-
|
|
14
|
-
### Install nodejs
|
|
15
|
-
[http://www.nodejs.org/](http://www.nodejs.org/)
|
|
16
|
-
|
|
17
|
-
### Install local npm modules
|
|
18
|
-
Open up a normal command line (admin is not needed) and go to the websdk folder
|
|
19
|
-
|
|
20
|
-
npm install
|
|
21
|
-
|
|
22
|
-
(whenever package.json has changed, you might to do this again)
|
|
23
|
-
|
|
24
|
-
### Build websdk
|
|
25
|
-
Library building process is using UMD (Universal Module Definition) output format so
|
|
26
|
-
it's compatible with both cjs and amd module formats. The same library can be use in the
|
|
27
|
-
client or on the server. Build process is using babel so it's possible to use new ES2015
|
|
28
|
-
code in source codes.
|
|
29
|
-
|
|
30
|
-
Library can be build in several ways as a dev or prod version.
|
|
31
|
-
To run a dev build with source maps run:
|
|
32
|
-
|
|
33
|
-
npm run build
|
|
34
|
-
|
|
35
|
-
To build a prod version - uglified, minified run:
|
|
36
|
-
|
|
37
|
-
npm run build-prod
|
|
38
|
-
|
|
39
|
-
Pulish new release to npm (Hint: Before doing this npm login needs to be done and the package version adjusted) :
|
|
40
|
-
|
|
41
|
-
npm run npm-publish
|
|
42
|
-
|
|
43
|
-
Check content of npm package (result is bimplus-renderer@(version).tar.gz)
|
|
44
|
-
|
|
45
|
-
npm run npm-pack
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
### Develop/Debug websdk
|
|
49
|
-
goto your websdk folder
|
|
50
|
-
|
|
51
|
-
npm link
|
|
52
|
-
|
|
53
|
-
goto your application folder which uses the websdk
|
|
54
|
-
|
|
55
|
-
npm link bimplus-websdk
|
|
56
|
-
|
|
57
|
-
Do you changes in the websdk and build
|
|
58
|
-
|
|
59
|
-
npm run build
|
|
60
|
-
|
|
61
|
-
or
|
|
62
|
-
|
|
63
|
-
npm run build-prod
|
|
64
|
-
|
|
65
|
-
Your app will automatically get the changes done in the renderer
|
|
66
|
-
|
|
67
|
-
After developing it might be wise to unlink:
|
|
68
|
-
goto your websdk folder
|
|
69
|
-
|
|
70
|
-
npm unlink
|
|
71
|
-
goto your application folder which uses the websdk
|
|
72
|
-
|
|
73
|
-
npm unlink bimplus-websdk
|
|
74
|
-
npm install
|
|
75
|
-
|
|
76
|
-
### Unit testing
|
|
77
|
-
With every build output is copied also to the test folder.
|
|
78
|
-
To run the unit tests go to the test subfolder and run :
|
|
79
|
-
|
|
80
|
-
npm install
|
|
81
|
-
npm run test
|
|
82
|
-
|
|
83
|
-
For more information see README.md inside the test folder
|
|
84
|
-
|
|
85
|
-
### Documentation
|
|
86
|
-
Bimplus WebSDK uses npm documentation plugin for easy documentation generation.
|
|
87
|
-
To generate a documentation please install documentation plugin via npm :
|
|
88
|
-
|
|
89
|
-
npm install -g documentation
|
|
90
|
-
|
|
91
|
-
To create documentation in html format go to your websdk folder and run :
|
|
92
|
-
|
|
93
|
-
npm run build-doc
|
|
94
|
-
|
|
95
|
-
Documentation output will be in websdk/documentation folder
|
|
96
|
-
|
|
97
|
-
To create documentation in markdown format go to your websdk folder and run :
|
|
98
|
-
|
|
99
|
-
npm run build-docMd
|
|
100
|
-
|
|
101
|
-
Documentation output will be in websdk/documentation/Bimplus_WebSDK_doc.md file.
|
|
102
|
-
|
|
103
|
-
To create a markdown suitable for Confluence run script:
|
|
104
|
-
|
|
105
|
-
npm run build-docConf
|
|
106
|
-
|
|
107
|
-
This script will convert generated markdown into Confluence format. See console
|
|
108
|
-
output for converted file name.
|
|
109
|
-
|
|
110
|
-
Content of the confluence file can be inserted into Confluence page :
|
|
111
|
-
- start confluence page editation mode
|
|
112
|
-
- choose Insert more content / {} Markup option from toolbar
|
|
113
|
-
- in popup window choose to Insert Markdown format
|
|
114
|
-
- copy content of the converted confluence markdown file into the field in Confluence
|
|
115
|
-
- save it (Please note that page links doesn't work in page preview mode)
|
|
116
|
-
|
|
117
|
-
### Typescript definitions
|
|
118
|
-
- typescript definition file is located in subfolder 'types'
|
|
1
|
+
bim+ websdk
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
bim+ websdk is a javascript wrapper around the bim+ api
|
|
5
|
+
|
|
6
|
+
Quick Links
|
|
7
|
+
-----------
|
|
8
|
+
|
|
9
|
+
https://nemetschekprime.atlassian.net/wiki/spaces/bimpluspublic/pages/1090127532/Bimplus+Web+SDK+Reference
|
|
10
|
+
|
|
11
|
+
How to build
|
|
12
|
+
------------
|
|
13
|
+
|
|
14
|
+
### Install nodejs
|
|
15
|
+
[http://www.nodejs.org/](http://www.nodejs.org/)
|
|
16
|
+
|
|
17
|
+
### Install local npm modules
|
|
18
|
+
Open up a normal command line (admin is not needed) and go to the websdk folder
|
|
19
|
+
|
|
20
|
+
npm install
|
|
21
|
+
|
|
22
|
+
(whenever package.json has changed, you might to do this again)
|
|
23
|
+
|
|
24
|
+
### Build websdk
|
|
25
|
+
Library building process is using UMD (Universal Module Definition) output format so
|
|
26
|
+
it's compatible with both cjs and amd module formats. The same library can be use in the
|
|
27
|
+
client or on the server. Build process is using babel so it's possible to use new ES2015
|
|
28
|
+
code in source codes.
|
|
29
|
+
|
|
30
|
+
Library can be build in several ways as a dev or prod version.
|
|
31
|
+
To run a dev build with source maps run:
|
|
32
|
+
|
|
33
|
+
npm run build
|
|
34
|
+
|
|
35
|
+
To build a prod version - uglified, minified run:
|
|
36
|
+
|
|
37
|
+
npm run build-prod
|
|
38
|
+
|
|
39
|
+
Pulish new release to npm (Hint: Before doing this npm login needs to be done and the package version adjusted) :
|
|
40
|
+
|
|
41
|
+
npm run npm-publish
|
|
42
|
+
|
|
43
|
+
Check content of npm package (result is bimplus-renderer@(version).tar.gz)
|
|
44
|
+
|
|
45
|
+
npm run npm-pack
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### Develop/Debug websdk
|
|
49
|
+
goto your websdk folder
|
|
50
|
+
|
|
51
|
+
npm link
|
|
52
|
+
|
|
53
|
+
goto your application folder which uses the websdk
|
|
54
|
+
|
|
55
|
+
npm link bimplus-websdk
|
|
56
|
+
|
|
57
|
+
Do you changes in the websdk and build
|
|
58
|
+
|
|
59
|
+
npm run build
|
|
60
|
+
|
|
61
|
+
or
|
|
62
|
+
|
|
63
|
+
npm run build-prod
|
|
64
|
+
|
|
65
|
+
Your app will automatically get the changes done in the renderer
|
|
66
|
+
|
|
67
|
+
After developing it might be wise to unlink:
|
|
68
|
+
goto your websdk folder
|
|
69
|
+
|
|
70
|
+
npm unlink
|
|
71
|
+
goto your application folder which uses the websdk
|
|
72
|
+
|
|
73
|
+
npm unlink bimplus-websdk
|
|
74
|
+
npm install
|
|
75
|
+
|
|
76
|
+
### Unit testing
|
|
77
|
+
With every build output is copied also to the test folder.
|
|
78
|
+
To run the unit tests go to the test subfolder and run :
|
|
79
|
+
|
|
80
|
+
npm install
|
|
81
|
+
npm run test
|
|
82
|
+
|
|
83
|
+
For more information see README.md inside the test folder
|
|
84
|
+
|
|
85
|
+
### Documentation
|
|
86
|
+
Bimplus WebSDK uses npm documentation plugin for easy documentation generation.
|
|
87
|
+
To generate a documentation please install documentation plugin via npm :
|
|
88
|
+
|
|
89
|
+
npm install -g documentation
|
|
90
|
+
|
|
91
|
+
To create documentation in html format go to your websdk folder and run :
|
|
92
|
+
|
|
93
|
+
npm run build-doc
|
|
94
|
+
|
|
95
|
+
Documentation output will be in websdk/documentation folder
|
|
96
|
+
|
|
97
|
+
To create documentation in markdown format go to your websdk folder and run :
|
|
98
|
+
|
|
99
|
+
npm run build-docMd
|
|
100
|
+
|
|
101
|
+
Documentation output will be in websdk/documentation/Bimplus_WebSDK_doc.md file.
|
|
102
|
+
|
|
103
|
+
To create a markdown suitable for Confluence run script:
|
|
104
|
+
|
|
105
|
+
npm run build-docConf
|
|
106
|
+
|
|
107
|
+
This script will convert generated markdown into Confluence format. See console
|
|
108
|
+
output for converted file name.
|
|
109
|
+
|
|
110
|
+
Content of the confluence file can be inserted into Confluence page :
|
|
111
|
+
- start confluence page editation mode
|
|
112
|
+
- choose Insert more content / {} Markup option from toolbar
|
|
113
|
+
- in popup window choose to Insert Markdown format
|
|
114
|
+
- copy content of the converted confluence markdown file into the field in Confluence
|
|
115
|
+
- save it (Please note that page links doesn't work in page preview mode)
|
|
116
|
+
|
|
117
|
+
### Typescript definitions
|
|
118
|
+
- typescript definition file is located in subfolder 'types'
|
package/clean
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
rm -rf ./dist ./node_modules
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
rm -rf ./dist ./node_modules
|