@major-tech/resource-client 0.2.4 → 0.2.6

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 (42) hide show
  1. package/bin/generate-clients.mjs +5 -3
  2. package/dist/clients/cosmosdb.cjs +182 -0
  3. package/dist/clients/cosmosdb.cjs.map +7 -0
  4. package/dist/clients/cosmosdb.d.ts +93 -0
  5. package/dist/clients/cosmosdb.d.ts.map +1 -0
  6. package/dist/clients/cosmosdb.js +155 -0
  7. package/dist/clients/cosmosdb.js.map +1 -0
  8. package/dist/clients/googlesheets.cjs +129 -0
  9. package/dist/clients/googlesheets.cjs.map +7 -0
  10. package/dist/clients/googlesheets.d.ts +68 -0
  11. package/dist/clients/googlesheets.d.ts.map +1 -0
  12. package/dist/clients/googlesheets.js +102 -0
  13. package/dist/clients/googlesheets.js.map +1 -0
  14. package/dist/index.cjs +4 -0
  15. package/dist/index.cjs.map +2 -2
  16. package/dist/index.d.ts +3 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/schemas/api-googlesheets.cjs +17 -0
  21. package/dist/schemas/api-googlesheets.cjs.map +7 -0
  22. package/dist/schemas/api-googlesheets.d.ts +31 -0
  23. package/dist/schemas/api-googlesheets.d.ts.map +1 -0
  24. package/dist/schemas/api-googlesheets.js +2 -0
  25. package/dist/schemas/api-googlesheets.js.map +1 -0
  26. package/dist/schemas/cosmosdb.cjs +17 -0
  27. package/dist/schemas/cosmosdb.cjs.map +7 -0
  28. package/dist/schemas/cosmosdb.d.ts +121 -0
  29. package/dist/schemas/cosmosdb.d.ts.map +1 -0
  30. package/dist/schemas/cosmosdb.js +2 -0
  31. package/dist/schemas/cosmosdb.js.map +1 -0
  32. package/dist/schemas/index.cjs +2 -0
  33. package/dist/schemas/index.cjs.map +2 -2
  34. package/dist/schemas/index.d.ts +5 -1
  35. package/dist/schemas/index.d.ts.map +1 -1
  36. package/dist/schemas/index.js +2 -0
  37. package/dist/schemas/index.js.map +1 -1
  38. package/dist/schemas/request.d.ts +1 -1
  39. package/dist/schemas/request.d.ts.map +1 -1
  40. package/dist/schemas/response.d.ts +6 -1
  41. package/dist/schemas/response.d.ts.map +1 -1
  42. package/package.json +1 -1
@@ -8,7 +8,7 @@
8
8
  * npx @major-tech/resource-client remove <name>
9
9
  * npx @major-tech/resource-client list
10
10
  *
11
- * Types: database-postgresql | database-dynamodb | api-hubspot | api-custom | storage-s3
11
+ * Types: database-postgresql | database-dynamodb | database-cosmosdb | api-hubspot | api-googlesheets | api-custom | storage-s3
12
12
  *
13
13
  * Examples:
14
14
  * npx @major-tech/resource-client add "abc-123" "orders-db" "database-postgresql" "Orders database" "app-123"
@@ -142,8 +142,10 @@ function getClientClass(type) {
142
142
  const typeMap = {
143
143
  'database-postgresql': 'PostgresResourceClient',
144
144
  'database-dynamodb': 'DynamoDBResourceClient',
145
+ 'database-cosmosdb': 'CosmosDBResourceClient',
145
146
  'api-custom': 'CustomApiResourceClient',
146
147
  'api-hubspot': 'HubSpotResourceClient',
148
+ 'api-googlesheets': 'GoogleSheetsResourceClient',
147
149
  'storage-s3': 'S3ResourceClient',
148
150
  };
149
151
  return typeMap[type] || 'PostgresResourceClient';
@@ -178,7 +180,7 @@ function generateIndexFile(resources) {
178
180
  }
179
181
 
180
182
  function addResource(resourceId, name, type, description, applicationId, framework) {
181
- const validTypes = ['database-postgresql', 'database-dynamodb', 'api-hubspot', 'api-custom', 'storage-s3'];
183
+ const validTypes = ['database-postgresql', 'database-dynamodb', 'database-cosmosdb', 'api-hubspot', 'api-googlesheets', 'api-custom', 'storage-s3'];
182
184
  if (!validTypes.includes(type)) {
183
185
  console.error(`❌ Invalid type: ${type}`);
184
186
  console.log(` Valid types: ${validTypes.join(', ')}`);
@@ -315,7 +317,7 @@ function main() {
315
317
  console.log(' npx @major-tech/resource-client add <resource_id> <name> <type> <description> <application_id> [--framework <nextjs|vite>]');
316
318
  console.log(' npx @major-tech/resource-client remove <name> [--framework <nextjs|vite>]');
317
319
  console.log(' npx @major-tech/resource-client list');
318
- console.log('\nTypes: database-postgresql | database-dynamodb | api-hubspot | api-custom | storage-s3');
320
+ console.log('\nTypes: database-postgresql | database-dynamodb | database-cosmosdb | api-hubspot | api-googlesheets | api-custom | storage-s3');
319
321
  return;
320
322
  }
321
323
 
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var cosmosdb_exports = {};
21
+ __export(cosmosdb_exports, {
22
+ CosmosDBResourceClient: () => CosmosDBResourceClient
23
+ });
24
+ module.exports = __toCommonJS(cosmosdb_exports);
25
+ var import_base = require("../base");
26
+ class CosmosDBResourceClient extends import_base.BaseResourceClient {
27
+ static {
28
+ __name(this, "CosmosDBResourceClient");
29
+ }
30
+ /**
31
+ * Invoke a CosmosDB operation with a raw payload
32
+ * @param payload The complete operation payload
33
+ * @param invocationKey Unique key for tracking this invocation
34
+ */
35
+ async invoke(payload, invocationKey) {
36
+ return this.invokeRaw(payload, invocationKey);
37
+ }
38
+ /**
39
+ * Execute a SQL query against a container
40
+ * @param container The container name
41
+ * @param query The SQL query string
42
+ * @param invocationKey Unique key for tracking this invocation
43
+ * @param options Query options (parameters, partitionKey, pagination)
44
+ */
45
+ async query(container, query, invocationKey, options) {
46
+ const payload = {
47
+ type: "database",
48
+ subtype: "cosmosdb",
49
+ operation: "query",
50
+ container,
51
+ query,
52
+ parameters: options?.parameters,
53
+ partitionKey: options?.partitionKey,
54
+ maxItemCount: options?.maxItemCount,
55
+ continuationToken: options?.continuationToken,
56
+ timeoutMs: options?.timeoutMs
57
+ };
58
+ return this.invokeRaw(payload, invocationKey);
59
+ }
60
+ /**
61
+ * Read a single document by ID
62
+ * @param container The container name
63
+ * @param id The document ID
64
+ * @param partitionKey The partition key value
65
+ * @param invocationKey Unique key for tracking this invocation
66
+ * @param options Additional options
67
+ */
68
+ async read(container, id, partitionKey, invocationKey, options) {
69
+ const payload = {
70
+ type: "database",
71
+ subtype: "cosmosdb",
72
+ operation: "read",
73
+ container,
74
+ id,
75
+ partitionKey,
76
+ timeoutMs: options?.timeoutMs
77
+ };
78
+ return this.invokeRaw(payload, invocationKey);
79
+ }
80
+ /**
81
+ * Create a new document
82
+ * @param container The container name
83
+ * @param body The document body (must include id and partition key properties)
84
+ * @param invocationKey Unique key for tracking this invocation
85
+ * @param options Additional options
86
+ */
87
+ async create(container, body, invocationKey, options) {
88
+ const payload = {
89
+ type: "database",
90
+ subtype: "cosmosdb",
91
+ operation: "create",
92
+ container,
93
+ body,
94
+ timeoutMs: options?.timeoutMs
95
+ };
96
+ return this.invokeRaw(payload, invocationKey);
97
+ }
98
+ /**
99
+ * Replace an existing document
100
+ * @param container The container name
101
+ * @param id The document ID
102
+ * @param partitionKey The partition key value
103
+ * @param body The new document body
104
+ * @param invocationKey Unique key for tracking this invocation
105
+ * @param options Additional options
106
+ */
107
+ async replace(container, id, partitionKey, body, invocationKey, options) {
108
+ const payload = {
109
+ type: "database",
110
+ subtype: "cosmosdb",
111
+ operation: "replace",
112
+ container,
113
+ id,
114
+ partitionKey,
115
+ body,
116
+ timeoutMs: options?.timeoutMs
117
+ };
118
+ return this.invokeRaw(payload, invocationKey);
119
+ }
120
+ /**
121
+ * Upsert a document (insert or replace)
122
+ * @param container The container name
123
+ * @param body The document body (must include id and partition key properties)
124
+ * @param invocationKey Unique key for tracking this invocation
125
+ * @param options Additional options
126
+ */
127
+ async upsert(container, body, invocationKey, options) {
128
+ const payload = {
129
+ type: "database",
130
+ subtype: "cosmosdb",
131
+ operation: "upsert",
132
+ container,
133
+ body,
134
+ timeoutMs: options?.timeoutMs
135
+ };
136
+ return this.invokeRaw(payload, invocationKey);
137
+ }
138
+ /**
139
+ * Delete a document
140
+ * @param container The container name
141
+ * @param id The document ID
142
+ * @param partitionKey The partition key value
143
+ * @param invocationKey Unique key for tracking this invocation
144
+ * @param options Additional options
145
+ */
146
+ async delete(container, id, partitionKey, invocationKey, options) {
147
+ const payload = {
148
+ type: "database",
149
+ subtype: "cosmosdb",
150
+ operation: "delete",
151
+ container,
152
+ id,
153
+ partitionKey,
154
+ timeoutMs: options?.timeoutMs
155
+ };
156
+ return this.invokeRaw(payload, invocationKey);
157
+ }
158
+ /**
159
+ * Patch a document with partial updates
160
+ * @param container The container name
161
+ * @param id The document ID
162
+ * @param partitionKey The partition key value
163
+ * @param patchOperations Array of patch operations
164
+ * @param invocationKey Unique key for tracking this invocation
165
+ * @param options Additional options (condition, timeoutMs)
166
+ */
167
+ async patch(container, id, partitionKey, patchOperations, invocationKey, options) {
168
+ const payload = {
169
+ type: "database",
170
+ subtype: "cosmosdb",
171
+ operation: "patch",
172
+ container,
173
+ id,
174
+ partitionKey,
175
+ patchOperations,
176
+ condition: options?.condition,
177
+ timeoutMs: options?.timeoutMs
178
+ };
179
+ return this.invokeRaw(payload, invocationKey);
180
+ }
181
+ }
182
+ //# sourceMappingURL=cosmosdb.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/clients/cosmosdb.ts"],
4
+ "sourcesContent": ["import type {\n DbCosmosDBPayload,\n CosmosValue,\n PartitionKey,\n CosmosQueryParameter,\n CosmosPatchOperation,\n CosmosQueryResult,\n CosmosReadResult,\n CosmosCreateResult,\n CosmosReplaceResult,\n CosmosUpsertResult,\n CosmosDeleteResult,\n CosmosPatchResult,\n DbCosmosDBResultGeneric,\n} from \"../schemas\";\nimport type { BaseInvokeSuccess, InvokeFailure } from \"../schemas/response\";\nimport { BaseResourceClient } from \"../base\";\n\nexport class CosmosDBResourceClient extends BaseResourceClient {\n /**\n * Invoke a CosmosDB operation with a raw payload\n * @param payload The complete operation payload\n * @param invocationKey Unique key for tracking this invocation\n */\n async invoke<T = Record<string, unknown>>(\n payload: DbCosmosDBPayload,\n invocationKey: string\n ): Promise<BaseInvokeSuccess<DbCosmosDBResultGeneric<T>> | InvokeFailure> {\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<DbCosmosDBResultGeneric<T>> | InvokeFailure\n >;\n }\n\n /**\n * Execute a SQL query against a container\n * @param container The container name\n * @param query The SQL query string\n * @param invocationKey Unique key for tracking this invocation\n * @param options Query options (parameters, partitionKey, pagination)\n */\n async query<T = Record<string, unknown>>(\n container: string,\n query: string,\n invocationKey: string,\n options?: {\n parameters?: CosmosQueryParameter[];\n partitionKey?: PartitionKey;\n maxItemCount?: number;\n continuationToken?: string;\n timeoutMs?: number;\n }\n ): Promise<BaseInvokeSuccess<CosmosQueryResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"query\",\n container,\n query,\n parameters: options?.parameters,\n partitionKey: options?.partitionKey,\n maxItemCount: options?.maxItemCount,\n continuationToken: options?.continuationToken,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosQueryResult<T>> | InvokeFailure\n >;\n }\n\n /**\n * Read a single document by ID\n * @param container The container name\n * @param id The document ID\n * @param partitionKey The partition key value\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options\n */\n async read<T = Record<string, unknown>>(\n container: string,\n id: string,\n partitionKey: PartitionKey,\n invocationKey: string,\n options?: { timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosReadResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"read\",\n container,\n id,\n partitionKey,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosReadResult<T>> | InvokeFailure\n >;\n }\n\n /**\n * Create a new document\n * @param container The container name\n * @param body The document body (must include id and partition key properties)\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options\n */\n async create<T = Record<string, unknown>>(\n container: string,\n body: Record<string, CosmosValue>,\n invocationKey: string,\n options?: { timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosCreateResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"create\",\n container,\n body,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosCreateResult<T>> | InvokeFailure\n >;\n }\n\n /**\n * Replace an existing document\n * @param container The container name\n * @param id The document ID\n * @param partitionKey The partition key value\n * @param body The new document body\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options\n */\n async replace<T = Record<string, unknown>>(\n container: string,\n id: string,\n partitionKey: PartitionKey,\n body: Record<string, CosmosValue>,\n invocationKey: string,\n options?: { timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosReplaceResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"replace\",\n container,\n id,\n partitionKey,\n body,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosReplaceResult<T>> | InvokeFailure\n >;\n }\n\n /**\n * Upsert a document (insert or replace)\n * @param container The container name\n * @param body The document body (must include id and partition key properties)\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options\n */\n async upsert<T = Record<string, unknown>>(\n container: string,\n body: Record<string, CosmosValue>,\n invocationKey: string,\n options?: { timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosUpsertResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"upsert\",\n container,\n body,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosUpsertResult<T>> | InvokeFailure\n >;\n }\n\n /**\n * Delete a document\n * @param container The container name\n * @param id The document ID\n * @param partitionKey The partition key value\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options\n */\n async delete(\n container: string,\n id: string,\n partitionKey: PartitionKey,\n invocationKey: string,\n options?: { timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosDeleteResult> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"delete\",\n container,\n id,\n partitionKey,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosDeleteResult> | InvokeFailure\n >;\n }\n\n /**\n * Patch a document with partial updates\n * @param container The container name\n * @param id The document ID\n * @param partitionKey The partition key value\n * @param patchOperations Array of patch operations\n * @param invocationKey Unique key for tracking this invocation\n * @param options Additional options (condition, timeoutMs)\n */\n async patch<T = Record<string, unknown>>(\n container: string,\n id: string,\n partitionKey: PartitionKey,\n patchOperations: CosmosPatchOperation[],\n invocationKey: string,\n options?: { condition?: string; timeoutMs?: number }\n ): Promise<BaseInvokeSuccess<CosmosPatchResult<T>> | InvokeFailure> {\n const payload: DbCosmosDBPayload = {\n type: \"database\",\n subtype: \"cosmosdb\",\n operation: \"patch\",\n container,\n id,\n partitionKey,\n patchOperations,\n condition: options?.condition,\n timeoutMs: options?.timeoutMs,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<\n BaseInvokeSuccess<CosmosPatchResult<T>> | InvokeFailure\n >;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAgBA;;;;;AAAA,kBAAmC;AAE7B,MAAO,+BAA+B,+BAAkB;EAF9D,OAE8D;;;;;;;;EAM5D,MAAM,OACJ,SACA,eAAqB;AAErB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;EASA,MAAM,MACJ,WACA,OACA,eACA,SAMC;AAED,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA,YAAY,SAAS;MACrB,cAAc,SAAS;MACvB,cAAc,SAAS;MACvB,mBAAmB,SAAS;MAC5B,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;;EAUA,MAAM,KACJ,WACA,IACA,cACA,eACA,SAAgC;AAEhC,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA;MACA,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;EASA,MAAM,OACJ,WACA,MACA,eACA,SAAgC;AAEhC,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;;;EAWA,MAAM,QACJ,WACA,IACA,cACA,MACA,eACA,SAAgC;AAEhC,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA;MACA;MACA,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;EASA,MAAM,OACJ,WACA,MACA,eACA,SAAgC;AAEhC,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;;EAUA,MAAM,OACJ,WACA,IACA,cACA,eACA,SAAgC;AAEhC,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA;MACA,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;;;;;;;;;EAWA,MAAM,MACJ,WACA,IACA,cACA,iBACA,eACA,SAAoD;AAEpD,UAAM,UAA6B;MACjC,MAAM;MACN,SAAS;MACT,WAAW;MACX;MACA;MACA;MACA;MACA,WAAW,SAAS;MACpB,WAAW,SAAS;;AAGtB,WAAO,KAAK,UAAU,SAAS,aAAa;EAG9C;;",
6
+ "names": []
7
+ }
@@ -0,0 +1,93 @@
1
+ import type { DbCosmosDBPayload, CosmosValue, PartitionKey, CosmosQueryParameter, CosmosPatchOperation, CosmosQueryResult, CosmosReadResult, CosmosCreateResult, CosmosReplaceResult, CosmosUpsertResult, CosmosDeleteResult, CosmosPatchResult, DbCosmosDBResultGeneric } from "../schemas";
2
+ import type { BaseInvokeSuccess, InvokeFailure } from "../schemas/response";
3
+ import { BaseResourceClient } from "../base";
4
+ export declare class CosmosDBResourceClient extends BaseResourceClient {
5
+ /**
6
+ * Invoke a CosmosDB operation with a raw payload
7
+ * @param payload The complete operation payload
8
+ * @param invocationKey Unique key for tracking this invocation
9
+ */
10
+ invoke<T = Record<string, unknown>>(payload: DbCosmosDBPayload, invocationKey: string): Promise<BaseInvokeSuccess<DbCosmosDBResultGeneric<T>> | InvokeFailure>;
11
+ /**
12
+ * Execute a SQL query against a container
13
+ * @param container The container name
14
+ * @param query The SQL query string
15
+ * @param invocationKey Unique key for tracking this invocation
16
+ * @param options Query options (parameters, partitionKey, pagination)
17
+ */
18
+ query<T = Record<string, unknown>>(container: string, query: string, invocationKey: string, options?: {
19
+ parameters?: CosmosQueryParameter[];
20
+ partitionKey?: PartitionKey;
21
+ maxItemCount?: number;
22
+ continuationToken?: string;
23
+ timeoutMs?: number;
24
+ }): Promise<BaseInvokeSuccess<CosmosQueryResult<T>> | InvokeFailure>;
25
+ /**
26
+ * Read a single document by ID
27
+ * @param container The container name
28
+ * @param id The document ID
29
+ * @param partitionKey The partition key value
30
+ * @param invocationKey Unique key for tracking this invocation
31
+ * @param options Additional options
32
+ */
33
+ read<T = Record<string, unknown>>(container: string, id: string, partitionKey: PartitionKey, invocationKey: string, options?: {
34
+ timeoutMs?: number;
35
+ }): Promise<BaseInvokeSuccess<CosmosReadResult<T>> | InvokeFailure>;
36
+ /**
37
+ * Create a new document
38
+ * @param container The container name
39
+ * @param body The document body (must include id and partition key properties)
40
+ * @param invocationKey Unique key for tracking this invocation
41
+ * @param options Additional options
42
+ */
43
+ create<T = Record<string, unknown>>(container: string, body: Record<string, CosmosValue>, invocationKey: string, options?: {
44
+ timeoutMs?: number;
45
+ }): Promise<BaseInvokeSuccess<CosmosCreateResult<T>> | InvokeFailure>;
46
+ /**
47
+ * Replace an existing document
48
+ * @param container The container name
49
+ * @param id The document ID
50
+ * @param partitionKey The partition key value
51
+ * @param body The new document body
52
+ * @param invocationKey Unique key for tracking this invocation
53
+ * @param options Additional options
54
+ */
55
+ replace<T = Record<string, unknown>>(container: string, id: string, partitionKey: PartitionKey, body: Record<string, CosmosValue>, invocationKey: string, options?: {
56
+ timeoutMs?: number;
57
+ }): Promise<BaseInvokeSuccess<CosmosReplaceResult<T>> | InvokeFailure>;
58
+ /**
59
+ * Upsert a document (insert or replace)
60
+ * @param container The container name
61
+ * @param body The document body (must include id and partition key properties)
62
+ * @param invocationKey Unique key for tracking this invocation
63
+ * @param options Additional options
64
+ */
65
+ upsert<T = Record<string, unknown>>(container: string, body: Record<string, CosmosValue>, invocationKey: string, options?: {
66
+ timeoutMs?: number;
67
+ }): Promise<BaseInvokeSuccess<CosmosUpsertResult<T>> | InvokeFailure>;
68
+ /**
69
+ * Delete a document
70
+ * @param container The container name
71
+ * @param id The document ID
72
+ * @param partitionKey The partition key value
73
+ * @param invocationKey Unique key for tracking this invocation
74
+ * @param options Additional options
75
+ */
76
+ delete(container: string, id: string, partitionKey: PartitionKey, invocationKey: string, options?: {
77
+ timeoutMs?: number;
78
+ }): Promise<BaseInvokeSuccess<CosmosDeleteResult> | InvokeFailure>;
79
+ /**
80
+ * Patch a document with partial updates
81
+ * @param container The container name
82
+ * @param id The document ID
83
+ * @param partitionKey The partition key value
84
+ * @param patchOperations Array of patch operations
85
+ * @param invocationKey Unique key for tracking this invocation
86
+ * @param options Additional options (condition, timeoutMs)
87
+ */
88
+ patch<T = Record<string, unknown>>(container: string, id: string, partitionKey: PartitionKey, patchOperations: CosmosPatchOperation[], invocationKey: string, options?: {
89
+ condition?: string;
90
+ timeoutMs?: number;
91
+ }): Promise<BaseInvokeSuccess<CosmosPatchResult<T>> | InvokeFailure>;
92
+ }
93
+ //# sourceMappingURL=cosmosdb.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmosdb.d.ts","sourceRoot":"","sources":["../../src/clients/cosmosdb.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC5D;;;;OAIG;IACG,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,OAAO,EAAE,iBAAiB,EAC1B,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,iBAAiB,CAAC,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MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAiBpE"}
@@ -0,0 +1,155 @@
1
+ import { BaseResourceClient } from "../base";
2
+ export class CosmosDBResourceClient extends BaseResourceClient {
3
+ /**
4
+ * Invoke a CosmosDB operation with a raw payload
5
+ * @param payload The complete operation payload
6
+ * @param invocationKey Unique key for tracking this invocation
7
+ */
8
+ async invoke(payload, invocationKey) {
9
+ return this.invokeRaw(payload, invocationKey);
10
+ }
11
+ /**
12
+ * Execute a SQL query against a container
13
+ * @param container The container name
14
+ * @param query The SQL query string
15
+ * @param invocationKey Unique key for tracking this invocation
16
+ * @param options Query options (parameters, partitionKey, pagination)
17
+ */
18
+ async query(container, query, invocationKey, options) {
19
+ const payload = {
20
+ type: "database",
21
+ subtype: "cosmosdb",
22
+ operation: "query",
23
+ container,
24
+ query,
25
+ parameters: options?.parameters,
26
+ partitionKey: options?.partitionKey,
27
+ maxItemCount: options?.maxItemCount,
28
+ continuationToken: options?.continuationToken,
29
+ timeoutMs: options?.timeoutMs,
30
+ };
31
+ return this.invokeRaw(payload, invocationKey);
32
+ }
33
+ /**
34
+ * Read a single document by ID
35
+ * @param container The container name
36
+ * @param id The document ID
37
+ * @param partitionKey The partition key value
38
+ * @param invocationKey Unique key for tracking this invocation
39
+ * @param options Additional options
40
+ */
41
+ async read(container, id, partitionKey, invocationKey, options) {
42
+ const payload = {
43
+ type: "database",
44
+ subtype: "cosmosdb",
45
+ operation: "read",
46
+ container,
47
+ id,
48
+ partitionKey,
49
+ timeoutMs: options?.timeoutMs,
50
+ };
51
+ return this.invokeRaw(payload, invocationKey);
52
+ }
53
+ /**
54
+ * Create a new document
55
+ * @param container The container name
56
+ * @param body The document body (must include id and partition key properties)
57
+ * @param invocationKey Unique key for tracking this invocation
58
+ * @param options Additional options
59
+ */
60
+ async create(container, body, invocationKey, options) {
61
+ const payload = {
62
+ type: "database",
63
+ subtype: "cosmosdb",
64
+ operation: "create",
65
+ container,
66
+ body,
67
+ timeoutMs: options?.timeoutMs,
68
+ };
69
+ return this.invokeRaw(payload, invocationKey);
70
+ }
71
+ /**
72
+ * Replace an existing document
73
+ * @param container The container name
74
+ * @param id The document ID
75
+ * @param partitionKey The partition key value
76
+ * @param body The new document body
77
+ * @param invocationKey Unique key for tracking this invocation
78
+ * @param options Additional options
79
+ */
80
+ async replace(container, id, partitionKey, body, invocationKey, options) {
81
+ const payload = {
82
+ type: "database",
83
+ subtype: "cosmosdb",
84
+ operation: "replace",
85
+ container,
86
+ id,
87
+ partitionKey,
88
+ body,
89
+ timeoutMs: options?.timeoutMs,
90
+ };
91
+ return this.invokeRaw(payload, invocationKey);
92
+ }
93
+ /**
94
+ * Upsert a document (insert or replace)
95
+ * @param container The container name
96
+ * @param body The document body (must include id and partition key properties)
97
+ * @param invocationKey Unique key for tracking this invocation
98
+ * @param options Additional options
99
+ */
100
+ async upsert(container, body, invocationKey, options) {
101
+ const payload = {
102
+ type: "database",
103
+ subtype: "cosmosdb",
104
+ operation: "upsert",
105
+ container,
106
+ body,
107
+ timeoutMs: options?.timeoutMs,
108
+ };
109
+ return this.invokeRaw(payload, invocationKey);
110
+ }
111
+ /**
112
+ * Delete a document
113
+ * @param container The container name
114
+ * @param id The document ID
115
+ * @param partitionKey The partition key value
116
+ * @param invocationKey Unique key for tracking this invocation
117
+ * @param options Additional options
118
+ */
119
+ async delete(container, id, partitionKey, invocationKey, options) {
120
+ const payload = {
121
+ type: "database",
122
+ subtype: "cosmosdb",
123
+ operation: "delete",
124
+ container,
125
+ id,
126
+ partitionKey,
127
+ timeoutMs: options?.timeoutMs,
128
+ };
129
+ return this.invokeRaw(payload, invocationKey);
130
+ }
131
+ /**
132
+ * Patch a document with partial updates
133
+ * @param container The container name
134
+ * @param id The document ID
135
+ * @param partitionKey The partition key value
136
+ * @param patchOperations Array of patch operations
137
+ * @param invocationKey Unique key for tracking this invocation
138
+ * @param options Additional options (condition, timeoutMs)
139
+ */
140
+ async patch(container, id, partitionKey, patchOperations, invocationKey, options) {
141
+ const payload = {
142
+ type: "database",
143
+ subtype: "cosmosdb",
144
+ operation: "patch",
145
+ container,
146
+ id,
147
+ partitionKey,
148
+ patchOperations,
149
+ condition: options?.condition,
150
+ timeoutMs: options?.timeoutMs,
151
+ };
152
+ return this.invokeRaw(payload, invocationKey);
153
+ }
154
+ }
155
+ //# sourceMappingURL=cosmosdb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmosdb.js","sourceRoot":"","sources":["../../src/clients/cosmosdb.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC5D;;;;OAIG;IACH,KAAK,CAAC,MAAM,CACV,OAA0B,EAC1B,aAAqB;QAErB,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAE3C,CAAC;IACJ,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,KAAK,CACT,SAAiB,EACjB,KAAa,EACb,aAAqB,EACrB,OAMC;QAED,MAAM,OAAO,GAAsB;YACjC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,OAAO;YAClB,SAAS;YACT,KAAK;YACL,UAAU,EAAE,OAAO,EAAE,UAAU;YAC/B,YAAY,EAAE,OAAO,EAAE,YAAY;YACnC,YAAY,EAAE,OAAO,EAAE,YAAY;YACnC,iBAAiB,EAAE,OAAO,EAAE,iBAAiB;YAC7C,SAAS,EAAE,OAAO,EAAE,SAAS;SAC9B,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAE3C,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,IAAI,CACR,SAAiB,EACjB,EAAU,EACV,YAA0B,EAC1B,aAAqB,EACrB,OAAgC;QAEhC,MAAM,OA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AC9B,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAE3C,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,EAAU,EACV,YAA0B,EAC1B,aAAqB,EACrB,OAAgC;QAEhC,MAAM,OAAO,GAAsB;YACjC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,QAAQ;YACnB,SAAS;YACT,EAAE;YACF,YAAY;YACZ,SAAS,EAAE,OAAO,EAAE,SAAS;SAC9B,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAE3C,CAAC;IACJ,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAK,CACT,SAAiB,EACjB,EAAU,EACV,YAA0B,EAC1B,eAAuC,EACvC,aAAqB,EACrB,OAAoD;QAEpD,MAAM,OAAO,GAAsB;YACjC,IAAI,EAAE,UAAU;YAChB,OAAO,EAAE,UAAU;YACnB,SAAS,EAAE,OAAO;YAClB,SAAS;YACT,EAAE;YACF,YAAY;YACZ,eAAe;YACf,SAAS,EAAE,OAAO,EAAE,SAAS;YAC7B,SAAS,EAAE,OAAO,EAAE,SAAS;SAC9B,CAAC;QAEF,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,aAAa,CAE3C,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var googlesheets_exports = {};
21
+ __export(googlesheets_exports, {
22
+ GoogleSheetsResourceClient: () => GoogleSheetsResourceClient
23
+ });
24
+ module.exports = __toCommonJS(googlesheets_exports);
25
+ var import_base = require("../base");
26
+ class GoogleSheetsResourceClient extends import_base.BaseResourceClient {
27
+ static {
28
+ __name(this, "GoogleSheetsResourceClient");
29
+ }
30
+ async invoke(method, path, invocationKey, options = {}) {
31
+ const payload = {
32
+ type: "api",
33
+ subtype: "googlesheets",
34
+ method,
35
+ path,
36
+ query: options.query,
37
+ body: options.body,
38
+ timeoutMs: options.timeoutMs || 3e4
39
+ };
40
+ return this.invokeRaw(payload, invocationKey);
41
+ }
42
+ /**
43
+ * Get values from a range in the spreadsheet
44
+ * @param range A1 notation range (e.g., "Sheet1!A1:D5")
45
+ * @param invocationKey Unique key for tracking this invocation
46
+ */
47
+ async getValues(range, invocationKey) {
48
+ return this.invoke("GET", `/values/${range}`, invocationKey);
49
+ }
50
+ /**
51
+ * Update values in a range in the spreadsheet
52
+ * @param range A1 notation range (e.g., "Sheet1!A1:D5")
53
+ * @param values 2D array of values to write
54
+ * @param invocationKey Unique key for tracking this invocation
55
+ * @param valueInputOption How to interpret input values ("RAW" or "USER_ENTERED")
56
+ */
57
+ async updateValues(range, values, invocationKey, valueInputOption = "USER_ENTERED") {
58
+ return this.invoke("PUT", `/values/${range}`, invocationKey, {
59
+ query: { valueInputOption },
60
+ body: { type: "json", value: { values } }
61
+ });
62
+ }
63
+ /**
64
+ * Append values to a sheet
65
+ * @param range A1 notation range (e.g., "Sheet1!A1:D1")
66
+ * @param values 2D array of values to append
67
+ * @param invocationKey Unique key for tracking this invocation
68
+ * @param valueInputOption How to interpret input values ("RAW" or "USER_ENTERED")
69
+ */
70
+ async appendValues(range, values, invocationKey, valueInputOption = "USER_ENTERED") {
71
+ return this.invoke("POST", `/values/${range}:append`, invocationKey, {
72
+ query: { valueInputOption },
73
+ body: { type: "json", value: { values } }
74
+ });
75
+ }
76
+ /**
77
+ * Clear values in a range
78
+ * @param range A1 notation range (e.g., "Sheet1!A1:D5")
79
+ * @param invocationKey Unique key for tracking this invocation
80
+ */
81
+ async clearValues(range, invocationKey) {
82
+ return this.invoke("POST", `/values/${range}:clear`, invocationKey);
83
+ }
84
+ /**
85
+ * Batch get multiple ranges
86
+ * @param ranges Array of A1 notation ranges
87
+ * @param invocationKey Unique key for tracking this invocation
88
+ */
89
+ async batchGetValues(ranges, invocationKey) {
90
+ return this.invoke("GET", "/values:batchGet", invocationKey, {
91
+ query: { ranges }
92
+ });
93
+ }
94
+ /**
95
+ * Batch update multiple ranges
96
+ * @param data Array of range updates
97
+ * @param invocationKey Unique key for tracking this invocation
98
+ * @param valueInputOption How to interpret input values ("RAW" or "USER_ENTERED")
99
+ */
100
+ async batchUpdateValues(data, invocationKey, valueInputOption = "USER_ENTERED") {
101
+ return this.invoke("POST", "/values:batchUpdate", invocationKey, {
102
+ body: {
103
+ type: "json",
104
+ value: {
105
+ valueInputOption,
106
+ data
107
+ }
108
+ }
109
+ });
110
+ }
111
+ /**
112
+ * Get spreadsheet metadata
113
+ * @param invocationKey Unique key for tracking this invocation
114
+ */
115
+ async getSpreadsheet(invocationKey) {
116
+ return this.invoke("GET", "/", invocationKey);
117
+ }
118
+ /**
119
+ * Batch update spreadsheet (for formatting, creating sheets, etc.)
120
+ * @param requests Array of update requests
121
+ * @param invocationKey Unique key for tracking this invocation
122
+ */
123
+ async batchUpdate(requests, invocationKey) {
124
+ return this.invoke("POST", "/:batchUpdate", invocationKey, {
125
+ body: { type: "json", value: { requests } }
126
+ });
127
+ }
128
+ }
129
+ //# sourceMappingURL=googlesheets.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/clients/googlesheets.ts"],
4
+ "sourcesContent": ["import type {\n HttpMethod,\n QueryParams,\n ApiGoogleSheetsPayload,\n ApiInvokeResponse,\n} from \"../schemas\";\nimport { BaseResourceClient } from \"../base\";\n\nexport class GoogleSheetsResourceClient extends BaseResourceClient {\n async invoke(\n method: HttpMethod,\n path: string,\n invocationKey: string,\n options: {\n query?: QueryParams;\n body?: { type: \"json\"; value: unknown };\n timeoutMs?: number;\n } = {}\n ): Promise<ApiInvokeResponse> {\n const payload: ApiGoogleSheetsPayload = {\n type: \"api\",\n subtype: \"googlesheets\",\n method,\n path,\n query: options.query,\n body: options.body,\n timeoutMs: options.timeoutMs || 30000,\n };\n\n return this.invokeRaw(payload, invocationKey) as Promise<ApiInvokeResponse>;\n }\n\n /**\n * Get values from a range in the spreadsheet\n * @param range A1 notation range (e.g., \"Sheet1!A1:D5\")\n * @param invocationKey Unique key for tracking this invocation\n */\n async getValues(\n range: string,\n invocationKey: string\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\"GET\", `/values/${range}`, invocationKey);\n }\n\n /**\n * Update values in a range in the spreadsheet\n * @param range A1 notation range (e.g., \"Sheet1!A1:D5\")\n * @param values 2D array of values to write\n * @param invocationKey Unique key for tracking this invocation\n * @param valueInputOption How to interpret input values (\"RAW\" or \"USER_ENTERED\")\n */\n async updateValues(\n range: string,\n values: unknown[][],\n invocationKey: string,\n valueInputOption: \"RAW\" | \"USER_ENTERED\" = \"USER_ENTERED\"\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\n \"PUT\",\n `/values/${range}`,\n invocationKey,\n {\n query: { valueInputOption },\n body: { type: \"json\", value: { values } },\n }\n );\n }\n\n /**\n * Append values to a sheet\n * @param range A1 notation range (e.g., \"Sheet1!A1:D1\")\n * @param values 2D array of values to append\n * @param invocationKey Unique key for tracking this invocation\n * @param valueInputOption How to interpret input values (\"RAW\" or \"USER_ENTERED\")\n */\n async appendValues(\n range: string,\n values: unknown[][],\n invocationKey: string,\n valueInputOption: \"RAW\" | \"USER_ENTERED\" = \"USER_ENTERED\"\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\n \"POST\",\n `/values/${range}:append`,\n invocationKey,\n {\n query: { valueInputOption },\n body: { type: \"json\", value: { values } },\n }\n );\n }\n\n /**\n * Clear values in a range\n * @param range A1 notation range (e.g., \"Sheet1!A1:D5\")\n * @param invocationKey Unique key for tracking this invocation\n */\n async clearValues(\n range: string,\n invocationKey: string\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\"POST\", `/values/${range}:clear`, invocationKey);\n }\n\n /**\n * Batch get multiple ranges\n * @param ranges Array of A1 notation ranges\n * @param invocationKey Unique key for tracking this invocation\n */\n async batchGetValues(\n ranges: string[],\n invocationKey: string\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\"GET\", \"/values:batchGet\", invocationKey, {\n query: { ranges },\n });\n }\n\n /**\n * Batch update multiple ranges\n * @param data Array of range updates\n * @param invocationKey Unique key for tracking this invocation\n * @param valueInputOption How to interpret input values (\"RAW\" or \"USER_ENTERED\")\n */\n async batchUpdateValues(\n data: Array<{ range: string; values: unknown[][] }>,\n invocationKey: string,\n valueInputOption: \"RAW\" | \"USER_ENTERED\" = \"USER_ENTERED\"\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\"POST\", \"/values:batchUpdate\", invocationKey, {\n body: {\n type: \"json\",\n value: {\n valueInputOption,\n data,\n },\n },\n });\n }\n\n /**\n * Get spreadsheet metadata\n * @param invocationKey Unique key for tracking this invocation\n */\n async getSpreadsheet(invocationKey: string): Promise<ApiInvokeResponse> {\n return this.invoke(\"GET\", \"/\", invocationKey);\n }\n\n /**\n * Batch update spreadsheet (for formatting, creating sheets, etc.)\n * @param requests Array of update requests\n * @param invocationKey Unique key for tracking this invocation\n */\n async batchUpdate(\n requests: unknown[],\n invocationKey: string\n ): Promise<ApiInvokeResponse> {\n return this.invoke(\"PO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