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

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 +30 -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 +108 -0
  8. package/lib/deployers/arm.service.d.ts.map +1 -0
  9. package/lib/deployers/arm.service.js +280 -0
  10. package/lib/deployers/arm.service.js.map +1 -0
  11. package/lib/deployers/containerapps.service.d.ts +156 -0
  12. package/lib/deployers/containerapps.service.d.ts.map +1 -0
  13. package/lib/deployers/containerapps.service.js +455 -0
  14. package/lib/deployers/containerapps.service.js.map +1 -0
  15. package/lib/deployers/functions-entrypoint.d.ts +48 -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 +66 -0
  20. package/lib/deployers/functions.service.d.ts.map +1 -0
  21. package/lib/deployers/functions.service.js +322 -0
  22. package/lib/deployers/functions.service.js.map +1 -0
  23. package/lib/deployers/functionspackager.service.d.ts +43 -0
  24. package/lib/deployers/functionspackager.service.d.ts.map +1 -0
  25. package/lib/deployers/functionspackager.service.js +151 -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 +41 -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 +157 -0
  36. package/lib/services/blob.service.d.ts.map +1 -0
  37. package/lib/services/blob.service.js +428 -0
  38. package/lib/services/blob.service.js.map +1 -0
  39. package/lib/services/contributors.d.ts +47 -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 +211 -0
  44. package/lib/services/cosmos.service.d.ts.map +1 -0
  45. package/lib/services/cosmos.service.js +554 -0
  46. package/lib/services/cosmos.service.js.map +1 -0
  47. package/lib/services/functionserver.service.d.ts +42 -0
  48. package/lib/services/functionserver.service.d.ts.map +1 -0
  49. package/lib/services/functionserver.service.js +223 -0
  50. package/lib/services/functionserver.service.js.map +1 -0
  51. package/lib/services/keyvault.service.d.ts +91 -0
  52. package/lib/services/keyvault.service.d.ts.map +1 -0
  53. package/lib/services/keyvault.service.js +225 -0
  54. package/lib/services/keyvault.service.js.map +1 -0
  55. package/lib/services/monitorlogger.service.d.ts +66 -0
  56. package/lib/services/monitorlogger.service.d.ts.map +1 -0
  57. package/lib/services/monitorlogger.service.js +131 -0
  58. package/lib/services/monitorlogger.service.js.map +1 -0
  59. package/lib/services/servicebus.service.d.ts +128 -0
  60. package/lib/services/servicebus.service.d.ts.map +1 -0
  61. package/lib/services/servicebus.service.js +324 -0
  62. package/lib/services/servicebus.service.js.map +1 -0
  63. package/lib/template.d.ts +53 -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 +1817 -0
@@ -0,0 +1,211 @@
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
+ endpoint: string;
9
+ key?: string | SecretString;
10
+ database: string;
11
+ container: string;
12
+ partitionKey: string;
13
+ createIfNotExists: boolean;
14
+ throughput?: number;
15
+ tenantId?: string;
16
+ clientId?: string;
17
+ clientSecret?: string | SecretString;
18
+ subscriptionId?: string;
19
+ /**
20
+ * Perform load.
21
+ * @override
22
+ */
23
+ load(params?: any): this;
24
+ }
25
+ /**
26
+ * Translate the supported WebdaQL filter subset with bound values and quoted field identifiers.
27
+ * @param query - WebdaQL query or parsed filter
28
+ * @returns SQL text and bound parameters
29
+ */
30
+ export declare function cosmosQuery(query: QL.Query): SqlQuerySpec;
31
+ type CosmosDocument = Record<string, any> & {
32
+ id: string;
33
+ value: Record<string, any>;
34
+ _etag?: string;
35
+ };
36
+ /** Typed Cosmos repository. A serializer envelope preserves dates, behaviors and concrete model types. */
37
+ export declare class CosmosRepository<T extends ModelClass> extends MemoryRepository<T> {
38
+ protected container: () => Container;
39
+ protected partitionKey: string;
40
+ /**
41
+ * Initialize the Azure integration.
42
+ * @param model - Model class or model identifier
43
+ * @param pks - Primary key field names
44
+ * @param container - Lazy Cosmos container accessor
45
+ * @param partitionKey - Cosmos partition key path
46
+ * @param separator - Composite primary key separator
47
+ */
48
+ constructor(model: T, pks: string[], container: () => Container, partitionKey?: string, separator?: string);
49
+ /**
50
+ * Encode the model primary key as a Cosmos item identifier.
51
+ * @param primaryKey - Model primary key
52
+ * @returns The key result
53
+ */
54
+ protected key(primaryKey: any): string;
55
+ /**
56
+ * Resolve the partition value from the primary key.
57
+ * @param primaryKey - Model primary key
58
+ * @returns The partition result
59
+ */
60
+ protected partition(primaryKey: any): string | number | boolean;
61
+ /**
62
+ * Address a Cosmos document by its item and partition keys.
63
+ * @param primaryKey - Model primary key
64
+ * @returns The item result
65
+ */
66
+ protected item(primaryKey: any): import("@azure/cosmos").Item;
67
+ /**
68
+ * Serialize a model into a typed Cosmos document.
69
+ * @param item - Collection item or model instance
70
+ * @returns The document result
71
+ */
72
+ protected document(item: InstanceType<T>): CosmosDocument;
73
+ /**
74
+ * Restore a typed model from a Cosmos document.
75
+ * @param document - Stored Cosmos document
76
+ * @returns The from document result
77
+ */
78
+ protected fromDocument(document: CosmosDocument): InstanceType<T>;
79
+ /**
80
+ * Map Cosmos storage errors to Webda errors.
81
+ * @param primaryKey - Model primary key
82
+ * @param error - Azure SDK error
83
+ */
84
+ protected translateError(primaryKey: any, error: unknown): never;
85
+ /**
86
+ * Read a Cosmos document or raise the store not-found error.
87
+ * @param primaryKey - Model primary key
88
+ * @returns The read result
89
+ */
90
+ protected read(primaryKey: any): Promise<CosmosDocument>;
91
+ /**
92
+ * Perform get.
93
+ * @override
94
+ */
95
+ get(primaryKey: any): Promise<any>;
96
+ /**
97
+ * Perform exists.
98
+ * @override
99
+ */
100
+ exists(primaryKey: any): Promise<boolean>;
101
+ /**
102
+ * Perform create.
103
+ * @override
104
+ */
105
+ create(data: any, save?: boolean): Promise<InstanceType<T>>;
106
+ /**
107
+ * Validate a write condition against the current document.
108
+ * @param primaryKey - Model primary key
109
+ * @param document - Stored Cosmos document
110
+ * @param field - Conditional write field
111
+ * @param expected - Expected field value
112
+ */
113
+ protected checkWriteCondition(primaryKey: any, document: CosmosDocument, field?: string | null, expected?: any): void;
114
+ /**
115
+ * Use the shared model mutation helpers, then submit the complete change atomically under the read ETag.
116
+ * @param primaryKey - Model primary key
117
+ * @param change - Model mutation applied through shared repository helpers
118
+ * @param conditionField - Conditional write field
119
+ * @param condition - Expected write condition
120
+ * @param native - Native atomic Cosmos patch operations
121
+ */
122
+ protected mutate(primaryKey: any, change: (repository: MemoryRepository<T>) => Promise<unknown>, conditionField?: string | null, condition?: any, native?: PatchOperation[]): Promise<void>;
123
+ /**
124
+ * Perform update.
125
+ * @override
126
+ */
127
+ update(data: any, conditionField?: any, condition?: any): Promise<void>;
128
+ /**
129
+ * Perform patch.
130
+ * @override
131
+ */
132
+ patch(primaryKey: any, data: any, field?: any, expected?: any): Promise<void>;
133
+ /**
134
+ * Perform delete.
135
+ * @override
136
+ */
137
+ delete(primaryKey: any, field?: any, expected?: any): Promise<void>;
138
+ /**
139
+ * Perform remove attribute.
140
+ * @override
141
+ */
142
+ removeAttribute(primaryKey: any, attribute: any, field?: any, expected?: any): Promise<void>;
143
+ /**
144
+ * Perform increment attributes.
145
+ * @override
146
+ */
147
+ incrementAttributes(primaryKey: any, info: any, field?: any, expected?: any): Promise<Record<string, number>>;
148
+ /**
149
+ * Perform upsert item to collection.
150
+ * @override
151
+ */
152
+ upsertItemToCollection(primaryKey: any, collection: any, item: any, index?: number, field?: any, expected?: any): Promise<void>;
153
+ /**
154
+ * Perform delete item from collection.
155
+ * @override
156
+ */
157
+ deleteItemFromCollection(primaryKey: any, collection: any, index: number, field?: any, expected?: any): Promise<void>;
158
+ /**
159
+ * Perform query.
160
+ * @override
161
+ */
162
+ query(query: string | any, params?: QL.QueryParameters): Promise<{
163
+ results: InstanceType<T>[];
164
+ continuationToken?: string;
165
+ }>;
166
+ /**
167
+ * Perform iterate.
168
+ * @override
169
+ */
170
+ iterate(query: string, params?: QL.QueryParameters): AsyncGenerator<InstanceType<T>>;
171
+ /**
172
+ * Perform delete many.
173
+ * @override
174
+ */
175
+ deleteMany(): Promise<number>;
176
+ /**
177
+ * Perform update many.
178
+ * @override
179
+ */
180
+ updateMany(): Promise<number>;
181
+ }
182
+ /** Cosmos DB NoSQL store using optimistic ETags and atomic document patches.
183
+ * @WebdaModda
184
+ */
185
+ export declare class CosmosStore extends Store<CosmosStoreParameters> implements AzureContributor {
186
+ static Parameters: typeof CosmosStoreParameters;
187
+ protected client: CosmosClient;
188
+ /**
189
+ * Perform init.
190
+ * @override
191
+ */
192
+ init(): Promise<this>;
193
+ /**
194
+ * Perform get repository.
195
+ * @override
196
+ */
197
+ getRepository<T extends ModelClass>(model: T): Repository<T>;
198
+ /**
199
+ * Perform stop.
200
+ * @override
201
+ */
202
+ stop(): Promise<void>;
203
+ /**
204
+ * Describe the Azure resources and identity permissions required by this service.
205
+ * @param deployer - Deployment scope and identity helpers
206
+ * @returns The azure resources result
207
+ */
208
+ getAzureResources(deployer: AzureDeployerInfo): AzureResourceContribution;
209
+ }
210
+ export {};
211
+ //# 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,QAAQ,EAAG,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IAC5B,QAAQ,EAAG,MAAM,CAAC;IAClB,SAAS,EAAG,MAAM,CAAC;IACnB,YAAY,SAAS;IACrB,iBAAiB,UAAS;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;IACrC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,IAAI,CAAC,MAAM,GAAE,GAAQ,GAAG,IAAI,CAG3B;CACF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC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