@adobe/helix-config-storage 1.6.0 → 1.7.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [1.7.0](https://github.com/adobe/helix-config-storage/compare/v1.6.1...v1.7.0) (2024-09-05)
2
+
3
+
4
+ ### Features
5
+
6
+ * add apiKeyId to org config ([#20](https://github.com/adobe/helix-config-storage/issues/20)) ([d6d86fe](https://github.com/adobe/helix-config-storage/commit/d6d86fecfad2f020a46efbe7061660bf312f67b6)), closes [#19](https://github.com/adobe/helix-config-storage/issues/19)
7
+
8
+ ## [1.6.1](https://github.com/adobe/helix-config-storage/compare/v1.6.0...v1.6.1) (2024-09-03)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * properly store tokens ([#18](https://github.com/adobe/helix-config-storage/issues/18)) ([d919bf8](https://github.com/adobe/helix-config-storage/commit/d919bf86f248e0badc771305fa4f995b2bae74df))
14
+
1
15
  # [1.6.0](https://github.com/adobe/helix-config-storage/compare/v1.5.0...v1.6.0) (2024-09-02)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-config-storage",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Helix Config Storage",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -102,6 +102,10 @@ const FRAGMENTS = {
102
102
  members: 'object',
103
103
  },
104
104
  },
105
+ access: {
106
+ '.': 'object',
107
+ admin: 'object',
108
+ },
105
109
  },
106
110
  };
107
111
 
@@ -31,6 +31,7 @@ import googleSchema from './schemas/content-source-google.schema.cjs';
31
31
  import headersSchema from './schemas/headers.schema.cjs';
32
32
  import markupSchema from './schemas/content-source-markup.schema.cjs';
33
33
  import metadataSchema from './schemas/metadata-source.schema.cjs';
34
+ import orgAccessSchema from './schemas/org-access.schema.cjs';
34
35
  import orgSchema from './schemas/org.schema.cjs';
35
36
  import onedriveSchema from './schemas/content-source-onedrive.schema.cjs';
36
37
  import publicSchema from './schemas/public.schema.cjs';
@@ -59,6 +60,7 @@ export const SCHEMAS = [
59
60
  markupSchema,
60
61
  metadataSchema,
61
62
  orgSchema,
63
+ orgAccessSchema,
62
64
  onedriveSchema,
63
65
  publicSchema,
64
66
  profileSchema,
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Copyright 2024 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ module.exports = require('./org-access.schema.json');
@@ -0,0 +1,24 @@
1
+ {
2
+ "$comment": "https://github.com/adobe/helix-config/blob/main/LICENSE.txt",
3
+ "$id": "https://ns.adobe.com/helix/config/org/access",
4
+ "$schema": "https://json-schema.org/draft/2019-09/schema",
5
+ "title": "Org Access Config",
6
+ "type": "object",
7
+ "properties": {
8
+ "admin": {
9
+ "type": "object",
10
+ "properties": {
11
+ "apiKeyId": {
12
+ "description": "the id of the API key(s). this is used to validate the API KEYS and allows to invalidate them.",
13
+ "type": "array",
14
+ "items": {
15
+ "type": "string"
16
+ }
17
+ }
18
+ },
19
+ "additionalProperties": false
20
+ }
21
+ },
22
+ "additionalProperties": false
23
+ }
24
+
@@ -20,6 +20,9 @@
20
20
  },
21
21
  "tokens": {
22
22
  "$ref": "https://ns.adobe.com/helix/config/tokens"
23
+ },
24
+ "access": {
25
+ "$ref": "https://ns.adobe.com/helix/config/org/access"
23
26
  }
24
27
  },
25
28
  "required": [
@@ -57,6 +57,11 @@ export class TransientTokenStore {
57
57
  */
58
58
  #modified;
59
59
 
60
+ /**
61
+ * flag indicating that the store was modified
62
+ */
63
+ wasModified = false;
64
+
60
65
  /**
61
66
  * consistent "now"
62
67
  */
@@ -108,8 +113,11 @@ export class TransientTokenStore {
108
113
  async #save(ctx) {
109
114
  if (this.#modified) {
110
115
  const storage = HelixStorage.fromContext(ctx).configBus();
111
- await storage.put(this.#key, JSON.stringify(this.#tokens));
116
+ await storage.put(this.#key, JSON.stringify({
117
+ tokens: this.#tokens,
118
+ }));
112
119
  this.#modified = false;
120
+ this.wasModified = true;
113
121
  }
114
122
  }
115
123
 
@@ -22,6 +22,7 @@ npx ajv-cli --spec=draft2019 -c ajv-formats compile \
22
22
  -s src/schemas/user.schema.json \
23
23
  -s src/schemas/users.schema.json \
24
24
  -s src/schemas/tokens.schema.json \
25
+ -s src/schemas/org-access.schema.json \
25
26
  -s src/schemas/org.schema.json \
26
27
  -s src/schemas/sidekick.schema.json \
27
28
  -s src/schemas/robots.schema.json \