cityworks 1.0.5 → 2.0.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/README.md CHANGED
@@ -4,13 +4,20 @@ This API wrapper for Cityworks follows the Cityworks release schedule as closely
4
4
 
5
5
  Require the class:
6
6
 
7
- const Cityworks = require('cityworks')
7
+ const cw = require('cityworks')
8
+
9
+ or
8
10
 
9
11
  import * as cw from 'cityworks'
10
12
 
11
13
  Instantiate the Class for the instance of Cityworks available given a domain:
12
14
 
13
- cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 15})
15
+ cw.Cityworks.configure('cwoffice.domain.tld', {path: 'cityworks', version: 15})
16
+
17
+ or
18
+
19
+ cw.Cityworks.configure('cw.domain.tld', {path: 'cityworks', version: 23});
20
+
14
21
 
15
22
  ## Authentication
16
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cityworks",
3
- "version": "1.0.5",
3
+ "version": "2.0.0",
4
4
  "description": "A Cityworks API wrapper",
5
5
  "main": "dist/index.js",
6
6
  "umd:main": "dist/index.umd.js",
@@ -38,21 +38,21 @@
38
38
  },
39
39
  "homepage": "https://walker.github.io/cityworks/",
40
40
  "devDependencies": {
41
- "chai": "*",
42
- "chai-as-promised": "~7.1.1",
43
- "dotenv": "~16.0.0",
44
- "jsdoc-to-markdown": "~8.0.0",
41
+ "chai": "~5.2.0",
42
+ "chai-as-promised": "~8.0.1",
43
+ "dotenv": "~16.5.0",
44
+ "jsdoc-to-markdown": "~9.1.1",
45
45
  "microbundle": "~0.15.1",
46
- "mocha": "~10.2.0",
47
- "typedoc": "~0.23.24",
48
- "typescript": "^4.9.5",
49
- "winston": "~3.8.2"
46
+ "mocha": "~11.3.0",
47
+ "typedoc": "~0.28.4",
48
+ "typescript": "^5.8.3",
49
+ "winston": "~3.17.0"
50
50
  },
51
51
  "dependencies": {
52
- "axios": "^1.6.0",
53
- "form-data": "^4.0.0",
52
+ "axios": "^1.9.0",
53
+ "form-data": "^4.0.2",
54
54
  "lodash": "~4.17.21",
55
- "mime-types": "^2.1.35",
55
+ "mime-types": "^3.0.1",
56
56
  "reversible-map": "~1.0.1"
57
57
  }
58
58
  }
@@ -1,84 +0,0 @@
1
- import ReversibleMap from 'reversible-map';
2
- /**
3
- * ActivityLink interface for ActivityLinks
4
- *
5
- */
6
- export interface ActivityLink {
7
- linkTypes: ReversibleMap<string, number>;
8
- activityTypes: ReversibleMap<string, number>;
9
- cw: any;
10
- }
11
- /**
12
- * ActivityLinks implements the activity link functions via using the ActivityLink interface
13
- *
14
- */
15
- export declare class ActivityLinks implements ActivityLink {
16
- /**
17
- * Activity types to map string to number for internal use. Activity types available are: "null", "case", "inspection", "request", "workorder", "wipcase"
18
- */
19
- activityTypes: ReversibleMap<string, number>;
20
- /**
21
- * Link types to map string to number for internal use. Link types available are: "null", "parent", "related"
22
- */
23
- linkTypes: ReversibleMap<string, number>;
24
- /**
25
- * @hidden
26
- */
27
- cw: any;
28
- /**
29
- * @hidden
30
- */
31
- constructor(cw: any);
32
- private setActivityTypes;
33
- private setLinkTypes;
34
- private validateType;
35
- private transformLinksData;
36
- private runRequest;
37
- /**
38
- * Create a new activity link between two items.
39
- *
40
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
41
- * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
42
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
43
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
44
- * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
45
- * @return {Object} Returns Promise object that represents a
46
- */
47
- add(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
48
- /**
49
- * Get the links for a particular node type by ID.
50
- *
51
- * @param {string} type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
52
- * @param {Array<number>} sids - Array of numeric (S)IDs you wish to get of the specified type
53
- * @return {Object} Returns Promise object that represents a collection
54
- */
55
- get(type: string, sids: Array<number>): Promise<unknown>;
56
- /**
57
- * Clone a current activity link.
58
- *
59
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
60
- * @param {number} source_sid - Source SID (numeric ID) one wishes to clone a link between SID as source and a particular destination
61
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
62
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to clone a link between SID as destination and a particular source
63
- * @return {Object} Returns Promise object that represents a
64
- */
65
- clone(source_type: string, source_sid: number, destination_type: string, destination_sid: number): Promise<unknown>;
66
- /**
67
- * Delete an activity link by ID
68
- *
69
- * @param {number} activity_link_id - The ID of the activity link one wishes to delete
70
- * @return {Object} Returns Promise object that represents a
71
- */
72
- delete(activity_link_id: number): Promise<unknown>;
73
- /**
74
- * Remove a link by specifying everything.
75
- *
76
- * @param {string} source_type - Source type as string. Options: "null", "case", "inspection", "request", "workorder", "wipcase"
77
- * @param {number} source_sid - Source SID (numeric ID) one wishes to remove a link between SID as source and a particular destination
78
- * @param {string} destination_type - Destination type as string: "null", "case", "inspection", "request", "workorder", "wipcase"
79
- * @param {number} destination_sid - Destination SID (numeric ID) one wishes to remove a link between SID as destination and a particular source
80
- * @param {string} link_type - The type of link which exists between provided source and destination. Defaults to `related`. Options: "null", "parent", "related"
81
- * @return {Object} Returns Promise object that represents a
82
- */
83
- remove(source_type: string, source_sid: number, destination_type: string, destination_sid: number, link_type?: string): Promise<unknown>;
84
- }
@@ -1,59 +0,0 @@
1
- export declare class Attachments {
2
- /**
3
- * @hidden
4
- */
5
- cw: any;
6
- /**
7
- * Storage of object's active activityType
8
- */
9
- currentActivityType: string;
10
- /**
11
- * @hidden
12
- */
13
- constructor(cw: any, current_type: any);
14
- /**
15
- * Add inspection attachments (doesn't handle URL or Signature type properly, currently)
16
- *
17
- * @category Inspection Attachments
18
- * @param {number} id - The ID of the node to add the attachment to (CA_OBJECT_ID, REQUESTID, WORKORDERSID, WORKORDERID, INSPECTIONID). If WORKORDERID, you _must_ feed in as a string.
19
- * @param {string} the_file - The loca path of the file to upload to the Cityworks instance
20
- * @param {number} [task_id] - ID of WorkOrder task, if current activity is a work order and the attachment should be on the task
21
- * @param {string} [filename] - The filename for the attachment
22
- * @param {string} [attachment_type] - The filename for the attachment, values: attachment, signature, url
23
- * @param {string} [comments] - The filename for the attachment
24
- * @return {Object} Returns object that represents a boolean for action resolution
25
- */
26
- add(node_id: number | string, the_file: string, filename?: string, attachment_type?: string, task_id?: number, comments?: string): Promise<unknown>;
27
- /**
28
- * Delete inspection attachments
29
- *
30
- * @category Inspection Attachments
31
- * @param {Array<number>|number} attachmentIds - An array of attachment IDs or a single attachment ID to delete.
32
- * @return {Object} Returns object that represents a boolean for action resolution
33
- */
34
- delete(attachmentIds: Array<number> | number): Promise<unknown>;
35
- /**
36
- * Download an attachment
37
- *
38
- * @category Attachments
39
- * @param {number} attachmentId - ID of an attachment to download
40
- * @return {Object} Returns object that represents a file stream
41
- */
42
- download(attachmentId: number): Promise<unknown>;
43
- /**
44
- * Get attachment by ID (not implemented)
45
- *
46
- * @category Attachments
47
- * @param {number} attachmentId - An attachment ID to get info for
48
- * @return {Object} Returns object that represents an object that describes the matched inspection attachment
49
- */
50
- getById(attachmentId: number): Promise<unknown>;
51
- /**
52
- * Get attachment by node (Inspection, WorkOrder, Request, or Case) IDs
53
- *
54
- * @category Attachments
55
- * @param {Array<number>|number} ids - An array of IDs or a single ID (inspectionIds, WorkOrderSids, WorkOrderIds, RequestIds, or CaseIds) to get attachments for. Only one node (Inspection, WorkOrder, Request, or Case) type at a time. Don't mix-and-match WorkOrderIds with WorkOrderSids.
56
- * @return {Object} Returns object that represents a collection of attachments from the matched inspections
57
- */
58
- getByNodesId(ids: Array<number> | number): Promise<unknown>;
59
- }
@@ -1,241 +0,0 @@
1
- export interface Briefcase {
2
- TempTableName: string;
3
- AnonymousFlag: string;
4
- RegisteredFlag: string;
5
- CreatedByLoginId: string;
6
- TableName: string;
7
- ModifiedByLoginId: number;
8
- AcceptedByLoginId: number;
9
- EnteredByLoginid: number;
10
- WorkOrderId: string;
11
- WorkOrderDesc: string;
12
- WorkOrderStatus: string;
13
- ServiceRequestId: number;
14
- ServiceRequestDesc: string;
15
- ServiceRequestStatus: string;
16
- CloneCaseRelation: any | null;
17
- PendingFlag: any | null;
18
- CaseGroup: any | null;
19
- ParentCaObjectId: number | null;
20
- AmountDue: number | null;
21
- GetViewColumns: Array<string>;
22
- CaObjectId: number;
23
- OrgId: number;
24
- CaseTypeId: number;
25
- CaseType: string;
26
- CaseTypeDesc: string;
27
- BusCaseDesc: string | null;
28
- SubTypeId: number | null;
29
- SubType: string | null;
30
- SubTypeDesc: string | null;
31
- CreatedBy: number;
32
- DateAccepted: Date | null;
33
- DateCreated: Date;
34
- DateEntered: Date;
35
- DateExpiration: Date | null;
36
- DateIssued: Date | null;
37
- DateModified: Date | null;
38
- EnteredBy: number;
39
- ExpiredFlag: string | null;
40
- IssuedBy: number | null;
41
- IssuedFlag: string | null;
42
- ModifiedBy: number | null;
43
- SubTypeDefaultText: string | null;
44
- CaseNumber: string;
45
- CaseStatusId: number;
46
- CaseStatus: string;
47
- ProjectSid: number | null;
48
- ProjectId: string | null;
49
- ProjectCode: string | null;
50
- ProjectDesc: string | null;
51
- PriorityLevel: string | null;
52
- StatusCode: string;
53
- CaseName: string;
54
- AcceptedBy: number;
55
- BLicenseFlag: string | null;
56
- BusinessName: string | null;
57
- BusCaseId: number | null;
58
- BusinessOrgType: string | null;
59
- BusinessCategory: string | null;
60
- StateTaxId: string | null;
61
- FedTaxId: string | null;
62
- Location: string | null;
63
- PACaseFlag: string | null;
64
- ActiveFlag: string | null;
65
- CX: number | null;
66
- CY: number | null;
67
- CZ: number | null;
68
- AssignedTo: number | null;
69
- AssignedToLoginId: string | null;
70
- AssignedToFirstName: string | null;
71
- AssignedToLastName: string | null;
72
- Facility_Id: string | number | null;
73
- Level_Id: string | number | null;
74
- }
75
- export declare class Briefcase {
76
- /**
77
- * @hidden
78
- */
79
- cw: any;
80
- /**
81
- * @hidden
82
- */
83
- current_case: number;
84
- /**
85
- * Data Detail methods
86
- */
87
- data?: any;
88
- /**
89
- * Asset (Address) methods
90
- */
91
- asset?: any;
92
- /**
93
- * Asset (Address) methods
94
- */
95
- attachments?: any;
96
- /**
97
- * Workflow & task methods
98
- */
99
- workflow?: any;
100
- /**
101
- * Payment, Receipt, & Fee methods
102
- */
103
- financial?: any;
104
- /**
105
- * Commenting methods
106
- */
107
- comment?: any;
108
- /**
109
- * PLL Administration methods
110
- */
111
- admin?: any;
112
- /**
113
- * @hidden
114
- */
115
- constructor(cw: any);
116
- /**
117
- * Create new case
118
- *
119
- * @category Cases
120
- * @param {number} caseTypeId - The case Type ID
121
- * @param {number} subTypeId - The case subType ID
122
- * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
123
- * @return {Object} Returns Promise that represents an object describing the newly-created case
124
- */
125
- create(caseTypeId: number, subTypeId: number, options?: Object): Promise<Briefcase>;
126
- /**
127
- * Create a child case
128
- *
129
- * @category Cases
130
- * @param {number} busCaseId - The case Type ID
131
- * @param {number} parentCaObjectId - The case subType ID
132
- * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
133
- * @return {Object} Returns Promise that represents an object describing the newly-created case
134
- */
135
- createChild(busCaseId: number, parentCaObjectId: number, options?: Object): Promise<Briefcase>;
136
- /**
137
- * Create a case from a Service Request
138
- *
139
- * @category Cases
140
- * @param {number} caseTypeId - The case Type ID
141
- * @param {number} subTypeId - The case subType ID
142
- * @param {number} requestId - The service request ID
143
- * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
144
- * @return {Object} Returns Promise that represents an object describing the newly-created case
145
- */
146
- createFromRequest(caseTypeId: number, subTypeId: number, requestId: number, options?: Object): Promise<unknown>;
147
- /**
148
- * Update a case
149
- *
150
- * @category Cases
151
- * @param {number} caObjectId - The case Object ID to update
152
- * @param {Object} [options] - See /{subdirectory}/apidocs/#/data-type-info;dataType=CaObjectItemBase
153
- * @return {Object} Returns Promise that represents an object describing the updated case
154
- */
155
- update(caObjectId: number, options?: Object): Promise<Briefcase>;
156
- /**
157
- * Get cases by IDs
158
- *
159
- * @category Cases
160
- * @param {Array<number>} caObjectIds - The case Object ID to get
161
- * @return {Object} Returns Promise that represents a collection of objects describing the cases
162
- */
163
- getByIds(caObjectIds: Array<number>): Promise<Array<Briefcase>>;
164
- /**
165
- * Search for Cases. Include at least one of the search fields. A logical 'and' operation is applied for multiple search fields.
166
- *
167
- * @category Cases
168
- * @param {Object} filters - The parameter(s) to search by
169
- * @return {Object} Returns Promise that represents an Array of case Object IDs
170
- */
171
- search(filters: Object): Promise<Array<number>>;
172
- /**
173
- * Move a Case point
174
- *
175
- * @category Cases
176
- * @param {string} caObjectId
177
- * @param {number} x
178
- * @param {number} y
179
- * @param {Object} projection - Should include at least WKT _or_ WKID attribute. Can also include VcsWKID attribute.
180
- * @param {number} [z] - Optional Z coordinate
181
- * @return {Object} Returns Promise that represents an object describing the updated GISPoint
182
- */
183
- move(caObjectId: number, x: number, y: number, projection: {
184
- WKID?: string;
185
- WKT?: string;
186
- VcsWKID?: string;
187
- }, z?: number): Promise<unknown>;
188
- /**
189
- * Delete case
190
- *
191
- * @category Cases
192
- * @param {number} caObjectId - The case Object ID
193
- * @return {Object} Returns Promise that represents an object describing the deleted case
194
- */
195
- delete(caObjectId: number): Promise<unknown>;
196
- /**
197
- * Get Map Layer Fields
198
- *
199
- * @category Cases
200
- * @param {number} caObjectId - The case object ID to get the map layer fields for.
201
- * @return {Object} Returns Promise that represents a collection of Objects describing the case object map layer fields
202
- */
203
- getMLFs(caObjectId: number): Promise<unknown>;
204
- /**
205
- * Update Map Layer Fields
206
- *
207
- * @category Cases
208
- * @param {number} caObjectId - The case object ID to get the map layer fields for.
209
- * @param {number} x
210
- * @param {number} y
211
- * @param {number} domainId - The domain ID for the case in question
212
- * @param {number} [z] - Optional Z coordinate
213
- * @return {Object} Returns Promise that represents a collection of Objects describing the case object map layer fields
214
- */
215
- updateMLFs(caObjectId: number, x?: number, y?: number, domainId?: number, z?: number): Promise<unknown>;
216
- /**
217
- * Delete Map Layer Fields
218
- *
219
- * @category Cases
220
- * @param {number} caObjectId - The case object ID to delete the map layer fields for.
221
- * @return {Object} Returns Promise that represents a collection of Objects describing the case object map layer fields deleted
222
- */
223
- deleteMLFs(caObjectId: number): Promise<unknown>;
224
- /**
225
- * Reports available for Case
226
- *
227
- * @category Cases
228
- * @param {number} caObjectId - The case object ID to get the report (print template) list for
229
- * @return {Object} Returns Promise that represents a collection of Objects describing the reports (print templates) available for this case
230
- */
231
- getPrintTemplates(caObjectId: number): Promise<unknown>;
232
- /**
233
- * Print Case
234
- *
235
- * @category Cases
236
- * @param {number} caObjectId - The case object ID to delete the map layer fields for.
237
- * @param {string} fileName - the filename of the report from the getPrintTemplates method, but w/out the extension
238
- * @return {Object} Returns Promise that represents a collection of Objects describing the case object map layer fields deleted
239
- */
240
- print(caObjectId: number, fileName: string, callback: any): Promise<unknown>;
241
- }