@webda/azure 0.0.0-stage → 4.0.0-beta.14

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 (68) hide show
  1. package/LICENSE +166 -0
  2. package/README.md +248 -2
  3. package/lib/auth.d.ts +36 -0
  4. package/lib/auth.d.ts.map +1 -0
  5. package/lib/auth.js +70 -0
  6. package/lib/auth.js.map +1 -0
  7. package/lib/deployers/arm.service.d.ts +177 -0
  8. package/lib/deployers/arm.service.d.ts.map +1 -0
  9. package/lib/deployers/arm.service.js +307 -0
  10. package/lib/deployers/arm.service.js.map +1 -0
  11. package/lib/deployers/containerapps.service.d.ts +186 -0
  12. package/lib/deployers/containerapps.service.d.ts.map +1 -0
  13. package/lib/deployers/containerapps.service.js +482 -0
  14. package/lib/deployers/containerapps.service.js.map +1 -0
  15. package/lib/deployers/functions-entrypoint.d.ts +60 -0
  16. package/lib/deployers/functions-entrypoint.d.ts.map +1 -0
  17. package/lib/deployers/functions-entrypoint.js +78 -0
  18. package/lib/deployers/functions-entrypoint.js.map +1 -0
  19. package/lib/deployers/functions.service.d.ts +96 -0
  20. package/lib/deployers/functions.service.d.ts.map +1 -0
  21. package/lib/deployers/functions.service.js +340 -0
  22. package/lib/deployers/functions.service.js.map +1 -0
  23. package/lib/deployers/functionspackager.service.d.ts +82 -0
  24. package/lib/deployers/functionspackager.service.d.ts.map +1 -0
  25. package/lib/deployers/functionspackager.service.js +157 -0
  26. package/lib/deployers/functionspackager.service.js.map +1 -0
  27. package/lib/index.d.ts +15 -0
  28. package/lib/index.d.ts.map +1 -0
  29. package/lib/index.js +18 -0
  30. package/lib/index.js.map +1 -0
  31. package/lib/services/azure-parameters.d.ts +56 -0
  32. package/lib/services/azure-parameters.d.ts.map +1 -0
  33. package/lib/services/azure-parameters.js +43 -0
  34. package/lib/services/azure-parameters.js.map +1 -0
  35. package/lib/services/blob.service.d.ts +196 -0
  36. package/lib/services/blob.service.d.ts.map +1 -0
  37. package/lib/services/blob.service.js +450 -0
  38. package/lib/services/blob.service.js.map +1 -0
  39. package/lib/services/contributors.d.ts +50 -0
  40. package/lib/services/contributors.d.ts.map +1 -0
  41. package/lib/services/contributors.js +2 -0
  42. package/lib/services/contributors.js.map +1 -0
  43. package/lib/services/cosmos.service.d.ts +253 -0
  44. package/lib/services/cosmos.service.d.ts.map +1 -0
  45. package/lib/services/cosmos.service.js +566 -0
  46. package/lib/services/cosmos.service.js.map +1 -0
  47. package/lib/services/functionserver.service.d.ts +51 -0
  48. package/lib/services/functionserver.service.d.ts.map +1 -0
  49. package/lib/services/functionserver.service.js +232 -0
  50. package/lib/services/functionserver.service.js.map +1 -0
  51. package/lib/services/keyvault.service.d.ts +106 -0
  52. package/lib/services/keyvault.service.d.ts.map +1 -0
  53. package/lib/services/keyvault.service.js +228 -0
  54. package/lib/services/keyvault.service.js.map +1 -0
  55. package/lib/services/monitorlogger.service.d.ts +117 -0
  56. package/lib/services/monitorlogger.service.d.ts.map +1 -0
  57. package/lib/services/monitorlogger.service.js +149 -0
  58. package/lib/services/monitorlogger.service.js.map +1 -0
  59. package/lib/services/servicebus.service.d.ts +224 -0
  60. package/lib/services/servicebus.service.d.ts.map +1 -0
  61. package/lib/services/servicebus.service.js +351 -0
  62. package/lib/services/servicebus.service.js.map +1 -0
  63. package/lib/template.d.ts +68 -0
  64. package/lib/template.d.ts.map +1 -0
  65. package/lib/template.js +74 -0
  66. package/lib/template.js.map +1 -0
  67. package/package.json +77 -3
  68. package/webda.module.json +1891 -0
@@ -0,0 +1,253 @@
1
+ import { Container, CosmosClient, PatchOperation, SqlQuerySpec } from "@azure/cosmos";
2
+ import { MemoryRepository, ModelClass, Repository, SecretString, Store, StoreParameters } from "@webda/core";
3
+ import * as QL from "@webda/ql";
4
+ import { AzureServiceParameters } from "./azure-parameters.js";
5
+ import { AzureContributor, AzureDeployerInfo, AzureResourceContribution } from "./contributors.js";
6
+ /** Cosmos DB NoSQL settings. All models in the store share a typed container. */
7
+ export declare class CosmosStoreParameters extends StoreParameters implements AzureServiceParameters {
8
+ /**
9
+ * Endpoint
10
+ */
11
+ endpoint: string;
12
+ /**
13
+ * Key
14
+ */
15
+ key?: string | SecretString;
16
+ /**
17
+ * Database
18
+ */
19
+ database: string;
20
+ /**
21
+ * Container
22
+ */
23
+ container: string;
24
+ /**
25
+ * Partition key
26
+ */
27
+ partitionKey: string;
28
+ /**
29
+ * Create if not exists
30
+ */
31
+ createIfNotExists: boolean;
32
+ /**
33
+ * Throughput
34
+ */
35
+ throughput?: number;
36
+ /**
37
+ * Tenant ID
38
+ */
39
+ tenantId?: string;
40
+ /**
41
+ * Client ID
42
+ */
43
+ clientId?: string;
44
+ /**
45
+ * Client secret
46
+ */
47
+ clientSecret?: string | SecretString;
48
+ /**
49
+ * Subscription ID
50
+ */
51
+ subscriptionId?: string;
52
+ /**
53
+ * Perform load.
54
+ * @override
55
+ */
56
+ load(params?: any): this;
57
+ }
58
+ /**
59
+ * Translate the supported WebdaQL filter subset with bound values and quoted field identifiers.
60
+ * @param query - WebdaQL query or parsed filter
61
+ * @returns SQL text and bound parameters
62
+ */
63
+ export declare function cosmosQuery(query: QL.Query): SqlQuerySpec;
64
+ /**
65
+ * Cosmos document type definition
66
+ */
67
+ type CosmosDocument = Record<string, any> & {
68
+ id: string;
69
+ value: Record<string, any>;
70
+ _etag?: string;
71
+ };
72
+ /** Typed Cosmos repository. A serializer envelope preserves dates, behaviors and concrete model types. */
73
+ export declare class CosmosRepository<T extends ModelClass> extends MemoryRepository<T> {
74
+ protected container: () => Container;
75
+ protected partitionKey: string;
76
+ /**
77
+ * Initialize the Azure integration.
78
+ * @param model - Model class or model identifier
79
+ * @param pks - Primary key field names
80
+ * @param container - Lazy Cosmos container accessor
81
+ * @param partitionKey - Cosmos partition key path
82
+ * @param separator - Composite primary key separator
83
+ */
84
+ constructor(model: T, pks: string[], container: () => Container, partitionKey?: string, separator?: string);
85
+ /**
86
+ * Encode the model primary key as a Cosmos item identifier.
87
+ * @param primaryKey - Model primary key
88
+ * @returns The key result
89
+ */
90
+ protected key(primaryKey: any): string;
91
+ /**
92
+ * Resolve the partition value from the primary key.
93
+ * @param primaryKey - Model primary key
94
+ * @returns The partition result
95
+ */
96
+ protected partition(primaryKey: any): string | number | boolean;
97
+ /**
98
+ * Address a Cosmos document by its item and partition keys.
99
+ * @param primaryKey - Model primary key
100
+ * @returns The item result
101
+ */
102
+ protected item(primaryKey: any): import("@azure/cosmos").Item;
103
+ /**
104
+ * Serialize a model into a typed Cosmos document.
105
+ * @param item - Collection item or model instance
106
+ * @returns The document result
107
+ */
108
+ protected document(item: InstanceType<T>): CosmosDocument;
109
+ /**
110
+ * Restore a typed model from a Cosmos document.
111
+ * @param document - Stored Cosmos document
112
+ * @returns The from document result
113
+ */
114
+ protected fromDocument(document: CosmosDocument): InstanceType<T>;
115
+ /**
116
+ * Map Cosmos storage errors to Webda errors.
117
+ * @param primaryKey - Model primary key
118
+ * @param error - Azure SDK error
119
+ */
120
+ protected translateError(primaryKey: any, error: unknown): never;
121
+ /**
122
+ * Read a Cosmos document or raise the store not-found error.
123
+ * @param primaryKey - Model primary key
124
+ * @returns The read result
125
+ */
126
+ protected read(primaryKey: any): Promise<CosmosDocument>;
127
+ /**
128
+ * Perform get.
129
+ * @override
130
+ */
131
+ get(primaryKey: any): Promise<any>;
132
+ /**
133
+ * Perform exists.
134
+ * @override
135
+ */
136
+ exists(primaryKey: any): Promise<boolean>;
137
+ /**
138
+ * Perform create.
139
+ * @override
140
+ */
141
+ create(data: any, save?: boolean): Promise<InstanceType<T>>;
142
+ /**
143
+ * Validate a write condition against the current document.
144
+ * @param primaryKey - Model primary key
145
+ * @param document - Stored Cosmos document
146
+ * @param field - Conditional write field
147
+ * @param expected - Expected field value
148
+ */
149
+ protected checkWriteCondition(primaryKey: any, document: CosmosDocument, field?: string | null, expected?: any): void;
150
+ /**
151
+ * Use the shared model mutation helpers, then submit the complete change atomically under the read ETag.
152
+ * @param primaryKey - Model primary key
153
+ * @param change - Model mutation applied through shared repository helpers
154
+ * @param conditionField - Conditional write field
155
+ * @param condition - Expected write condition
156
+ * @param native - Native atomic Cosmos patch operations
157
+ */
158
+ protected mutate(primaryKey: any, change: (repository: MemoryRepository<T>) => Promise<unknown>, conditionField?: string | null, condition?: any, native?: PatchOperation[]): Promise<void>;
159
+ /**
160
+ * Perform update.
161
+ * @override
162
+ */
163
+ update(data: any, conditionField?: any, condition?: any): Promise<void>;
164
+ /**
165
+ * Perform patch.
166
+ * @override
167
+ */
168
+ patch(primaryKey: any, data: any, field?: any, expected?: any): Promise<void>;
169
+ /**
170
+ * Perform delete.
171
+ * @override
172
+ */
173
+ delete(primaryKey: any, field?: any, expected?: any): Promise<void>;
174
+ /**
175
+ * Perform remove attribute.
176
+ * @override
177
+ */
178
+ removeAttribute(primaryKey: any, attribute: any, field?: any, expected?: any): Promise<void>;
179
+ /**
180
+ * Perform increment attributes.
181
+ * @override
182
+ */
183
+ incrementAttributes(primaryKey: any, info: any, field?: any, expected?: any): Promise<Record<string, number>>;
184
+ /**
185
+ * Perform upsert item to collection.
186
+ * @override
187
+ */
188
+ upsertItemToCollection(primaryKey: any, collection: any, item: any, index?: number, field?: any, expected?: any): Promise<void>;
189
+ /**
190
+ * Perform delete item from collection.
191
+ * @override
192
+ */
193
+ deleteItemFromCollection(primaryKey: any, collection: any, index: number, field?: any, expected?: any): Promise<void>;
194
+ /**
195
+ * Perform query.
196
+ * @override
197
+ */
198
+ query(query: string | any, params?: QL.QueryParameters): Promise<{
199
+ results: InstanceType<T>[];
200
+ continuationToken?: string;
201
+ }>;
202
+ /**
203
+ * Perform iterate.
204
+ * @override
205
+ */
206
+ iterate(query: string, params?: QL.QueryParameters): AsyncGenerator<InstanceType<T>>;
207
+ /**
208
+ * Perform delete many.
209
+ * @override
210
+ */
211
+ deleteMany(): Promise<number>;
212
+ /**
213
+ * Perform update many.
214
+ * @override
215
+ */
216
+ updateMany(): Promise<number>;
217
+ }
218
+ /** Cosmos DB NoSQL store using optimistic ETags and atomic document patches.
219
+ * @WebdaModda
220
+ */
221
+ export declare class CosmosStore extends Store<CosmosStoreParameters> implements AzureContributor {
222
+ /**
223
+ * Parameters
224
+ */
225
+ static Parameters: typeof CosmosStoreParameters;
226
+ /**
227
+ * Client
228
+ */
229
+ protected client: CosmosClient;
230
+ /**
231
+ * Perform init.
232
+ * @override
233
+ */
234
+ init(): Promise<this>;
235
+ /**
236
+ * Perform get repository.
237
+ * @override
238
+ */
239
+ getRepository<T extends ModelClass>(model: T): Repository<T>;
240
+ /**
241
+ * Perform stop.
242
+ * @override
243
+ */
244
+ stop(): Promise<void>;
245
+ /**
246
+ * Describe the Azure resources and identity permissions required by this service.
247
+ * @param deployer - Deployment scope and identity helpers
248
+ * @returns The azure resources result
249
+ */
250
+ getAzureResources(deployer: AzureDeployerInfo): AzureResourceContribution;
251
+ }
252
+ export {};
253
+ //# sourceMappingURL=cosmos.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cosmos.service.d.ts","sources":["../../src/services/cosmos.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAGL,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,YAAY,EACZ,KAAK,EAEL,eAAe,EAIhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,sBAAsB,EAA2C,MAAM,uBAAuB,CAAC;AACxG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAGnG,iFAAiF;AACjF,qBAAa,qBAAsB,SAAQ,eAAgB,YAAW,sBAAsB;IAC1F;;OAEG;IACH,QAAQ,EAAG,MAAM,CAAC;IAClB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B;;OAEG;IACH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