@innspel/core 0.3.0 → 0.5.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.d.cts CHANGED
@@ -11,7 +11,7 @@ type CommonCorrelation = {
11
11
  /**
12
12
  * Maskinlesbar feilkode. Klienten forgrener på denne, aldri på message. Meldingen navngir feltet som feilet, aldri innsendte verdier — den kan inneholde fritekst fra innsenderen.
13
13
  */
14
- type CommonErrorCode = 'validation_failed' | 'unknown_field' | 'text_too_short' | 'text_too_long' | 'correlation_invalid' | 'unauthenticated' | 'feedback_token_required' | 'feedback_token_invalid' | 'feedback_token_expired' | 'mfa_required' | 'insufficient_role' | 'insufficient_scope' | 'screenshots_disabled' | 'submission_not_found' | 'known_issue_not_found' | 'program_not_found' | 'invitation_invalid' | 'task_not_found' | 'follow_up_not_found' | 'participant_not_found' | 'subject_not_found' | 'attachment_not_found' | 'webhook_not_found' | 'delivery_not_found' | 'product_not_found' | 'key_not_found' | 'receipt_not_found' | 'report_not_found' | 'handoff_invalid' | 'invalid_status_transition' | 'reply_exists' | 'invitation_already_answered' | 'program_incomplete' | 'program_full' | 'task_already_completed' | 'follow_up_already_answered' | 'report_frozen' | 'webhook_not_verified' | 'attachment_already_uploaded' | 'reply_required' | 'reason_code_required' | 'template_unmodified' | 'fixed_in_required' | 'canonical_is_duplicate' | 'known_issue_conflict' | 'deadline_cannot_be_extended' | 'minors_present_conflict' | 'contacts_exceed_tenant_cap' | 'data_limitations_required' | 'attachment_too_large' | 'attachment_type_not_allowed' | 'rate_limited' | 'not_implemented';
14
+ type CommonErrorCode = 'validation_failed' | 'unknown_field' | 'text_too_short' | 'text_too_long' | 'correlation_invalid' | 'unauthenticated' | 'feedback_token_required' | 'feedback_token_invalid' | 'feedback_token_expired' | 'mfa_required' | 'insufficient_role' | 'insufficient_scope' | 'screenshots_disabled' | 'submission_not_found' | 'known_issue_not_found' | 'program_not_found' | 'invitation_invalid' | 'task_not_found' | 'follow_up_not_found' | 'participant_not_found' | 'subject_not_found' | 'attachment_not_found' | 'webhook_not_found' | 'delivery_not_found' | 'product_not_found' | 'key_not_found' | 'receipt_not_found' | 'report_not_found' | 'handoff_invalid' | 'invalid_status_transition' | 'reply_exists' | 'invitation_already_answered' | 'program_incomplete' | 'program_full' | 'task_already_completed' | 'follow_up_already_answered' | 'follow_up_not_answerable' | 'report_frozen' | 'webhook_not_verified' | 'attachment_already_uploaded' | 'reply_required' | 'reason_code_required' | 'template_unmodified' | 'fixed_in_required' | 'canonical_is_duplicate' | 'known_issue_conflict' | 'deadline_cannot_be_extended' | 'minors_present_conflict' | 'contacts_exceed_tenant_cap' | 'data_limitations_required' | 'attachment_too_large' | 'attachment_type_not_allowed' | 'rate_limited' | 'not_implemented';
15
15
  /**
16
16
  * Plattformen innsendingen kom fra. Lukket liste fra dag én, inkludert storskjerm — en verdi som legges til senere er en kontraktendring hos alle SDK-er (ideer/storskjerm-qr-handoff.md).
17
17
  */
@@ -43,6 +43,14 @@ type KnownIssuesKnownIssueStatus = 'aktiv' | 'fikset';
43
43
  * paaminnelse bærer alltid fristen i teksten; tilbud_om_utgang er eneste lovlige form for den betingede kontakten når ingen oppgave er gjort (DD-34).
44
44
  */
45
45
  type ProgramsFollowUpKind = 'paaminnelse' | 'hvordan_gikk_det' | 'sjekkpunkt' | 'tilbud_om_utgang';
46
+ /**
47
+ * Svar på en oppfølging med spørsmål (kind = hvordan_gikk_det eller sjekkpunkt): tre lukkede valg (fungerte · delvis · ikke) og valgfri fritekst ≤ 140 (domain-model.md Response). Én per FollowUp. Skala 1–5 er FORKASTET 2026-09-07 — se tech-decisions.md M3.2 (forts.).
48
+ */
49
+ type ProgramsFollowUpResponseCreate = {
50
+ outcome: ProgramsTaskOutcome;
51
+ text?: string;
52
+ submissionId?: string;
53
+ };
46
54
  /**
47
55
  * En oppfølging som er sendt ut til kalleren og ikke besvart. Teksten bærer fristen når kind = paaminnelse (DD-34).
48
56
  */
@@ -138,12 +146,21 @@ type ProgramsTask = {
138
146
  estimatedMinutes: number;
139
147
  };
140
148
  /**
141
- * Én fullført oppgave, som testeren ser den.
149
+ * Testeren fullfører en oppgave med utfall (3c «Hvordan gikk det?»). text er den valgfrie setningen «Vil du si én setning om det?» ≤ 140 — vises på programsiden per oppgave, aldri i innboksen, og slettes med pseudonymet. Valgfri kobling til innspillet som ble sendt underveis.
150
+ */
151
+ type ProgramsTaskCompletionCreate = {
152
+ outcome: ProgramsTaskOutcome;
153
+ text?: string;
154
+ submissionId?: string;
155
+ };
156
+ /**
157
+ * Én fullført oppgave, som testeren ser den. text er testerens egen setning fra «Gjort» (3c), aldri fra panelet.
142
158
  */
143
159
  type ProgramsTaskCompletionView = {
144
160
  taskId: string;
145
161
  outcome: ProgramsTaskOutcome;
146
162
  at: string;
163
+ text?: string;
147
164
  submissionId?: string;
148
165
  };
149
166
  /**
@@ -533,7 +550,33 @@ interface InnspelClient {
533
550
  status(submissionId: string): Promise<SubmissionsSubmissionStatusView>;
534
551
  };
535
552
  readonly programs: {
553
+ /** Alt om betaprogram for innsenderen i ett kall: invitasjoner til banneret (DD-12), deltakelser til fanen, og oppfølginger som venter. */
536
554
  list(): Promise<ProgramsMyPrograms>;
555
+ /**
556
+ * Aksepterer invitasjonen etter forventningsavklaringen (DD-13, DD-32).
557
+ * Tokenet kom fra leietakerens egen kanal — plattformen sender aldri (DD-12).
558
+ * Er det brukt, utløpt eller utstedt til noen andre, kommer 404
559
+ * `invitation_invalid`. Gjentak fra samme innsender er trygt: svaret er den
560
+ * samme deltakelsen.
561
+ */
562
+ accept(invitationToken: string): Promise<ProgramsParticipationView>;
563
+ /** Avslår invitasjonen. Ingen årsak spørres. Et nei etter ja er {@link withdraw}, ikke avslag. */
564
+ decline(invitationToken: string): Promise<void>;
565
+ /** «Gå ut» (DD-36): umiddelbart, alltid tilgjengelig, og aldri en straff. Idempotent. */
566
+ withdraw(participationId: string): Promise<ProgramsParticipationView>;
567
+ /**
568
+ * «Gjort» (3c): ett av tre lukkede utfall — fungerte · delvis · ikke — og en valgfri
569
+ * setning ≤ 140. Én per oppgave; et gjentak er 409 `task_already_completed`. En egen
570
+ * innsending kan henge ved. Teller `task_completed` med utfallet, aldri teksten.
571
+ */
572
+ completeTask(taskId: string, completion: ProgramsTaskCompletionCreate): Promise<ProgramsTaskCompletionView>;
573
+ /**
574
+ * «Hvordan gikk det?» på en utsendt oppfølging fra `list().pendingFollowUps`: de samme
575
+ * tre valgene og en valgfri setning ≤ 140. Bare `hvordan_gikk_det` og `sjekkpunkt` tar
576
+ * svar — en påminnelse eller et tilbud om utgang gir 409 `follow_up_not_answerable`.
577
+ * Engangs (409 `follow_up_already_answered`). Teller `followup_answered`.
578
+ */
579
+ respond(followUpId: string, response: ProgramsFollowUpResponseCreate): Promise<void>;
537
580
  };
538
581
  readonly attachments: {
539
582
  /**
@@ -742,6 +785,6 @@ declare function dekkerAlt(rekter: readonly MaskRect[], bilde: {
742
785
  * ikke kan lese JSON, og `test/versjon.test.ts` holder den i takt med
743
786
  * `package.json`.
744
787
  */
745
- declare const VERSJON = "0.3.0";
788
+ declare const VERSJON = "0.5.0";
746
789
 
747
- export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
790
+ export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type ProgramsFollowUpKind as FollowUpKind, type ProgramsFollowUpResponseCreate as FollowUpResponseCreate, type ProgramsFollowUpView as FollowUpView, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, type ProgramsInvitationView as InvitationView, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type ProgramsParticipationView as ParticipationView, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type ProgramsTask as ProgramTask, type ProgramsProgramView as ProgramView, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type ProgramsTaskCompletionCreate as TaskCompletionCreate, type ProgramsTaskCompletionView as TaskCompletionView, type ProgramsTaskOutcome as TaskOutcome, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ type CommonCorrelation = {
11
11
  /**
12
12
  * Maskinlesbar feilkode. Klienten forgrener på denne, aldri på message. Meldingen navngir feltet som feilet, aldri innsendte verdier — den kan inneholde fritekst fra innsenderen.
13
13
  */
14
- type CommonErrorCode = 'validation_failed' | 'unknown_field' | 'text_too_short' | 'text_too_long' | 'correlation_invalid' | 'unauthenticated' | 'feedback_token_required' | 'feedback_token_invalid' | 'feedback_token_expired' | 'mfa_required' | 'insufficient_role' | 'insufficient_scope' | 'screenshots_disabled' | 'submission_not_found' | 'known_issue_not_found' | 'program_not_found' | 'invitation_invalid' | 'task_not_found' | 'follow_up_not_found' | 'participant_not_found' | 'subject_not_found' | 'attachment_not_found' | 'webhook_not_found' | 'delivery_not_found' | 'product_not_found' | 'key_not_found' | 'receipt_not_found' | 'report_not_found' | 'handoff_invalid' | 'invalid_status_transition' | 'reply_exists' | 'invitation_already_answered' | 'program_incomplete' | 'program_full' | 'task_already_completed' | 'follow_up_already_answered' | 'report_frozen' | 'webhook_not_verified' | 'attachment_already_uploaded' | 'reply_required' | 'reason_code_required' | 'template_unmodified' | 'fixed_in_required' | 'canonical_is_duplicate' | 'known_issue_conflict' | 'deadline_cannot_be_extended' | 'minors_present_conflict' | 'contacts_exceed_tenant_cap' | 'data_limitations_required' | 'attachment_too_large' | 'attachment_type_not_allowed' | 'rate_limited' | 'not_implemented';
14
+ type CommonErrorCode = 'validation_failed' | 'unknown_field' | 'text_too_short' | 'text_too_long' | 'correlation_invalid' | 'unauthenticated' | 'feedback_token_required' | 'feedback_token_invalid' | 'feedback_token_expired' | 'mfa_required' | 'insufficient_role' | 'insufficient_scope' | 'screenshots_disabled' | 'submission_not_found' | 'known_issue_not_found' | 'program_not_found' | 'invitation_invalid' | 'task_not_found' | 'follow_up_not_found' | 'participant_not_found' | 'subject_not_found' | 'attachment_not_found' | 'webhook_not_found' | 'delivery_not_found' | 'product_not_found' | 'key_not_found' | 'receipt_not_found' | 'report_not_found' | 'handoff_invalid' | 'invalid_status_transition' | 'reply_exists' | 'invitation_already_answered' | 'program_incomplete' | 'program_full' | 'task_already_completed' | 'follow_up_already_answered' | 'follow_up_not_answerable' | 'report_frozen' | 'webhook_not_verified' | 'attachment_already_uploaded' | 'reply_required' | 'reason_code_required' | 'template_unmodified' | 'fixed_in_required' | 'canonical_is_duplicate' | 'known_issue_conflict' | 'deadline_cannot_be_extended' | 'minors_present_conflict' | 'contacts_exceed_tenant_cap' | 'data_limitations_required' | 'attachment_too_large' | 'attachment_type_not_allowed' | 'rate_limited' | 'not_implemented';
15
15
  /**
16
16
  * Plattformen innsendingen kom fra. Lukket liste fra dag én, inkludert storskjerm — en verdi som legges til senere er en kontraktendring hos alle SDK-er (ideer/storskjerm-qr-handoff.md).
17
17
  */
@@ -43,6 +43,14 @@ type KnownIssuesKnownIssueStatus = 'aktiv' | 'fikset';
43
43
  * paaminnelse bærer alltid fristen i teksten; tilbud_om_utgang er eneste lovlige form for den betingede kontakten når ingen oppgave er gjort (DD-34).
44
44
  */
45
45
  type ProgramsFollowUpKind = 'paaminnelse' | 'hvordan_gikk_det' | 'sjekkpunkt' | 'tilbud_om_utgang';
46
+ /**
47
+ * Svar på en oppfølging med spørsmål (kind = hvordan_gikk_det eller sjekkpunkt): tre lukkede valg (fungerte · delvis · ikke) og valgfri fritekst ≤ 140 (domain-model.md Response). Én per FollowUp. Skala 1–5 er FORKASTET 2026-09-07 — se tech-decisions.md M3.2 (forts.).
48
+ */
49
+ type ProgramsFollowUpResponseCreate = {
50
+ outcome: ProgramsTaskOutcome;
51
+ text?: string;
52
+ submissionId?: string;
53
+ };
46
54
  /**
47
55
  * En oppfølging som er sendt ut til kalleren og ikke besvart. Teksten bærer fristen når kind = paaminnelse (DD-34).
48
56
  */
@@ -138,12 +146,21 @@ type ProgramsTask = {
138
146
  estimatedMinutes: number;
139
147
  };
140
148
  /**
141
- * Én fullført oppgave, som testeren ser den.
149
+ * Testeren fullfører en oppgave med utfall (3c «Hvordan gikk det?»). text er den valgfrie setningen «Vil du si én setning om det?» ≤ 140 — vises på programsiden per oppgave, aldri i innboksen, og slettes med pseudonymet. Valgfri kobling til innspillet som ble sendt underveis.
150
+ */
151
+ type ProgramsTaskCompletionCreate = {
152
+ outcome: ProgramsTaskOutcome;
153
+ text?: string;
154
+ submissionId?: string;
155
+ };
156
+ /**
157
+ * Én fullført oppgave, som testeren ser den. text er testerens egen setning fra «Gjort» (3c), aldri fra panelet.
142
158
  */
143
159
  type ProgramsTaskCompletionView = {
144
160
  taskId: string;
145
161
  outcome: ProgramsTaskOutcome;
146
162
  at: string;
163
+ text?: string;
147
164
  submissionId?: string;
148
165
  };
149
166
  /**
@@ -533,7 +550,33 @@ interface InnspelClient {
533
550
  status(submissionId: string): Promise<SubmissionsSubmissionStatusView>;
534
551
  };
535
552
  readonly programs: {
553
+ /** Alt om betaprogram for innsenderen i ett kall: invitasjoner til banneret (DD-12), deltakelser til fanen, og oppfølginger som venter. */
536
554
  list(): Promise<ProgramsMyPrograms>;
555
+ /**
556
+ * Aksepterer invitasjonen etter forventningsavklaringen (DD-13, DD-32).
557
+ * Tokenet kom fra leietakerens egen kanal — plattformen sender aldri (DD-12).
558
+ * Er det brukt, utløpt eller utstedt til noen andre, kommer 404
559
+ * `invitation_invalid`. Gjentak fra samme innsender er trygt: svaret er den
560
+ * samme deltakelsen.
561
+ */
562
+ accept(invitationToken: string): Promise<ProgramsParticipationView>;
563
+ /** Avslår invitasjonen. Ingen årsak spørres. Et nei etter ja er {@link withdraw}, ikke avslag. */
564
+ decline(invitationToken: string): Promise<void>;
565
+ /** «Gå ut» (DD-36): umiddelbart, alltid tilgjengelig, og aldri en straff. Idempotent. */
566
+ withdraw(participationId: string): Promise<ProgramsParticipationView>;
567
+ /**
568
+ * «Gjort» (3c): ett av tre lukkede utfall — fungerte · delvis · ikke — og en valgfri
569
+ * setning ≤ 140. Én per oppgave; et gjentak er 409 `task_already_completed`. En egen
570
+ * innsending kan henge ved. Teller `task_completed` med utfallet, aldri teksten.
571
+ */
572
+ completeTask(taskId: string, completion: ProgramsTaskCompletionCreate): Promise<ProgramsTaskCompletionView>;
573
+ /**
574
+ * «Hvordan gikk det?» på en utsendt oppfølging fra `list().pendingFollowUps`: de samme
575
+ * tre valgene og en valgfri setning ≤ 140. Bare `hvordan_gikk_det` og `sjekkpunkt` tar
576
+ * svar — en påminnelse eller et tilbud om utgang gir 409 `follow_up_not_answerable`.
577
+ * Engangs (409 `follow_up_already_answered`). Teller `followup_answered`.
578
+ */
579
+ respond(followUpId: string, response: ProgramsFollowUpResponseCreate): Promise<void>;
537
580
  };
538
581
  readonly attachments: {
539
582
  /**
@@ -742,6 +785,6 @@ declare function dekkerAlt(rekter: readonly MaskRect[], bilde: {
742
785
  * ikke kan lese JSON, og `test/versjon.test.ts` holder den i takt med
743
786
  * `package.json`.
744
787
  */
745
- declare const VERSJON = "0.3.0";
788
+ declare const VERSJON = "0.5.0";
746
789
 
747
- export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
790
+ export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type ProgramsFollowUpKind as FollowUpKind, type ProgramsFollowUpResponseCreate as FollowUpResponseCreate, type ProgramsFollowUpView as FollowUpView, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, type ProgramsInvitationView as InvitationView, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type ProgramsParticipationView as ParticipationView, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type ProgramsTask as ProgramTask, type ProgramsProgramView as ProgramView, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type ProgramsTaskCompletionCreate as TaskCompletionCreate, type ProgramsTaskCompletionView as TaskCompletionView, type ProgramsTaskOutcome as TaskOutcome, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
package/dist/index.js CHANGED
@@ -809,6 +809,37 @@ var configGet = (options) => (options?.client ?? client).get({
809
809
  url: "/v1/ingest/config",
810
810
  ...options
811
811
  });
812
+ var programsRespond = (options) => (options.client ?? client).post({
813
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
814
+ key: "FeedbackTokenAuth",
815
+ scheme: "bearer",
816
+ type: "http"
817
+ }],
818
+ url: "/v1/ingest/follow-ups/{id}/respond",
819
+ ...options,
820
+ headers: {
821
+ "Content-Type": "application/json",
822
+ ...options.headers
823
+ }
824
+ });
825
+ var programsAccept = (options) => (options.client ?? client).post({
826
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
827
+ key: "FeedbackTokenAuth",
828
+ scheme: "bearer",
829
+ type: "http"
830
+ }],
831
+ url: "/v1/ingest/invitations/{token}/accept",
832
+ ...options
833
+ });
834
+ var programsDecline = (options) => (options.client ?? client).post({
835
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
836
+ key: "FeedbackTokenAuth",
837
+ scheme: "bearer",
838
+ type: "http"
839
+ }],
840
+ url: "/v1/ingest/invitations/{token}/decline",
841
+ ...options
842
+ });
812
843
  var knownIssuesList2 = (options) => (options?.client ?? client).get({
813
844
  security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
814
845
  key: "FeedbackTokenAuth",
@@ -831,6 +862,15 @@ var knownIssuesConfirm = (options) => (options.client ?? client).post({
831
862
  ...options.headers
832
863
  }
833
864
  });
865
+ var programsWithdraw = (options) => (options.client ?? client).post({
866
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
867
+ key: "FeedbackTokenAuth",
868
+ scheme: "bearer",
869
+ type: "http"
870
+ }],
871
+ url: "/v1/ingest/participations/{id}/withdraw",
872
+ ...options
873
+ });
834
874
  var programsListMine = (options) => (options?.client ?? client).get({
835
875
  security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
836
876
  key: "FeedbackTokenAuth",
@@ -871,6 +911,19 @@ var submissionsStatus = (options) => (options.client ?? client).get({
871
911
  url: "/v1/ingest/submissions/{id}/status",
872
912
  ...options
873
913
  });
914
+ var programsCompleteTask = (options) => (options.client ?? client).post({
915
+ security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
916
+ key: "FeedbackTokenAuth",
917
+ scheme: "bearer",
918
+ type: "http"
919
+ }],
920
+ url: "/v1/ingest/tasks/{id}/complete",
921
+ ...options,
922
+ headers: {
923
+ "Content-Type": "application/json",
924
+ ...options.headers
925
+ }
926
+ });
874
927
 
875
928
  // src/feil.ts
876
929
  var PREFIKS = "[innspel]";
@@ -1217,11 +1270,21 @@ async function lastOppTilLagring(fetchImpl, presign, body, signal) {
1217
1270
  }
1218
1271
 
1219
1272
  // src/versjon.ts
1220
- var VERSJON = "0.3.0";
1273
+ var VERSJON = "0.5.0";
1221
1274
 
1222
1275
  // src/klient.ts
1223
1276
  var STANDARD_TIMEOUT_MS = 1e4;
1224
1277
  var noopTelemetri = { emit: () => void 0 };
1278
+ var UTFALL = ["fungerte", "delvis", "ikke"];
1279
+ var SETNING_MAKS = 140;
1280
+ function validerUtfall(input) {
1281
+ if (!UTFALL.includes(input.outcome)) {
1282
+ throw new InnspelConfigError("outcome", `m\xE5 v\xE6re ett av ${UTFALL.join(" \xB7 ")}`);
1283
+ }
1284
+ if (input.text !== void 0 && (typeof input.text !== "string" || input.text.length > SETNING_MAKS)) {
1285
+ throw new InnspelConfigError("text", `er valgfri, men aldri lengre enn ${SETNING_MAKS} tegn`);
1286
+ }
1287
+ }
1225
1288
  function krev(betingelse, felt, hva) {
1226
1289
  if (!betingelse) throw new InnspelConfigError(felt, hva);
1227
1290
  }
@@ -1327,6 +1390,14 @@ function init(options) {
1327
1390
  if (!res.response.ok) throw tilApiFeil(res.response.status, res.error, res.response);
1328
1391
  return res.data;
1329
1392
  }
1393
+ function krevInvitasjonstoken(token) {
1394
+ if (typeof token !== "string" || token.length === 0) {
1395
+ throw new InnspelConfigError(
1396
+ "invitationToken",
1397
+ "mangler \u2014 det er engangs-tokenet leietakeren sendte i sin egen kanal (dyplenke, varsel eller e-post)"
1398
+ );
1399
+ }
1400
+ }
1330
1401
  function krevToken() {
1331
1402
  if (anonym) {
1332
1403
  throw new InnspelApiError(
@@ -1540,6 +1611,82 @@ function init(options) {
1540
1611
  return medToken(
1541
1612
  (h) => programsListMine({ client: klient, headers: h, signal: signal() })
1542
1613
  );
1614
+ },
1615
+ async accept(invitationToken) {
1616
+ krevInvitasjonstoken(invitationToken);
1617
+ krevToken();
1618
+ const svar = await medToken(
1619
+ (h) => programsAccept({
1620
+ client: klient,
1621
+ headers: h,
1622
+ signal: signal(),
1623
+ path: { token: invitationToken }
1624
+ })
1625
+ );
1626
+ telemetri.emit({ name: "invitation_accepted" });
1627
+ return svar;
1628
+ },
1629
+ async decline(invitationToken) {
1630
+ krevInvitasjonstoken(invitationToken);
1631
+ krevToken();
1632
+ await medToken(
1633
+ (h) => programsDecline({
1634
+ client: klient,
1635
+ headers: h,
1636
+ signal: signal(),
1637
+ path: { token: invitationToken }
1638
+ })
1639
+ );
1640
+ telemetri.emit({ name: "invitation_declined" });
1641
+ },
1642
+ async withdraw(participationId) {
1643
+ if (typeof participationId !== "string" || participationId.length === 0) {
1644
+ throw new InnspelConfigError("participationId", "mangler \u2014 bruk id fra deltakelsen i programs.list()");
1645
+ }
1646
+ krevToken();
1647
+ return medToken(
1648
+ (h) => programsWithdraw({
1649
+ client: klient,
1650
+ headers: h,
1651
+ signal: signal(),
1652
+ path: { id: participationId }
1653
+ })
1654
+ );
1655
+ },
1656
+ async completeTask(taskId, completion) {
1657
+ if (typeof taskId !== "string" || taskId.length === 0) {
1658
+ throw new InnspelConfigError("taskId", "mangler \u2014 bruk id fra program.tasks i programs.list()");
1659
+ }
1660
+ validerUtfall(completion);
1661
+ krevToken();
1662
+ const svar = await medToken(
1663
+ (h) => programsCompleteTask({
1664
+ client: klient,
1665
+ headers: h,
1666
+ signal: signal(),
1667
+ path: { id: taskId },
1668
+ body: completion
1669
+ })
1670
+ );
1671
+ telemetri.emit({ name: "task_completed", outcome: completion.outcome });
1672
+ return svar;
1673
+ },
1674
+ async respond(followUpId, response) {
1675
+ if (typeof followUpId !== "string" || followUpId.length === 0) {
1676
+ throw new InnspelConfigError("followUpId", "mangler \u2014 bruk id fra pendingFollowUps i programs.list()");
1677
+ }
1678
+ validerUtfall(response);
1679
+ krevToken();
1680
+ await medToken(
1681
+ (h) => programsRespond({
1682
+ client: klient,
1683
+ headers: h,
1684
+ signal: signal(),
1685
+ path: { id: followUpId },
1686
+ body: response
1687
+ })
1688
+ );
1689
+ telemetri.emit({ name: "followup_answered" });
1543
1690
  }
1544
1691
  },
1545
1692
  attachments: {