@kontent-ai/core-sdk 12.0.0-preview.34 → 12.0.0-preview.35
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/dist/core-sdk-info.js
CHANGED
package/dist/public_api.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export type { EmptyObject, PickStringLiteral } from "./models/utility.types.js";
|
|
|
9
9
|
export { createFetchQuery } from "./sdk/queries/fetch-sdk-query.js";
|
|
10
10
|
export { createMutationQuery } from "./sdk/queries/mutation-sdk-query.js";
|
|
11
11
|
export { createPagedFetchQuery } from "./sdk/queries/paged-fetch-sdk-query.js";
|
|
12
|
-
export { codenameOf,
|
|
12
|
+
export { codenameOf, kontentUuidSchema, nilUuid, strictCodenameSchema, } from "./sdk/sdk-config.js";
|
|
13
13
|
export type { BaseUrl, FetchQuery, FetchQueryRequest, MutationQuery, MutationQueryRequest, PagedFetchQuery, PagingQueryResponse, Query, QueryResponse, QueryResponseMeta, SafePagingQueryResult, SafeQueryResult, SdkConfig, SuccessfulHttpResponse, } from "./sdk/sdk-models.js";
|
|
14
14
|
export { isPagingQuery } from "./sdk/sdk-utils.js";
|
|
15
15
|
export { isDefined } from "./utils/core.utils.js";
|
package/dist/public_api.js
CHANGED
|
@@ -6,7 +6,7 @@ export { jsonValueSchema } from "./models/json.models.js";
|
|
|
6
6
|
export { createFetchQuery } from "./sdk/queries/fetch-sdk-query.js";
|
|
7
7
|
export { createMutationQuery } from "./sdk/queries/mutation-sdk-query.js";
|
|
8
8
|
export { createPagedFetchQuery } from "./sdk/queries/paged-fetch-sdk-query.js";
|
|
9
|
-
export { codenameOf,
|
|
9
|
+
export { codenameOf, kontentUuidSchema, nilUuid, strictCodenameSchema, } from "./sdk/sdk-config.js";
|
|
10
10
|
export { isPagingQuery } from "./sdk/sdk-utils.js";
|
|
11
11
|
export { isDefined } from "./utils/core.utils.js";
|
|
12
12
|
export { isKontent404Error, isKontentSdkError } from "./utils/error.utils.js";
|
package/dist/public_api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../lib/public_api.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAoB/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAU/D,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EAKjB,eAAe,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmD,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3G,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"public_api.js","sourceRoot":"","sources":["../lib/public_api.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAoB/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAU/D,OAAO,EACN,iBAAiB,EACjB,iBAAiB,EAKjB,eAAe,GAEf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAmD,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3G,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC/E,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,oBAAoB,GACpB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/sdk/sdk-config.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
export declare const nilUuid = "00000000-0000-0000-0000-000000000000";
|
|
3
3
|
export declare const kontentUuidSchema: z.ZodUnion<readonly [z.ZodUUID, z.ZodLiteral<"00000000-0000-0000-0000-000000000000">]>;
|
|
4
|
-
export declare const
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
export declare const strictCodenameSchema: z.ZodString;
|
|
5
|
+
/**
|
|
6
|
+
* Builds a Zod schema for a codename field.
|
|
7
|
+
*
|
|
8
|
+
* The generic type parameter `TCodenames` is a **TypeScript-only hint** - it
|
|
9
|
+
* narrows the schema's output type for consumers (e.g.
|
|
10
|
+
* `codenameOf<"article" | "product">()` returns `z.ZodType<"article" | "product">`
|
|
11
|
+
* for autocomplete and downstream type inference) but is not enforced at runtime.
|
|
12
|
+
*
|
|
13
|
+
* At runtime the schema only checks that the value is a string. Two reasons:
|
|
14
|
+
*
|
|
15
|
+
* 1. Codenames are not a closed set - editors can add a new content type,
|
|
16
|
+
* taxonomy term, language, etc. at any time. A `z.literal(codenames)` schema
|
|
17
|
+
* would reject newly-added codenames once they appear in API responses, even
|
|
18
|
+
* though those values are perfectly valid.
|
|
19
|
+
* 2. Format-checking every codename on every response is unnecessary cost - the
|
|
20
|
+
* Kontent.ai API contract guarantees the format, so the SDK trusts it.
|
|
21
|
+
*
|
|
22
|
+
* If you need strict format validation (e.g. for inputs in Management SDK), use `strictCodenameSchema` schema instead.
|
|
23
|
+
*/
|
|
24
|
+
export declare function codenameOf<TCodenames extends string = string>(): z.ZodType<TCodenames>;
|
package/dist/sdk/sdk-config.js
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import z from "zod";
|
|
2
2
|
export const nilUuid = "00000000-0000-0000-0000-000000000000";
|
|
3
3
|
export const kontentUuidSchema = z.union([z.uuid({ version: "v4" }), z.literal(nilUuid)]);
|
|
4
|
-
export const
|
|
4
|
+
export const strictCodenameSchema = z.string().regex(/^[a-z][a-z0-9_]*$/, {
|
|
5
5
|
message: "Codename must start with a lowercase letter and contain only lowercase letters, digits, and underscores",
|
|
6
6
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Builds a Zod schema for a codename field.
|
|
9
|
+
*
|
|
10
|
+
* The generic type parameter `TCodenames` is a **TypeScript-only hint** - it
|
|
11
|
+
* narrows the schema's output type for consumers (e.g.
|
|
12
|
+
* `codenameOf<"article" | "product">()` returns `z.ZodType<"article" | "product">`
|
|
13
|
+
* for autocomplete and downstream type inference) but is not enforced at runtime.
|
|
14
|
+
*
|
|
15
|
+
* At runtime the schema only checks that the value is a string. Two reasons:
|
|
16
|
+
*
|
|
17
|
+
* 1. Codenames are not a closed set - editors can add a new content type,
|
|
18
|
+
* taxonomy term, language, etc. at any time. A `z.literal(codenames)` schema
|
|
19
|
+
* would reject newly-added codenames once they appear in API responses, even
|
|
20
|
+
* though those values are perfectly valid.
|
|
21
|
+
* 2. Format-checking every codename on every response is unnecessary cost - the
|
|
22
|
+
* Kontent.ai API contract guarantees the format, so the SDK trusts it.
|
|
23
|
+
*
|
|
24
|
+
* If you need strict format validation (e.g. for inputs in Management SDK), use `strictCodenameSchema` schema instead.
|
|
25
|
+
*/
|
|
26
|
+
export function codenameOf() {
|
|
27
|
+
return z.custom((value) => typeof value === "string", {
|
|
28
|
+
error: "Invalid codename",
|
|
29
|
+
});
|
|
12
30
|
}
|
|
13
31
|
//# sourceMappingURL=sdk-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-config.js","sourceRoot":"","sources":["../../lib/sdk/sdk-config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"sdk-config.js","sourceRoot":"","sources":["../../lib/sdk/sdk-config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAE9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE1F,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,mBAAmB,EAAE;IACzE,OAAO,EAAE,yGAAyG;CAClH,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,UAAU;IACzB,OAAO,CAAC,CAAC,MAAM,CAAa,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,EAAE;QACjE,KAAK,EAAE,kBAAkB;KACzB,CAAC,CAAC;AACJ,CAAC"}
|