Skip to content

Commit

Permalink
Changed data.key --> data.name for store, retrieve, and delete, to be…
Browse files Browse the repository at this point in the history
… the same as let/var.

Part of #36.
  • Loading branch information
jkomoros committed Jul 8, 2023
1 parent f8181c4 commit 7e42ce5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
12 changes: 6 additions & 6 deletions seed-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1661,7 +1661,7 @@
}
]
},
"key": {
"name": {
"anyOf": [
{
"$ref": "#/definitions/seedData"
Expand Down Expand Up @@ -1703,7 +1703,7 @@
},
"required": [
"type",
"key",
"name",
"value"
],
"additionalProperties": false
Expand Down Expand Up @@ -1742,7 +1742,7 @@
}
]
},
"key": {
"name": {
"anyOf": [
{
"$ref": "#/definitions/seedData"
Expand All @@ -1760,7 +1760,7 @@
},
"required": [
"type",
"key"
"name"
],
"additionalProperties": false
},
Expand Down Expand Up @@ -1798,7 +1798,7 @@
}
]
},
"key": {
"name": {
"anyOf": [
{
"$ref": "#/definitions/seedData"
Expand All @@ -1816,7 +1816,7 @@
},
"required": [
"type",
"key"
"name"
],
"additionalProperties": false
}
Expand Down
2 changes: 1 addition & 1 deletion seeds/example-complex.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
"name": "user_first_name",
"value": {
"type": "retrieve",
"key": "user_first_name"
"name": "user_first_name"
},
"block": {
"type": "if",
Expand Down
6 changes: 3 additions & 3 deletions src/grow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ const growStore = async (seed : Seed<SeedDataStore>, env : Environment) : Promis
const data = seed.data;
const rawStoreID = extractString(await getProperty(seed, env, data.store, env.getKnownStringKey('store')));
const storeID = env.getStoreID(rawStoreID);
const key = extractString(await getProperty(seed, env, data.key));
const key = extractString(await getProperty(seed, env, data.name));
const value = inputValue.parse(await getProperty(seed, env, data.value));
seed.garden.profile.store(storeID, key, value);
return value;
Expand All @@ -540,7 +540,7 @@ const growRetrieve = async (seed : Seed<SeedDataRetrieve>, env : Environment) :
const data = seed.data;
const rawStoreID = extractString(await getProperty(seed, env, data.store, env.getKnownStringKey('store')));
const storeID = env.getStoreID(rawStoreID);
const key = extractString(await getProperty(seed, env, data.key));
const key = extractString(await getProperty(seed, env, data.name));
const result = seed.garden.profile.retrieve(storeID, key);
if (result === undefined) return null;
return result;
Expand All @@ -550,7 +550,7 @@ const growDelete = async (seed : Seed<SeedDataDelete>, env : Environment) : Prom
const data = seed.data;
const rawStoreID = extractString(await getProperty(seed, env, data.store, env.getKnownStringKey('store')));
const storeID = env.getStoreID(rawStoreID);
const key = extractString(await getProperty(seed, env, data.key));
const key = extractString(await getProperty(seed, env, data.name));
return seed.garden.profile.delete(storeID, key);
};

Expand Down
6 changes: 3 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ const seedDataConfigStore = {
type: z.literal('store'),
properties: {
store: storeID.optional().describe('The store ID to use'),
key: storeKey.describe('The name of the variable in environment to store'),
name: storeKey.describe('The name of the variable in environment to store'),
value: inputValue.describe('The value to store')
}
};
Expand All @@ -707,7 +707,7 @@ const seedDataConfigRetrieve = {
type: z.literal('retrieve'),
properties: {
store: storeID.optional().describe('The store ID to use'),
key: storeKey.describe('The name of the variable in environment to retrieve'),
name: storeKey.describe('The name of the variable in environment to retrieve'),
}
};

Expand All @@ -720,7 +720,7 @@ const seedDataConfigDelete = {
type: z.literal('delete'),
properties: {
store: storeID.optional().describe('The store ID to use'),
key: storeKey.describe('The name of the variable in environment to delete'),
name: storeKey.describe('The name of the variable in environment to delete'),
}
};

Expand Down
6 changes: 3 additions & 3 deletions test/base/a_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@
},
"store-test": {
"type": "store",
"key": "foo",
"name": "foo",
"value": 3
},
"retrieve-test": {
"type": "retrieve",
"key": "foo"
"name": "foo"
},
"delete-test": {
"type": "delete",
"key": "foo"
"name": "foo"
}
}
}
2 changes: 1 addition & 1 deletion test/base/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ Suffix`;
seeds: {
'other-test': {
type: 'store',
key: 'foo',
name: 'foo',
value: 3
}
}
Expand Down

0 comments on commit 7e42ce5

Please sign in to comment.