@form-engine-ts/storage-azure-table 6.8.0 → 6.10.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 +4 -1
- package/dist/index.cjs +12 -0
- package/dist/index.d.cts +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +13 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -43,7 +43,10 @@ owns table creation, credentials, retries, and client lifecycle.
|
|
|
43
43
|
The default codec persists the canonical `FormSubmission.values` payload and never creates an `answers` property. Set
|
|
44
44
|
`rejectLegacyAnswers: true` to fail explicitly when a legacy entity is encountered; no legacy decoding or migration is
|
|
45
45
|
performed. `idempotentSubmissions: true` enables typed `created`, `duplicate`, and `conflict` results from
|
|
46
|
-
`saveSubmission(submission)`. Pass `validateAgainstSchema: true` to re-validate against the stored schema.
|
|
46
|
+
`saveSubmission(submission)`. Pass `validateAgainstSchema: true` to re-validate against the stored schema. Pass
|
|
47
|
+
`submissionSchema`, `submissionValidator`, or `validation` to validate every submission before it is written; the same
|
|
48
|
+
source can be supplied per call as `saveSubmission(submission, { validation })`. A source can be a FormSchema, a
|
|
49
|
+
Zod-compatible object with `safeParse`, or an async validator callback.
|
|
47
50
|
|
|
48
51
|
`listTextAnswerPage` accepts either the legacy single field ID or `TextAnswerPageQueryOptions.fieldIds`. Page size counts
|
|
49
52
|
emitted text items rather than entities. Its opaque Base64 JSON cursor retains the Azure continuation token plus entity
|
package/dist/index.cjs
CHANGED
|
@@ -521,6 +521,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
521
521
|
async saveSubmission(submission, saveOptions = {}) {
|
|
522
522
|
ensureWritable();
|
|
523
523
|
const stored = parseSubmission(submission, `input ${String(submission?.id)}`);
|
|
524
|
+
const explicitValidation = saveOptions.validator ?? saveOptions.validation;
|
|
525
|
+
const configuredValidation = options.submissionValidator ?? options.submissionSchema ?? options.validator ?? options.schema ?? options.validation;
|
|
526
|
+
if (explicitValidation !== void 0) await (0, import_core.assertValidFormSubmissionWith)(explicitValidation, stored);
|
|
527
|
+
if (explicitValidation === void 0 && configuredValidation !== void 0) {
|
|
528
|
+
await (0, import_core.assertValidFormSubmissionWith)(configuredValidation, stored);
|
|
529
|
+
}
|
|
524
530
|
if (options.validateSubmissions === true || saveOptions.validateAgainstSchema === true) {
|
|
525
531
|
const schema = parseSchemaEntity(
|
|
526
532
|
await (await schemaClient(stored.formId)).getEntity(stored.formId, schemaRowKey(stored.formVersion))
|
|
@@ -741,6 +747,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
741
747
|
};
|
|
742
748
|
return {
|
|
743
749
|
...adapter,
|
|
750
|
+
async fetchSubmissionPage(formId, options2) {
|
|
751
|
+
return await adapter.listSubmissionPage(
|
|
752
|
+
formId,
|
|
753
|
+
options2
|
|
754
|
+
);
|
|
755
|
+
},
|
|
744
756
|
async fetchPage(formId, options2) {
|
|
745
757
|
const page = await adapter.listSubmissionPage(formId, {
|
|
746
758
|
...options2?.pageSize === void 0 ? {} : { pageSize: options2.pageSize },
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
1
|
+
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, TypedSubmissionPageQueryOptions, TypedSubmissionPage, SubmissionPageQueryOptions, FormSubmissionValidationSource, FormSubmissionValidator, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
2
2
|
|
|
3
3
|
interface AzureTableListOptions {
|
|
4
4
|
readonly queryOptions?: {
|
|
@@ -112,8 +112,16 @@ interface AzureTableStorageOptions<T = FormSubmission> {
|
|
|
112
112
|
readonly idempotency?: boolean;
|
|
113
113
|
/** Re-validate a submission against the stored FormSchema before saving. */
|
|
114
114
|
readonly validateSubmissions?: boolean;
|
|
115
|
+
/** Validate every saved submission with an application-owned schema or callback. */
|
|
116
|
+
readonly submissionSchema?: FormSubmissionValidationSource;
|
|
117
|
+
readonly submissionValidator?: FormSubmissionValidator;
|
|
118
|
+
/** Alias for `submissionValidator`/`submissionSchema`. */
|
|
119
|
+
readonly validation?: FormSubmissionValidationSource;
|
|
120
|
+
readonly validator?: FormSubmissionValidationSource;
|
|
121
|
+
readonly schema?: FormSubmissionValidationSource;
|
|
115
122
|
}
|
|
116
123
|
interface AzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends PagedSubmissionStorageAdapter {
|
|
124
|
+
readonly fetchSubmissionPage?: (formId: string, options?: TypedSubmissionPageQueryOptions<TMeta>) => Promise<TypedSubmissionPage<TMeta>>;
|
|
117
125
|
readonly fetchPage: (formId: string, options?: {
|
|
118
126
|
readonly pageSize?: number;
|
|
119
127
|
readonly fromSubmittedAt?: string;
|
|
@@ -147,6 +155,7 @@ type TypedAzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata | undefi
|
|
|
147
155
|
readonly items: readonly FormSubmission<TMeta>[];
|
|
148
156
|
readonly nextCursor?: string;
|
|
149
157
|
}>;
|
|
158
|
+
readonly fetchSubmissionPage?: (formId: string, options?: TypedSubmissionPageQueryOptions<TMeta>) => Promise<TypedSubmissionPage<TMeta>>;
|
|
150
159
|
readonly listTextAnswerPage: (formId: string, fieldIdOrOptions?: string | TextAnswerPageQueryOptions, options?: TextAnswerPageQueryOptions) => Promise<TypedTextAnswerPage<TMeta>>;
|
|
151
160
|
};
|
|
152
161
|
interface AzureTextAnswerCursorPayload {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, SubmissionPageQueryOptions, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
1
|
+
import { FormSubmission, BaseSubmissionMetadata, PagedSubmissionStorageAdapter, TypedSubmissionPageQueryOptions, TypedSubmissionPage, SubmissionPageQueryOptions, FormSubmissionValidationSource, FormSubmissionValidator, StrictFormSubmission, SaveSubmissionOptions, SubmissionSaveResult, SubmissionFilter, JsonValue, TextAnswerPageQueryOptions, TypedTextAnswerPage } from '@form-engine-ts/core';
|
|
2
2
|
|
|
3
3
|
interface AzureTableListOptions {
|
|
4
4
|
readonly queryOptions?: {
|
|
@@ -112,8 +112,16 @@ interface AzureTableStorageOptions<T = FormSubmission> {
|
|
|
112
112
|
readonly idempotency?: boolean;
|
|
113
113
|
/** Re-validate a submission against the stored FormSchema before saving. */
|
|
114
114
|
readonly validateSubmissions?: boolean;
|
|
115
|
+
/** Validate every saved submission with an application-owned schema or callback. */
|
|
116
|
+
readonly submissionSchema?: FormSubmissionValidationSource;
|
|
117
|
+
readonly submissionValidator?: FormSubmissionValidator;
|
|
118
|
+
/** Alias for `submissionValidator`/`submissionSchema`. */
|
|
119
|
+
readonly validation?: FormSubmissionValidationSource;
|
|
120
|
+
readonly validator?: FormSubmissionValidationSource;
|
|
121
|
+
readonly schema?: FormSubmissionValidationSource;
|
|
115
122
|
}
|
|
116
123
|
interface AzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata = BaseSubmissionMetadata> extends PagedSubmissionStorageAdapter {
|
|
124
|
+
readonly fetchSubmissionPage?: (formId: string, options?: TypedSubmissionPageQueryOptions<TMeta>) => Promise<TypedSubmissionPage<TMeta>>;
|
|
117
125
|
readonly fetchPage: (formId: string, options?: {
|
|
118
126
|
readonly pageSize?: number;
|
|
119
127
|
readonly fromSubmittedAt?: string;
|
|
@@ -147,6 +155,7 @@ type TypedAzureTableStorageAdapter<TMeta extends BaseSubmissionMetadata | undefi
|
|
|
147
155
|
readonly items: readonly FormSubmission<TMeta>[];
|
|
148
156
|
readonly nextCursor?: string;
|
|
149
157
|
}>;
|
|
158
|
+
readonly fetchSubmissionPage?: (formId: string, options?: TypedSubmissionPageQueryOptions<TMeta>) => Promise<TypedSubmissionPage<TMeta>>;
|
|
150
159
|
readonly listTextAnswerPage: (formId: string, fieldIdOrOptions?: string | TextAnswerPageQueryOptions, options?: TextAnswerPageQueryOptions) => Promise<TypedTextAnswerPage<TMeta>>;
|
|
151
160
|
};
|
|
152
161
|
interface AzureTextAnswerCursorPayload {
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import {
|
|
3
3
|
assertValidFormSchema,
|
|
4
4
|
assertValidFormSubmission,
|
|
5
|
+
assertValidFormSubmissionWith,
|
|
5
6
|
hashFormSubmissionPayload,
|
|
6
7
|
matchesSubmissionPageFilters,
|
|
7
8
|
normalizeSubmissionPageSize
|
|
@@ -497,6 +498,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
497
498
|
async saveSubmission(submission, saveOptions = {}) {
|
|
498
499
|
ensureWritable();
|
|
499
500
|
const stored = parseSubmission(submission, `input ${String(submission?.id)}`);
|
|
501
|
+
const explicitValidation = saveOptions.validator ?? saveOptions.validation;
|
|
502
|
+
const configuredValidation = options.submissionValidator ?? options.submissionSchema ?? options.validator ?? options.schema ?? options.validation;
|
|
503
|
+
if (explicitValidation !== void 0) await assertValidFormSubmissionWith(explicitValidation, stored);
|
|
504
|
+
if (explicitValidation === void 0 && configuredValidation !== void 0) {
|
|
505
|
+
await assertValidFormSubmissionWith(configuredValidation, stored);
|
|
506
|
+
}
|
|
500
507
|
if (options.validateSubmissions === true || saveOptions.validateAgainstSchema === true) {
|
|
501
508
|
const schema = parseSchemaEntity(
|
|
502
509
|
await (await schemaClient(stored.formId)).getEntity(stored.formId, schemaRowKey(stored.formVersion))
|
|
@@ -717,6 +724,12 @@ function createAzureTableStorage(options = {}) {
|
|
|
717
724
|
};
|
|
718
725
|
return {
|
|
719
726
|
...adapter,
|
|
727
|
+
async fetchSubmissionPage(formId, options2) {
|
|
728
|
+
return await adapter.listSubmissionPage(
|
|
729
|
+
formId,
|
|
730
|
+
options2
|
|
731
|
+
);
|
|
732
|
+
},
|
|
720
733
|
async fetchPage(formId, options2) {
|
|
721
734
|
const page = await adapter.listSubmissionPage(formId, {
|
|
722
735
|
...options2?.pageSize === void 0 ? {} : { pageSize: options2.pageSize },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@form-engine-ts/storage-azure-table",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.10.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"typescript"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@form-engine-ts/core": "6.
|
|
42
|
+
"@form-engine-ts/core": "6.10.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@azure/data-tables": "^13.3.2"
|