@shiqianjiang/ceru-plugin-issuer 0.3.1 → 0.3.3

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 (2) hide show
  1. package/dist/index.js +20 -2
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -146,11 +146,11 @@ export const MANIFEST_SCHEMA = object({
146
146
  maxItems: 64,
147
147
  items: object({
148
148
  id,
149
- kind: { enum: ['schema', 'web'] },
149
+ kind: { enum: ['schema', 'web', 'native'] },
150
150
  entry: id,
151
151
  title: { type: 'string', minLength: 1, maxLength: 100 },
152
152
  presentation: object({
153
- kind: { const: 'drawer' },
153
+ kind: { enum: ['drawer', 'modal'] },
154
154
  placement: { enum: ['left', 'right', 'top', 'bottom'] },
155
155
  size: { type: 'integer', minimum: 280, maximum: 1200 },
156
156
  }, ['kind']),
@@ -203,6 +203,11 @@ export const MANIFEST_SCHEMA = object({
203
203
  }),
204
204
  }, ['id', 'slot', 'title', 'commandId']),
205
205
  },
206
+ accountItems: {
207
+ type: 'array',
208
+ maxItems: 16,
209
+ items: object({ id, title: string, view: id, action: id, logoutAction: id }, ['id', 'title', 'view', 'action']),
210
+ },
206
211
  homeSections: {
207
212
  type: 'array',
208
213
  maxItems: 32,
@@ -391,9 +396,20 @@ export function validateManifest(value) {
391
396
  const views = new Set(manifest.modules.surfaces?.map((p) => p.id));
392
397
  const actions = new Set(manifest.contributes?.commands?.map((command) => command.action));
393
398
  for (const surface of manifest.modules.surfaces ?? []) {
399
+ if (surface.kind === 'native') {
400
+ ensure(manifest.modules.logic, 'Native surfaces require a logic module');
401
+ ensure(actions.has(surface.entry), 'Missing native render action: ' + surface.entry);
402
+ }
394
403
  for (const action of Object.values(surface.lifecycle ?? {}))
395
404
  ensure(actions.has(action), 'Unknown surface lifecycle action: ' + action);
396
405
  }
406
+ for (const account of manifest.contributes?.accountItems ?? []) {
407
+ ensure(manifest.modules.logic, 'Account items require a logic module');
408
+ ensure(views.has(account.view), 'Unknown account view: ' + account.view);
409
+ ensure(actions.has(account.action), 'Unknown account summary action: ' + account.action);
410
+ if (account.logoutAction)
411
+ ensure(actions.has(account.logoutAction), 'Unknown account logout action: ' + account.logoutAction);
412
+ }
397
413
  const share = manifest.modules.share;
398
414
  if (share?.guestAdapterId)
399
415
  ensure(manifest.contributes?.guestAdapters?.some((adapter) => adapter.id === share.guestAdapterId), 'Unknown share guest adapter: ' + share.guestAdapterId);
@@ -848,6 +864,8 @@ function inspectBody(body, manifest) {
848
864
  for (const surface of manifest.modules.surfaces ?? []) {
849
865
  if (surface.kind === 'web')
850
866
  add(surface.entry);
867
+ else if (surface.kind === 'native')
868
+ ensure(manifest.contributes?.commands?.some(command => command.action === surface.entry), 'Missing native render action: ' + surface.entry);
851
869
  else
852
870
  ensure(resources[surface.entry]?.type === 'json', 'Missing schema resource: ' + surface.entry);
853
871
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shiqianjiang/ceru-plugin-issuer",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Static verification, Ed25519 signing and cached personalized issuance of Ceru single-JS plugins",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "node": ">=22.12.0"
24
24
  },
25
25
  "dependencies": {
26
- "@shiqianjiang/ceru-plugin-sdk": "0.3.1",
26
+ "@shiqianjiang/ceru-plugin-sdk": "0.3.3",
27
27
  "acorn": "^8.18.0",
28
28
  "ajv": "^8.20.0"
29
29
  },