@ttt-productions/q-core 0.1.50 → 0.1.51
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/constants/business.d.ts +3 -4
- package/dist/constants/business.d.ts.map +1 -1
- package/dist/constants/business.js +3 -4
- package/dist/constants/business.js.map +1 -1
- package/dist/doc-schemas/audit-event.d.ts +0 -2
- package/dist/doc-schemas/audit-event.d.ts.map +1 -1
- package/dist/doc-schemas/index.d.ts +0 -1
- package/dist/doc-schemas/index.d.ts.map +1 -1
- package/dist/doc-schemas/index.js +0 -1
- package/dist/doc-schemas/index.js.map +1 -1
- package/dist/doc-schemas/registry.d.ts +0 -39
- package/dist/doc-schemas/registry.d.ts.map +1 -1
- package/dist/doc-schemas/registry.js +0 -5
- package/dist/doc-schemas/registry.js.map +1 -1
- package/dist/ids/index.d.ts +0 -1
- package/dist/ids/index.d.ts.map +1 -1
- package/dist/ids/index.js +0 -1
- package/dist/ids/index.js.map +1 -1
- package/dist/paths/collection-groups.d.ts +0 -1
- package/dist/paths/collection-groups.d.ts.map +1 -1
- package/dist/paths/collection-groups.js +1 -2
- package/dist/paths/collection-groups.js.map +1 -1
- package/dist/paths/collection-refs.d.ts +0 -1
- package/dist/paths/collection-refs.d.ts.map +1 -1
- package/dist/paths/collection-refs.js +0 -1
- package/dist/paths/collection-refs.js.map +1 -1
- package/dist/paths/collections.d.ts +0 -4
- package/dist/paths/collections.d.ts.map +1 -1
- package/dist/paths/collections.js +0 -4
- package/dist/paths/collections.js.map +1 -1
- package/dist/paths/path-builders.d.ts +0 -3
- package/dist/paths/path-builders.d.ts.map +1 -1
- package/dist/paths/path-builders.js +1 -13
- package/dist/paths/path-builders.js.map +1 -1
- package/dist/schemas/awards.d.ts +5 -75
- package/dist/schemas/awards.d.ts.map +1 -1
- package/dist/schemas/awards.js +6 -30
- package/dist/schemas/awards.js.map +1 -1
- package/dist/types/audit.d.ts +1 -1
- package/dist/types/audit.d.ts.map +1 -1
- package/dist/types/audit.js +0 -1
- package/dist/types/audit.js.map +1 -1
- package/dist/types/schedules.d.ts +1 -1
- package/dist/types/schedules.d.ts.map +1 -1
- package/dist/types/schedules.js +1 -2
- package/dist/types/schedules.js.map +1 -1
- package/dist/types/unions.d.ts +0 -6
- package/dist/types/unions.d.ts.map +1 -1
- package/dist/types/unions.js +0 -3
- package/dist/types/unions.js.map +1 -1
- package/package.json +1 -1
- package/dist/doc-schemas/award-group-grant.d.ts +0 -54
- package/dist/doc-schemas/award-group-grant.d.ts.map +0 -1
- package/dist/doc-schemas/award-group-grant.js +0 -55
- package/dist/doc-schemas/award-group-grant.js.map +0 -1
- package/dist/ids/award-grant-ids.d.ts +0 -9
- package/dist/ids/award-grant-ids.d.ts.map +0 -1
- package/dist/ids/award-grant-ids.js +0 -10
- package/dist/ids/award-grant-ids.js.map +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { buildAwardGroupGrantId, buildAwardGroupGrantTargetKey } from '../ids/award-grant-ids.js';
|
|
3
|
-
import { AWARD_GROUP_GRANT_ACTION_KEYS, AWARD_GROUP_GRANT_STATUS_KEYS, AWARD_GROUP_REVOKE_SKIP_KEYS, AWARD_GROUP_TYPE_KEYS, } from '../types/unions.js';
|
|
4
|
-
import { countSchema, documentIdSegmentSchema, epochMsSchema, revisionSchema, userIdSchema, } from './atoms.js';
|
|
5
|
-
import { awardIdSchema } from './catalogs.js';
|
|
6
|
-
export const awardGroupTypeSchema = z.enum(AWARD_GROUP_TYPE_KEYS);
|
|
7
|
-
export const awardGroupGrantActionSchema = z.enum(AWARD_GROUP_GRANT_ACTION_KEYS);
|
|
8
|
-
export const awardGroupGrantStatusSchema = z.enum(AWARD_GROUP_GRANT_STATUS_KEYS);
|
|
9
|
-
export const awardGroupGrantDecisionSchema = revisionSchema;
|
|
10
|
-
export const AwardGroupGrantSchema = z
|
|
11
|
-
.object({
|
|
12
|
-
grantId: z.string().min(1),
|
|
13
|
-
action: awardGroupGrantActionSchema,
|
|
14
|
-
awardId: awardIdSchema,
|
|
15
|
-
groupType: awardGroupTypeSchema,
|
|
16
|
-
groupId: documentIdSegmentSchema,
|
|
17
|
-
targetKey: z.string().min(1),
|
|
18
|
-
decision: awardGroupGrantDecisionSchema,
|
|
19
|
-
actorUid: userIdSchema,
|
|
20
|
-
status: awardGroupGrantStatusSchema,
|
|
21
|
-
createdAt: epochMsSchema,
|
|
22
|
-
completedAt: epochMsSchema.optional(),
|
|
23
|
-
attemptCount: countSchema,
|
|
24
|
-
nextAttemptAt: epochMsSchema,
|
|
25
|
-
lastError: z.string().optional(),
|
|
26
|
-
})
|
|
27
|
-
.superRefine((grant, ctx) => {
|
|
28
|
-
const targetKey = buildAwardGroupGrantTargetKey(grant);
|
|
29
|
-
if (grant.targetKey !== targetKey) {
|
|
30
|
-
ctx.addIssue({
|
|
31
|
-
code: 'custom',
|
|
32
|
-
path: ['targetKey'],
|
|
33
|
-
message: 'targetKey must be the award and group target key.',
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
if (grant.grantId !== buildAwardGroupGrantId(targetKey, grant.decision)) {
|
|
37
|
-
ctx.addIssue({
|
|
38
|
-
code: 'custom',
|
|
39
|
-
path: ['grantId'],
|
|
40
|
-
message: 'grantId must be the target key and the decision.',
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
export function awardGroupGrantOpens(latest, action) {
|
|
45
|
-
return action === 'grant' ? latest?.action !== 'grant' : latest?.action === 'grant';
|
|
46
|
-
}
|
|
47
|
-
export const AwardGroupGrantPersonSchema = z.object({
|
|
48
|
-
userId: userIdSchema,
|
|
49
|
-
heldBefore: z.boolean(),
|
|
50
|
-
recordedAt: epochMsSchema,
|
|
51
|
-
revoked: z.boolean(),
|
|
52
|
-
revokedAt: epochMsSchema.optional(),
|
|
53
|
-
revokeSkipped: z.enum(AWARD_GROUP_REVOKE_SKIP_KEYS).optional(),
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=award-group-grant.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"award-group-grant.js","sourceRoot":"","sources":["../../src/doc-schemas/award-group-grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAClG,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,WAAW,EACX,uBAAuB,EACvB,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AACjF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;AAEjF,MAAM,CAAC,MAAM,6BAA6B,GAAG,cAAc,CAAC;AAE5D,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,2BAA2B;IACnC,OAAO,EAAE,aAAa;IACtB,SAAS,EAAE,oBAAoB;IAC/B,OAAO,EAAE,uBAAuB;IAChC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,QAAQ,EAAE,6BAA6B;IACvC,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,2BAA2B;IACnC,SAAS,EAAE,aAAa;IACx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AC,CAAC,QAAQ,EAAE;CAC/D,CAAC,CAAC","sourcesContent":["import { z } from 'zod';\nimport { buildAwardGroupGrantId, buildAwardGroupGrantTargetKey } from '../ids/award-grant-ids.js';\nimport {\n AWARD_GROUP_GRANT_ACTION_KEYS,\n AWARD_GROUP_GRANT_STATUS_KEYS,\n AWARD_GROUP_REVOKE_SKIP_KEYS,\n AWARD_GROUP_TYPE_KEYS,\n} from '../types/unions.js';\nimport {\n countSchema,\n documentIdSegmentSchema,\n epochMsSchema,\n revisionSchema,\n userIdSchema,\n} from './atoms.js';\nimport { awardIdSchema } from './catalogs.js';\n\nexport const awardGroupTypeSchema = z.enum(AWARD_GROUP_TYPE_KEYS);\nexport const awardGroupGrantActionSchema = z.enum(AWARD_GROUP_GRANT_ACTION_KEYS);\nexport const awardGroupGrantStatusSchema = z.enum(AWARD_GROUP_GRANT_STATUS_KEYS);\n\nexport const awardGroupGrantDecisionSchema = revisionSchema;\n\nexport const AwardGroupGrantSchema = z\n .object({\n grantId: z.string().min(1),\n action: awardGroupGrantActionSchema,\n awardId: awardIdSchema,\n groupType: awardGroupTypeSchema,\n groupId: documentIdSegmentSchema,\n targetKey: z.string().min(1),\n decision: awardGroupGrantDecisionSchema,\n actorUid: userIdSchema,\n status: awardGroupGrantStatusSchema,\n createdAt: epochMsSchema,\n completedAt: epochMsSchema.optional(),\n attemptCount: countSchema,\n nextAttemptAt: epochMsSchema,\n lastError: z.string().optional(),\n })\n .superRefine((grant, ctx) => {\n const targetKey = buildAwardGroupGrantTargetKey(grant);\n if (grant.targetKey !== targetKey) {\n ctx.addIssue({\n code: 'custom',\n path: ['targetKey'],\n message: 'targetKey must be the award and group target key.',\n });\n }\n if (grant.grantId !== buildAwardGroupGrantId(targetKey, grant.decision)) {\n ctx.addIssue({\n code: 'custom',\n path: ['grantId'],\n message: 'grantId must be the target key and the decision.',\n });\n }\n });\nexport type AwardGroupGrant = z.infer<typeof AwardGroupGrantSchema>;\n\nexport function awardGroupGrantOpens(\n latest: Pick<AwardGroupGrant, 'action'> | null,\n action: AwardGroupGrant['action'],\n): boolean {\n return action === 'grant' ? latest?.action !== 'grant' : latest?.action === 'grant';\n}\n\nexport const AwardGroupGrantPersonSchema = z.object({\n userId: userIdSchema,\n heldBefore: z.boolean(),\n recordedAt: epochMsSchema,\n revoked: z.boolean(),\n revokedAt: epochMsSchema.optional(),\n revokeSkipped: z.enum(AWARD_GROUP_REVOKE_SKIP_KEYS).optional(),\n});\nexport type AwardGroupGrantPerson = z.infer<typeof AwardGroupGrantPersonSchema>;\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { AwardGroupType } from '../types/unions.js';
|
|
2
|
-
export interface AwardGroupGrantTarget {
|
|
3
|
-
readonly awardId: string;
|
|
4
|
-
readonly groupType: AwardGroupType;
|
|
5
|
-
readonly groupId: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function buildAwardGroupGrantTargetKey(target: AwardGroupGrantTarget): string;
|
|
8
|
-
export declare function buildAwardGroupGrantId(targetKey: string, decision: number): string;
|
|
9
|
-
//# sourceMappingURL=award-grant-ids.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"award-grant-ids.d.ts","sourceRoot":"","sources":["../../src/ids/award-grant-ids.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAOD,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAEnF;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElF"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// A part prefixed by its length, so parts that contain any character still decode one way.
|
|
2
|
-
const lengthPrefixed = (part) => `${part.length}:${part}`;
|
|
3
|
-
const DECISION_SEPARATOR = '~';
|
|
4
|
-
export function buildAwardGroupGrantTargetKey(target) {
|
|
5
|
-
return [target.awardId, target.groupType, target.groupId].map(lengthPrefixed).join('');
|
|
6
|
-
}
|
|
7
|
-
export function buildAwardGroupGrantId(targetKey, decision) {
|
|
8
|
-
return `${targetKey}${DECISION_SEPARATOR}${decision}`;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=award-grant-ids.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"award-grant-ids.js","sourceRoot":"","sources":["../../src/ids/award-grant-ids.ts"],"names":[],"mappings":"AAQA,2FAA2F;AAC3F,MAAM,cAAc,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC;AAE1E,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,MAAM,UAAU,6BAA6B,CAAC,MAA6B;IACzE,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAAiB,EAAE,QAAgB;IACxE,OAAO,GAAG,SAAS,GAAG,kBAAkB,GAAG,QAAQ,EAAE,CAAC;AACxD,CAAC","sourcesContent":["import type { AwardGroupType } from '../types/unions.js';\n\nexport interface AwardGroupGrantTarget {\n readonly awardId: string;\n readonly groupType: AwardGroupType;\n readonly groupId: string;\n}\n\n// A part prefixed by its length, so parts that contain any character still decode one way.\nconst lengthPrefixed = (part: string): string => `${part.length}:${part}`;\n\nconst DECISION_SEPARATOR = '~';\n\nexport function buildAwardGroupGrantTargetKey(target: AwardGroupGrantTarget): string {\n return [target.awardId, target.groupType, target.groupId].map(lengthPrefixed).join('');\n}\n\nexport function buildAwardGroupGrantId(targetKey: string, decision: number): string {\n return `${targetKey}${DECISION_SEPARATOR}${decision}`;\n}\n"]}
|