@ampless/backend 1.0.0-alpha.49 → 1.0.0-alpha.50

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.
@@ -192,7 +192,7 @@ function createProcessorTrustedHandler(opts) {
192
192
  const result = await rawDdb.send(
193
193
  new GetItemCommand({
194
194
  TableName: PLUGIN_SECRET_TABLE,
195
- Key: marshall({ siteId: "default", sk })
195
+ Key: marshall({ sk })
196
196
  })
197
197
  );
198
198
  if (!result.Item) {
@@ -74,13 +74,13 @@ async function handleSet(args) {
74
74
  await ddb.send(
75
75
  new PutItemCommand({
76
76
  TableName: secretTable,
77
- Item: marshall({ siteId: "default", sk, value: ciphertext })
77
+ Item: marshall({ sk, value: ciphertext })
78
78
  })
79
79
  );
80
80
  await ddb.send(
81
81
  new PutItemCommand({
82
82
  TableName: indicatorTable,
83
- Item: marshall({ siteId: "default", sk, lastSetAt: now })
83
+ Item: marshall({ sk, lastSetAt: now })
84
84
  })
85
85
  );
86
86
  return "ok";
@@ -99,13 +99,13 @@ async function handleClear(args) {
99
99
  await ddb.send(
100
100
  new DeleteItemCommand({
101
101
  TableName: secretTable,
102
- Key: marshall({ siteId: "default", sk })
102
+ Key: marshall({ sk })
103
103
  })
104
104
  );
105
105
  await ddb.send(
106
106
  new DeleteItemCommand({
107
107
  TableName: indicatorTable,
108
- Key: marshall({ siteId: "default", sk })
108
+ Key: marshall({ sk })
109
109
  })
110
110
  );
111
111
  return "ok";
package/dist/index.js CHANGED
@@ -455,17 +455,19 @@ function amplessSchemaModels(a, opts = {}) {
455
455
  // access scoped to the table the Lambda needs.
456
456
  //
457
457
  // Storage key convention:
458
- // siteId = 'default' (single-site architecture)
459
458
  // sk = `plugins.${instanceId ?? name}.${fieldKey}`
460
459
  //
460
+ // Single-site architecture: no `siteId` partition column. The same
461
+ // single-table convention as KvStore / Post / Page / Media after
462
+ // the `remove-siteid-from-schema` migration.
463
+ //
461
464
  // DynamoDB auto-encrypts at rest (AWS-managed KMS key). Secrets
462
465
  // never flow to the S3 site-settings mirror because the trusted
463
466
  // processor only queries KvStore (pk='siteconfig') for that path —
464
467
  // PluginSecret is a structurally separate table.
465
468
  PluginSecret: a.model({
466
- // Single-site architecture: siteId is always 'default'.
467
- siteId: a.string().required(),
468
- // Composite sort key: `plugins.<instanceId>.<fieldKey>`
469
+ // Sort key (also the partition key — single-id identifier):
470
+ // `plugins.<instanceId>.<fieldKey>`
469
471
  sk: a.string().required(),
470
472
  // The secret value stored as AES-256-GCM ciphertext (base64).
471
473
  // Format: base64( IV[12] || ciphertext || authTag[16] ).
@@ -480,7 +482,7 @@ function amplessSchemaModels(a, opts = {}) {
480
482
  // / deploy artifact access, NOT defeated for a malicious
481
483
  // trusted plugin co-located in the same Lambda.
482
484
  value: a.string().required()
483
- }).identifier(["siteId", "sk"]).authorization((allow) => [
485
+ }).identifier(["sk"]).authorization((allow) => [
484
486
  // Deny-all-via-AppSync sentinel. See the comment above this
485
487
  // model for why this is a non-existent group name and how the
486
488
  // real Lambda access path works (DDB SDK + IAM grants).
@@ -501,14 +503,13 @@ function amplessSchemaModels(a, opts = {}) {
501
503
  // row is at most stale-indicator-but-no-secret, which degrades
502
504
  // gracefully as a false "stored" indicator in the UI).
503
505
  PluginSecretIndicator: a.model({
504
- siteId: a.string().required(),
505
506
  // Same sort-key format as PluginSecret:
506
507
  // `plugins.${instanceId ?? name}.${fieldKey}`
507
508
  sk: a.string().required(),
508
509
  // ISO 8601 datetime string — set by plugin-secret-handler on
509
510
  // every write. Admin UI may show this as "last updated" hint.
510
511
  lastSetAt: a.datetime().required()
511
- }).identifier(["siteId", "sk"]).authorization((allow) => [
512
+ }).identifier(["sk"]).authorization((allow) => [
512
513
  // Admin/editor have AppSync read for `hasPluginSecret` and
513
514
  // direct write+delete as a recovery path. The Lambda is the
514
515
  // normal write path (it calls the DDB SDK directly with IAM,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ampless/backend",
3
- "version": "1.0.0-alpha.49",
3
+ "version": "1.0.0-alpha.50",
4
4
  "description": "Amplify Gen 2 backend factories for ampless: auth, data, storage, event processors, API key renewer",
5
5
  "license": "MIT",
6
6
  "type": "module",