@andesine/sdk 0.7.0 → 0.9.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,5 +1,40 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.9.0
4
+
5
+ - `schemas.updateDraft` replaces the fields of a schema draft; people editing the draft see the
6
+ change live. It takes the draft hash from `schemas.get` and fails if the draft changed since.
7
+ - `schemas.apply` takes an optional `definition` to apply in place of the draft; the draft is
8
+ replaced only if the apply succeeds.
9
+ - Workspaces have `exampleCollectionID`, the collection with the example content.
10
+ - **Breaking:** `publishing.revertChanges` requires the `entries` permission in addition to
11
+ `read:publishing`; a read-only key can no longer revert drafts.
12
+ - The README describes Pro usage as a pool shared across the workspace: each seat adds 150,000
13
+ API calls and 15,000 AI credits. An AI answer uses 10 credits.
14
+
15
+ ## 0.8.0
16
+
17
+ - `collections.get` returns one collection by `collectionID`, `collectionPath`, or
18
+ `collectionSlugPath`, with its name, path, and ancestors (`read:collections`).
19
+ - `extensions.listElements` lists the custom elements of the workspace's active extensions (e.g.
20
+ Tabs): their props, whether they have content, the blocks their content accepts, and the
21
+ elements that belong inside them (`read:entries`).
22
+ - `extensions.getSelf` and `extensions.verifySession` return `workspacePlan`, the workspace's
23
+ effective plan (`pro` on instances without billing), so extensions can offer plan features.
24
+ - Extension-managed publishable keys: `extensions.listSelfPublishableKeys`,
25
+ `createSelfPublishableKey`, `updateSelfPublishableKey`, and `deleteSelfPublishableKey`, for
26
+ extensions with the `publishable-keys` permission. The keys read published content of their
27
+ collections (and ask for AI answers with `answers` and the extension's `ai-answers` permission),
28
+ in their origins. Members can only delete them. They stop while the extension is disabled or
29
+ revoked; losing `publishable-keys` or `read:publishing`, or uninstalling, deletes them, and
30
+ losing `ai-answers` removes it.
31
+ - Keys have `extensionID`: the extension that manages the key, or `null`.
32
+ - `extensions.verifySession` takes optional `checks` (`{ collectionID, actions }`, up to 10) and
33
+ returns `checks` with `allowed` and the `denied` actions. An action is allowed when the
34
+ member can take it and the extension can read the collection, restricted collections included.
35
+ - `createExtensionBackend().verifySession(headers, { checks })` passes the checks; the results
36
+ are in `session.checks`.
37
+
3
38
  ## 0.7.0
4
39
 
5
40
  - `auth.getIdentity` returns `client` (ID and registered name) for OAuth access tokens.
package/README.md CHANGED
@@ -141,11 +141,11 @@ grant, or app session) in one-minute windows.
141
141
  Each workspace also has two monthly meters, which reset at 00:00 UTC on the first
142
142
  day of each month:
143
143
 
144
- - **API calls:** each request with an API key or OAuth. Free includes 50,000; Pro
145
- includes 500,000 and bills the rest.
146
- - **AI credits:** an AI answer uses 3 credits, and a semantic search uses 1. Requests
147
- from the app use credits too. Free includes 5,000; Pro includes 50,000 and bills
148
- the rest.
144
+ - **API calls:** each request with an API key or OAuth. Free includes 50,000; on Pro,
145
+ each seat adds 150,000 to a pool shared across the workspace, and the rest is billed.
146
+ - **AI credits:** an AI answer uses 10 credits, and a semantic search uses 1. Requests
147
+ from the app use credits too. Free includes 5,000; on Pro, each seat adds 15,000 to
148
+ the shared pool, and the rest is billed.
149
149
 
150
150
  On Free, the meters are hard limits. On Pro, a workspace admin can set a monthly
151
151
  spending limit for the billed usage; when it is reached, metered requests stop until
@@ -1,4 +1,4 @@
1
- import { N as ContentSchemaMetadata, R as EntryFragment, _n as operations, gn as components, mt as PublishedCollection, yt as PublishedEntryContent, z as EntryProperty } from "./schema-D7yh5Hbs.js";
1
+ import { N as ContentSchemaMetadata, R as EntryFragment, _n as operations, gn as components, mt as PublishedCollection, yt as PublishedEntryContent, z as EntryProperty } from "./schema-DBHoDzsT.js";
2
2
  //#region src/workspace.d.ts
3
3
  /**
4
4
  * Type-only description of one workspace and content source.
@@ -451,7 +451,7 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
451
451
  /**
452
452
  * Verify a session token
453
453
  *
454
- * Verifies a session token from the extension frontend and returns its member. Tokens of other extensions, expired tokens, and tokens of an earlier extension generation fail with NOT_FOUND.
454
+ * Verifies a session token from the extension frontend and returns its member. Tokens of other extensions, expired tokens, and tokens of an earlier extension generation fail with NOT_FOUND. checks evaluates collection and entry actions for the member, in collections the extension can read (restricted collections included), so the backend can authorize the member's request.
455
455
  */
456
456
  verifySession: Operation<"extensions.verifySession", Workspace>;
457
457
  /**
@@ -472,6 +472,30 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
472
472
  * Returns the extension's configuration, including secret fields, and its revision. Unset fields use their defaults.
473
473
  */
474
474
  getSelfConfiguration: Operation<"extensions.getSelfConfiguration", Workspace>;
475
+ /**
476
+ * List managed publishable keys
477
+ *
478
+ * Lists the publishable keys that the extension manages. Requires the publishable-keys permission.
479
+ */
480
+ listSelfPublishableKeys: Operation<"extensions.listSelfPublishableKeys", Workspace>;
481
+ /**
482
+ * Create a managed publishable key
483
+ *
484
+ * Creates a publishable key that the extension manages: read:publishing, and ai-answers with answers. Its collections must be readable by the extension. Members see it in API settings and can only delete it. It stops working while the extension is disabled or revoked; losing the permission or read:publishing, or uninstalling, deletes it, and losing ai-answers removes that permission. Up to 10 keys per installation. Requires the publishable-keys permission.
485
+ */
486
+ createSelfPublishableKey: Operation<"extensions.createSelfPublishableKey", Workspace>;
487
+ /**
488
+ * Update a managed publishable key
489
+ *
490
+ * Changes the name, collections, origins, or AI answers of a key that the extension manages. Requires the publishable-keys permission.
491
+ */
492
+ updateSelfPublishableKey: Operation<"extensions.updateSelfPublishableKey", Workspace>;
493
+ /**
494
+ * Delete a managed publishable key
495
+ *
496
+ * Deletes a key that the extension manages, if it exists. Requires the publishable-keys permission.
497
+ */
498
+ deleteSelfPublishableKey: Operation<"extensions.deleteSelfPublishableKey", Workspace>;
475
499
  /**
476
500
  * Get a storage entry
477
501
  *
@@ -496,6 +520,14 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
496
520
  * Lists the extension's storage entries in key order, optionally with a key prefix. A page ends early when its values reach 192 KiB.
497
521
  */
498
522
  listSelfStorageEntries: Operation<"extensions.listSelfStorageEntries", Workspace>;
523
+ /**
524
+ * List custom elements
525
+ *
526
+ * The custom elements that the workspace's active extensions draw in the editor, e.g. Tabs: their props, whether they have content, which child blocks their content accepts, and the elements that belong inside them. Write them in MDX as <Name prop="value">content</Name>. The editor guides edits by these rules and offers a clean-up; the API doesn't enforce them.
527
+ *
528
+ * Required API key permissions: read:entries. Write permissions also grant read access for the same resource.
529
+ */
530
+ listElements: Operation<"extensions.listElements", Workspace>;
499
531
  };
500
532
  collections: {
501
533
  /**
@@ -568,6 +600,19 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
568
600
  * });
569
601
  */
570
602
  move: Operation<"collections.move", Workspace>;
603
+ /**
604
+ * Get a collection
605
+ *
606
+ * Returns one collection by collectionID, collectionPath, or collectionSlugPath, with its name, path, and ancestors.
607
+ *
608
+ * Required API key permissions: read:collections. Write permissions also grant read access for the same resource.
609
+ *
610
+ * @example
611
+ * await client.collections.get({
612
+ * "collectionID": "coll_example"
613
+ * });
614
+ */
615
+ get: Operation<"collections.get", Workspace>;
571
616
  /**
572
617
  * List collections
573
618
  *
@@ -968,10 +1013,36 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
968
1013
  * });
969
1014
  */
970
1015
  get: Operation<"schemas.get", Workspace>;
1016
+ /**
1017
+ * Update a schema draft
1018
+ *
1019
+ * Replaces the fields of the local schema draft. People editing the draft see the change live. Fields keep their content in entries by ID, so reuse the IDs from schemas.get. Inherited fields stay as they are; don't include them. Entries don't change until schemas.apply.
1020
+ *
1021
+ * Required API key permissions: collections. Write permissions also grant read access for the same resource.
1022
+ *
1023
+ * @example
1024
+ * await client.schemas.updateDraft({
1025
+ * "schemaID": "sch_example",
1026
+ * "definition": {
1027
+ * "formatVersion": 1,
1028
+ * "fields": [
1029
+ * {
1030
+ * "id": "summary",
1031
+ * "kind": "property",
1032
+ * "label": "Summary",
1033
+ * "type": "text",
1034
+ * "initialValue": "",
1035
+ * "options": []
1036
+ * }
1037
+ * ]
1038
+ * }
1039
+ * });
1040
+ */
1041
+ updateDraft: Operation<"schemas.updateDraft", Workspace>;
971
1042
  /**
972
1043
  * Apply a schema draft
973
1044
  *
974
- * Creates a schema version from the draft and starts any required migration of affected entry content. Review possible content removal before calling: confirmedDataLoss must be true. Use schemaMigrations.get to follow a returned migrationID.
1045
+ * Creates a schema version from the draft, or from definition, and starts any required migration of affected entry content. With definition, the draft is replaced only if the apply succeeds. Review possible content removal before calling: confirmedDataLoss must be true. Use schemaMigrations.get to follow a returned migrationID.
975
1046
  *
976
1047
  * Required API key permissions: collections. Write permissions also grant read access for the same resource.
977
1048
  *
@@ -1333,9 +1404,9 @@ interface APIResources<Workspace extends WorkspaceTypeMap = WorkspaceTypeMap> {
1333
1404
  /**
1334
1405
  * Revert pending publishing changes
1335
1406
  *
1336
- * Restores selected drafts to the reviewed publication snapshot. This can remove unpublished items and replace draft content. First review publishing.getChannelContent and pass its snapshotID. Use all: true or specific collectionIDs/entryIDs, never both. Requires write access to affected resources in addition to read:publishing.
1407
+ * Restores selected drafts to the reviewed publication snapshot. This can remove unpublished items and replace draft content. First review publishing.getChannelContent and pass its snapshotID. Use all: true or specific collectionIDs/entryIDs, never both. Requires read:publishing and entries, plus write access to affected resources.
1337
1408
  *
1338
- * Required API key permissions: read:publishing. Write permissions also grant read access for the same resource.
1409
+ * Required API key permissions: read:publishing, entries. Write permissions also grant read access for the same resource.
1339
1410
  *
1340
1411
  * @example
1341
1412
  * await client.publishing.revertChanges({
@@ -1663,4 +1734,4 @@ interface ClientOptions {
1663
1734
  declare const createClient: <Workspace extends WorkspaceTypeMap = WorkspaceTypeMap>(config?: ClientOptions) => AndesineClient<Workspace>;
1664
1735
  //#endregion
1665
1736
  export { WorkspaceCollection as _, ContentPaginationOptions as a, WorkspaceTypeMap as b, APIErrorData as c, OperationError as d, OperationInput as f, SchemaContent as g, ContentListOutput as h, ContentClient as i, APIResponse as l, RequestOptions as m, ClientOptions as n, APIErrorBody as o, OperationOutput as p, createClient as r, APIErrorCode as s, AndesineClient as t, NotModifiedResponse as u, WorkspaceEntry as v, WorkspaceSchema as y };
1666
- //# sourceMappingURL=client-TZ83eSln.d.ts.map
1737
+ //# sourceMappingURL=client-54DXm4mG.d.ts.map
@@ -333,6 +333,46 @@ const createResources = (request) => ({
333
333
  binary: false,
334
334
  anonymous: false
335
335
  }),
336
+ listSelfPublishableKeys: operation(request, {
337
+ method: "get",
338
+ path: "/extensions/self/publishable-keys",
339
+ pathParams: [],
340
+ queryParams: [],
341
+ body: false,
342
+ multipart: false,
343
+ binary: false,
344
+ anonymous: false
345
+ }),
346
+ createSelfPublishableKey: operation(request, {
347
+ method: "post",
348
+ path: "/extensions/self/publishable-keys",
349
+ pathParams: [],
350
+ queryParams: [],
351
+ body: true,
352
+ multipart: false,
353
+ binary: false,
354
+ anonymous: false
355
+ }),
356
+ updateSelfPublishableKey: operation(request, {
357
+ method: "patch",
358
+ path: "/extensions/self/publishable-keys/{keyID}",
359
+ pathParams: ["keyID"],
360
+ queryParams: [],
361
+ body: true,
362
+ multipart: false,
363
+ binary: false,
364
+ anonymous: false
365
+ }),
366
+ deleteSelfPublishableKey: operation(request, {
367
+ method: "delete",
368
+ path: "/extensions/self/publishable-keys/{keyID}",
369
+ pathParams: ["keyID"],
370
+ queryParams: [],
371
+ body: false,
372
+ multipart: false,
373
+ binary: false,
374
+ anonymous: false
375
+ }),
336
376
  getSelfStorageEntry: operation(request, {
337
377
  method: "get",
338
378
  path: "/extensions/self/storage/entry",
@@ -376,6 +416,16 @@ const createResources = (request) => ({
376
416
  multipart: false,
377
417
  binary: false,
378
418
  anonymous: false
419
+ }),
420
+ listElements: operation(request, {
421
+ method: "get",
422
+ path: "/extensions/elements",
423
+ pathParams: [],
424
+ queryParams: [],
425
+ body: false,
426
+ multipart: false,
427
+ binary: false,
428
+ anonymous: false
379
429
  })
380
430
  },
381
431
  collections: {
@@ -429,6 +479,20 @@ const createResources = (request) => ({
429
479
  binary: false,
430
480
  anonymous: false
431
481
  }),
482
+ get: operation(request, {
483
+ method: "get",
484
+ path: "/collections/get",
485
+ pathParams: [],
486
+ queryParams: [
487
+ "collectionID",
488
+ "collectionPath",
489
+ "collectionSlugPath"
490
+ ],
491
+ body: false,
492
+ multipart: false,
493
+ binary: false,
494
+ anonymous: false
495
+ }),
432
496
  list: operation(request, {
433
497
  method: "get",
434
498
  path: "/collections/list",
@@ -867,6 +931,16 @@ const createResources = (request) => ({
867
931
  binary: false,
868
932
  anonymous: false
869
933
  }),
934
+ updateDraft: operation(request, {
935
+ method: "post",
936
+ path: "/schemas/{schemaID}/draft",
937
+ pathParams: ["schemaID"],
938
+ queryParams: [],
939
+ body: true,
940
+ multipart: false,
941
+ binary: false,
942
+ anonymous: false
943
+ }),
870
944
  apply: operation(request, {
871
945
  method: "post",
872
946
  path: "/schemas/{schemaID}/apply",
@@ -1477,4 +1551,4 @@ const createClient = (config = {}) => {
1477
1551
  //#endregion
1478
1552
  export { paginate as n, paginatePages as r, createClient as t };
1479
1553
 
1480
- //# sourceMappingURL=client-D7hqNIEY.js.map
1554
+ //# sourceMappingURL=client-C_F2KykP.js.map