@cmssy/core 19.21.0 → 19.23.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/dist/index.cjs +14 -6
- package/dist/index.d.cts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +14 -6
- package/dist/internal/locale.cjs +1 -1
- package/dist/internal/locale.js +1 -1
- package/dist/internal.cjs +29 -12
- package/dist/internal.d.cts +2 -1
- package/dist/internal.d.ts +2 -1
- package/dist/internal.js +29 -12
- package/dist/preflight.cjs +1 -1
- package/dist/preflight.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -225,7 +225,7 @@ function documentText(document2) {
|
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
// src/version.ts
|
|
228
|
-
var CMSSY_CORE_VERSION = "19.
|
|
228
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
229
229
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
230
230
|
|
|
231
231
|
// src/data/http.ts
|
|
@@ -747,12 +747,11 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
747
747
|
"cmssy: getBuyerCatalogPrices needs the signed-in member's accessToken - an anonymous visitor reads the catalogue"
|
|
748
748
|
);
|
|
749
749
|
}
|
|
750
|
-
const { currency: _currency, ...listing } = query;
|
|
751
750
|
const data = await graphqlRequest(
|
|
752
751
|
config,
|
|
753
752
|
BUYER_CATALOG_PRICES_QUERY,
|
|
754
753
|
{
|
|
755
|
-
...
|
|
754
|
+
...query,
|
|
756
755
|
workspaceId: options.workspaceId,
|
|
757
756
|
...channelVariable(options.channel)
|
|
758
757
|
},
|
|
@@ -785,6 +784,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
|
785
784
|
$channel: String!
|
|
786
785
|
$items: [PriceQueryItem!]!
|
|
787
786
|
$locale: String
|
|
787
|
+
$previewSecret: String
|
|
788
788
|
) {
|
|
789
789
|
public {
|
|
790
790
|
pricing {
|
|
@@ -793,6 +793,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
|
793
793
|
channel: $channel
|
|
794
794
|
items: $items
|
|
795
795
|
locale: $locale
|
|
796
|
+
previewSecret: $previewSecret
|
|
796
797
|
) {
|
|
797
798
|
currency
|
|
798
799
|
displayMode
|
|
@@ -864,6 +865,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
|
864
865
|
$sort: BuyerCatalogSort
|
|
865
866
|
$limit: Int
|
|
866
867
|
$offset: Int
|
|
868
|
+
$previewSecret: String
|
|
867
869
|
) {
|
|
868
870
|
public {
|
|
869
871
|
pricing {
|
|
@@ -880,6 +882,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
|
880
882
|
sort: $sort
|
|
881
883
|
limit: $limit
|
|
882
884
|
offset: $offset
|
|
885
|
+
previewSecret: $previewSecret
|
|
883
886
|
) {
|
|
884
887
|
total
|
|
885
888
|
hasMore
|
|
@@ -965,7 +968,8 @@ async function getPublicPrices(config, items, options) {
|
|
|
965
968
|
items: items.map(
|
|
966
969
|
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
967
970
|
),
|
|
968
|
-
...options.locale ? { locale: options.locale } : {}
|
|
971
|
+
...options.locale ? { locale: options.locale } : {},
|
|
972
|
+
...options.previewSecret ? { previewSecret: options.previewSecret } : {}
|
|
969
973
|
},
|
|
970
974
|
{
|
|
971
975
|
public: true,
|
|
@@ -980,11 +984,15 @@ async function getPublicPrices(config, items, options) {
|
|
|
980
984
|
}
|
|
981
985
|
async function getPublicCatalogPrices(config, query, options) {
|
|
982
986
|
const channel = requireChannel(config, options, "getPublicCatalogPrices");
|
|
983
|
-
const { currency: _currency, ...listing } = query;
|
|
984
987
|
const data = await graphqlRequest(
|
|
985
988
|
config,
|
|
986
989
|
PUBLIC_CATALOG_PRICES_QUERY,
|
|
987
|
-
{
|
|
990
|
+
{
|
|
991
|
+
...query,
|
|
992
|
+
workspaceId: options.workspaceId,
|
|
993
|
+
channel,
|
|
994
|
+
...options.previewSecret ? { previewSecret: options.previewSecret } : {}
|
|
995
|
+
},
|
|
988
996
|
{
|
|
989
997
|
public: true,
|
|
990
998
|
fetch: options.fetch,
|
package/dist/index.d.cts
CHANGED
|
@@ -126,9 +126,7 @@ interface BuyerCatalogPricesResult {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResult, BuyerCatalogPricesVariables>;
|
|
129
|
-
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel"
|
|
130
|
-
currency?: string | null;
|
|
131
|
-
};
|
|
129
|
+
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel">;
|
|
132
130
|
declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
|
|
133
131
|
|
|
134
132
|
declare const CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
|
|
@@ -165,6 +163,7 @@ interface PublicPricesVariables {
|
|
|
165
163
|
channel: string;
|
|
166
164
|
items: CmssyPriceQueryItem[];
|
|
167
165
|
locale?: string | null;
|
|
166
|
+
previewSecret?: string | null;
|
|
168
167
|
}
|
|
169
168
|
interface PublicPricesResult {
|
|
170
169
|
public: {
|
|
@@ -187,6 +186,7 @@ interface PublicCatalogPricesVariables {
|
|
|
187
186
|
sort?: CmssyBuyerCatalogSort | null;
|
|
188
187
|
limit?: number | null;
|
|
189
188
|
offset?: number | null;
|
|
189
|
+
previewSecret?: string | null;
|
|
190
190
|
}
|
|
191
191
|
interface PublicCatalogPricesResult {
|
|
192
192
|
public: {
|
|
@@ -200,14 +200,13 @@ interface GetPublicPricesOptions {
|
|
|
200
200
|
workspaceId: string;
|
|
201
201
|
channel?: string;
|
|
202
202
|
locale?: string | null;
|
|
203
|
+
previewSecret?: string;
|
|
203
204
|
fetch?: FetchLike;
|
|
204
205
|
signal?: AbortSignal;
|
|
205
206
|
retry?: RetryOption;
|
|
206
207
|
}
|
|
207
208
|
declare function getPublicPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetPublicPricesOptions): Promise<CmssyPublicPriceResult>;
|
|
208
|
-
type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel"
|
|
209
|
-
currency?: string | null;
|
|
210
|
-
};
|
|
209
|
+
type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
|
|
211
210
|
declare function getPublicCatalogPrices(config: CmssyClientConfig, query: GetPublicCatalogPricesQuery, options: Omit<GetPublicPricesOptions, "locale">): Promise<CmssyPublicCatalogPage>;
|
|
212
211
|
|
|
213
212
|
declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
package/dist/index.d.ts
CHANGED
|
@@ -126,9 +126,7 @@ interface BuyerCatalogPricesResult {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
declare const BUYER_CATALOG_PRICES_QUERY: CmssyOperation<BuyerCatalogPricesResult, BuyerCatalogPricesVariables>;
|
|
129
|
-
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel"
|
|
130
|
-
currency?: string | null;
|
|
131
|
-
};
|
|
129
|
+
type GetBuyerCatalogPricesQuery = Omit<BuyerCatalogPricesVariables, "workspaceId" | "channel">;
|
|
132
130
|
declare function getBuyerCatalogPrices(config: CmssyClientConfig, query: GetBuyerCatalogPricesQuery, options: GetBuyerPricesOptions): Promise<CmssyBuyerCatalogPage>;
|
|
133
131
|
|
|
134
132
|
declare const CMSSY_PUBLIC_PRICES_MAX_ITEMS = 50;
|
|
@@ -165,6 +163,7 @@ interface PublicPricesVariables {
|
|
|
165
163
|
channel: string;
|
|
166
164
|
items: CmssyPriceQueryItem[];
|
|
167
165
|
locale?: string | null;
|
|
166
|
+
previewSecret?: string | null;
|
|
168
167
|
}
|
|
169
168
|
interface PublicPricesResult {
|
|
170
169
|
public: {
|
|
@@ -187,6 +186,7 @@ interface PublicCatalogPricesVariables {
|
|
|
187
186
|
sort?: CmssyBuyerCatalogSort | null;
|
|
188
187
|
limit?: number | null;
|
|
189
188
|
offset?: number | null;
|
|
189
|
+
previewSecret?: string | null;
|
|
190
190
|
}
|
|
191
191
|
interface PublicCatalogPricesResult {
|
|
192
192
|
public: {
|
|
@@ -200,14 +200,13 @@ interface GetPublicPricesOptions {
|
|
|
200
200
|
workspaceId: string;
|
|
201
201
|
channel?: string;
|
|
202
202
|
locale?: string | null;
|
|
203
|
+
previewSecret?: string;
|
|
203
204
|
fetch?: FetchLike;
|
|
204
205
|
signal?: AbortSignal;
|
|
205
206
|
retry?: RetryOption;
|
|
206
207
|
}
|
|
207
208
|
declare function getPublicPrices(config: CmssyClientConfig, items: readonly CmssyPriceQueryItem[], options: GetPublicPricesOptions): Promise<CmssyPublicPriceResult>;
|
|
208
|
-
type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel"
|
|
209
|
-
currency?: string | null;
|
|
210
|
-
};
|
|
209
|
+
type GetPublicCatalogPricesQuery = Omit<PublicCatalogPricesVariables, "workspaceId" | "channel" | "previewSecret">;
|
|
211
210
|
declare function getPublicCatalogPrices(config: CmssyClientConfig, query: GetPublicCatalogPricesQuery, options: Omit<GetPublicPricesOptions, "locale">): Promise<CmssyPublicCatalogPage>;
|
|
212
211
|
|
|
213
212
|
declare const quantityRuleReasonValues: readonly ["QUANTITY_BELOW_MIN", "QUANTITY_ABOVE_MAX", "QUANTITY_NOT_ON_STEP"];
|
package/dist/index.js
CHANGED
|
@@ -224,7 +224,7 @@ function documentText(document2) {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// src/version.ts
|
|
227
|
-
var CMSSY_CORE_VERSION = "19.
|
|
227
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
228
228
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
229
229
|
|
|
230
230
|
// src/data/http.ts
|
|
@@ -746,12 +746,11 @@ async function getBuyerCatalogPrices(config, query, options) {
|
|
|
746
746
|
"cmssy: getBuyerCatalogPrices needs the signed-in member's accessToken - an anonymous visitor reads the catalogue"
|
|
747
747
|
);
|
|
748
748
|
}
|
|
749
|
-
const { currency: _currency, ...listing } = query;
|
|
750
749
|
const data = await graphqlRequest(
|
|
751
750
|
config,
|
|
752
751
|
BUYER_CATALOG_PRICES_QUERY,
|
|
753
752
|
{
|
|
754
|
-
...
|
|
753
|
+
...query,
|
|
755
754
|
workspaceId: options.workspaceId,
|
|
756
755
|
...channelVariable(options.channel)
|
|
757
756
|
},
|
|
@@ -784,6 +783,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
|
784
783
|
$channel: String!
|
|
785
784
|
$items: [PriceQueryItem!]!
|
|
786
785
|
$locale: String
|
|
786
|
+
$previewSecret: String
|
|
787
787
|
) {
|
|
788
788
|
public {
|
|
789
789
|
pricing {
|
|
@@ -792,6 +792,7 @@ var PUBLIC_PRICES_QUERY = typedOperation(`query PublicPrices(
|
|
|
792
792
|
channel: $channel
|
|
793
793
|
items: $items
|
|
794
794
|
locale: $locale
|
|
795
|
+
previewSecret: $previewSecret
|
|
795
796
|
) {
|
|
796
797
|
currency
|
|
797
798
|
displayMode
|
|
@@ -863,6 +864,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
|
863
864
|
$sort: BuyerCatalogSort
|
|
864
865
|
$limit: Int
|
|
865
866
|
$offset: Int
|
|
867
|
+
$previewSecret: String
|
|
866
868
|
) {
|
|
867
869
|
public {
|
|
868
870
|
pricing {
|
|
@@ -879,6 +881,7 @@ var PUBLIC_CATALOG_PRICES_QUERY = typedOperation(`query PublicCatalogPrices(
|
|
|
879
881
|
sort: $sort
|
|
880
882
|
limit: $limit
|
|
881
883
|
offset: $offset
|
|
884
|
+
previewSecret: $previewSecret
|
|
882
885
|
) {
|
|
883
886
|
total
|
|
884
887
|
hasMore
|
|
@@ -964,7 +967,8 @@ async function getPublicPrices(config, items, options) {
|
|
|
964
967
|
items: items.map(
|
|
965
968
|
({ recordId, variantKey }) => variantKey ? { recordId, variantKey } : { recordId }
|
|
966
969
|
),
|
|
967
|
-
...options.locale ? { locale: options.locale } : {}
|
|
970
|
+
...options.locale ? { locale: options.locale } : {},
|
|
971
|
+
...options.previewSecret ? { previewSecret: options.previewSecret } : {}
|
|
968
972
|
},
|
|
969
973
|
{
|
|
970
974
|
public: true,
|
|
@@ -979,11 +983,15 @@ async function getPublicPrices(config, items, options) {
|
|
|
979
983
|
}
|
|
980
984
|
async function getPublicCatalogPrices(config, query, options) {
|
|
981
985
|
const channel = requireChannel(config, options, "getPublicCatalogPrices");
|
|
982
|
-
const { currency: _currency, ...listing } = query;
|
|
983
986
|
const data = await graphqlRequest(
|
|
984
987
|
config,
|
|
985
988
|
PUBLIC_CATALOG_PRICES_QUERY,
|
|
986
|
-
{
|
|
989
|
+
{
|
|
990
|
+
...query,
|
|
991
|
+
workspaceId: options.workspaceId,
|
|
992
|
+
channel,
|
|
993
|
+
...options.previewSecret ? { previewSecret: options.previewSecret } : {}
|
|
994
|
+
},
|
|
987
995
|
{
|
|
988
996
|
public: true,
|
|
989
997
|
fetch: options.fetch,
|
package/dist/internal/locale.cjs
CHANGED
package/dist/internal/locale.js
CHANGED
package/dist/internal.cjs
CHANGED
|
@@ -154,7 +154,7 @@ function documentText(document2) {
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// src/version.ts
|
|
157
|
-
var CMSSY_CORE_VERSION = "19.
|
|
157
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
158
158
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
159
159
|
|
|
160
160
|
// src/data/http.ts
|
|
@@ -640,10 +640,10 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
|
|
|
640
640
|
}
|
|
641
641
|
}
|
|
642
642
|
}`);
|
|
643
|
-
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {
|
|
643
|
+
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
|
|
644
644
|
public {
|
|
645
645
|
model {
|
|
646
|
-
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {
|
|
646
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
|
|
647
647
|
items { id modelId data status createdAt updatedAt }
|
|
648
648
|
total
|
|
649
649
|
hasMore
|
|
@@ -782,10 +782,10 @@ function createCmssyClient(input) {
|
|
|
782
782
|
}
|
|
783
783
|
|
|
784
784
|
// src/data/block-content.ts
|
|
785
|
-
var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {
|
|
785
|
+
var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String, $previewSecret: String) {
|
|
786
786
|
public {
|
|
787
787
|
model {
|
|
788
|
-
recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {
|
|
788
|
+
recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale, previewSecret: $previewSecret) {
|
|
789
789
|
id modelId data status createdAt updatedAt
|
|
790
790
|
}
|
|
791
791
|
}
|
|
@@ -925,7 +925,7 @@ function collectionKey(ref) {
|
|
|
925
925
|
"\0"
|
|
926
926
|
);
|
|
927
927
|
}
|
|
928
|
-
async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}) {
|
|
928
|
+
async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}, previewSecret) {
|
|
929
929
|
const refs = collectRefs(entries, schemas);
|
|
930
930
|
if (refs.length === 0) return;
|
|
931
931
|
const client = createCmssyClient(config);
|
|
@@ -949,8 +949,20 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
|
|
|
949
949
|
let collectionItems;
|
|
950
950
|
try {
|
|
951
951
|
[recordsById, collectionItems] = await Promise.all([
|
|
952
|
-
fetchPickedRecords(
|
|
953
|
-
|
|
952
|
+
fetchPickedRecords(
|
|
953
|
+
client,
|
|
954
|
+
[...pickedIds],
|
|
955
|
+
locale,
|
|
956
|
+
requestOptions,
|
|
957
|
+
previewSecret
|
|
958
|
+
),
|
|
959
|
+
fetchCollections(
|
|
960
|
+
client,
|
|
961
|
+
collections,
|
|
962
|
+
locale,
|
|
963
|
+
requestOptions,
|
|
964
|
+
previewSecret
|
|
965
|
+
)
|
|
954
966
|
]);
|
|
955
967
|
} catch (err) {
|
|
956
968
|
if (typeof console !== "undefined") {
|
|
@@ -984,7 +996,7 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
|
|
|
984
996
|
}
|
|
985
997
|
}
|
|
986
998
|
}
|
|
987
|
-
async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
999
|
+
async function fetchPickedRecords(client, ids, locale, requestOptions = {}, previewSecret) {
|
|
988
1000
|
const byId = /* @__PURE__ */ new Map();
|
|
989
1001
|
const chunks = [];
|
|
990
1002
|
for (let i = 0; i < ids.length; i += BY_IDS_CHUNK) {
|
|
@@ -994,7 +1006,11 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
|
994
1006
|
chunks.map(async (chunk) => {
|
|
995
1007
|
const result = await client.queryScoped(
|
|
996
1008
|
RECORDS_BY_IDS_QUERY,
|
|
997
|
-
{
|
|
1009
|
+
{
|
|
1010
|
+
ids: chunk,
|
|
1011
|
+
locale: locale ?? null,
|
|
1012
|
+
previewSecret: previewSecret ?? null
|
|
1013
|
+
},
|
|
998
1014
|
requestOptions
|
|
999
1015
|
);
|
|
1000
1016
|
for (const record of result.public.model.recordsByIds) {
|
|
@@ -1004,7 +1020,7 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
|
1004
1020
|
);
|
|
1005
1021
|
return byId;
|
|
1006
1022
|
}
|
|
1007
|
-
async function fetchCollections(client, collections, locale, requestOptions = {}) {
|
|
1023
|
+
async function fetchCollections(client, collections, locale, requestOptions = {}, previewSecret) {
|
|
1008
1024
|
const byKey = /* @__PURE__ */ new Map();
|
|
1009
1025
|
await Promise.all(
|
|
1010
1026
|
[...collections.entries()].map(async ([key, { model, sort, limit }]) => {
|
|
@@ -1014,7 +1030,8 @@ async function fetchCollections(client, collections, locale, requestOptions = {}
|
|
|
1014
1030
|
modelSlug: model,
|
|
1015
1031
|
sort: sort ?? null,
|
|
1016
1032
|
limit: limit ?? COLLECTION_DEFAULT_LIMIT,
|
|
1017
|
-
locale: locale ?? null
|
|
1033
|
+
locale: locale ?? null,
|
|
1034
|
+
previewSecret: previewSecret ?? null
|
|
1018
1035
|
},
|
|
1019
1036
|
requestOptions
|
|
1020
1037
|
);
|
package/dist/internal.d.cts
CHANGED
|
@@ -37,6 +37,7 @@ interface ModelRecordsVariables {
|
|
|
37
37
|
limit?: number | null;
|
|
38
38
|
offset?: number | null;
|
|
39
39
|
populate?: string[] | null;
|
|
40
|
+
previewSecret?: string | null;
|
|
40
41
|
}
|
|
41
42
|
interface ModelRecordsResult {
|
|
42
43
|
public: {
|
|
@@ -91,7 +92,7 @@ type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
|
|
|
91
92
|
* page.
|
|
92
93
|
*/
|
|
93
94
|
declare function normalizeBlockContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
|
|
94
|
-
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
|
|
95
|
+
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions, previewSecret?: string): Promise<void>;
|
|
95
96
|
|
|
96
97
|
/**
|
|
97
98
|
* Finds the forms a page needs by reading the blocks' schemas, so a form field
|
package/dist/internal.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ interface ModelRecordsVariables {
|
|
|
37
37
|
limit?: number | null;
|
|
38
38
|
offset?: number | null;
|
|
39
39
|
populate?: string[] | null;
|
|
40
|
+
previewSecret?: string | null;
|
|
40
41
|
}
|
|
41
42
|
interface ModelRecordsResult {
|
|
42
43
|
public: {
|
|
@@ -91,7 +92,7 @@ type BlockSchemaMap = Record<string, Record<string, FieldDefinition>>;
|
|
|
91
92
|
* page.
|
|
92
93
|
*/
|
|
93
94
|
declare function normalizeBlockContent(content: Record<string, unknown>, schema: Record<string, FieldDefinition>, resolved?: Record<string, unknown>): void;
|
|
94
|
-
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions): Promise<void>;
|
|
95
|
+
declare function resolveRelationContent(config: CmssyClientConfig, entries: RelationContentEntry[], schemas: BlockSchemaMap, locale?: string, requestOptions?: QueryScopedOptions, previewSecret?: string): Promise<void>;
|
|
95
96
|
|
|
96
97
|
/**
|
|
97
98
|
* Finds the forms a page needs by reading the blocks' schemas, so a form field
|
package/dist/internal.js
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document2) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/data/http.ts
|
|
@@ -638,10 +638,10 @@ var MODEL_DEFINITIONS_QUERY = typedOperation(`query PublicModelDefinitions($work
|
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
640
|
}`);
|
|
641
|
-
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!]) {
|
|
641
|
+
var MODEL_RECORDS_QUERY = typedOperation(`query PublicModelRecords($workspaceId: String!, $modelSlug: String!, $filter: JSON, $sort: String, $locale: String, $limit: Int, $offset: Int, $populate: [String!], $previewSecret: String) {
|
|
642
642
|
public {
|
|
643
643
|
model {
|
|
644
|
-
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate) {
|
|
644
|
+
records(workspaceId: $workspaceId, modelSlug: $modelSlug, filter: $filter, sort: $sort, locale: $locale, limit: $limit, offset: $offset, populate: $populate, previewSecret: $previewSecret) {
|
|
645
645
|
items { id modelId data status createdAt updatedAt }
|
|
646
646
|
total
|
|
647
647
|
hasMore
|
|
@@ -780,10 +780,10 @@ function createCmssyClient(input) {
|
|
|
780
780
|
}
|
|
781
781
|
|
|
782
782
|
// src/data/block-content.ts
|
|
783
|
-
var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String) {
|
|
783
|
+
var RECORDS_BY_IDS_QUERY = typedOperation(`query PublicRecordsByIds($workspaceId: String!, $ids: [String!]!, $locale: String, $previewSecret: String) {
|
|
784
784
|
public {
|
|
785
785
|
model {
|
|
786
|
-
recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale) {
|
|
786
|
+
recordsByIds(workspaceId: $workspaceId, ids: $ids, locale: $locale, previewSecret: $previewSecret) {
|
|
787
787
|
id modelId data status createdAt updatedAt
|
|
788
788
|
}
|
|
789
789
|
}
|
|
@@ -923,7 +923,7 @@ function collectionKey(ref) {
|
|
|
923
923
|
"\0"
|
|
924
924
|
);
|
|
925
925
|
}
|
|
926
|
-
async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}) {
|
|
926
|
+
async function resolveRelationContent(config, entries, schemas, locale, requestOptions = {}, previewSecret) {
|
|
927
927
|
const refs = collectRefs(entries, schemas);
|
|
928
928
|
if (refs.length === 0) return;
|
|
929
929
|
const client = createCmssyClient(config);
|
|
@@ -947,8 +947,20 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
|
|
|
947
947
|
let collectionItems;
|
|
948
948
|
try {
|
|
949
949
|
[recordsById, collectionItems] = await Promise.all([
|
|
950
|
-
fetchPickedRecords(
|
|
951
|
-
|
|
950
|
+
fetchPickedRecords(
|
|
951
|
+
client,
|
|
952
|
+
[...pickedIds],
|
|
953
|
+
locale,
|
|
954
|
+
requestOptions,
|
|
955
|
+
previewSecret
|
|
956
|
+
),
|
|
957
|
+
fetchCollections(
|
|
958
|
+
client,
|
|
959
|
+
collections,
|
|
960
|
+
locale,
|
|
961
|
+
requestOptions,
|
|
962
|
+
previewSecret
|
|
963
|
+
)
|
|
952
964
|
]);
|
|
953
965
|
} catch (err) {
|
|
954
966
|
if (typeof console !== "undefined") {
|
|
@@ -982,7 +994,7 @@ async function resolveRelationContent(config, entries, schemas, locale, requestO
|
|
|
982
994
|
}
|
|
983
995
|
}
|
|
984
996
|
}
|
|
985
|
-
async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
997
|
+
async function fetchPickedRecords(client, ids, locale, requestOptions = {}, previewSecret) {
|
|
986
998
|
const byId = /* @__PURE__ */ new Map();
|
|
987
999
|
const chunks = [];
|
|
988
1000
|
for (let i = 0; i < ids.length; i += BY_IDS_CHUNK) {
|
|
@@ -992,7 +1004,11 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
|
992
1004
|
chunks.map(async (chunk) => {
|
|
993
1005
|
const result = await client.queryScoped(
|
|
994
1006
|
RECORDS_BY_IDS_QUERY,
|
|
995
|
-
{
|
|
1007
|
+
{
|
|
1008
|
+
ids: chunk,
|
|
1009
|
+
locale: locale ?? null,
|
|
1010
|
+
previewSecret: previewSecret ?? null
|
|
1011
|
+
},
|
|
996
1012
|
requestOptions
|
|
997
1013
|
);
|
|
998
1014
|
for (const record of result.public.model.recordsByIds) {
|
|
@@ -1002,7 +1018,7 @@ async function fetchPickedRecords(client, ids, locale, requestOptions = {}) {
|
|
|
1002
1018
|
);
|
|
1003
1019
|
return byId;
|
|
1004
1020
|
}
|
|
1005
|
-
async function fetchCollections(client, collections, locale, requestOptions = {}) {
|
|
1021
|
+
async function fetchCollections(client, collections, locale, requestOptions = {}, previewSecret) {
|
|
1006
1022
|
const byKey = /* @__PURE__ */ new Map();
|
|
1007
1023
|
await Promise.all(
|
|
1008
1024
|
[...collections.entries()].map(async ([key, { model, sort, limit }]) => {
|
|
@@ -1012,7 +1028,8 @@ async function fetchCollections(client, collections, locale, requestOptions = {}
|
|
|
1012
1028
|
modelSlug: model,
|
|
1013
1029
|
sort: sort ?? null,
|
|
1014
1030
|
limit: limit ?? COLLECTION_DEFAULT_LIMIT,
|
|
1015
|
-
locale: locale ?? null
|
|
1031
|
+
locale: locale ?? null,
|
|
1032
|
+
previewSecret: previewSecret ?? null
|
|
1016
1033
|
},
|
|
1017
1034
|
requestOptions
|
|
1018
1035
|
);
|
package/dist/preflight.cjs
CHANGED
|
@@ -152,7 +152,7 @@ function documentText(document) {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
// src/version.ts
|
|
155
|
-
var CMSSY_CORE_VERSION = "19.
|
|
155
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
156
156
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
157
157
|
|
|
158
158
|
// src/content/content-client.ts
|
package/dist/preflight.js
CHANGED
|
@@ -150,7 +150,7 @@ function documentText(document) {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
// src/version.ts
|
|
153
|
-
var CMSSY_CORE_VERSION = "19.
|
|
153
|
+
var CMSSY_CORE_VERSION = "19.23.0" ;
|
|
154
154
|
var CMSSY_USER_AGENT = `@cmssy/core/${CMSSY_CORE_VERSION}`;
|
|
155
155
|
|
|
156
156
|
// src/content/content-client.ts
|