@pdc/sdk 0.3.1

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.
Files changed (62) hide show
  1. package/.swagger-codegen/VERSION +1 -0
  2. package/.swagger-codegen-ignore +23 -0
  3. package/README.md +6 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +17 -0
  6. package/dist/types/Applicant.d.ts +8 -0
  7. package/dist/types/Applicant.js +2 -0
  8. package/dist/types/ApplicationForm.d.ts +10 -0
  9. package/dist/types/ApplicationForm.js +2 -0
  10. package/dist/types/ApplicationFormField.d.ts +10 -0
  11. package/dist/types/ApplicationFormField.js +2 -0
  12. package/dist/types/BaseField.d.ts +10 -0
  13. package/dist/types/BaseField.js +2 -0
  14. package/dist/types/BulkUpload.d.ts +19 -0
  15. package/dist/types/BulkUpload.js +14 -0
  16. package/dist/types/Bundle.d.ts +6 -0
  17. package/dist/types/Bundle.js +2 -0
  18. package/dist/types/Opportunity.d.ts +7 -0
  19. package/dist/types/Opportunity.js +2 -0
  20. package/dist/types/PdcError.d.ts +7 -0
  21. package/dist/types/PdcError.js +2 -0
  22. package/dist/types/PlatformProviderResponse.d.ts +8 -0
  23. package/dist/types/PlatformProviderResponse.js +2 -0
  24. package/dist/types/PresignedPostRequest.d.ts +8 -0
  25. package/dist/types/PresignedPostRequest.js +2 -0
  26. package/dist/types/PresignedPostRequestPresignedPost.d.ts +7 -0
  27. package/dist/types/PresignedPostRequestPresignedPost.js +2 -0
  28. package/dist/types/PresignedPostRequestPresignedPostFields.d.ts +5 -0
  29. package/dist/types/PresignedPostRequestPresignedPostFields.js +2 -0
  30. package/dist/types/Proposal.d.ts +11 -0
  31. package/dist/types/Proposal.js +2 -0
  32. package/dist/types/ProposalBundle.d.ts +6 -0
  33. package/dist/types/ProposalBundle.js +2 -0
  34. package/dist/types/ProposalFieldValue.d.ts +12 -0
  35. package/dist/types/ProposalFieldValue.js +2 -0
  36. package/dist/types/ProposalVersion.d.ts +11 -0
  37. package/dist/types/ProposalVersion.js +2 -0
  38. package/dist/types/Writable.d.ts +13 -0
  39. package/dist/types/Writable.js +2 -0
  40. package/dist/types/index.d.ts +16 -0
  41. package/dist/types/index.js +32 -0
  42. package/package.json +22 -0
  43. package/src/index.ts +1 -0
  44. package/src/types/Applicant.ts +12 -0
  45. package/src/types/ApplicationForm.ts +16 -0
  46. package/src/types/ApplicationFormField.ts +14 -0
  47. package/src/types/BaseField.ts +14 -0
  48. package/src/types/BulkUpload.ts +22 -0
  49. package/src/types/Bundle.ts +10 -0
  50. package/src/types/Opportunity.ts +11 -0
  51. package/src/types/PdcError.ts +11 -0
  52. package/src/types/PlatformProviderResponse.ts +12 -0
  53. package/src/types/PresignedPostRequest.ts +14 -0
  54. package/src/types/PresignedPostRequestPresignedPost.ts +13 -0
  55. package/src/types/PresignedPostRequestPresignedPostFields.ts +9 -0
  56. package/src/types/Proposal.ts +17 -0
  57. package/src/types/ProposalBundle.ts +15 -0
  58. package/src/types/ProposalFieldValue.ts +18 -0
  59. package/src/types/ProposalVersion.ts +17 -0
  60. package/src/types/Writable.ts +23 -0
  61. package/src/types/index.ts +16 -0
  62. package/tsconfig.json +9 -0
@@ -0,0 +1 @@
1
+ 3.0.52
@@ -0,0 +1,23 @@
1
+ # Swagger Codegen Ignore
2
+ # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
3
+
4
+ # Use this file to prevent files from being overwritten by the generator.
5
+ # The patterns follow closely to .gitignore or .dockerignore.
6
+
7
+ # As an example, the C# client generator defines ApiClient.cs.
8
+ # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
9
+ #ApiClient.cs
10
+
11
+ # You can match any string of characters against a directory, file or extension with a single asterisk (*):
12
+ #foo/*/qux
13
+ # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14
+
15
+ # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16
+ #foo/**/qux
17
+ # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18
+
19
+ # You can also negate patterns with an exclamation (!).
20
+ # For example, you can ignore all files in a docs folder with the file extension .md:
21
+ #docs/*.md
22
+ # Then explicitly reverse the ignore rule for a single file:
23
+ #!docs/README.md
package/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # TypeScript SDK for the Philanthropy Data Commons
2
+
3
+ To build this code base:
4
+
5
+ 1. Run `npm i`
6
+ 2. Run `npm build`
@@ -0,0 +1 @@
1
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,8 @@
1
+ import { Writable } from './Writable';
2
+ export interface Applicant {
3
+ readonly id: number;
4
+ externalId: string;
5
+ optedIn: boolean;
6
+ readonly createdAt: Date;
7
+ }
8
+ export type WritableApplicant = Writable<Applicant>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { ApplicationFormField } from './ApplicationFormField';
2
+ import { Writable } from './Writable';
3
+ export interface ApplicationForm {
4
+ readonly id: number;
5
+ opportunityId: number;
6
+ readonly version: number;
7
+ fields?: Array<ApplicationFormField>;
8
+ readonly createdAt: Date;
9
+ }
10
+ export type WritableApplicationForm = Writable<ApplicationForm>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Writable } from './Writable';
2
+ export interface ApplicationFormField {
3
+ readonly id: number;
4
+ readonly applicationFormId: number;
5
+ baseFieldId: number;
6
+ position: number;
7
+ label: string;
8
+ readonly createdAt: Date;
9
+ }
10
+ export type WritableApplicationFormField = Writable<ApplicationFormField>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ import { Writable } from './Writable';
2
+ export interface BaseField {
3
+ readonly id: number;
4
+ label: string;
5
+ description?: string;
6
+ shortCode: string;
7
+ dataType: string;
8
+ readonly createdAt: Date;
9
+ }
10
+ export type WritableBaseField = Writable<BaseField>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,19 @@
1
+ import { Writable } from './Writable';
2
+ export interface BulkUpload {
3
+ readonly id: number;
4
+ fileName: string;
5
+ readonly fileSize?: number;
6
+ sourceKey: string;
7
+ readonly status?: BulkUpload.StatusEnum;
8
+ readonly createdAt: Date;
9
+ }
10
+ export type WritableBulkUpload = Writable<BulkUpload>;
11
+ export declare namespace BulkUpload {
12
+ enum StatusEnum {
13
+ Pending = "pending",
14
+ InProgress = "in_progress",
15
+ Completed = "completed",
16
+ Failed = "failed",
17
+ Canceled = "canceled"
18
+ }
19
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BulkUpload = void 0;
4
+ var BulkUpload;
5
+ (function (BulkUpload) {
6
+ let StatusEnum;
7
+ (function (StatusEnum) {
8
+ StatusEnum["Pending"] = "pending";
9
+ StatusEnum["InProgress"] = "in_progress";
10
+ StatusEnum["Completed"] = "completed";
11
+ StatusEnum["Failed"] = "failed";
12
+ StatusEnum["Canceled"] = "canceled";
13
+ })(StatusEnum = BulkUpload.StatusEnum || (BulkUpload.StatusEnum = {}));
14
+ })(BulkUpload || (exports.BulkUpload = BulkUpload = {}));
@@ -0,0 +1,6 @@
1
+ import { Writable } from './Writable';
2
+ export interface Bundle {
3
+ entries: Array<any>;
4
+ total: number;
5
+ }
6
+ export type WritableBundle = Writable<Bundle>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { Writable } from './Writable';
2
+ export interface Opportunity {
3
+ readonly id: number;
4
+ title: string;
5
+ readonly createdAt: Date;
6
+ }
7
+ export type WritableOpportunity = Writable<Opportunity>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { Writable } from './Writable';
2
+ export interface PdcError {
3
+ message?: string;
4
+ name?: string;
5
+ details?: Array<any>;
6
+ }
7
+ export type WritablePdcError = Writable<PdcError>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { Writable } from './Writable';
2
+ export interface PlatformProviderResponse {
3
+ externalId: string;
4
+ platformProvider: string;
5
+ data: any;
6
+ readonly createdAt: Date;
7
+ }
8
+ export type WritablePlatformProviderResponse = Writable<PlatformProviderResponse>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { PresignedPostRequestPresignedPost } from './PresignedPostRequestPresignedPost';
2
+ import { Writable } from './Writable';
3
+ export interface PresignedPostRequest {
4
+ fileType: string;
5
+ fileSize: number;
6
+ presignedPost: PresignedPostRequestPresignedPost;
7
+ }
8
+ export type WritablePresignedPostRequest = Writable<PresignedPostRequest>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,7 @@
1
+ import { PresignedPostRequestPresignedPostFields } from './PresignedPostRequestPresignedPostFields';
2
+ import { Writable } from './Writable';
3
+ export interface PresignedPostRequestPresignedPost {
4
+ url: string;
5
+ fields: PresignedPostRequestPresignedPostFields;
6
+ }
7
+ export type WritablePresignedPostRequestPresignedPost = Writable<PresignedPostRequestPresignedPost>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import { Writable } from './Writable';
2
+ export interface PresignedPostRequestPresignedPostFields {
3
+ key: string;
4
+ }
5
+ export type WritablePresignedPostRequestPresignedPostFields = Writable<PresignedPostRequestPresignedPostFields>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { ProposalVersion } from './ProposalVersion';
2
+ import { Writable } from './Writable';
3
+ export interface Proposal {
4
+ readonly id: number;
5
+ applicantId: number;
6
+ opportunityId: number;
7
+ externalId: string;
8
+ readonly versions?: Array<ProposalVersion>;
9
+ readonly createdAt: Date;
10
+ }
11
+ export type WritableProposal = Writable<Proposal>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ import { Proposal } from './Proposal';
2
+ import { Writable } from './Writable';
3
+ export interface ProposalBundle {
4
+ entries: Array<Proposal>;
5
+ }
6
+ export type WritableProposalBundle = Writable<ProposalBundle>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { ApplicationFormField } from './ApplicationFormField';
2
+ import { Writable } from './Writable';
3
+ export interface ProposalFieldValue {
4
+ readonly id: number;
5
+ readonly proposalVersionId: number;
6
+ applicationFormFieldId: number;
7
+ applicationFormField?: ApplicationFormField;
8
+ position: number;
9
+ value: string;
10
+ readonly createdAt: Date;
11
+ }
12
+ export type WritableProposalFieldValue = Writable<ProposalFieldValue>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { ProposalFieldValue } from './ProposalFieldValue';
2
+ import { Writable } from './Writable';
3
+ export interface ProposalVersion {
4
+ readonly id: number;
5
+ proposalId: number;
6
+ applicationFormId?: number;
7
+ readonly version: number;
8
+ fieldValues?: Array<ProposalFieldValue>;
9
+ readonly createdAt: Date;
10
+ }
11
+ export type WritableProposalVersion = Writable<ProposalVersion>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ type IfEquals<X, Y, A = X, B = never> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : B;
2
+ type WritableKeys<T> = {
3
+ [P in keyof T]: IfEquals<{
4
+ [Q in P]: T[P];
5
+ }, {
6
+ -readonly [Q in P]: T[P];
7
+ }, P>;
8
+ }[keyof T];
9
+ type WritablePrimitive = undefined | null | boolean | string | number | Function;
10
+ export type Writable<T> = T extends WritablePrimitive ? T : T extends Array<infer U> ? Array<Writable<U>> : T extends Map<infer K, infer V> ? Map<K, Writable<V>> : T extends Set<infer T> ? Set<Writable<T>> : T extends Object ? {
11
+ [K in WritableKeys<T>]: Writable<T[K]>;
12
+ } : T;
13
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ export * from './Applicant';
2
+ export * from './ApplicationForm';
3
+ export * from './ApplicationFormField';
4
+ export * from './BaseField';
5
+ export * from './BulkUpload';
6
+ export * from './Bundle';
7
+ export * from './Opportunity';
8
+ export * from './PdcError';
9
+ export * from './PlatformProviderResponse';
10
+ export * from './PresignedPostRequest';
11
+ export * from './PresignedPostRequestPresignedPost';
12
+ export * from './PresignedPostRequestPresignedPostFields';
13
+ export * from './Proposal';
14
+ export * from './ProposalBundle';
15
+ export * from './ProposalFieldValue';
16
+ export * from './ProposalVersion';
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./Applicant"), exports);
18
+ __exportStar(require("./ApplicationForm"), exports);
19
+ __exportStar(require("./ApplicationFormField"), exports);
20
+ __exportStar(require("./BaseField"), exports);
21
+ __exportStar(require("./BulkUpload"), exports);
22
+ __exportStar(require("./Bundle"), exports);
23
+ __exportStar(require("./Opportunity"), exports);
24
+ __exportStar(require("./PdcError"), exports);
25
+ __exportStar(require("./PlatformProviderResponse"), exports);
26
+ __exportStar(require("./PresignedPostRequest"), exports);
27
+ __exportStar(require("./PresignedPostRequestPresignedPost"), exports);
28
+ __exportStar(require("./PresignedPostRequestPresignedPostFields"), exports);
29
+ __exportStar(require("./Proposal"), exports);
30
+ __exportStar(require("./ProposalBundle"), exports);
31
+ __exportStar(require("./ProposalFieldValue"), exports);
32
+ __exportStar(require("./ProposalVersion"), exports);
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@pdc/sdk",
3
+ "version": "0.3.1",
4
+ "description": "A swagger client for the Philanthropy Data Commons (PDC)",
5
+ "author": "Open Tech Strategies",
6
+ "keywords": [
7
+ "typescript",
8
+ "Philanthropy Data Commons"
9
+ ],
10
+ "license": "AGPL-3.0",
11
+ "main": "./dist/index.js",
12
+ "scripts" : {
13
+ "build": "npm run cleanup && npm run build:node",
14
+ "build:node": "tsc -p tsconfig.json",
15
+ "cleanup": "rimraf dist"
16
+ },
17
+ "devDependencies": {
18
+ "@tsconfig/node18": "^18.2.2",
19
+ "rimraf": "^5.0.5",
20
+ "typescript": "^5.3.3"
21
+ }
22
+ }
package/src/index.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './types';
@@ -0,0 +1,12 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface Applicant {
4
+ readonly id: number;
5
+ externalId: string;
6
+ optedIn: boolean;
7
+ readonly createdAt: Date;
8
+ }
9
+
10
+ export type WritableApplicant = Writable<Applicant>
11
+
12
+
@@ -0,0 +1,16 @@
1
+ import {
2
+ ApplicationFormField,
3
+ } from './ApplicationFormField';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface ApplicationForm {
7
+ readonly id: number;
8
+ opportunityId: number;
9
+ readonly version: number;
10
+ fields?: Array<ApplicationFormField>;
11
+ readonly createdAt: Date;
12
+ }
13
+
14
+ export type WritableApplicationForm = Writable<ApplicationForm>
15
+
16
+
@@ -0,0 +1,14 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface ApplicationFormField {
4
+ readonly id: number;
5
+ readonly applicationFormId: number;
6
+ baseFieldId: number;
7
+ position: number;
8
+ label: string;
9
+ readonly createdAt: Date;
10
+ }
11
+
12
+ export type WritableApplicationFormField = Writable<ApplicationFormField>
13
+
14
+
@@ -0,0 +1,14 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface BaseField {
4
+ readonly id: number;
5
+ label: string;
6
+ description?: string;
7
+ shortCode: string;
8
+ dataType: string;
9
+ readonly createdAt: Date;
10
+ }
11
+
12
+ export type WritableBaseField = Writable<BaseField>
13
+
14
+
@@ -0,0 +1,22 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface BulkUpload {
4
+ readonly id: number;
5
+ fileName: string;
6
+ readonly fileSize?: number;
7
+ sourceKey: string;
8
+ readonly status?: BulkUpload.StatusEnum;
9
+ readonly createdAt: Date;
10
+ }
11
+
12
+ export type WritableBulkUpload = Writable<BulkUpload>
13
+
14
+ export namespace BulkUpload {
15
+ export enum StatusEnum {
16
+ Pending = 'pending',
17
+ InProgress = 'in_progress',
18
+ Completed = 'completed',
19
+ Failed = 'failed',
20
+ Canceled = 'canceled'
21
+ }
22
+ }
@@ -0,0 +1,10 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface Bundle {
4
+ entries: Array<any>;
5
+ total: number;
6
+ }
7
+
8
+ export type WritableBundle = Writable<Bundle>
9
+
10
+
@@ -0,0 +1,11 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface Opportunity {
4
+ readonly id: number;
5
+ title: string;
6
+ readonly createdAt: Date;
7
+ }
8
+
9
+ export type WritableOpportunity = Writable<Opportunity>
10
+
11
+
@@ -0,0 +1,11 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface PdcError {
4
+ message?: string;
5
+ name?: string;
6
+ details?: Array<any>;
7
+ }
8
+
9
+ export type WritablePdcError = Writable<PdcError>
10
+
11
+
@@ -0,0 +1,12 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface PlatformProviderResponse {
4
+ externalId: string;
5
+ platformProvider: string;
6
+ data: any;
7
+ readonly createdAt: Date;
8
+ }
9
+
10
+ export type WritablePlatformProviderResponse = Writable<PlatformProviderResponse>
11
+
12
+
@@ -0,0 +1,14 @@
1
+ import {
2
+ PresignedPostRequestPresignedPost,
3
+ } from './PresignedPostRequestPresignedPost';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface PresignedPostRequest {
7
+ fileType: string;
8
+ fileSize: number;
9
+ presignedPost: PresignedPostRequestPresignedPost;
10
+ }
11
+
12
+ export type WritablePresignedPostRequest = Writable<PresignedPostRequest>
13
+
14
+
@@ -0,0 +1,13 @@
1
+ import {
2
+ PresignedPostRequestPresignedPostFields,
3
+ } from './PresignedPostRequestPresignedPostFields';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface PresignedPostRequestPresignedPost {
7
+ url: string;
8
+ fields: PresignedPostRequestPresignedPostFields;
9
+ }
10
+
11
+ export type WritablePresignedPostRequestPresignedPost = Writable<PresignedPostRequestPresignedPost>
12
+
13
+
@@ -0,0 +1,9 @@
1
+ import { Writable } from './Writable';
2
+
3
+ export interface PresignedPostRequestPresignedPostFields {
4
+ key: string;
5
+ }
6
+
7
+ export type WritablePresignedPostRequestPresignedPostFields = Writable<PresignedPostRequestPresignedPostFields>
8
+
9
+
@@ -0,0 +1,17 @@
1
+ import {
2
+ ProposalVersion,
3
+ } from './ProposalVersion';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface Proposal {
7
+ readonly id: number;
8
+ applicantId: number;
9
+ opportunityId: number;
10
+ externalId: string;
11
+ readonly versions?: Array<ProposalVersion>;
12
+ readonly createdAt: Date;
13
+ }
14
+
15
+ export type WritableProposal = Writable<Proposal>
16
+
17
+
@@ -0,0 +1,15 @@
1
+ import {
2
+ Bundle,
3
+ } from './Bundle';
4
+ import {
5
+ Proposal,
6
+ } from './Proposal';
7
+ import { Writable } from './Writable';
8
+
9
+ export interface ProposalBundle {
10
+ entries: Array<Proposal>;
11
+ }
12
+
13
+ export type WritableProposalBundle = Writable<ProposalBundle>
14
+
15
+
@@ -0,0 +1,18 @@
1
+ import {
2
+ ApplicationFormField,
3
+ } from './ApplicationFormField';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface ProposalFieldValue {
7
+ readonly id: number;
8
+ readonly proposalVersionId: number;
9
+ applicationFormFieldId: number;
10
+ applicationFormField?: ApplicationFormField;
11
+ position: number;
12
+ value: string;
13
+ readonly createdAt: Date;
14
+ }
15
+
16
+ export type WritableProposalFieldValue = Writable<ProposalFieldValue>
17
+
18
+
@@ -0,0 +1,17 @@
1
+ import {
2
+ ProposalFieldValue,
3
+ } from './ProposalFieldValue';
4
+ import { Writable } from './Writable';
5
+
6
+ export interface ProposalVersion {
7
+ readonly id: number;
8
+ proposalId: number;
9
+ applicationFormId?: number;
10
+ readonly version: number;
11
+ fieldValues?: Array<ProposalFieldValue>;
12
+ readonly createdAt: Date;
13
+ }
14
+
15
+ export type WritableProposalVersion = Writable<ProposalVersion>
16
+
17
+
@@ -0,0 +1,23 @@
1
+ // This set of types is inspired by https://stackoverflow.com/a/62362197/159522
2
+ // The final `Writable` utility type will create a deep copy of a type with all
3
+ // `readonly` properties removed.
4
+ //
5
+ // Providing "Writable" versions of our models is important because we know that
6
+ // POST operations do not accept readonly model properties.
7
+ type IfEquals<X, Y, A=X, B=never> =
8
+ (<T>() => T extends X ? 1 : 2) extends
9
+ (<T>() => T extends Y ? 1 : 2) ? A : B;
10
+
11
+ type WritableKeys<T> = {
12
+ [P in keyof T]: IfEquals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P>
13
+ }[keyof T];
14
+
15
+ type WritablePrimitive = undefined | null | boolean | string | number | Function;
16
+
17
+ export type Writable<T> =
18
+ T extends WritablePrimitive ? T :
19
+ T extends Array<infer U> ? Array<Writable<U>> :
20
+ T extends Map<infer K, infer V> ? Map<K, Writable<V>> :
21
+ T extends Set<infer T> ? Set<Writable<T>> :
22
+ T extends Object ? { [K in WritableKeys<T>]: Writable<T[K]> } :
23
+ T;
@@ -0,0 +1,16 @@
1
+ export * from './Applicant';
2
+ export * from './ApplicationForm';
3
+ export * from './ApplicationFormField';
4
+ export * from './BaseField';
5
+ export * from './BulkUpload';
6
+ export * from './Bundle';
7
+ export * from './Opportunity';
8
+ export * from './PdcError';
9
+ export * from './PlatformProviderResponse';
10
+ export * from './PresignedPostRequest';
11
+ export * from './PresignedPostRequestPresignedPost';
12
+ export * from './PresignedPostRequestPresignedPostFields';
13
+ export * from './Proposal';
14
+ export * from './ProposalBundle';
15
+ export * from './ProposalFieldValue';
16
+ export * from './ProposalVersion';
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@tsconfig/node18/tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "dist",
5
+ "declaration": true
6
+ },
7
+ "include": ["src"],
8
+ "exclude": ["**/*.test.ts", "**/src/test"]
9
+ }