codeapp-js 0.2.2 → 1.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/AI/codeapp.agent.md +105 -0
- package/AI/skills/connections/SKILL.md +47 -0
- package/AI/skills/dataverse/SKILL.md +99 -0
- package/AI/skills/environment-variables/SKILL.md +89 -0
- package/AI/skills/frontend-design/SKILL.md +34 -0
- package/AI/skills/jira/SKILL.md +81 -0
- package/AI/skills/office365-groups/SKILL.md +61 -0
- package/AI/skills/office365-outlook/SKILL.md +52 -0
- package/AI/skills/office365-users/SKILL.md +78 -0
- package/AI/skills/sharepoint/SKILL.md +77 -0
- package/AI/skills/sql/SKILL.md +85 -0
- package/AI/skills/start/SKILL.md +46 -0
- package/AI/skills/teams/SKILL.md +55 -0
- package/codeApp/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -0
- package/codeApp/.power/schemas/jira/jira.Schema.json +6903 -0
- package/codeApp/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
- package/{examples/combined demo/.power/schemas/office365groups/office365groups.Schema.json → codeApp/.power/schemas/office365groups/office365groups.Schema.json} +2203 -2203
- package/codeApp/.power/schemas/teams/teams.Schema.json +11112 -0
- package/codeApp/dist/codeapp.js +103 -1043
- package/codeApp/dist/connectors/azureKeyvault.js +459 -0
- package/codeApp/dist/connectors/jira.js +1247 -0
- package/codeApp/dist/connectors/office365groups.js +642 -0
- package/codeApp/dist/connectors/office365users.js +513 -0
- package/codeApp/dist/connectors/outlook.js +1393 -0
- package/{examples/kanban/dist → codeApp/dist/connectors}/sharepoint.js +466 -339
- package/codeApp/dist/connectors/sql.js +149 -0
- package/codeApp/dist/connectors/teams.js +280 -0
- package/codeApp/dist/index.js +1 -1
- package/codeApp/dist/power-apps-data.js +725 -176
- package/codeApp/src/generated/index.ts +12 -0
- package/codeApp/src/generated/models/AzureKeyVaultModel.ts +107 -0
- package/codeApp/src/generated/models/JiraModel.ts +501 -0
- package/codeApp/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/codeApp/src/generated/services/JiraService.ts +1124 -0
- package/examples/{kanban → apps/kanban}/dist/dataverse.js +94 -94
- package/examples/{kanban → apps/kanban}/dist/index.css +605 -605
- package/examples/{kanban → apps/kanban}/dist/index.html +21 -21
- package/examples/{kanban → apps/kanban}/dist/index.js +860 -860
- package/examples/{kanban → apps/kanban}/dist/office365groups.js +97 -97
- package/examples/apps/kanban/dist/office365users.js +451 -0
- package/examples/{kanban → apps/kanban}/dist/outlook.js +162 -162
- package/examples/{planning Poker/dist/power-apps-data.js → apps/kanban/dist/power-apps-data.js} +2953 -2953
- package/{dev files/sharepoint.js → examples/apps/kanban/dist/sharepoint.js} +195 -99
- package/examples/{kanban → apps/kanban}/power.config.json +35 -35
- package/examples/{planning Poker → apps/planning Poker}/additional files/customizations (tables).xml +6428 -6428
- package/examples/{planning Poker → apps/planning Poker}/additional files/dataverse-tables.json +165 -165
- package/examples/{planning Poker → apps/planning Poker}/additional files/readme.md +122 -122
- package/examples/{planning Poker → apps/planning Poker}/dist/dataverse.js +78 -78
- package/examples/{planning Poker → apps/planning Poker}/dist/index.html +198 -198
- package/examples/{planning Poker → apps/planning Poker}/dist/index.js +954 -954
- package/examples/{kanban/dist/power-apps-data.js → apps/planning Poker/dist/power-apps-data.js } +2953 -2953
- package/examples/{planning Poker → apps/planning Poker}/dist/styles.css +815 -815
- package/examples/{planning Poker → apps/planning Poker}/power.config.json +50 -50
- package/examples/{solution explorer → apps/solution explorer}/dist/codeapp.js +1098 -1098
- package/examples/{solution explorer → apps/solution explorer}/dist/index.html +80 -80
- package/examples/{solution explorer → apps/solution explorer}/dist/index.js +735 -735
- package/examples/{solution explorer → apps/solution explorer}/dist/styles.css +571 -571
- package/examples/{solution explorer → apps/solution explorer}/power.config.json +150 -150
- package/examples/{todo → apps/todo}/dist/dataverse.js +64 -64
- package/examples/{todo → apps/todo}/dist/index.html +75 -75
- package/examples/{todo → apps/todo}/dist/index.js +8 -8
- package/examples/{todo → apps/todo}/dist/power-apps-data.js +2953 -2953
- package/examples/{todo → apps/todo}/dist/renderer.js +375 -375
- package/examples/{todo → apps/todo}/dist/styles.css +691 -691
- package/examples/{todo → apps/todo}/power.config.json +34 -34
- package/examples/combined demo/.power/schemas/appschemas/dataSourcesInfo.ts +6275 -7830
- package/examples/combined demo/.power/schemas/jira/jira.Schema.json +6903 -0
- package/examples/combined demo/.power/schemas/keyvault/keyvault.Schema.json +1600 -0
- package/examples/combined demo/.power/schemas/teams/teams.Schema.json +11112 -0
- package/examples/combined demo/dist/codeapp.js +394 -1098
- package/examples/combined demo/dist/index.html +29 -511
- package/examples/combined demo/dist/index.js +490 -470
- package/examples/combined demo/dist/office365users.js +513 -0
- package/examples/combined demo/dist/outlook.js +1393 -0
- package/examples/combined demo/dist/power-apps-data.js +3079 -3006
- package/examples/combined demo/dist/styles.css +483 -0
- package/examples/combined demo/power.config.json +33 -42
- package/examples/combined demo/src/generated/index.ts +12 -14
- package/examples/combined demo/src/generated/models/AzureKeyVaultModel.ts +107 -0
- package/examples/combined demo/src/generated/models/JiraModel.ts +501 -0
- package/examples/combined demo/src/generated/services/AzureKeyVaultService.ts +257 -0
- package/examples/combined demo/src/generated/services/JiraService.ts +1124 -0
- package/examples/dataverse Demo/dist/codeapp.js +394 -1085
- package/examples/{outlook Demo2/OutlookDemo_1_0_0_1.zip → dataverse Demo/dist/icon-512.png} +0 -0
- package/examples/dataverse Demo/dist/index.html +146 -54
- package/examples/dataverse Demo/dist/index.js +693 -83
- package/examples/dataverse Demo/dist/power-apps-data.js +3079 -2911
- package/examples/dataverse Demo/dist/styles.css +528 -0
- package/examples/dataverse Demo/power.config.json +41 -35
- package/examples/dataverse Demo/readme.md +79 -79
- package/examples/groups Demo/dist/codeapp.js +394 -1085
- package/examples/groups Demo/dist/icon-512.png +0 -0
- package/examples/groups Demo/dist/index.html +21 -25
- package/examples/groups Demo/dist/index.js +304 -113
- package/examples/groups Demo/dist/office365groups.js +642 -0
- package/examples/groups Demo/dist/power-apps-data.js +3079 -2911
- package/examples/groups Demo/dist/styles.css +509 -0
- package/examples/groups Demo/power.config.json +25 -25
- package/examples/myProfile/dist/codeapp.js +398 -0
- package/examples/myProfile/dist/index.html +21 -184
- package/examples/myProfile/dist/index.js +324 -141
- package/examples/myProfile/dist/office365users.js +517 -169
- package/examples/myProfile/dist/power-apps-data.js +3080 -2953
- package/examples/myProfile/dist/styles.css +458 -0
- package/examples/myProfile/power.config.json +24 -23
- package/examples/outlook Demo/dist/codeapp.js +394 -1085
- package/examples/outlook Demo/dist/index.html +150 -35
- package/examples/outlook Demo/dist/index.js +516 -170
- package/examples/outlook Demo/dist/outlook.js +1393 -121
- package/examples/outlook Demo/dist/power-apps-data.js +3079 -2911
- package/examples/outlook Demo/dist/styles.css +408 -84
- package/examples/outlook Demo/power.config.json +24 -23
- package/examples/outlook Demo/readme.md +92 -82
- package/examples/sharePoint Demo/dist/codeapp.js +394 -1085
- package/examples/sharePoint Demo/dist/icon-512.png +0 -0
- package/examples/sharePoint Demo/dist/index.html +22 -255
- package/examples/sharePoint Demo/dist/index.js +899 -262
- package/examples/sharePoint Demo/dist/power-apps-data.js +3079 -2911
- package/examples/sharePoint Demo/dist/sharepoint.js +466 -0
- package/examples/sharePoint Demo/dist/styles.css +587 -0
- package/examples/sharePoint Demo/power.config.json +23 -22
- package/package.json +1 -1
- package/readme.md +479 -61
- package/.github/instructions/wyattdave.instructions.md +0 -39
- package/.vscode/settings.json +0 -6
- package/dev files/dataverse.js +0 -105
- package/dev files/office365groups.js +0 -65
- package/dev files/office365users.js +0 -169
- package/dev files/outlook.js +0 -330
- package/examples/combined demo/.power/schemas/office365/office365.Schema.json +0 -21098
- package/examples/combined demo/.power/schemas/office365users/office365users.Schema.json +0 -2094
- package/examples/kanban/agent/decision-log.md +0 -9
- package/examples/kanban/agent/mockup-01-editorial-glass.html +0 -159
- package/examples/kanban/agent/mockup-02-dark-rail.html +0 -147
- package/examples/kanban/agent/mockup-03-paper-grid.html +0 -114
- package/examples/kanban/agent/mockup-04-neon-minimal.html +0 -141
- package/examples/kanban/agent/mockup-05-mono-architect.html +0 -119
- package/examples/kanban/dist/environmentVar.js +0 -55
- package/examples/kanban/dist/office365users.js +0 -169
- package/examples/kanban/src/generated/index.ts +0 -14
- package/examples/outlook Demo2/agent/decision-log.md +0 -7
- package/examples/outlook Demo2/dist/codeapp.js +0 -1334
- package/examples/outlook Demo2/dist/index.html +0 -98
- package/examples/outlook Demo2/dist/index.js +0 -346
- package/examples/outlook Demo2/dist/styles.css +0 -639
- package/examples/outlook Demo2/power.config.json +0 -23
- package/examples/planning Poker/.vscode/settings.json +0 -5
- package/examples/sharePoint Demo/agent/decision-log.md +0 -17
- package/examples/solution explorer/agent/decision-log.md +0 -27
- package/examples/solution explorer/agent/mockup-01-swiss-grid.html +0 -452
- package/examples/solution explorer/agent/mockup-02-dark-glass.html +0 -496
- package/examples/solution explorer/agent/mockup-03-paper-console.html +0 -510
- package/examples/solution explorer/agent/mockup-04-neon-noir.html +0 -546
- package/examples/solution explorer/agent/mockup-05-zen-garden.html +0 -534
- package/examples/solution explorer/dist/power-apps-data.js +0 -3007
- package/scripts/build-power-sdk.mjs +0 -69
- /package/{examples/kanban → codeApp}/src/generated/models/Office365GroupsModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/models/Office365OutlookModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/models/Office365UsersModel.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365GroupsService.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365OutlookService.ts +0 -0
- /package/{examples/kanban → codeApp}/src/generated/services/Office365UsersService.ts +0 -0
- /package/{dev files → examples/apps/kanban/dist}/environmentVar.js +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/index.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365GroupsModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365OutlookModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/models/Office365UsersModel.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365GroupsService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365OutlookService.ts +0 -0
- /package/examples/{outlook Demo2 → apps/kanban}/src/generated/services/Office365UsersService.ts +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/AgilePoker_1_0_0_1.zip +0 -0
- /package/examples/{planning Poker → apps/planning Poker}/additional files/PokerTables_1_0_0_1.zip +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/icon-512.png +0 -0
- /package/examples/{outlook Demo2 → apps/solution explorer}/dist/power-apps-data.js +0 -0
- /package/examples/{todo → apps/todo}/dist/icon192.png +0 -0
- /package/examples/{solution explorer → combined demo}/dist/icon-512.png +0 -0
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// ───────────────────────────── Azure Key Vault ──────────────────────────────
|
|
3
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
import { getClient } from "./power-apps-data.js";
|
|
5
|
+
import {_dbgWrap } from "./codeapp.js";
|
|
6
|
+
const KEY_VAULT_DATA_SOURCE_CANDIDATES = ["keyvault", "KeyVault", "azurekeyvault", "azureKeyVault", "AzureKeyVault"];
|
|
7
|
+
const KEY_VAULT_APIS = {
|
|
8
|
+
ListKeys: {
|
|
9
|
+
path: "/{connectionId}/keys",
|
|
10
|
+
method: "GET",
|
|
11
|
+
parameters: [
|
|
12
|
+
{ name: "connectionId", in: "path", required: true },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
ListKeyVersions: {
|
|
16
|
+
path: "/{connectionId}/keys/{keyName}/versions",
|
|
17
|
+
method: "GET",
|
|
18
|
+
parameters: [
|
|
19
|
+
{ name: "connectionId", in: "path", required: true },
|
|
20
|
+
{ name: "keyName", in: "path", required: true },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
GetKeyMetadata: {
|
|
24
|
+
path: "/{connectionId}/keys/{keyName}/metadata",
|
|
25
|
+
method: "GET",
|
|
26
|
+
parameters: [
|
|
27
|
+
{ name: "connectionId", in: "path", required: true },
|
|
28
|
+
{ name: "keyName", in: "path", required: true },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
GetKeyVersionMetadata: {
|
|
32
|
+
path: "/{connectionId}/keys/{keyName}/versions/{keyVersion}/metadata",
|
|
33
|
+
method: "GET",
|
|
34
|
+
parameters: [
|
|
35
|
+
{ name: "connectionId", in: "path", required: true },
|
|
36
|
+
{ name: "keyName", in: "path", required: true },
|
|
37
|
+
{ name: "keyVersion", in: "path", required: true },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
EncryptData: {
|
|
41
|
+
path: "/{connectionId}/keys/{keyName}/encrypt",
|
|
42
|
+
method: "POST",
|
|
43
|
+
parameters: [
|
|
44
|
+
{ name: "connectionId", in: "path", required: true },
|
|
45
|
+
{ name: "keyName", in: "path", required: true },
|
|
46
|
+
{ name: "operationInput", in: "body", required: true },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
EncryptDataWithVersion: {
|
|
50
|
+
path: "/{connectionId}/keys/{keyName}/versions/{keyVersion}/encrypt",
|
|
51
|
+
method: "POST",
|
|
52
|
+
parameters: [
|
|
53
|
+
{ name: "connectionId", in: "path", required: true },
|
|
54
|
+
{ name: "keyName", in: "path", required: true },
|
|
55
|
+
{ name: "keyVersion", in: "path", required: true },
|
|
56
|
+
{ name: "operationInput", in: "body", required: true },
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
DecryptData: {
|
|
60
|
+
path: "/{connectionId}/keys/{keyName}/decrypt",
|
|
61
|
+
method: "POST",
|
|
62
|
+
parameters: [
|
|
63
|
+
{ name: "connectionId", in: "path", required: true },
|
|
64
|
+
{ name: "keyName", in: "path", required: true },
|
|
65
|
+
{ name: "operationInput", in: "body", required: true },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
DecryptDataWithVersion: {
|
|
69
|
+
path: "/{connectionId}/keys/{keyName}/versions/{keyVersion}/decrypt",
|
|
70
|
+
method: "POST",
|
|
71
|
+
parameters: [
|
|
72
|
+
{ name: "connectionId", in: "path", required: true },
|
|
73
|
+
{ name: "keyName", in: "path", required: true },
|
|
74
|
+
{ name: "keyVersion", in: "path", required: true },
|
|
75
|
+
{ name: "operationInput", in: "body", required: true },
|
|
76
|
+
],
|
|
77
|
+
},
|
|
78
|
+
GetSecret: {
|
|
79
|
+
path: "/{connectionId}/secrets/{secretName}/value",
|
|
80
|
+
method: "GET",
|
|
81
|
+
parameters: [
|
|
82
|
+
{ name: "connectionId", in: "path", required: true },
|
|
83
|
+
{ name: "secretName", in: "path", required: true },
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
ListSecrets: {
|
|
87
|
+
path: "/{connectionId}/secrets",
|
|
88
|
+
method: "GET",
|
|
89
|
+
parameters: [
|
|
90
|
+
{ name: "connectionId", in: "path", required: true },
|
|
91
|
+
],
|
|
92
|
+
},
|
|
93
|
+
ListSecretVersions: {
|
|
94
|
+
path: "/{connectionId}/secrets/{secretName}/versions",
|
|
95
|
+
method: "GET",
|
|
96
|
+
parameters: [
|
|
97
|
+
{ name: "connectionId", in: "path", required: true },
|
|
98
|
+
{ name: "secretName", in: "path", required: true },
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
GetSecretMetadata: {
|
|
102
|
+
path: "/{connectionId}/secrets/{secretName}/metadata",
|
|
103
|
+
method: "GET",
|
|
104
|
+
parameters: [
|
|
105
|
+
{ name: "connectionId", in: "path", required: true },
|
|
106
|
+
{ name: "secretName", in: "path", required: true },
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
GetSecretVersionMetadata: {
|
|
110
|
+
path: "/{connectionId}/secrets/{secretName}/versions/{secretVersion}/metadata",
|
|
111
|
+
method: "GET",
|
|
112
|
+
parameters: [
|
|
113
|
+
{ name: "connectionId", in: "path", required: true },
|
|
114
|
+
{ name: "secretName", in: "path", required: true },
|
|
115
|
+
{ name: "secretVersion", in: "path", required: true },
|
|
116
|
+
],
|
|
117
|
+
},
|
|
118
|
+
GetSecretVersion: {
|
|
119
|
+
path: "/{connectionId}/secrets/{secretName}/versions/{secretVersion}/value",
|
|
120
|
+
method: "GET",
|
|
121
|
+
parameters: [
|
|
122
|
+
{ name: "connectionId", in: "path", required: true },
|
|
123
|
+
{ name: "secretName", in: "path", required: true },
|
|
124
|
+
{ name: "secretVersion", in: "path", required: true },
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
function isKeyVaultObject(oValue) {
|
|
130
|
+
return !!oValue && typeof oValue === "object" && !Array.isArray(oValue);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function pickKeyVaultValue() {
|
|
134
|
+
for (let iIndex = 0; iIndex < arguments.length; iIndex += 1) {
|
|
135
|
+
const oValue = arguments[iIndex];
|
|
136
|
+
if (oValue !== undefined && oValue !== null) return oValue;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function setKeyVaultIfDefined(oTarget, sKey, oValue) {
|
|
143
|
+
if (oValue !== undefined && oValue !== null) {
|
|
144
|
+
oTarget[sKey] = oValue;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return oTarget;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function normalizeKeyVaultOperationInput(oInputOrOptions, sValueKey, oFallbackOptions) {
|
|
151
|
+
const oSource = isKeyVaultObject(oInputOrOptions)
|
|
152
|
+
? (isKeyVaultObject(oInputOrOptions.operationInput)
|
|
153
|
+
? oInputOrOptions.operationInput
|
|
154
|
+
: (isKeyVaultObject(oInputOrOptions.input)
|
|
155
|
+
? oInputOrOptions.input
|
|
156
|
+
: (isKeyVaultObject(oInputOrOptions.body) ? oInputOrOptions.body : oInputOrOptions)))
|
|
157
|
+
: (isKeyVaultObject(oFallbackOptions)
|
|
158
|
+
? (isKeyVaultObject(oFallbackOptions.operationInput)
|
|
159
|
+
? oFallbackOptions.operationInput
|
|
160
|
+
: (isKeyVaultObject(oFallbackOptions.input)
|
|
161
|
+
? oFallbackOptions.input
|
|
162
|
+
: (isKeyVaultObject(oFallbackOptions.body) ? oFallbackOptions.body : oFallbackOptions)))
|
|
163
|
+
: {});
|
|
164
|
+
|
|
165
|
+
const oPayload = {};
|
|
166
|
+
const oFallbackSource = isKeyVaultObject(oFallbackOptions) ? oFallbackOptions : {};
|
|
167
|
+
|
|
168
|
+
setKeyVaultIfDefined(oPayload, "algorithm", pickKeyVaultValue(
|
|
169
|
+
oSource.algorithm,
|
|
170
|
+
oSource.Algorithm,
|
|
171
|
+
oSource.alg,
|
|
172
|
+
oFallbackSource.algorithm,
|
|
173
|
+
oFallbackSource.Algorithm,
|
|
174
|
+
oFallbackSource.alg,
|
|
175
|
+
"RSA-OAEP-256"
|
|
176
|
+
));
|
|
177
|
+
|
|
178
|
+
if (typeof oInputOrOptions === "string") {
|
|
179
|
+
setKeyVaultIfDefined(oPayload, sValueKey, oInputOrOptions);
|
|
180
|
+
return oPayload;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (sValueKey === "rawData") {
|
|
184
|
+
setKeyVaultIfDefined(oPayload, sValueKey, pickKeyVaultValue(
|
|
185
|
+
oSource.rawData,
|
|
186
|
+
oSource.RawData,
|
|
187
|
+
oSource.data,
|
|
188
|
+
oSource.raw,
|
|
189
|
+
oSource.plainText,
|
|
190
|
+
oSource.plaintext,
|
|
191
|
+
oSource.value,
|
|
192
|
+
oFallbackSource.rawData,
|
|
193
|
+
oFallbackSource.RawData,
|
|
194
|
+
oFallbackSource.data,
|
|
195
|
+
oFallbackSource.raw,
|
|
196
|
+
oFallbackSource.plainText,
|
|
197
|
+
oFallbackSource.plaintext,
|
|
198
|
+
oFallbackSource.value
|
|
199
|
+
));
|
|
200
|
+
} else {
|
|
201
|
+
setKeyVaultIfDefined(oPayload, sValueKey, pickKeyVaultValue(
|
|
202
|
+
oSource.encryptedData,
|
|
203
|
+
oSource.EncryptedData,
|
|
204
|
+
oSource.cipherText,
|
|
205
|
+
oSource.ciphertext,
|
|
206
|
+
oSource.data,
|
|
207
|
+
oSource.value,
|
|
208
|
+
oFallbackSource.encryptedData,
|
|
209
|
+
oFallbackSource.EncryptedData,
|
|
210
|
+
oFallbackSource.cipherText,
|
|
211
|
+
oFallbackSource.ciphertext,
|
|
212
|
+
oFallbackSource.data,
|
|
213
|
+
oFallbackSource.value
|
|
214
|
+
));
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return oPayload;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async function execKeyVaultOp(operationName, parameters) {
|
|
221
|
+
return execConnectorOpWithCandidates(KEY_VAULT_DATA_SOURCE_CANDIDATES, KEY_VAULT_APIS, "Azure Key Vault", operationName, parameters);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export async function callKeyVaultOperation(operationName, parameters = {}) {
|
|
225
|
+
return _dbgWrap('callKeyVaultOperation', [operationName, parameters], async function() {
|
|
226
|
+
return execKeyVaultOp(operationName, parameters);
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export async function listKeys(oOptions = {}) {
|
|
231
|
+
return _dbgWrap('listKeys', [oOptions], async function() {
|
|
232
|
+
if (!isKeyVaultObject(oOptions)) {
|
|
233
|
+
oOptions = {};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return execKeyVaultOp("ListKeys", {});
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export async function listKeyVersions(sKeyName) {
|
|
241
|
+
return _dbgWrap('listKeyVersions', [sKeyName], async function() {
|
|
242
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
243
|
+
sKeyName = pickKeyVaultValue(sKeyName.keyName, sKeyName.name);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
return execKeyVaultOp("ListKeyVersions", {
|
|
247
|
+
keyName: sKeyName,
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export async function getKeyMetadata(sKeyName) {
|
|
253
|
+
return _dbgWrap('getKeyMetadata', [sKeyName], async function() {
|
|
254
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
255
|
+
sKeyName = pickKeyVaultValue(sKeyName.keyName, sKeyName.name);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return execKeyVaultOp("GetKeyMetadata", {
|
|
259
|
+
keyName: sKeyName,
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export async function getKeyVersionMetadata(sKeyName, sKeyVersion) {
|
|
265
|
+
return _dbgWrap('getKeyVersionMetadata', [sKeyName, sKeyVersion], async function() {
|
|
266
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
267
|
+
sKeyVersion = pickKeyVaultValue(sKeyName.keyVersion, sKeyName.version);
|
|
268
|
+
sKeyName = pickKeyVaultValue(sKeyName.keyName, sKeyName.name);
|
|
269
|
+
} else if (isKeyVaultObject(sKeyVersion)) {
|
|
270
|
+
sKeyVersion = pickKeyVaultValue(sKeyVersion.keyVersion, sKeyVersion.version);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return execKeyVaultOp("GetKeyVersionMetadata", {
|
|
274
|
+
keyName: sKeyName,
|
|
275
|
+
keyVersion: sKeyVersion,
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export async function encryptData(sKeyName, oInputOrOptions) {
|
|
281
|
+
return _dbgWrap('encryptData', [sKeyName, oInputOrOptions], async function() {
|
|
282
|
+
let oOptions = isKeyVaultObject(oInputOrOptions) ? oInputOrOptions : {};
|
|
283
|
+
|
|
284
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
285
|
+
oOptions = sKeyName;
|
|
286
|
+
sKeyName = pickKeyVaultValue(oOptions.keyName, oOptions.name);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
const sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
290
|
+
const sOperationName = sKeyVersion ? "EncryptDataWithVersion" : "EncryptData";
|
|
291
|
+
const params = {
|
|
292
|
+
keyName: sKeyName,
|
|
293
|
+
operationInput: normalizeKeyVaultOperationInput(oInputOrOptions, "rawData", oOptions),
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
setKeyVaultIfDefined(params, "keyVersion", sKeyVersion);
|
|
297
|
+
return execKeyVaultOp(sOperationName, params);
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export async function encryptDataWithVersion(sKeyName, sKeyVersion, oInputOrOptions) {
|
|
302
|
+
return _dbgWrap('encryptDataWithVersion', [sKeyName, sKeyVersion, oInputOrOptions], async function() {
|
|
303
|
+
let oOptions = isKeyVaultObject(oInputOrOptions) ? oInputOrOptions : {};
|
|
304
|
+
|
|
305
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
306
|
+
oOptions = sKeyName;
|
|
307
|
+
sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
308
|
+
sKeyName = pickKeyVaultValue(oOptions.keyName, oOptions.name);
|
|
309
|
+
} else if (isKeyVaultObject(sKeyVersion)) {
|
|
310
|
+
oOptions = sKeyVersion;
|
|
311
|
+
sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return execKeyVaultOp("EncryptDataWithVersion", {
|
|
315
|
+
keyName: sKeyName,
|
|
316
|
+
keyVersion: sKeyVersion,
|
|
317
|
+
operationInput: normalizeKeyVaultOperationInput(oInputOrOptions, "rawData", oOptions),
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export async function decryptData(sKeyName, oInputOrOptions) {
|
|
323
|
+
return _dbgWrap('decryptData', [sKeyName, oInputOrOptions], async function() {
|
|
324
|
+
let oOptions = isKeyVaultObject(oInputOrOptions) ? oInputOrOptions : {};
|
|
325
|
+
|
|
326
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
327
|
+
oOptions = sKeyName;
|
|
328
|
+
sKeyName = pickKeyVaultValue(oOptions.keyName, oOptions.name);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
const sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
332
|
+
const sOperationName = sKeyVersion ? "DecryptDataWithVersion" : "DecryptData";
|
|
333
|
+
const params = {
|
|
334
|
+
keyName: sKeyName,
|
|
335
|
+
operationInput: normalizeKeyVaultOperationInput(oInputOrOptions, "encryptedData", oOptions),
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
setKeyVaultIfDefined(params, "keyVersion", sKeyVersion);
|
|
339
|
+
return execKeyVaultOp(sOperationName, params);
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export async function decryptDataWithVersion(sKeyName, sKeyVersion, oInputOrOptions) {
|
|
344
|
+
return _dbgWrap('decryptDataWithVersion', [sKeyName, sKeyVersion, oInputOrOptions], async function() {
|
|
345
|
+
let oOptions = isKeyVaultObject(oInputOrOptions) ? oInputOrOptions : {};
|
|
346
|
+
|
|
347
|
+
if (isKeyVaultObject(sKeyName)) {
|
|
348
|
+
oOptions = sKeyName;
|
|
349
|
+
sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
350
|
+
sKeyName = pickKeyVaultValue(oOptions.keyName, oOptions.name);
|
|
351
|
+
} else if (isKeyVaultObject(sKeyVersion)) {
|
|
352
|
+
oOptions = sKeyVersion;
|
|
353
|
+
sKeyVersion = pickKeyVaultValue(oOptions.keyVersion, oOptions.version);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return execKeyVaultOp("DecryptDataWithVersion", {
|
|
357
|
+
keyName: sKeyName,
|
|
358
|
+
keyVersion: sKeyVersion,
|
|
359
|
+
operationInput: normalizeKeyVaultOperationInput(oInputOrOptions, "encryptedData", oOptions),
|
|
360
|
+
});
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export async function getSecret(sSecretName, sApiVersion) {
|
|
365
|
+
return _dbgWrap('getSecret', [sSecretName, sApiVersion], async function() {
|
|
366
|
+
if (isKeyVaultObject(sSecretName)) {
|
|
367
|
+
sApiVersion = pickKeyVaultValue(sSecretName.apiVersion, sSecretName.ApiVersion);
|
|
368
|
+
sSecretName = pickKeyVaultValue(sSecretName.secretName, sSecretName.name);
|
|
369
|
+
} else if (isKeyVaultObject(sApiVersion)) {
|
|
370
|
+
sSecretName = pickKeyVaultValue(sSecretName, sApiVersion.secretName, sApiVersion.name);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return execKeyVaultOp("GetSecret", {
|
|
374
|
+
secretName: sSecretName,
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export async function listSecrets(oOptions = {}) {
|
|
380
|
+
return _dbgWrap('listSecrets', [oOptions], async function() {
|
|
381
|
+
if (!isKeyVaultObject(oOptions)) {
|
|
382
|
+
oOptions = {};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
return execKeyVaultOp("ListSecrets", {});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export async function listSecretVersions(sSecretName, sApiVersion) {
|
|
390
|
+
return _dbgWrap('listSecretVersions', [sSecretName, sApiVersion], async function() {
|
|
391
|
+
if (isKeyVaultObject(sSecretName)) {
|
|
392
|
+
sApiVersion = pickKeyVaultValue(sSecretName.apiVersion, sSecretName.ApiVersion);
|
|
393
|
+
sSecretName = pickKeyVaultValue(sSecretName.secretName, sSecretName.name);
|
|
394
|
+
} else if (isKeyVaultObject(sApiVersion)) {
|
|
395
|
+
sSecretName = pickKeyVaultValue(sSecretName, sApiVersion.secretName, sApiVersion.name);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
return execKeyVaultOp("ListSecretVersions", {
|
|
399
|
+
secretName: sSecretName,
|
|
400
|
+
});
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export async function getSecretMetadata(sSecretName, sApiVersion) {
|
|
405
|
+
return _dbgWrap('getSecretMetadata', [sSecretName, sApiVersion], async function() {
|
|
406
|
+
if (isKeyVaultObject(sSecretName)) {
|
|
407
|
+
sApiVersion = pickKeyVaultValue(sSecretName.apiVersion, sSecretName.ApiVersion);
|
|
408
|
+
sSecretName = pickKeyVaultValue(sSecretName.secretName, sSecretName.name);
|
|
409
|
+
} else if (isKeyVaultObject(sApiVersion)) {
|
|
410
|
+
sSecretName = pickKeyVaultValue(sSecretName, sApiVersion.secretName, sApiVersion.name);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
return execKeyVaultOp("GetSecretMetadata", {
|
|
414
|
+
secretName: sSecretName,
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export async function getSecretVersionMetadata(sSecretName, sSecretVersion, sApiVersion) {
|
|
420
|
+
return _dbgWrap('getSecretVersionMetadata', [sSecretName, sSecretVersion, sApiVersion], async function() {
|
|
421
|
+
if (isKeyVaultObject(sSecretName)) {
|
|
422
|
+
sApiVersion = pickKeyVaultValue(sSecretName.apiVersion, sSecretName.ApiVersion);
|
|
423
|
+
sSecretVersion = pickKeyVaultValue(sSecretName.secretVersion, sSecretName.version);
|
|
424
|
+
sSecretName = pickKeyVaultValue(sSecretName.secretName, sSecretName.name);
|
|
425
|
+
} else if (isKeyVaultObject(sSecretVersion)) {
|
|
426
|
+
sApiVersion = pickKeyVaultValue(sSecretVersion.apiVersion, sSecretVersion.ApiVersion);
|
|
427
|
+
sSecretVersion = pickKeyVaultValue(sSecretVersion.secretVersion, sSecretVersion.version);
|
|
428
|
+
} else if (isKeyVaultObject(sApiVersion)) {
|
|
429
|
+
sSecretName = pickKeyVaultValue(sSecretName, sApiVersion.secretName, sApiVersion.name);
|
|
430
|
+
sSecretVersion = pickKeyVaultValue(sSecretVersion, sApiVersion.secretVersion, sApiVersion.version);
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
return execKeyVaultOp("GetSecretVersionMetadata", {
|
|
434
|
+
secretName: sSecretName,
|
|
435
|
+
secretVersion: sSecretVersion,
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
export async function getSecretVersion(sSecretName, sSecretVersion, sApiVersion) {
|
|
441
|
+
return _dbgWrap('getSecretVersion', [sSecretName, sSecretVersion, sApiVersion], async function() {
|
|
442
|
+
if (isKeyVaultObject(sSecretName)) {
|
|
443
|
+
sApiVersion = pickKeyVaultValue(sSecretName.apiVersion, sSecretName.ApiVersion);
|
|
444
|
+
sSecretVersion = pickKeyVaultValue(sSecretName.secretVersion, sSecretName.version);
|
|
445
|
+
sSecretName = pickKeyVaultValue(sSecretName.secretName, sSecretName.name);
|
|
446
|
+
} else if (isKeyVaultObject(sSecretVersion)) {
|
|
447
|
+
sApiVersion = pickKeyVaultValue(sSecretVersion.apiVersion, sSecretVersion.ApiVersion);
|
|
448
|
+
sSecretVersion = pickKeyVaultValue(sSecretVersion.secretVersion, sSecretVersion.version);
|
|
449
|
+
} else if (isKeyVaultObject(sApiVersion)) {
|
|
450
|
+
sSecretName = pickKeyVaultValue(sSecretName, sApiVersion.secretName, sApiVersion.name);
|
|
451
|
+
sSecretVersion = pickKeyVaultValue(sSecretVersion, sApiVersion.secretVersion, sApiVersion.version);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return execKeyVaultOp("GetSecretVersion", {
|
|
455
|
+
secretName: sSecretName,
|
|
456
|
+
secretVersion: sSecretVersion,
|
|
457
|
+
});
|
|
458
|
+
});
|
|
459
|
+
}
|