@01.software/sdk 0.15.0 → 0.16.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/README.md CHANGED
@@ -590,6 +590,22 @@ SOFTWARE_SECRET_KEY=sk01_... # Server only — opaque API key from Console
590
590
 
591
591
  ## Migration Guide
592
592
 
593
+ ### v0.16.0 (Phase 1–7 sync — additive)
594
+
595
+ New error codes propagated via `SDKError.code` (no breaking change; existing callers ignore unknown codes safely):
596
+
597
+ | Code | Phase | Trigger |
598
+ |---|---|---|
599
+ | `account_suspended` | P1 | Suspended session / `sk01_` / `pat01_` / customer JWT — 401 |
600
+ | `pat_tenant_header_forbidden` | P1 | `pat01_` with `X-Tenant-Id` header — 401 (header rejected) |
601
+ | `tenant_mismatch` | P3 | Cross-tenant FK rejection (forms / community / orders) |
602
+ | `server_derived` | P3 | Body-driven write into a server-derived state field — 422 |
603
+ | `scope_denied` | P5 | `pat01_` whose `ApiKeys.scopes` lacks the operation |
604
+
605
+ P5 also adds JWT-`jti` revocation: `revokeCustomerJti(jti, ttl)` on the server invalidates a token immediately; subsequent SDK calls receive `401 { code: 'token_revoked' }`.
606
+
607
+ `COLLECTIONS` and `INTERNAL_COLLECTIONS` are now both exported from `@01.software/sdk`. Use `INTERNAL_COLLECTIONS` to detect admin-only slugs in custom tooling.
608
+
593
609
  ### v0.8.0 (Breaking Changes)
594
610
 
595
611
  **Field renames** — update any code that reads these fields from API responses:
@@ -0,0 +1,24 @@
1
+ import { C as Config } from './payload-types-DRvL_bS2.cjs';
2
+
3
+ /**
4
+ * Collection type derived from Payload Config.
5
+ * This ensures type safety and automatic synchronization with payload-types.ts
6
+ */
7
+ type Collection = keyof Config['collections'];
8
+ /**
9
+ * Internal collections that should not be exposed via SDK.
10
+ * Includes Payload system collections and admin-only collections.
11
+ */
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "tenant-auth-settings", "tenant-community-settings", "api-usage", "tenant-analytics-daily", "analytics-event-schemas", "subscriptions", "billing-history", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks"];
13
+ /**
14
+ * Array of all public collection names for runtime use (e.g., Zod enum validation).
15
+ * This is the single source of truth for which collections are publicly accessible via SDK.
16
+ */
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
18
+ /**
19
+ * Public collections available for SDK access.
20
+ * Derived from the COLLECTIONS array (single source of truth).
21
+ */
22
+ type PublicCollection = (typeof COLLECTIONS)[number];
23
+
24
+ export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, COLLECTIONS as a };
@@ -0,0 +1,24 @@
1
+ import { C as Config } from './payload-types-DRvL_bS2.js';
2
+
3
+ /**
4
+ * Collection type derived from Payload Config.
5
+ * This ensures type safety and automatic synchronization with payload-types.ts
6
+ */
7
+ type Collection = keyof Config['collections'];
8
+ /**
9
+ * Internal collections that should not be exposed via SDK.
10
+ * Includes Payload system collections and admin-only collections.
11
+ */
12
+ declare const INTERNAL_COLLECTIONS: readonly ["users", "payload-kv", "payload-locked-documents", "payload-preferences", "payload-migrations", "field-configs", "system-media", "track-assets", "audiences", "email-logs", "tenant-auth-settings", "tenant-community-settings", "api-usage", "tenant-analytics-daily", "analytics-event-schemas", "subscriptions", "billing-history", "order-status-logs", "api-keys", "personal-access-tokens", "tenant-entitlements", "webhook-events", "webhook-deliveries", "audit-logs", "plans", "webhooks"];
13
+ /**
14
+ * Array of all public collection names for runtime use (e.g., Zod enum validation).
15
+ * This is the single source of truth for which collections are publicly accessible via SDK.
16
+ */
17
+ declare const COLLECTIONS: readonly ["tenants", "tenant-metadata", "tenant-logos", "products", "product-variants", "product-options", "product-option-values", "product-categories", "product-tags", "product-collections", "brands", "brand-logos", "orders", "order-items", "returns", "return-items", "fulfillments", "fulfillment-items", "transactions", "customers", "customer-addresses", "customer-groups", "carts", "cart-items", "discounts", "promotions", "shipping-policies", "documents", "document-categories", "document-types", "posts", "post-authors", "post-categories", "post-tags", "playlists", "playlist-categories", "playlist-tags", "tracks", "track-categories", "track-tags", "galleries", "gallery-categories", "gallery-tags", "gallery-items", "links", "link-categories", "link-tags", "canvases", "canvas-node-types", "canvas-edge-types", "canvas-categories", "canvas-tags", "canvas-nodes", "canvas-edges", "videos", "video-categories", "video-tags", "live-streams", "images", "forms", "form-submissions", "threads", "comments", "reactions", "reaction-types", "bookmarks", "thread-categories", "reports", "community-bans"];
18
+ /**
19
+ * Public collections available for SDK access.
20
+ * Derived from the COLLECTIONS array (single source of truth).
21
+ */
22
+ type PublicCollection = (typeof COLLECTIONS)[number];
23
+
24
+ export { type Collection as C, INTERNAL_COLLECTIONS as I, type PublicCollection as P, COLLECTIONS as a };
package/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  DiscountApi: () => DiscountApi,
40
40
  GoneError: () => GoneError,
41
41
  IMAGE_SIZES: () => IMAGE_SIZES,
42
+ INTERNAL_COLLECTIONS: () => INTERNAL_COLLECTIONS,
42
43
  ModerationApi: () => ModerationApi,
43
44
  NetworkError: () => NetworkError,
44
45
  NotFoundError: () => NotFoundError,
@@ -1065,6 +1066,34 @@ var CollectionClient = class extends HttpClient {
1065
1066
  };
1066
1067
 
1067
1068
  // src/core/collection/const.ts
1069
+ var INTERNAL_COLLECTIONS = [
1070
+ "users",
1071
+ "payload-kv",
1072
+ "payload-locked-documents",
1073
+ "payload-preferences",
1074
+ "payload-migrations",
1075
+ "field-configs",
1076
+ "system-media",
1077
+ "track-assets",
1078
+ "audiences",
1079
+ "email-logs",
1080
+ "tenant-auth-settings",
1081
+ "tenant-community-settings",
1082
+ "api-usage",
1083
+ "tenant-analytics-daily",
1084
+ "analytics-event-schemas",
1085
+ "subscriptions",
1086
+ "billing-history",
1087
+ "order-status-logs",
1088
+ "api-keys",
1089
+ "personal-access-tokens",
1090
+ "tenant-entitlements",
1091
+ "webhook-events",
1092
+ "webhook-deliveries",
1093
+ "audit-logs",
1094
+ "plans",
1095
+ "webhooks"
1096
+ ];
1068
1097
  var COLLECTIONS = [
1069
1098
  "tenants",
1070
1099
  "tenant-metadata",
@@ -1091,6 +1120,7 @@ var COLLECTIONS = [
1091
1120
  "carts",
1092
1121
  "cart-items",
1093
1122
  "discounts",
1123
+ "promotions",
1094
1124
  "shipping-policies",
1095
1125
  "documents",
1096
1126
  "document-categories",
@@ -1117,6 +1147,8 @@ var COLLECTIONS = [
1117
1147
  "canvas-edge-types",
1118
1148
  "canvas-categories",
1119
1149
  "canvas-tags",
1150
+ "canvas-nodes",
1151
+ "canvas-edges",
1120
1152
  "videos",
1121
1153
  "video-categories",
1122
1154
  "video-tags",